2 Copyright 2002-2006, The AROS Development Team.
11 #include <exec/memory.h>
13 #include <libraries/asl.h>
14 #include <libraries/mui.h>
15 #include <prefs/prefhdr.h>
17 #include <clib/alib_protos.h>
18 #include <proto/exec.h>
19 #include <proto/dos.h>
20 #include <proto/intuition.h>
21 #include <proto/utility.h>
22 #include <proto/iffparse.h>
23 #include <proto/muimaster.h>
31 #include "scrollbarsp.h"
32 #include "listviewsp.h"
35 #include "navigationp.h"
37 #include "zunestuff.h"
39 /************************************************************************/
41 #ifndef MAXFILENAMELENGTH
42 #define MAXFILENAMELENGTH 255
45 /************************************************************************/
48 #define MCC_Query(x) AROS_LVO_CALL1(struct MUI_CustomClass *, \
49 AROS_LCA(LONG, (x), D0), \
50 struct Library *, mcclib, 5, lib)
55 struct MUI_CustomClass
*MCC_Query(ULONG d0
);
56 #pragma libcall mcclib MCC_Query 01e 001
60 #define ZUNEVERSION "$VER: Zune 0.2 (22.02.2006) AROS Dev Team"
64 struct TagItem prefstags
[] =
66 { ASLFR_DoPatterns
, (IPTR
)TRUE
},
67 { ASLFR_InitialPattern
, (IPTR
)"#?.prefs" },
71 /************************************************************************/
73 void load_prefs(CONST_STRPTR name
);
74 void save_prefs(CONST_STRPTR name
, BOOL envarc
);
75 void test_prefs(void);
76 void main_open_menu(void);
77 void main_saveas_menu(void);
78 void restore_prefs(CONST_STRPTR name
);
80 /************************************************************************/
83 struct Library
*ZuneMasterBase
;
84 struct ZuneMasterIFace
*IZuneMaster
;
88 /************************************************************************/
90 /****************************************************************
92 *****************************************************************/
96 if (!(ZuneMasterBase
= OpenLibrary("zunemaster.library",0)))
98 printf("Unable to open zunemaster.library\n");
102 if (!(IZuneMaster
= (struct ZuneMasterIFace
*)GetInterface(ZuneMasterBase
,"main",1,NULL
)))
104 printf("Unable to get main interface of zunemaster.library\n");
105 CloseLibrary(ZuneMasterBase
); ZuneMasterBase
= NULL
;
112 /****************************************************************
113 Close opened libraries
114 *****************************************************************/
115 void close_libs(void)
118 DropInterface((struct Interface
*)IZuneMaster
);
119 CloseLibrary(ZuneMasterBase
);
123 struct Hook hook_standard
;
126 static Object
*open_menuitem
;
127 static Object
*append_menuitem
;
128 static Object
*saveas_menuitem
;
129 static Object
*aboutzune_menuitem
;
130 static Object
*quit_menuitem
;
131 static Object
*LastSavedConfigdata
= NULL
;
132 static STRPTR appname
= NULL
;
134 static Object
*main_wnd
;
135 static Object
*main_page_list
;
136 static Object
*main_page_group
; /* contains the selelected group */
137 static Object
*main_page_group_displayed
; /* The current displayed group */
138 static Object
*main_page_space
; /* a space object */
140 void close_classes(void)
144 int open_classes(void)
161 struct MUI_CustomClass
*cl
; /* The class pointer, maybe NULL */
162 Object
*group
; /* The group which should be is displayed, maybe NULL */
163 const struct __MUIBuiltinClass
*desc
;
164 struct Library
*mcp_library
;
165 UBYTE mcp_namebuffer
[MAXFILENAMELENGTH
+ 1];
168 #define MAX_PAGE_ENTRIES 100
170 /* the name field is set in init_gui() */
171 struct page_entry main_page_entries
[MAX_PAGE_ENTRIES
+ 1] =
173 /* {"Info",NULL,NULL,NULL}, */
174 { "", NULL
, NULL
, &_MUIP_System_desc
},
175 { "", NULL
, NULL
, &_MUIP_Windows_desc
},
176 { "", NULL
, NULL
, &_MUIP_Groups_desc
},
177 { "", NULL
, NULL
, &_MUIP_Buttons_desc
},
178 { "", NULL
, NULL
, &_MUIP_Cycles_desc
},
179 { "", NULL
, NULL
, &_MUIP_Sliders_desc
},
180 { "", NULL
, NULL
, &_MUIP_Scrollbars_desc
},
181 { "", NULL
, NULL
, &_MUIP_Listviews_desc
},
182 { "", NULL
, NULL
, &_MUIP_Strings_desc
},
183 { "", NULL
, NULL
, &_MUIP_Navigation_desc
},
184 { "", NULL
, NULL
, &_MUIP_Special_desc
},
185 { "", NULL
, NULL
, &_MUIP_Frames_desc
},
186 { NULL
, NULL
, NULL
, NULL
},
189 struct MUI_CustomClass
*create_class(const struct __MUIBuiltinClass
*desc
)
191 return MUI_CreateCustomClass(NULL
,MUIC_Settingsgroup
,NULL
,desc
->datasize
,desc
->dispatcher
);
194 /****************************************************************
195 Our standard hook function, for easy call backs
196 *****************************************************************/
197 static void hook_func_standard(struct Hook
*h
, void *dummy
, ULONG
* funcptr
)
199 void (*func
) (ULONG
*) = (void (*)(ULONG
*)) (*funcptr
);
200 if (func
) func(funcptr
+ 1);
203 /****************************************************************
204 The display function for the page listview
205 *****************************************************************/
206 static void main_page_list_display(struct Hook
*h
, char **strings
, struct page_entry
*entry
)
210 strings
[0] = entry
->name
;
215 /****************************************************************
216 A new entry has been selected
217 *****************************************************************/
218 void main_page_active(void)
220 int new_active
= XGET(main_page_list
,MUIA_List_Active
);
223 if (new_active
== -1)
224 new_group
= main_page_space
;
227 new_group
= main_page_entries
[new_active
].group
;
229 new_group
= main_page_space
;
232 if (new_group
== main_page_group_displayed
)
235 DoMethod(main_page_group
, MUIM_Group_InitChange
);
236 DoMethod(main_page_group
, OM_REMMEMBER
, (IPTR
)main_page_group_displayed
);
237 DoMethod(main_page_group
, OM_ADDMEMBER
, (IPTR
)new_group
);
238 DoMethod(main_page_group
, MUIM_Group_ExitChange
);
239 main_page_group_displayed
= new_group
;
242 /****************************************************************
244 *****************************************************************/
245 void main_save_pressed(void)
247 save_prefs(appname
, TRUE
);
248 DoMethod(app
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
251 /****************************************************************
253 *****************************************************************/
254 void main_use_pressed(void)
256 save_prefs(appname
, FALSE
);
257 DoMethod(app
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
260 /****************************************************************
262 *****************************************************************/
263 void main_test_pressed(void)
268 /****************************************************************
270 *****************************************************************/
271 void main_cancel_pressed(void)
273 restore_prefs(appname
);
274 DoMethod(app
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
277 /****************************************************************
280 TODO: Write for AmigaOS4
281 *****************************************************************/
285 static CONST_STRPTR
const searchpaths
[] =
288 "Classes/Zune/#?.(mcp|mcc)",
292 CONST_STRPTR
const *pathptr
;
293 struct DevProc
*dp
= NULL
;
294 struct page_entry
*pe
;
295 WORD num_page_entries
= 0;
298 for(pe
= main_page_entries
; pe
->name
; pe
++)
303 olddir
= CurrentDir(NULL
);
305 while((dp
= GetDeviceProc("LIBS:", dp
)))
307 CurrentDir(dp
->dvp_Lock
);
309 for(pathptr
= searchpaths
; *pathptr
; pathptr
++)
311 struct AnchorPath
*ap
;
314 ap
= (struct AnchorPath
*)AllocVec(sizeof(struct AnchorPath
) + 256, MEMF_CLEAR
);
319 for(match
= MatchFirst((STRPTR
)*pathptr
, ap
);
321 match
= MatchNext(ap
))
323 struct Library
*mcclib
;
325 if (num_page_entries
< MAX_PAGE_ENTRIES
)
327 if ((mcclib
= OpenLibrary(ap
->ap_Buf
, 0)))
329 struct MUI_CustomClass
*mcp
;
331 if ((mcp
= MCC_Query(1)))
336 pe
->mcp_library
= mcclib
;
339 pe
->mcp_namebuffer
[0] = 27;
340 pe
->mcp_namebuffer
[1] = '3';
341 strncpy(pe
->mcp_namebuffer
+ 2, mcp
->mcc_Class
->cl_ID
, sizeof(pe
->mcp_namebuffer
) - 3);
343 if ((sp
= strrchr(pe
->mcp_namebuffer
, '.')))
346 pe
->name
= pe
->mcp_namebuffer
;
351 } /* if ((mcp = MCC_Query(1))) */
353 if (mcclib
) CloseLibrary(mcclib
);
355 } /* if ((mcclib = OpenLibrary(ap->ap_Buf, 0))) */
357 } /* if (num_page_entries < MAX_PAGE_ENTRIES) */
359 } /* for(match = ... */
367 } /* for(pathptr = searchpaths; *pathptr; pathptr++) */
369 if (!dp
->dvp_Flags
& DVPF_ASSIGN
) break;
371 } /* while((dp = GetDeviceProc("LIBS:", dp))) */
379 /****************************************************************
380 Deallocates all gui resources
381 *****************************************************************/
382 void deinit_gui(void)
387 MUI_DisposeObject(app
);
389 for (i
= 0; main_page_entries
[i
].name
; i
++)
391 if ((main_page_entries
[i
].group
!= NULL
) &&
392 (main_page_entries
[i
].group
!= main_page_group_displayed
))
394 DisposeObject(main_page_entries
[i
].group
);
397 if (main_page_entries
[i
].mcp_library
)
399 main_page_entries
[i
].cl
= NULL
; /* Prevent MUI_DeleteCustomClass call below */
401 if ((main_page_entries
[i
].group
== NULL
) ||
402 (main_page_entries
[i
].group
!= main_page_group_displayed
))
404 /* Only close library if main_page_group_displayed is not this page,
405 because in that case the object got automatically killed through
406 MUI_DisposeObject(app) which also does the CloseLibrary()!! */
408 CloseLibrary(main_page_entries
[i
].mcp_library
);
409 main_page_entries
[i
].mcp_library
= NULL
;
413 main_page_entries
[i
].group
= NULL
;
415 if (main_page_entries
[i
].cl
!= NULL
)
417 MUI_DeleteCustomClass(main_page_entries
[i
].cl
);
418 main_page_entries
[i
].cl
= NULL
;
422 if (main_page_group_displayed
!= main_page_space
)
423 MUI_DisposeObject(main_page_space
);
426 /****************************************************************
427 Allocate resources for gui
428 *****************************************************************/
434 Object
*cancel_button
;
438 main_page_entries
[ 0].name
= (char *)_(MSG_DSC_SYSTEM
);
439 main_page_entries
[ 1].name
= (char *)_(MSG_DSC_WINDOWS
);
440 main_page_entries
[ 2].name
= (char *)_(MSG_DSC_GROUPS
);
441 main_page_entries
[ 3].name
= (char *)_(MSG_DSC_BUTTONS
);
442 main_page_entries
[ 4].name
= (char *)_(MSG_DSC_CYCLES
);
443 main_page_entries
[ 5].name
= (char *)_(MSG_DSC_SLIDERS
);
444 main_page_entries
[ 6].name
= (char *)_(MSG_DSC_SCROLLBARS
);
445 main_page_entries
[ 7].name
= (char *)_(MSG_DSC_LISTVIEWS
);
446 main_page_entries
[ 8].name
= (char *)_(MSG_DSC_STRINGS
);
447 main_page_entries
[ 9].name
= (char *)_(MSG_DSC_NAVIGATION
);
448 main_page_entries
[10].name
= (char *)_(MSG_DSC_SPECIAL
);
449 main_page_entries
[11].name
= (char *)_(MSG_DSC_FRAMES
);
451 static struct Hook page_display_hook
;
454 hook_standard
.h_Entry
= (HOOKFUNC
)hook_func_standard
;
455 page_display_hook
.h_Entry
= (HOOKFUNC
)main_page_list_display
;
457 hook_standard
.h_Entry
= HookEntry
;
458 hook_standard
.h_SubEntry
= (APTR
)hook_func_standard
;
459 page_display_hook
.h_Entry
= HookEntry
;
460 page_display_hook
.h_SubEntry
= (APTR
)main_page_list_display
;
463 if (!strcmp(appname
, "global"))
464 wintitle
= (STRPTR
) _(MSG_WINTITLE1
);
467 snprintf(titlebuf
, 255, _(MSG_WINTITLE2
), appname
);
471 app
= ApplicationObject
,
472 MUIA_Application_Title
, (IPTR
) "Zune",
473 MUIA_Application_Version
, (IPTR
) ZUNEVERSION
,
474 MUIA_Application_Copyright
, (IPTR
) " 2006, The AROS Development Team",
475 MUIA_Application_Description
, wintitle
,
476 MUIA_Application_Base
, "ZUNEPREF",
477 MUIA_Application_Menustrip
, MenuitemObject
,
478 MUIA_Family_Child
, MenuitemObject
,
479 MUIA_Menuitem_Title
, _(MSG_MEN_PROJECT
),
480 MUIA_Family_Child
, open_menuitem
= MenuitemObject
,
481 MUIA_Menuitem_Title
, _(MSG_MEN_OPEN
), MUIA_Menuitem_Shortcut
, _(MSG_MEN_OPEN_SC
),
483 MUIA_Family_Child
, append_menuitem
= MenuitemObject
, MUIA_Menuitem_Title
, _(MSG_MEN_APPEND
), End
,
484 MUIA_Family_Child
, saveas_menuitem
= MenuitemObject
,
485 MUIA_Menuitem_Title
, _(MSG_MEN_SAVEAS
), MUIA_Menuitem_Shortcut
, _(MSG_MEN_SAVEAS_SC
),
487 MUIA_Family_Child
, MenuitemObject
, MUIA_Menuitem_Title
, NM_BARLABEL
, End
,
488 MUIA_Family_Child
, aboutzune_menuitem
= MenuitemObject
,
489 MUIA_Menuitem_Title
, _(MSG_MEN_ABOUT
), MUIA_Menuitem_Shortcut
, _(MSG_MEN_ABOUT_SC
),
491 MUIA_Family_Child
, MenuitemObject
, MUIA_Menuitem_Title
, NM_BARLABEL
, End
,
492 MUIA_Family_Child
, quit_menuitem
= MenuitemObject
,
493 MUIA_Menuitem_Title
, _(MSG_MEN_QUIT
), MUIA_Menuitem_Shortcut
, _(MSG_MEN_QUIT_SC
),
497 SubWindow
, main_wnd
= WindowObject
,
498 MUIA_Window_Title
, (IPTR
)wintitle
,
499 MUIA_Window_Activate
, TRUE
,
500 MUIA_Window_CloseGadget
, FALSE
,
501 MUIA_Window_ID
, MAKE_ID('Z','W','I','N'),
503 WindowContents
, VGroup
,
504 MUIA_Group_VertSpacing
, 10,
507 Child
, ListviewObject
,
509 MUIA_Listview_List
, main_page_list
= ListObject
,
511 MUIA_List_AdjustWidth
, TRUE
,
512 MUIA_List_DisplayHook
, &page_display_hook
,
516 Child
, MUI_NewObject(MUIC_Popframe
,
518 MUIA_Window_Title
, (IPTR
) _(MSG_FRAME_CLIPBOARD
),
520 Child
, MUI_NewObject(MUIC_Popimage
,
522 MUIA_Imageadjust_Type
, MUIV_Imageadjust_Type_All
,
523 MUIA_Window_Title
, (IPTR
) _(MSG_IMAGE_CLIPBOARD
),
530 MUIA_Background
, MUII_PageBack
,
531 Child
, main_page_group
= VGroup
,
532 Child
, main_page_group_displayed
= main_page_space
= HVSpace
,
537 Child
, test_button
= MakeButton(_(MSG_GAD_TEST
)),
539 Child
, save_button
= MakeButton(_(MSG_GAD_SAVE
)),
540 Child
, use_button
= MakeButton(_(MSG_GAD_USE
)),
541 Child
, cancel_button
= MakeButton(_(MSG_GAD_CANCEL
)),
551 DoMethod(main_wnd
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
552 (IPTR
)app
, 3, MUIM_CallHook
, (IPTR
)&hook_standard
,
553 (IPTR
)main_cancel_pressed
);
554 DoMethod(cancel_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)app
, 3,
555 MUIM_CallHook
, (IPTR
)&hook_standard
, (IPTR
)main_cancel_pressed
);
556 DoMethod(save_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)app
, 3,
557 MUIM_CallHook
, (IPTR
)&hook_standard
, (IPTR
)main_save_pressed
);
558 DoMethod(use_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)app
, 3,
559 MUIM_CallHook
, (IPTR
)&hook_standard
, (IPTR
)main_use_pressed
);
560 DoMethod(test_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)app
, 6,
561 MUIM_Application_PushMethod
, (IPTR
)app
, 3, MUIM_CallHook
,
562 (IPTR
)&hook_standard
, (IPTR
)main_test_pressed
);
563 DoMethod(quit_menuitem
, MUIM_Notify
, MUIA_Menuitem_Trigger
,
564 MUIV_EveryTime
, (IPTR
)app
, 3, MUIM_CallHook
,
565 (IPTR
)&hook_standard
, (IPTR
)main_cancel_pressed
);
566 DoMethod(open_menuitem
, MUIM_Notify
, MUIA_Menuitem_Trigger
,
567 MUIV_EveryTime
, (IPTR
)app
, 3, MUIM_CallHook
,
568 (IPTR
)&hook_standard
, (IPTR
)main_open_menu
);
569 DoMethod(saveas_menuitem
, MUIM_Notify
, MUIA_Menuitem_Trigger
,
570 MUIV_EveryTime
, (IPTR
)app
, 3, MUIM_CallHook
,
571 (IPTR
)&hook_standard
, (IPTR
)main_saveas_menu
);
572 DoMethod(aboutzune_menuitem
, MUIM_Notify
, MUIA_Menuitem_Trigger
,
573 MUIV_EveryTime
, (IPTR
)app
, 2, MUIM_Application_AboutMUI
,
576 for (i
= 0; main_page_entries
[i
].name
!= NULL
; i
++)
578 struct page_entry
*p
= &main_page_entries
[i
];
580 if (!p
->cl
) p
->cl
= create_class(p
->desc
);
582 if (!(p
->cl
&& (p
->group
= NewObject(p
->cl
->mcc_Class
, NULL
, TAG_DONE
))))
588 DoMethod(main_page_list
, MUIM_List_InsertSingle
, (IPTR
)p
,
589 MUIV_List_Insert_Bottom
);
592 DoMethod(main_page_list
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
593 (IPTR
)app
, 3, MUIM_CallHook
, (IPTR
)&hook_standard
,
594 (IPTR
)main_page_active
);
596 /* Activate first entry */
597 set(main_page_list
,MUIA_List_Active
,0);
604 /****************************************************************
606 *****************************************************************/
607 void load_prefs(CONST_STRPTR name
)
611 configdata
= MUI_NewObject(MUIC_Configdata
,
612 MUIA_Configdata_ApplicationBase
, (IPTR
)name
,
614 if (configdata
!= NULL
)
618 /* D(bug("zune::load_prefs: created configdata %p\n", configdata)); */
619 LastSavedConfigdata
= configdata
;
621 /* Call MUIM_Settingsgroup_ConfigToGadgets for every group */
622 for (i
=0;main_page_entries
[i
].name
;i
++)
624 struct page_entry
*p
= &main_page_entries
[i
];
626 DoMethod(p
->group
, MUIM_Settingsgroup_ConfigToGadgets
,
630 /* D(bug("zune::save_prefs: disposed configdata %p\n", configdata)); */
634 /* write prefs to env: */
635 void test_prefs(void)
639 save_prefs(appname
, FALSE
);
641 cfg
= MUI_NewObject(MUIC_Configdata
, MUIA_Configdata_Application
, (IPTR
)app
, TAG_DONE
);
642 set(app
, MUIA_Application_Configdata
, (IPTR
)cfg
);
645 void restore_prefs(CONST_STRPTR name
)
649 snprintf(buf
, 255, "ENV:zune/%s.prefs", name
);
650 DoMethod(LastSavedConfigdata
, MUIM_Configdata_Save
, (IPTR
)buf
);
654 /****************************************************************
655 open given prefs file from menue
656 *****************************************************************/
658 void main_open_menu(void)
660 static char dirpart
[500]="ENVARC:Zune",filepart
[500],filename
[1000];
662 if (aslfilerequest ("Load a Zune Prefs File", (char *)&dirpart
, (char *)&filepart
, (char *)&filename
, prefstags
));
666 configdata
= MUI_NewObject(MUIC_Configdata
,
667 MUIA_Configdata_ApplicationBase
,appname
,
670 if (configdata
!= NULL
)
674 /* D(bug("zune::load_prefs: created configdata %p\n", configdata)); */
675 //LastSavedConfigdata = configdata;
676 DoMethod(configdata
, MUIM_Configdata_Load
,filename
);
678 /* Call MUIM_Settingsgroup_ConfigToGadgets for every group */
679 for (i
=0;main_page_entries
[i
].name
;i
++)
681 struct page_entry
*p
= &main_page_entries
[i
];
683 if (p
->group
) DoMethod(p
->group
, MUIM_Settingsgroup_ConfigToGadgets
, (IPTR
)configdata
);
686 /* activate prefs in test mode */
689 /* D(bug("zune::save_prefs: disposed configdata %p\n", configdata)); */
695 /****************************************************************
697 *****************************************************************/
698 void save_prefs(CONST_STRPTR name
, BOOL envarc
)
702 configdata
= MUI_NewObject(MUIC_Configdata
,
703 //MUIA_Configdata_ApplicationBase, name,
704 MUIA_Configdata_Application
,appaddr
,
706 if (configdata
!= NULL
)
711 /* D(bug("zune::save_prefs: created configdata %p\n", configdata)); */
713 /* Call MUIM_Settingsgroup_GadgetsToConfig for every group */
714 for (i
=0;main_page_entries
[i
].name
;i
++)
716 struct page_entry
*p
= &main_page_entries
[i
];
718 DoMethod(p
->group
, MUIM_Settingsgroup_GadgetsToConfig
,
724 snprintf(buf
, 255, "ENVARC:zune/%s.prefs", name
);
725 DoMethod(configdata
, MUIM_Configdata_Save
, (IPTR
)buf
);
727 snprintf(buf
, 255, "ENV:zune/%s.prefs", name
);
728 DoMethod(configdata
, MUIM_Configdata_Save
, (IPTR
)buf
);
730 MUI_DisposeObject(configdata
);
731 /* D(bug("zune::save_prefs: disposed configdata %p\n", configdata)); */
736 /****************************************************************
737 SaveAS the done prefs from menue
738 *****************************************************************/
740 void main_saveas_menu(void)
742 static char dirpart
[500]="ENVARC:Zune",filepart
[500],filename
[1000];
744 if (aslfilerequest("Save a Zune Prefs File", (char *)&dirpart
, (char *)&filepart
, (char *)&filename
, prefstags
));
748 configdata
= MUI_NewObject(MUIC_Configdata
,
749 MUIA_Configdata_ApplicationBase
, "dummyfile",
752 /* check for ".prefs" suffix in filename, add if not existing */
753 if ( !strstr( filename
, ".prefs") ) strcat(filename
, ".prefs");
755 if (configdata
!= NULL
)
759 /* D(bug("zune::save_prefs: created configdata %p\n", configdata)); */
761 /* Call MUIM_Settingsgroup_GadgetsToConfig for every group */
762 for (i
=0;main_page_entries
[i
].name
;i
++)
764 struct page_entry
*p
= &main_page_entries
[i
];
766 if (p
->group
) DoMethod(p
->group
, MUIM_Settingsgroup_GadgetsToConfig
, (IPTR
)configdata
);
769 DoMethod(configdata
, MUIM_Configdata_Save
, filename
);
771 MUI_DisposeObject(configdata
);
772 /* D(bug("zune::save_prefs: disposed configdata %p\n", configdata)); */
780 /****************************************************************
782 *****************************************************************/
787 while((LONG
) DoMethod(app
, MUIM_Application_NewInput
, (IPTR
)&sigs
)
788 != MUIV_Application_ReturnID_Quit
)
792 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
| SIGBREAKF_CTRL_D
);
793 if (sigs
& SIGBREAKF_CTRL_C
) break;
794 if (sigs
& SIGBREAKF_CTRL_D
) break;
799 /****************************************************************
801 *****************************************************************/
806 int retval
= RETURN_OK
;
807 struct RDArgs
*rda
= NULL
;
809 IPTR args
[] = { 0,0 };
810 enum { ARG_APPNAME
= 0,ARG_APPADDR
=1 };
816 rda
= ReadArgs("/A,/N", args
, NULL
);
817 appname
=(STRPTR
)args
[ARG_APPNAME
];
818 appaddr
=(APTR
)args
[ARG_APPADDR
];
819 if (appaddr
)appaddr
=*(appaddr
);
827 if (retval
== RETURN_OK
)
837 NewDir
= Lock("RAM:", SHARED_LOCK
);
839 OldDir
= CurrentDir(NewDir
);
842 load_prefs((STRPTR
)args
[ARG_APPNAME
]);
843 set(main_wnd
, MUIA_Window_Open
, TRUE
);
844 if (XGET(main_wnd
,MUIA_Window_Open
))
848 if (LastSavedConfigdata
)
849 MUI_DisposeObject(LastSavedConfigdata
);
862 if (rda
) FreeArgs(rda
);
864 Locale_Deinitialize();