[gedit/eggplugins] [libplugins] Introduce the engine->plugin_deactivated virtual method.
- From: Steve Frécinaux <sfre src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gedit/eggplugins] [libplugins] Introduce the engine->plugin_deactivated virtual method.
- Date: Sun, 11 Oct 2009 12:59:25 +0000 (UTC)
commit 7a6d778533039ea2d4c52c2c81a50b1798fb268c
Author: Steve Frécinaux <code istique net>
Date: Sun Oct 11 14:38:47 2009 +0200
[libplugins] Introduce the engine->plugin_deactivated virtual method.
The 'plugin_deactivated' virtual method is called after the plugin has
been deactivated, but before it is unloaded. This can be used for
the cleanups that needs to be done while the plugin is still in memory.
libplugins/egg-plugins-engine.c | 10 ++++++++++
libplugins/egg-plugins-engine.h | 5 +++++
2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/libplugins/egg-plugins-engine.c b/libplugins/egg-plugins-engine.c
index 8df4503..2834746 100644
--- a/libplugins/egg-plugins-engine.c
+++ b/libplugins/egg-plugins-engine.c
@@ -87,6 +87,12 @@ static void egg_plugins_engine_deactivate_plugin_real (EggPluginsEngine *engine,
typedef gboolean (*LoadDirCallback)(EggPluginsEngine *engine, const gchar *filename, gpointer userdata);
+static void
+dummy (EggPluginsEngine *engine, EggPluginsInfo *info)
+{
+ /* Empty */
+}
+
static gboolean
load_dir_real (EggPluginsEngine *engine,
const gchar *dir,
@@ -339,6 +345,7 @@ egg_plugins_engine_class_init (EggPluginsEngineClass *klass)
object_class->finalize = egg_plugins_engine_finalize;
klass->activate_plugin = egg_plugins_engine_activate_plugin_real;
klass->deactivate_plugin = egg_plugins_engine_deactivate_plugin_real;
+ klass->plugin_deactivated = dummy;
signals[ACTIVATE_PLUGIN] =
g_signal_new ("activate-plugin",
@@ -672,6 +679,9 @@ egg_plugins_engine_deactivate_plugin_real (EggPluginsEngine *engine,
call_plugin_deactivate (info->plugin, G_OBJECT (wins->data));
}
+ /* let engine subclasses perform required cleanups. */
+ EGG_PLUGINS_ENGINE_GET_CLASS (engine)->plugin_deactivated (engine, info);
+
/* first unref the plugin (the loader still has one) */
g_object_unref (info->plugin);
diff --git a/libplugins/egg-plugins-engine.h b/libplugins/egg-plugins-engine.h
index a909b1b..35cdff0 100644
--- a/libplugins/egg-plugins-engine.h
+++ b/libplugins/egg-plugins-engine.h
@@ -65,6 +65,11 @@ struct _EggPluginsEngineClass
void (* deactivate_plugin) (EggPluginsEngine *engine,
EggPluginsInfo *info);
+
+ /* called when done deactivating the plugin, but before the plugin
+ * gets unloaded. */
+ void (* plugin_deactivated) (EggPluginsEngine *engine,
+ EggPluginsInfo *info);
};
GType egg_plugins_engine_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]