From a6ddfc2221ffff0cb1d2b3a411874f0015e4804c Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 16 Apr 2008 15:09:52 +0000 Subject: [PATCH] Move plugin keyfile pref saving and loading to plugins.c. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2491 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 2 ++ src/keyfile.c | 31 ++----------------------------- src/plugins.c | 25 ++++++++++++++++++++++++- src/plugins.h | 4 +++- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index d90c8a5d..c9dfdc3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ Refactor handle_cl_filename() from open_cl_files(). * src/callbacks.c: Fix geany_debug() warnings with Close All. + * src/keyfile.c, src/plugins.c, src/plugins.h: + Move plugin keyfile pref saving and loading to plugins.c. 2008-04-15 Enrico Tröger diff --git a/src/keyfile.c b/src/keyfile.c index aabd976a..4a28874e 100644 --- a/src/keyfile.c +++ b/src/keyfile.c @@ -151,24 +151,6 @@ void configuration_save_session_files(GKeyFile *config) } -#ifdef HAVE_PLUGINS -static void save_plugin_prefs(GKeyFile *config) -{ - g_key_file_set_boolean(config, "plugins", "load_plugins", prefs.load_plugins); - plugins_create_active_list(); - if (app->active_plugins != NULL) - g_key_file_set_string_list(config, "plugins", "active_plugins", - (const gchar**)app->active_plugins, g_strv_length(app->active_plugins)); - else - { - /* use an empty dummy array to override maybe exisiting value */ - const gchar *dummy[] = { "" }; - g_key_file_set_string_list(config, "plugins", "active_plugins", dummy, 1); - } -} -#endif - - static void save_dialog_prefs(GKeyFile *config) { /* Some of the key names are not consistent, but this is for backwards compatibility */ @@ -389,7 +371,7 @@ void configuration_save(void) save_dialog_prefs(config); #ifdef HAVE_PLUGINS - save_plugin_prefs(config); + plugins_save_prefs(config); #endif save_hidden_prefs(config); save_ui_prefs(config); @@ -672,15 +654,6 @@ static void load_dialog_prefs(GKeyFile *config) } -#ifdef HAVE_PLUGINS -static void load_plugin_prefs(GKeyFile *config) -{ - prefs.load_plugins = utils_get_setting_boolean(config, "plugins", "load_plugins", TRUE); - app->active_plugins = g_key_file_get_string_list(config, "plugins", "active_plugins", NULL, NULL); -} -#endif - - static void load_ui_prefs(GKeyFile *config) { gint *geo; @@ -792,7 +765,7 @@ gboolean configuration_load(void) load_dialog_prefs(config); #ifdef HAVE_PLUGINS - load_plugin_prefs(config); + plugins_load_prefs(config); #endif load_ui_prefs(config); project_load_prefs(config); diff --git a/src/plugins.c b/src/plugins.c index a8891ced..b33b6489 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -690,7 +690,7 @@ void plugins_init() } -void plugins_create_active_list() +static void create_active_list(void) { gint i = 0; GList *list; @@ -713,6 +713,29 @@ void plugins_create_active_list() } +void plugins_save_prefs(GKeyFile *config) +{ + g_key_file_set_boolean(config, "plugins", "load_plugins", prefs.load_plugins); + create_active_list(); + if (app->active_plugins != NULL) + g_key_file_set_string_list(config, "plugins", "active_plugins", + (const gchar**)app->active_plugins, g_strv_length(app->active_plugins)); + else + { + /* use an empty dummy array to override maybe exisiting value */ + const gchar *dummy[] = { "" }; + g_key_file_set_string_list(config, "plugins", "active_plugins", dummy, 1); + } +} + + +void plugins_load_prefs(GKeyFile *config) +{ + prefs.load_plugins = utils_get_setting_boolean(config, "plugins", "load_plugins", TRUE); + app->active_plugins = g_key_file_get_string_list(config, "plugins", "active_plugins", NULL, NULL); +} + + void plugins_free() { if (active_plugin_list != NULL) diff --git a/src/plugins.h b/src/plugins.h index 8a4b35ca..40642f3d 100644 --- a/src/plugins.h +++ b/src/plugins.h @@ -32,7 +32,9 @@ void plugins_init(void); void plugins_free(void); -void plugins_create_active_list(void); +void plugins_save_prefs(GKeyFile *config); + +void plugins_load_prefs(GKeyFile *config); void plugins_update_tools_menu(void);