From 38b310ad5fe5b6b4417ea3d935bf977719ad19e6 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Wed, 28 Mar 2012 22:17:27 +0000 Subject: [PATCH] Move user-specifics out of Resources svn path=/trunk/netsurf/; revision=13768 --- amiga/gui.c | 40 +++++++++++++++++++++++++--------------- amiga/gui_options.c | 2 +- amiga/gui_options.h | 2 ++ amiga/menu.c | 2 +- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index 2e2509951..88488dc63 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -155,6 +155,9 @@ struct MsgPort *applibport = NULL; ULONG applibsig = 0; 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_content_icon_name[] = "def_project.info"; @@ -375,6 +378,7 @@ void ami_set_options(void) { STRPTR tempacceptlangs; BPTR lock = 0; + char temp[1024]; /* The following line disables the popupmenu.class select menu ** 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, - (char *)strdup("PROGDIR:Resources/Cookies")); + (char *)strdup(temp)); + sprintf(temp, "%s/Hotlist", current_user_dir); 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, - (char *)strdup("PROGDIR:Resources/URLs")); - -/* - nsoption_setnull_charp(cookie_jar, - (char *)strdup("PROGDIR:Resources/CookieJar")); -*/ + (char *)strdup(temp)); /* 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 */ - nsoption_setnull_charp(ca_bundle, (char *)strdup("PROGDIR:Resources/ca-bundle")); @@ -595,7 +595,7 @@ void ami_openscreen(void) id = screenmodereq->sm_DisplayID; sprintf(modeid, "0x%lx", id); nsoption_set_charp(modeid, modeid); - nsoption_write("PROGDIR:Resources/Options"); + nsoption_write(current_user_options); } FreeAslRequest(screenmodereq); } @@ -818,21 +818,27 @@ int main(int argc, char** argv) setbuf(stderr, NULL); char messages[100]; char script[1024]; + char temp[1024]; 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) die("Cannot open Messages file"); 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_create(); amiga_plugin_hack_init(); amiga_datatypes_init(); - netsurf_init(&argc, &argv, "PROGDIR:Resources/Options", messages); + netsurf_init(&argc, &argv, current_user_options, messages); amiga_icon_init(); @@ -1705,8 +1711,8 @@ void ami_handle_msg(void) /* case 'u': // open url if((nsoption_bool(kiosk_mode) == false)) - ActivateGadget((struct Gadget *)gwin->objects[GID_URL], - gwin->win, NULL); + ActivateLayoutGadget((struct Gadget *)gwin->objects[GID_MAIN], + gwin->win, NULL, (uint32)gwin->objects[GID_URL]); break; */ } @@ -2311,6 +2317,10 @@ void gui_quit(void) ami_schedule_close_timer(); FreeObjList(window_list); + + FreeVec(current_user_options); + FreeVec(current_user_dir); + FreeVec(current_user); } void ami_update_buttons(struct gui_window_2 *gwin) diff --git a/amiga/gui_options.c b/amiga/gui_options.c index b66d48bc8..f708b26bd 100755 --- a/amiga/gui_options.c +++ b/amiga/gui_options.c @@ -1734,7 +1734,7 @@ BOOL ami_gui_opts_event(void) { case GID_OPTS_SAVE: ami_gui_opts_use(); - nsoption_write("PROGDIR:Resources/Options"); + nsoption_write(current_user_options); ami_gui_opts_close(); return TRUE; break; diff --git a/amiga/gui_options.h b/amiga/gui_options.h index e7f0938d2..0fd0715a3 100755 --- a/amiga/gui_options.h +++ b/amiga/gui_options.h @@ -20,4 +20,6 @@ #define AMIGA_GUI_OPTIONS_H void ami_gui_opts_open(void); BOOL ami_gui_opts_event(void); + +char *current_user_options; #endif diff --git a/amiga/menu.c b/amiga/menu.c index 60858823e..f76dc163a 100755 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -687,7 +687,7 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item) break; case 3: // save settings - nsoption_write("PROGDIR:Resources/Options"); + nsoption_write(current_user_options); break; } break;