2 Copyright 2002-2013, 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"
40 #include <aros/debug.h>
42 /************************************************************************/
44 #ifndef MAXFILENAMELENGTH
45 #define MAXFILENAMELENGTH 255
48 /************************************************************************/
50 #define MCC_Query(x) AROS_LVO_CALL1(struct MUI_CustomClass *, \
51 AROS_LCA(LONG, (x), D0), \
52 struct Library *, mcclib, 5, lib)
55 #define ZUNEVERSION "$VER: Zune 0.2 (22.02.2006) AROS Dev Team"
59 struct TagItem prefstags
[] =
61 { ASLFR_DoPatterns
, (IPTR
)TRUE
},
62 { ASLFR_InitialPattern
, (IPTR
)"#?.prefs" },
66 /************************************************************************/
68 void load_prefs(CONST_STRPTR name
);
69 void save_prefs(CONST_STRPTR name
, BOOL envarc
);
70 void test_prefs(void);
71 void main_open_menu(void);
72 void main_saveas_menu(void);
73 void restore_prefs(CONST_STRPTR name
);
75 /************************************************************************/
78 static struct Hook main_cancel_pressed_hook
;
79 static struct Hook main_save_pressed_hook
;
80 static struct Hook main_use_pressed_hook
;
81 static struct Hook main_test_pressed_hook
;
82 static struct Hook main_open_menu_hook
;
83 static struct Hook main_saveas_menu_hook
;
84 static struct Hook main_page_active_hook
;
85 static struct Hook page_display_hook
;
88 static Object
*open_menuitem
;
89 static Object
*append_menuitem
;
90 static Object
*saveas_menuitem
;
91 static Object
*aboutzune_menuitem
;
92 static Object
*quit_menuitem
;
93 static Object
*LastSavedConfigdata
= NULL
;
94 static STRPTR appname
= NULL
;
96 static Object
*main_wnd
;
97 static Object
*main_page_list
;
98 static Object
*main_page_group
; /* contains the selelected group */
99 static Object
*main_page_group_displayed
; /* The current displayed group */
100 static Object
*main_page_space
; /* a space object */
102 void close_classes(void)
104 delete_listview_class();
107 int open_classes(void)
109 if ((ClassListview_CLASS
= create_listview_class()) != NULL
)
121 #define MAX_PAGE_ENTRIES 100
123 /* the name field is set in init_gui() */
124 struct page_entry main_page_entries
[MAX_PAGE_ENTRIES
+ 1] =
126 /* {"Info", NULL, NULL, NULL, NULL, NULL}, */
127 { "", NULL
, NULL
, NULL
, NULL
, &_MUIP_System_desc
},
128 { "", NULL
, NULL
, NULL
, NULL
, &_MUIP_Windows_desc
},
129 { "", NULL
, NULL
, NULL
, NULL
, &_MUIP_Groups_desc
},
130 { "", NULL
, NULL
, NULL
, NULL
, &_MUIP_Buttons_desc
},
131 { "", NULL
, NULL
, NULL
, NULL
, &_MUIP_Cycles_desc
},
132 { "", NULL
, NULL
, NULL
, NULL
, &_MUIP_Sliders_desc
},
133 { "", NULL
, NULL
, NULL
, NULL
, &_MUIP_Scrollbars_desc
},
134 { "", NULL
, NULL
, NULL
, NULL
, &_MUIP_Listviews_desc
},
135 { "", NULL
, NULL
, NULL
, NULL
, &_MUIP_Strings_desc
},
136 { "", NULL
, NULL
, NULL
, NULL
, &_MUIP_Navigation_desc
},
137 { "", NULL
, NULL
, NULL
, NULL
, &_MUIP_Special_desc
},
138 { "", NULL
, NULL
, NULL
, NULL
, &_MUIP_Frames_desc
},
139 { NULL
, NULL
, NULL
, NULL
, NULL
, NULL
},
142 struct MUI_CustomClass
*create_class(const struct __MUIBuiltinClass
*desc
)
144 return MUI_CreateCustomClass(NULL
,MUIC_Settingsgroup
,NULL
,desc
->datasize
,desc
->dispatcher
);
148 /****************************************************************
149 The display function for the page listview
150 *****************************************************************/
151 static void main_page_list_display(struct Hook
*h
, char **strings
, struct page_entry
*entry
)
155 sprintf(entry
->mcp_imagespec
, "\33O[%08lx]", (long unsigned)entry
->mcp_listimage
);
156 *strings
++ = entry
->mcp_imagespec
;
157 *strings
= entry
->name
;
162 /****************************************************************
163 A new entry has been selected
164 *****************************************************************/
165 void main_page_active(void)
167 int new_active
= XGET(main_page_list
,MUIA_List_Active
);
170 if (new_active
== -1)
171 new_group
= main_page_space
;
174 new_group
= main_page_entries
[new_active
].group
;
176 new_group
= main_page_space
;
179 if (new_group
== main_page_group_displayed
)
182 DoMethod(main_page_group
, MUIM_Group_InitChange
);
183 DoMethod(main_page_group
, OM_REMMEMBER
, (IPTR
)main_page_group_displayed
);
184 DoMethod(main_page_group
, OM_ADDMEMBER
, (IPTR
)new_group
);
185 DoMethod(main_page_group
, MUIM_Group_ExitChange
);
186 main_page_group_displayed
= new_group
;
189 /****************************************************************
191 *****************************************************************/
192 void main_save_pressed(void)
194 save_prefs(appname
, TRUE
);
195 DoMethod(app
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
198 /****************************************************************
200 *****************************************************************/
201 void main_use_pressed(void)
203 save_prefs(appname
, FALSE
);
204 DoMethod(app
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
207 /****************************************************************
209 *****************************************************************/
210 void main_test_pressed(void)
215 /****************************************************************
217 *****************************************************************/
218 void main_cancel_pressed(void)
220 restore_prefs(appname
);
221 DoMethod(app
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
224 /****************************************************************
226 *****************************************************************/
229 static CONST_STRPTR
const searchpaths
[] =
232 "Classes/Zune/#?.(mcp|mcc)",
236 CONST_STRPTR
const *pathptr
;
237 struct DevProc
*dp
= NULL
;
238 struct page_entry
*pe
;
239 WORD num_page_entries
= 0;
242 for(pe
= main_page_entries
; pe
->name
; pe
++)
247 olddir
= CurrentDir(BNULL
);
249 while((dp
= GetDeviceProc("LIBS:", dp
)))
251 CurrentDir(dp
->dvp_Lock
);
253 for(pathptr
= searchpaths
; *pathptr
; pathptr
++)
255 struct AnchorPath
*ap
;
258 ap
= (struct AnchorPath
*)AllocVec(sizeof(struct AnchorPath
) + 256, MEMF_CLEAR
);
263 for(match
= MatchFirst((STRPTR
)*pathptr
, ap
);
265 match
= MatchNext(ap
))
267 struct Library
*mcclib
;
269 if (num_page_entries
< MAX_PAGE_ENTRIES
)
271 if ((mcclib
= OpenLibrary(ap
->ap_Buf
, 0)))
273 struct MUI_CustomClass
*mcp
;
275 if ((mcp
= MCC_Query(1)))
280 pe
->mcp_library
= mcclib
;
281 pe
->mcp_image
= (Object
*)MCC_Query(2); /* Get MCP image */
282 D(bug("[Zune Prefs/find_mcps] image %p\n", pe
->mcp_image
));
286 pe
->mcp_namebuffer
[0] = 27;
287 pe
->mcp_namebuffer
[1] = '3';
288 strncpy(pe
->mcp_namebuffer
+ 2, mcp
->mcc_Class
->cl_ID
, sizeof(pe
->mcp_namebuffer
) - 3);
290 if ((sp
= strrchr(pe
->mcp_namebuffer
, '.')))
293 pe
->name
= pe
->mcp_namebuffer
;
298 } /* if ((mcp = MCC_Query(1))) */
300 if (mcclib
) CloseLibrary(mcclib
);
302 } /* if ((mcclib = OpenLibrary(ap->ap_Buf, 0))) */
304 } /* if (num_page_entries < MAX_PAGE_ENTRIES) */
306 } /* for(match = ... */
314 } /* for(pathptr = searchpaths; *pathptr; pathptr++) */
316 if (!(dp
->dvp_Flags
& DVPF_ASSIGN
)) break;
318 } /* while((dp = GetDeviceProc("LIBS:", dp))) */
325 /****************************************************************
326 Deallocates all gui resources
327 *****************************************************************/
328 void deinit_gui(void)
333 MUI_DisposeObject(app
);
335 for (i
= 0; main_page_entries
[i
].name
; i
++)
337 if ((main_page_entries
[i
].group
!= NULL
) &&
338 (main_page_entries
[i
].group
!= main_page_group_displayed
))
340 DisposeObject(main_page_entries
[i
].group
);
343 if (main_page_entries
[i
].mcp_library
)
345 main_page_entries
[i
].cl
= NULL
; /* Prevent MUI_DeleteCustomClass call below */
347 if ((main_page_entries
[i
].group
== NULL
) ||
348 (main_page_entries
[i
].group
!= main_page_group_displayed
))
350 /* Only close library if main_page_group_displayed is not this page,
351 because in that case the object got automatically killed through
352 MUI_DisposeObject(app) which also does the CloseLibrary()!! */
354 CloseLibrary(main_page_entries
[i
].mcp_library
);
355 main_page_entries
[i
].mcp_library
= NULL
;
359 main_page_entries
[i
].group
= NULL
;
361 if (main_page_entries
[i
].cl
!= NULL
)
363 MUI_DeleteCustomClass(main_page_entries
[i
].cl
);
364 main_page_entries
[i
].cl
= NULL
;
368 if (main_page_group_displayed
!= main_page_space
)
369 MUI_DisposeObject(main_page_space
);
372 /****************************************************************
373 Allocate resources for gui
374 *****************************************************************/
380 Object
*cancel_button
;
384 main_page_entries
[ 0].name
= (char *)_(MSG_DSC_SYSTEM
);
385 main_page_entries
[ 1].name
= (char *)_(MSG_DSC_WINDOWS
);
386 main_page_entries
[ 2].name
= (char *)_(MSG_DSC_GROUPS
);
387 main_page_entries
[ 3].name
= (char *)_(MSG_DSC_BUTTONS
);
388 main_page_entries
[ 4].name
= (char *)_(MSG_DSC_CYCLES
);
389 main_page_entries
[ 5].name
= (char *)_(MSG_DSC_SLIDERS
);
390 main_page_entries
[ 6].name
= (char *)_(MSG_DSC_SCROLLBARS
);
391 main_page_entries
[ 7].name
= (char *)_(MSG_DSC_LISTVIEWS
);
392 main_page_entries
[ 8].name
= (char *)_(MSG_DSC_STRINGS
);
393 main_page_entries
[ 9].name
= (char *)_(MSG_DSC_NAVIGATION
);
394 main_page_entries
[10].name
= (char *)_(MSG_DSC_SPECIAL
);
395 main_page_entries
[11].name
= (char *)_(MSG_DSC_FRAMES
);
397 main_cancel_pressed_hook
.h_Entry
= HookEntry
;
398 main_cancel_pressed_hook
.h_SubEntry
= (HOOKFUNC
)main_cancel_pressed
;
400 main_save_pressed_hook
.h_Entry
= HookEntry
;
401 main_save_pressed_hook
.h_SubEntry
= (HOOKFUNC
)main_save_pressed
;
403 main_use_pressed_hook
.h_Entry
= HookEntry
;
404 main_use_pressed_hook
.h_SubEntry
= (HOOKFUNC
)main_use_pressed
;
406 main_test_pressed_hook
.h_Entry
= HookEntry
;
407 main_test_pressed_hook
.h_SubEntry
= (HOOKFUNC
)main_test_pressed
;
409 main_open_menu_hook
.h_Entry
= HookEntry
;
410 main_open_menu_hook
.h_SubEntry
= (HOOKFUNC
)main_open_menu
;
412 main_saveas_menu_hook
.h_Entry
= HookEntry
;
413 main_saveas_menu_hook
.h_SubEntry
= (HOOKFUNC
)main_saveas_menu
;
415 main_page_active_hook
.h_Entry
= HookEntry
;
416 main_page_active_hook
.h_SubEntry
= (HOOKFUNC
)main_page_active
;
418 page_display_hook
.h_Entry
= HookEntry
;
419 page_display_hook
.h_SubEntry
= (APTR
)main_page_list_display
;
421 if (!strcmp(appname
, "global"))
422 wintitle
= (STRPTR
) _(MSG_WINTITLE1
);
425 snprintf(titlebuf
, 255, _(MSG_WINTITLE2
), appname
);
429 app
= ApplicationObject
,
430 MUIA_Application_Title
, (IPTR
) "Zune",
431 MUIA_Application_Version
, (IPTR
) ZUNEVERSION
,
432 MUIA_Application_Copyright
, (IPTR
) " 2006, The AROS Development Team",
433 MUIA_Application_Description
, wintitle
,
434 MUIA_Application_Base
, "ZUNEPREF",
435 MUIA_Application_Menustrip
, MenuitemObject
,
436 MUIA_Family_Child
, MenuitemObject
,
437 MUIA_Menuitem_Title
, _(MSG_MEN_PROJECT
),
438 MUIA_Family_Child
, open_menuitem
= MenuitemObject
,
439 MUIA_Menuitem_Title
, _(MSG_MEN_OPEN
), MUIA_Menuitem_Shortcut
, _(MSG_MEN_OPEN_SC
),
441 MUIA_Family_Child
, append_menuitem
= MenuitemObject
, MUIA_Menuitem_Title
, _(MSG_MEN_APPEND
), End
,
442 MUIA_Family_Child
, saveas_menuitem
= MenuitemObject
,
443 MUIA_Menuitem_Title
, _(MSG_MEN_SAVEAS
), MUIA_Menuitem_Shortcut
, _(MSG_MEN_SAVEAS_SC
),
445 MUIA_Family_Child
, MenuitemObject
, MUIA_Menuitem_Title
, NM_BARLABEL
, End
,
446 MUIA_Family_Child
, aboutzune_menuitem
= MenuitemObject
,
447 MUIA_Menuitem_Title
, _(MSG_MEN_ABOUT
), MUIA_Menuitem_Shortcut
, _(MSG_MEN_ABOUT_SC
),
449 MUIA_Family_Child
, MenuitemObject
, MUIA_Menuitem_Title
, NM_BARLABEL
, End
,
450 MUIA_Family_Child
, quit_menuitem
= MenuitemObject
,
451 MUIA_Menuitem_Title
, _(MSG_MEN_QUIT
), MUIA_Menuitem_Shortcut
, _(MSG_MEN_QUIT_SC
),
455 SubWindow
, main_wnd
= WindowObject
,
456 MUIA_Window_Title
, (IPTR
)wintitle
,
457 MUIA_Window_Activate
, TRUE
,
458 MUIA_Window_CloseGadget
, FALSE
,
459 MUIA_Window_ID
, MAKE_ID('Z','W','I','N'),
461 WindowContents
, VGroup
,
462 MUIA_Group_VertSpacing
, 10,
465 Child
, (NewObject(ClassListview_CLASS
->mcc_Class
, NULL
,
467 MUIA_Listview_List
, main_page_list
= ListObject
,
469 MUIA_List_AdjustWidth
, TRUE
,
470 MUIA_List_Format
, ",",
471 MUIA_List_DisplayHook
, &page_display_hook
,
475 Child
, MUI_NewObject(MUIC_Popframe
,
477 MUIA_Window_Title
, (IPTR
) _(MSG_FRAME_CLIPBOARD
),
479 Child
, MUI_NewObject(MUIC_Popimage
,
481 MUIA_Imageadjust_Type
, MUIV_Imageadjust_Type_All
,
482 MUIA_Window_Title
, (IPTR
) _(MSG_IMAGE_CLIPBOARD
),
489 MUIA_Background
, MUII_PageBack
,
490 Child
, main_page_group
= VGroup
,
491 Child
, main_page_group_displayed
= main_page_space
= HVSpace
,
496 Child
, test_button
= ImageButton(_(MSG_GAD_TEST
), "THEME:Images/Gadgets/Prefs/Test"),
498 Child
, save_button
= ImageButton(_(MSG_GAD_SAVE
), "THEME:Images/Gadgets/Prefs/Save"),
499 Child
, use_button
= ImageButton(_(MSG_GAD_USE
), "THEME:Images/Gadgets/Prefs/Use"),
500 Child
, cancel_button
= ImageButton(_(MSG_GAD_CANCEL
), "THEME:Images/Gadgets/Prefs/Cancel"),
510 DoMethod(main_wnd
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
511 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&main_cancel_pressed_hook
);
512 DoMethod(cancel_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)app
, 2,
513 MUIM_CallHook
, (IPTR
)&main_cancel_pressed_hook
);
514 DoMethod(save_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)app
, 2,
515 MUIM_CallHook
, (IPTR
)&main_save_pressed_hook
);
516 DoMethod(use_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)app
, 2,
517 MUIM_CallHook
, (IPTR
)&main_use_pressed_hook
);
518 DoMethod(test_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)app
, 5,
519 MUIM_Application_PushMethod
, (IPTR
)app
, 2, MUIM_CallHook
,
520 (IPTR
)&main_test_pressed_hook
);
521 DoMethod(quit_menuitem
, MUIM_Notify
, MUIA_Menuitem_Trigger
,
522 MUIV_EveryTime
, (IPTR
)app
, 2, MUIM_CallHook
,
523 (IPTR
)&main_cancel_pressed_hook
);
524 DoMethod(open_menuitem
, MUIM_Notify
, MUIA_Menuitem_Trigger
,
525 MUIV_EveryTime
, (IPTR
)app
, 2, MUIM_CallHook
,
526 (IPTR
)&main_open_menu_hook
);
527 DoMethod(saveas_menuitem
, MUIM_Notify
, MUIA_Menuitem_Trigger
,
528 MUIV_EveryTime
, (IPTR
)app
, 2, MUIM_CallHook
,
529 (IPTR
)&main_saveas_menu_hook
);
530 DoMethod(aboutzune_menuitem
, MUIM_Notify
, MUIA_Menuitem_Trigger
,
531 MUIV_EveryTime
, (IPTR
)app
, 2, MUIM_Application_AboutMUI
,
534 for (i
= 0; main_page_entries
[i
].name
!= NULL
; i
++)
536 struct page_entry
*p
= &main_page_entries
[i
];
538 if (!p
->cl
) p
->cl
= create_class(p
->desc
);
540 if (!(p
->cl
&& (p
->group
= NewObject(p
->cl
->mcc_Class
, NULL
, TAG_DONE
))))
546 DoMethod(main_page_list
, MUIM_List_InsertSingle
, (IPTR
)p
,
547 MUIV_List_Insert_Bottom
);
550 DoMethod(main_page_list
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
551 (IPTR
)app
, 3, MUIM_CallHook
, (IPTR
)&main_page_active_hook
);
553 /* Activate first entry */
554 set(main_page_list
,MUIA_List_Active
,0);
561 /****************************************************************
563 *****************************************************************/
564 void load_prefs(CONST_STRPTR name
)
568 configdata
= MUI_NewObject(MUIC_Configdata
,
569 MUIA_Configdata_ApplicationBase
, (IPTR
)name
,
571 if (configdata
!= NULL
)
575 /* D(bug("zune::load_prefs: created configdata %p\n", configdata)); */
576 LastSavedConfigdata
= configdata
;
578 /* Call MUIM_Settingsgroup_ConfigToGadgets for every group */
579 for (i
=0;main_page_entries
[i
].name
;i
++)
581 struct page_entry
*p
= &main_page_entries
[i
];
583 DoMethod(p
->group
, MUIM_Settingsgroup_ConfigToGadgets
,
587 /* D(bug("zune::save_prefs: disposed configdata %p\n", configdata)); */
591 /* write prefs to env: */
592 void test_prefs(void)
596 save_prefs(appname
, FALSE
);
598 cfg
= MUI_NewObject(MUIC_Configdata
, MUIA_Configdata_Application
, (IPTR
)app
, TAG_DONE
);
599 set(app
, MUIA_Application_Configdata
, (IPTR
)cfg
);
602 void restore_prefs(CONST_STRPTR name
)
606 snprintf(buf
, 255, "ENV:zune/%s.prefs", name
);
607 DoMethod(LastSavedConfigdata
, MUIM_Configdata_Save
, (IPTR
)buf
);
611 /****************************************************************
612 open given prefs file from menue
613 *****************************************************************/
615 void main_open_menu(void)
617 static char dirpart
[500]="ENVARC:Zune",filepart
[500],filename
[1000];
619 if (aslfilerequest ("Load a Zune Prefs File", (char *)&dirpart
, (char *)&filepart
, (char *)&filename
, prefstags
));
623 configdata
= MUI_NewObject(MUIC_Configdata
,
624 MUIA_Configdata_ApplicationBase
,appname
,
627 if (configdata
!= NULL
)
631 /* D(bug("zune::load_prefs: created configdata %p\n", configdata)); */
632 //LastSavedConfigdata = configdata;
633 DoMethod(configdata
, MUIM_Configdata_Load
,filename
);
635 /* Call MUIM_Settingsgroup_ConfigToGadgets for every group */
636 for (i
=0;main_page_entries
[i
].name
;i
++)
638 struct page_entry
*p
= &main_page_entries
[i
];
640 if (p
->group
) DoMethod(p
->group
, MUIM_Settingsgroup_ConfigToGadgets
, (IPTR
)configdata
);
643 /* activate prefs in test mode */
646 /* D(bug("zune::save_prefs: disposed configdata %p\n", configdata)); */
652 /****************************************************************
654 *****************************************************************/
655 void save_prefs(CONST_STRPTR name
, BOOL envarc
)
659 configdata
= MUI_NewObject(MUIC_Configdata
,
660 //MUIA_Configdata_ApplicationBase, name,
661 MUIA_Configdata_Application
,appaddr
,
663 if (configdata
!= NULL
)
668 /* D(bug("zune::save_prefs: created configdata %p\n", configdata)); */
670 /* Call MUIM_Settingsgroup_GadgetsToConfig for every group */
671 for (i
=0;main_page_entries
[i
].name
;i
++)
673 struct page_entry
*p
= &main_page_entries
[i
];
675 DoMethod(p
->group
, MUIM_Settingsgroup_GadgetsToConfig
,
681 snprintf(buf
, 255, "ENVARC:zune/%s.prefs", name
);
682 DoMethod(configdata
, MUIM_Configdata_Save
, (IPTR
)buf
);
684 snprintf(buf
, 255, "ENV:zune/%s.prefs", name
);
685 DoMethod(configdata
, MUIM_Configdata_Save
, (IPTR
)buf
);
687 MUI_DisposeObject(configdata
);
688 /* D(bug("zune::save_prefs: disposed configdata %p\n", configdata)); */
693 /****************************************************************
694 SaveAS the done prefs from menue
695 *****************************************************************/
697 void main_saveas_menu(void)
699 static char dirpart
[500]="ENVARC:Zune",filepart
[500],filename
[1000];
701 if (aslfilerequest("Save a Zune Prefs File", (char *)&dirpart
, (char *)&filepart
, (char *)&filename
, prefstags
));
705 configdata
= MUI_NewObject(MUIC_Configdata
,
706 MUIA_Configdata_ApplicationBase
, "dummyfile",
709 /* check for ".prefs" suffix in filename, add if not existing */
710 if ( !strstr( filename
, ".prefs") ) strcat(filename
, ".prefs");
712 if (configdata
!= NULL
)
716 /* D(bug("zune::save_prefs: created configdata %p\n", configdata)); */
718 /* Call MUIM_Settingsgroup_GadgetsToConfig for every group */
719 for (i
=0;main_page_entries
[i
].name
;i
++)
721 struct page_entry
*p
= &main_page_entries
[i
];
723 if (p
->group
) DoMethod(p
->group
, MUIM_Settingsgroup_GadgetsToConfig
, (IPTR
)configdata
);
726 DoMethod(configdata
, MUIM_Configdata_Save
, filename
);
728 MUI_DisposeObject(configdata
);
729 /* D(bug("zune::save_prefs: disposed configdata %p\n", configdata)); */
737 /****************************************************************
739 *****************************************************************/
744 while((LONG
) DoMethod(app
, MUIM_Application_NewInput
, (IPTR
)&sigs
)
745 != MUIV_Application_ReturnID_Quit
)
749 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
| SIGBREAKF_CTRL_D
);
750 if (sigs
& SIGBREAKF_CTRL_C
) break;
751 if (sigs
& SIGBREAKF_CTRL_D
) break;
756 /****************************************************************
758 *****************************************************************/
762 BPTR OldDir
= BNULL
, NewDir
;
763 int retval
= RETURN_OK
;
764 struct RDArgs
*rda
= NULL
;
766 IPTR args
[] = { 0,0 };
767 enum { ARG_APPNAME
= 0,ARG_APPADDR
=1 };
773 rda
= ReadArgs("/A,/N", args
, NULL
);
774 appname
=(STRPTR
)args
[ARG_APPNAME
];
775 appaddr
=(APTR
)args
[ARG_APPADDR
];
776 if (appaddr
)appaddr
=*(appaddr
);
783 if (retval
== RETURN_OK
)
791 NewDir
= Lock("RAM:", SHARED_LOCK
);
793 OldDir
= CurrentDir(NewDir
);
796 load_prefs((STRPTR
)args
[ARG_APPNAME
]);
797 set(main_wnd
, MUIA_Window_Open
, TRUE
);
798 if (XGET(main_wnd
,MUIA_Window_Open
))
802 if (LastSavedConfigdata
)
803 MUI_DisposeObject(LastSavedConfigdata
);
814 if (rda
) FreeArgs(rda
);
816 Locale_Deinitialize();