Move user-specifics out of Resources
svn path=/trunk/netsurf/; revision=13768
This commit is contained in:
parent
483b86e713
commit
38b310ad5f
40
amiga/gui.c
40
amiga/gui.c
|
@ -155,6 +155,9 @@ struct MsgPort *applibport = NULL;
|
||||||
ULONG applibsig = 0;
|
ULONG applibsig = 0;
|
||||||
BOOL refresh_search_ico = FALSE;
|
BOOL refresh_search_ico = FALSE;
|
||||||
|
|
||||||
|
static char *current_user;
|
||||||
|
static char *current_user_dir;
|
||||||
|
|
||||||
const char tree_directory_icon_name[] = "def_drawer.info";
|
const char tree_directory_icon_name[] = "def_drawer.info";
|
||||||
const char tree_content_icon_name[] = "def_project.info";
|
const char tree_content_icon_name[] = "def_project.info";
|
||||||
|
|
||||||
|
@ -375,6 +378,7 @@ void ami_set_options(void)
|
||||||
{
|
{
|
||||||
STRPTR tempacceptlangs;
|
STRPTR tempacceptlangs;
|
||||||
BPTR lock = 0;
|
BPTR lock = 0;
|
||||||
|
char temp[1024];
|
||||||
|
|
||||||
/* The following line disables the popupmenu.class select menu
|
/* The following line disables the popupmenu.class select menu
|
||||||
** This will become a user option when/if popupmenu.class is
|
** This will become a user option when/if popupmenu.class is
|
||||||
|
@ -400,25 +404,21 @@ void ami_set_options(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sprintf(temp, "%s/Cookies", current_user_dir);
|
||||||
nsoption_setnull_charp(cookie_file,
|
nsoption_setnull_charp(cookie_file,
|
||||||
(char *)strdup("PROGDIR:Resources/Cookies"));
|
(char *)strdup(temp));
|
||||||
|
|
||||||
|
sprintf(temp, "%s/Hotlist", current_user_dir);
|
||||||
nsoption_setnull_charp(hotlist_file,
|
nsoption_setnull_charp(hotlist_file,
|
||||||
(char *)strdup("PROGDIR:Resources/Hotlist"));
|
(char *)strdup(temp));
|
||||||
|
|
||||||
|
|
||||||
|
sprintf(temp, "%s/URLdb", current_user_dir);
|
||||||
nsoption_setnull_charp(url_file,
|
nsoption_setnull_charp(url_file,
|
||||||
(char *)strdup("PROGDIR:Resources/URLs"));
|
(char *)strdup(temp));
|
||||||
|
|
||||||
/*
|
|
||||||
nsoption_setnull_charp(cookie_jar,
|
|
||||||
(char *)strdup("PROGDIR:Resources/CookieJar"));
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* devs:curl-ca-bundle.crt is the default place for the ca bundle on OS4,
|
/* devs:curl-ca-bundle.crt is the default place for the ca bundle on OS4,
|
||||||
* but we can't rely on it existing, so default to our local one in resources */
|
* but we can't rely on it existing, so default to our local one in resources */
|
||||||
|
|
||||||
|
|
||||||
nsoption_setnull_charp(ca_bundle,
|
nsoption_setnull_charp(ca_bundle,
|
||||||
(char *)strdup("PROGDIR:Resources/ca-bundle"));
|
(char *)strdup("PROGDIR:Resources/ca-bundle"));
|
||||||
|
|
||||||
|
@ -595,7 +595,7 @@ void ami_openscreen(void)
|
||||||
id = screenmodereq->sm_DisplayID;
|
id = screenmodereq->sm_DisplayID;
|
||||||
sprintf(modeid, "0x%lx", id);
|
sprintf(modeid, "0x%lx", id);
|
||||||
nsoption_set_charp(modeid, modeid);
|
nsoption_set_charp(modeid, modeid);
|
||||||
nsoption_write("PROGDIR:Resources/Options");
|
nsoption_write(current_user_options);
|
||||||
}
|
}
|
||||||
FreeAslRequest(screenmodereq);
|
FreeAslRequest(screenmodereq);
|
||||||
}
|
}
|
||||||
|
@ -818,21 +818,27 @@ int main(int argc, char** argv)
|
||||||
setbuf(stderr, NULL);
|
setbuf(stderr, NULL);
|
||||||
char messages[100];
|
char messages[100];
|
||||||
char script[1024];
|
char script[1024];
|
||||||
|
char temp[1024];
|
||||||
|
|
||||||
Object *splash_window = ami_gui_splash_open();
|
Object *splash_window = ami_gui_splash_open();
|
||||||
|
|
||||||
|
current_user = ASPrintf("Default");
|
||||||
|
current_user_dir = ASPrintf("PROGDIR:Users/%s", current_user);
|
||||||
|
current_user_options = ASPrintf("%s/Choices", current_user_dir);
|
||||||
|
|
||||||
if(ami_locate_resource(messages, "Messages") == false)
|
if(ami_locate_resource(messages, "Messages") == false)
|
||||||
die("Cannot open Messages file");
|
die("Cannot open Messages file");
|
||||||
|
|
||||||
ami_mime_init("PROGDIR:Resources/mimetypes");
|
ami_mime_init("PROGDIR:Resources/mimetypes");
|
||||||
ami_mime_init("PROGDIR:Resources/mimetypes.user");
|
sprintf(temp, "%s/mimetypes.user", current_user_dir);
|
||||||
|
ami_mime_init(temp);
|
||||||
ami_schedule_open_timer();
|
ami_schedule_open_timer();
|
||||||
ami_schedule_create();
|
ami_schedule_create();
|
||||||
|
|
||||||
amiga_plugin_hack_init();
|
amiga_plugin_hack_init();
|
||||||
amiga_datatypes_init();
|
amiga_datatypes_init();
|
||||||
|
|
||||||
netsurf_init(&argc, &argv, "PROGDIR:Resources/Options", messages);
|
netsurf_init(&argc, &argv, current_user_options, messages);
|
||||||
|
|
||||||
amiga_icon_init();
|
amiga_icon_init();
|
||||||
|
|
||||||
|
@ -1705,8 +1711,8 @@ void ami_handle_msg(void)
|
||||||
/*
|
/*
|
||||||
case 'u': // open url
|
case 'u': // open url
|
||||||
if((nsoption_bool(kiosk_mode) == false))
|
if((nsoption_bool(kiosk_mode) == false))
|
||||||
ActivateGadget((struct Gadget *)gwin->objects[GID_URL],
|
ActivateLayoutGadget((struct Gadget *)gwin->objects[GID_MAIN],
|
||||||
gwin->win, NULL);
|
gwin->win, NULL, (uint32)gwin->objects[GID_URL]);
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
@ -2311,6 +2317,10 @@ void gui_quit(void)
|
||||||
ami_schedule_close_timer();
|
ami_schedule_close_timer();
|
||||||
|
|
||||||
FreeObjList(window_list);
|
FreeObjList(window_list);
|
||||||
|
|
||||||
|
FreeVec(current_user_options);
|
||||||
|
FreeVec(current_user_dir);
|
||||||
|
FreeVec(current_user);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ami_update_buttons(struct gui_window_2 *gwin)
|
void ami_update_buttons(struct gui_window_2 *gwin)
|
||||||
|
|
|
@ -1734,7 +1734,7 @@ BOOL ami_gui_opts_event(void)
|
||||||
{
|
{
|
||||||
case GID_OPTS_SAVE:
|
case GID_OPTS_SAVE:
|
||||||
ami_gui_opts_use();
|
ami_gui_opts_use();
|
||||||
nsoption_write("PROGDIR:Resources/Options");
|
nsoption_write(current_user_options);
|
||||||
ami_gui_opts_close();
|
ami_gui_opts_close();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -20,4 +20,6 @@
|
||||||
#define AMIGA_GUI_OPTIONS_H
|
#define AMIGA_GUI_OPTIONS_H
|
||||||
void ami_gui_opts_open(void);
|
void ami_gui_opts_open(void);
|
||||||
BOOL ami_gui_opts_event(void);
|
BOOL ami_gui_opts_event(void);
|
||||||
|
|
||||||
|
char *current_user_options;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -687,7 +687,7 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // save settings
|
case 3: // save settings
|
||||||
nsoption_write("PROGDIR:Resources/Options");
|
nsoption_write(current_user_options);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue