[gedit/libgpe] Load the plugin list from gconf on engine initialization.
- From: Steve Frécinaux <sfre src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gedit/libgpe] Load the plugin list from gconf on engine initialization.
- Date: Wed, 4 Nov 2009 23:43:02 +0000 (UTC)
commit cce211c543f1ad82a74e94504dab869e86fc779c
Author: Steve Frécinaux <code istique net>
Date: Thu Nov 5 00:42:46 2009 +0100
Load the plugin list from gconf on engine initialization.
gedit/gedit-plugins-engine.c | 69 +++++++++++++++++++++++++++--------------
1 files changed, 45 insertions(+), 24 deletions(-)
---
diff --git a/gedit/gedit-plugins-engine.c b/gedit/gedit-plugins-engine.c
index fbde7f4..ca5a79c 100644
--- a/gedit/gedit-plugins-engine.c
+++ b/gedit/gedit-plugins-engine.c
@@ -70,6 +70,46 @@ gedit_plugins_engine_init (GeditPluginsEngine *engine)
}
static void
+save_active_plugin_list (GPEEngine *engine)
+{
+ GSList *list = NULL;
+ gchar **active_plugins;
+ guint i;
+
+ g_debug ("Saving the plugin list.");
+
+ active_plugins = gpe_engine_get_active_plugins (engine);
+
+ for (i = 0; active_plugins[i] != NULL; i++)
+ list = g_slist_prepend (list, active_plugins[i]);
+
+ gedit_prefs_manager_set_active_plugins (list);
+
+ g_slist_free (list);
+ g_boxed_free (G_TYPE_STRV, active_plugins);
+}
+
+static void
+gedit_plugins_engine_activate_plugin (GPEEngine *engine,
+ GPEPluginInfo *info)
+{
+ GPE_ENGINE_CLASS (gedit_plugins_engine_parent_class)->activate_plugin (engine, info);
+
+ if (gpe_plugin_info_is_active (info))
+ save_active_plugin_list (engine);
+}
+
+
+static void
+gedit_plugins_engine_deactivate_plugin (GPEEngine *engine,
+ GPEPluginInfo *info)
+{
+ GPE_ENGINE_CLASS (gedit_plugins_engine_parent_class)->deactivate_plugin (engine, info);
+ if (!gpe_plugin_info_is_active (info))
+ save_active_plugin_list (engine);
+}
+
+static void
gedit_plugins_engine_deactivate_plugin_on_object (GPEEngine *engine,
GPEPluginInfo *info,
GObject *object)
@@ -98,6 +138,8 @@ gedit_plugins_engine_class_init (GeditPluginsEngineClass *klass)
GPEEngineClass *engine_class = GPE_ENGINE_CLASS (klass);
object_class->finalize = gedit_plugins_engine_finalize;
+ engine_class->activate_plugin = gedit_plugins_engine_activate_plugin;
+ engine_class->deactivate_plugin = gedit_plugins_engine_deactivate_plugin;
engine_class->deactivate_plugin_on_object = gedit_plugins_engine_deactivate_plugin_on_object;
g_type_class_add_private (klass, sizeof (GeditPluginsEnginePrivate));
@@ -132,35 +174,14 @@ gedit_plugins_engine_get_default (void)
g_free (module_dir);
g_free (data_dir);
+ /* Load the plugin list from gconf */
+ gedit_plugins_engine_active_plugins_changed (GEDIT_PLUGINS_ENGINE (default_engine));
+
g_object_add_weak_pointer (G_OBJECT (default_engine),
(gpointer) &default_engine);
return default_engine;
}
-#if 0
-static void
-save_active_plugin_list (GeditPluginsEngine *engine)
-{
- GSList *active_plugins = NULL;
- GList *l;
-
- for (l = engine->priv->plugin_list; l != NULL; l = l->next)
- {
- GeditPluginInfo *info = (GeditPluginInfo *) l->data;
-
- if (gedit_plugin_info_is_active (info))
- {
- active_plugins = g_slist_prepend (active_plugins,
- (gpointer)gedit_plugin_info_get_module_name (info));
- }
- }
-
- gedit_prefs_manager_set_active_plugins (active_plugins);
-
- g_slist_free (active_plugins);
-}
-#endif
-
void
gedit_plugins_engine_active_plugins_changed (GeditPluginsEngine *engine)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]