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
This commit is contained in:
Nick Treleaven 2008-04-16 15:09:52 +00:00
parent 7e244e784a
commit a6ddfc2221
4 changed files with 31 additions and 31 deletions

View File

@ -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 <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -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);

View File

@ -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)

View File

@ -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);