[gedit/eggplugins] [libplugins] handle UI manager update in GeditPluginsEngine.



commit 8cd42480ed21f19e21b08a3844cb648901ff3e10
Author: Steve Frécinaux <code istique net>
Date:   Sun Oct 11 14:52:52 2009 +0200

    [libplugins] handle UI manager update in GeditPluginsEngine.
    
    This had nothing to do in the generic EggPluginsEngine as it has no idea
    what kind of GObjects it's diealing with.
    The GeditPluginsEngine uses the new plugin_deactivated virtual method to
    update the ui manager before the plugin is unloaded.

 gedit/gedit-plugins-engine.c    |   27 ++++++++++++++++++++++++++-
 libplugins/egg-plugins-engine.c |   17 +----------------
 2 files changed, 27 insertions(+), 17 deletions(-)
---
diff --git a/gedit/gedit-plugins-engine.c b/gedit/gedit-plugins-engine.c
index 17c7fe0..88358ef 100644
--- a/gedit/gedit-plugins-engine.c
+++ b/gedit/gedit-plugins-engine.c
@@ -32,15 +32,40 @@
 #endif
 
 #include "gedit-plugins-engine.h"
+#include "gedit-app.h"
 
 G_DEFINE_TYPE(GeditPluginsEngine, gedit_plugins_engine, EGG_PLUGINS_TYPE_ENGINE)
 
 EggPluginsEngine *default_engine = NULL;
 
 static void
+gedit_plugins_engine_plugin_deactivated (EggPluginsEngine *engine,
+					 EggPluginsInfo *info)
+{
+	const GList *wins;
+	for (wins = gedit_app_get_windows (gedit_app_get_default ());
+	     wins != NULL;
+	     wins = wins->next)
+	{
+		GeditWindow *window = GEDIT_WINDOW (wins->data);
+
+		/* ensure update of ui manager, because we suspect it does something
+		   with expected static strings in the type module (when unloaded the
+		   strings don't exist anymore, and ui manager updates in an idle
+		   func) */
+		gtk_ui_manager_ensure_update (gedit_window_get_ui_manager (window));
+	}
+
+	EGG_PLUGINS_ENGINE_CLASS (gedit_plugins_engine_parent_class)
+						->plugin_deactivated (engine, info);
+}
+
+static void
 gedit_plugins_engine_class_init (GeditPluginsEngineClass *klass)
 {
-	/* Empty */
+	EggPluginsEngineClass *engine_class = EGG_PLUGINS_ENGINE_CLASS (klass);
+
+	engine_class->plugin_deactivated = gedit_plugins_engine_plugin_deactivated;
 }
 
 static void
diff --git a/libplugins/egg-plugins-engine.c b/libplugins/egg-plugins-engine.c
index 2834746..912cbd0 100644
--- a/libplugins/egg-plugins-engine.c
+++ b/libplugins/egg-plugins-engine.c
@@ -42,7 +42,6 @@
 #include "egg-plugins-object-module.h"
 #include "egg-plugins-plugin.h"
 #include <gedit/gedit-app.h>
-#include <gedit/gedit-window.h>
 #include <gedit/gedit-prefs-manager.h>
 #include <gedit/gedit-dirs.h>
 
@@ -648,20 +647,6 @@ egg_plugins_engine_activate_plugin (EggPluginsEngine *engine,
 }
 
 static void
-call_plugin_deactivate (EggPluginsPlugin *plugin,
-			GObject          *target_object)
-{
-	egg_plugins_plugin_deactivate (plugin, target_object);
-
-	/* ensure update of ui manager, because we suspect it does something
-	   with expected static strings in the type module (when unloaded the
-	   strings don't exist anymore, and ui manager updates in an idle
-	   func) 
-	   FIXME: move it to GeditPluginsEngine */
-	gtk_ui_manager_ensure_update (gedit_window_get_ui_manager (GEDIT_WINDOW (target_object)));
-}
-
-static void
 egg_plugins_engine_deactivate_plugin_real (EggPluginsEngine *engine,
 					   EggPluginsInfo   *info)
 {
@@ -676,7 +661,7 @@ egg_plugins_engine_deactivate_plugin_real (EggPluginsEngine *engine,
 	     wins != NULL;
 	     wins = wins->next)
 	{
-		call_plugin_deactivate (info->plugin, G_OBJECT (wins->data));
+		egg_plugins_plugin_deactivate (info->plugin, G_OBJECT (wins->data));
 	}
 
 	/* let engine subclasses perform required cleanups. */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]