From 6a9a8d6127e3fd677dc8ad28d14b4d84b3dfdc40 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 9 Jul 2016 01:07:18 +0100 Subject: Move current user options path to an abstracted nsoptions_read/write function --- frontends/amiga/Makefile | 2 +- frontends/amiga/gui.c | 8 ++++---- frontends/amiga/gui_options.c | 5 ++--- frontends/amiga/gui_options.h | 2 -- frontends/amiga/menu.c | 3 ++- 5 files changed, 9 insertions(+), 11 deletions(-) (limited to 'frontends/amiga') diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile index 22bf85b7a..eb3c70b85 100644 --- a/frontends/amiga/Makefile +++ b/frontends/amiga/Makefile @@ -45,7 +45,7 @@ S_FRONTEND := gui.c tree.c history.c hotlist.c schedule.c file.c \ datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \ stringview/stringview.c stringview/urlhistory.c rtg.c \ agclass/amigaguide_class.c os3support.c font_diskfont.c \ - selectmenu.c hash/xxhash.c font_cache.c font_bullet.c + selectmenu.c hash/xxhash.c font_cache.c font_bullet.c nsoption.c # This is the final source build list # Note this is deliberately *not* expanded here as common and image diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index 9e57bc780..815ffb7fd 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -776,7 +776,7 @@ static void ami_openscreen(void) id = screenmodereq->sm_DisplayID; sprintf(modeid, "0x%lx", id); nsoption_set_charp(screen_modeid, modeid); - nsoption_write(current_user_options, NULL, NULL); + ami_nsoption_write(); } FreeAslRequest(screenmodereq); } @@ -5643,7 +5643,7 @@ int main(int argc, char** argv) if((lock = CreateDirTree(current_user_dir))) UnLock(lock); - current_user_options = ASPrintf("%s/Choices", current_user_dir); + ami_nsoption_set_location(current_user_dir); current_user_cache = ASPrintf("%s/Cache", current_user_dir); current_user_faviconcache = ASPrintf("%s/IconCache", current_user_dir); @@ -5672,7 +5672,7 @@ int main(int argc, char** argv) ami_libs_close(); return RETURN_FAIL; } - nsoption_read(current_user_options, NULL); + ami_nsoption_read(); if(args != NULL) { nsoption_commandline(&nargc, &nargv, NULL); FreeArgs(args); @@ -5742,7 +5742,7 @@ int main(int argc, char** argv) netsurf_exit(); - FreeVec(current_user_options); + ami_nsoption_free(); FreeVec(current_user_dir); FreeVec(current_user_faviconcache); FreeVec(current_user); diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c index 21067fb40..2b1b7c944 100755 --- a/frontends/amiga/gui_options.c +++ b/frontends/amiga/gui_options.c @@ -74,6 +74,7 @@ #include "amiga/help.h" #include "amiga/libs.h" #include "amiga/misc.h" +#include "amiga/nsoption.h" #include "amiga/object.h" #include "amiga/selectmenu.h" #include "amiga/theme.h" @@ -233,8 +234,6 @@ struct ami_gui_opts_window { #endif }; -char *current_user_options = NULL; - static struct ami_gui_opts_window *gow = NULL; static CONST_STRPTR tabs[OPTS_MAX_TABS]; @@ -2057,7 +2056,7 @@ static void ami_gui_opts_use(bool save) } if(save == true) { - nsoption_write(current_user_options, NULL, NULL); + ami_nsoption_write(); ami_font_savescanner(); /* just in case it has changed and been used only */ } diff --git a/frontends/amiga/gui_options.h b/frontends/amiga/gui_options.h index 3d680845b..abb0b111c 100755 --- a/frontends/amiga/gui_options.h +++ b/frontends/amiga/gui_options.h @@ -26,7 +26,5 @@ void ami_gui_opts_close(void); /* Web search list */ struct List *ami_gui_opts_websearch(void); void ami_gui_opts_websearch_free(struct List *websearchlist); - -extern char *current_user_options; #endif diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c index 479bf8188..0fd730ed8 100644 --- a/frontends/amiga/menu.c +++ b/frontends/amiga/menu.c @@ -69,6 +69,7 @@ #include "amiga/libs.h" #include "amiga/menu.h" #include "amiga/misc.h" +#include "amiga/nsoption.h" #include "amiga/print.h" #include "amiga/search.h" #include "amiga/theme.h" @@ -484,7 +485,7 @@ HOOKF(void, ami_menu_item_settings_snapshot, APTR, window, struct IntuiMessage * HOOKF(void, ami_menu_item_settings_save, APTR, window, struct IntuiMessage *) { - nsoption_write(current_user_options, NULL, NULL); + ami_nsoption_write(); } HOOKF(void, ami_menu_item_arexx_execute, APTR, window, struct IntuiMessage *) -- cgit v1.2.3