[eog] Port the existing plugins to libpeas



commit cf39e40b422dad061184ac67028661bd4dcb0106
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Wed Aug 4 17:00:41 2010 +0300

    Port the existing plugins to libpeas
    
    https://bugzilla.gnome.org/show_bug.cgi?id=626091

 plugins/fullscreen/eog-fullscreen-plugin.c         |  122 ++++++++++------
 plugins/fullscreen/eog-fullscreen-plugin.h         |   12 +-
 plugins/reload/eog-reload-plugin.c                 |  142 ++++++++++++-------
 plugins/reload/eog-reload-plugin.h                 |   14 ++-
 plugins/statusbar-date/eog-statusbar-date-plugin.c |  154 ++++++++++++-------
 plugins/statusbar-date/eog-statusbar-date-plugin.h |   13 +-
 6 files changed, 293 insertions(+), 164 deletions(-)
---
diff --git a/plugins/fullscreen/eog-fullscreen-plugin.c b/plugins/fullscreen/eog-fullscreen-plugin.c
index dcd4400..c9484bc 100644
--- a/plugins/fullscreen/eog-fullscreen-plugin.c
+++ b/plugins/fullscreen/eog-fullscreen-plugin.c
@@ -6,18 +6,24 @@
 
 #include <gmodule.h>
 #include <glib/gi18n-lib.h>
+#include <libpeas/peas-activatable.h>
 
 #include <eog-debug.h>
 #include <eog-scroll-view.h>
 
-#define WINDOW_DATA_KEY "EogFullscreenWindowData"
+static void peas_activatable_iface_init (PeasActivatableInterface *iface);
 
-EOG_PLUGIN_REGISTER_TYPE(EogFullscreenPlugin, eog_fullscreen_plugin)
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (EogFullscreenPlugin,
+                                eog_fullscreen_plugin,
+                                PEAS_TYPE_EXTENSION_BASE,
+                                0,
+                                G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+                                                               peas_activatable_iface_init))
 
-typedef struct
-{
-	gulong signal_id;
-} WindowData;
+enum {
+  PROP_0,
+  PROP_OBJECT
+};
 
 static gboolean
 on_button_press (GtkWidget *button, GdkEventButton *event, EogWindow *window)
@@ -38,13 +44,43 @@ on_button_press (GtkWidget *button, GdkEventButton *event, EogWindow *window)
 }
 
 static void
-free_window_data (WindowData *data)
+eog_fullscreen_plugin_set_property (GObject      *object,
+				guint         prop_id,
+				const GValue *value,
+				GParamSpec   *pspec)
 {
-	g_return_if_fail (data != NULL);
+	EogFullscreenPlugin *plugin = EOG_FULLSCREEN_PLUGIN (object);
 
-	eog_debug (DEBUG_PLUGINS);
+	switch (prop_id)
+	{
+	case PROP_OBJECT:
+		plugin->window = GTK_WIDGET (g_value_dup_object (value));
+		break;
+
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+eog_fullscreen_plugin_get_property (GObject    *object,
+				guint       prop_id,
+				GValue     *value,
+				GParamSpec *pspec)
+{
+	EogFullscreenPlugin *plugin = EOG_FULLSCREEN_PLUGIN (object);
+
+	switch (prop_id)
+	{
+	case PROP_OBJECT:
+		g_value_set_object (value, plugin->window);
+		break;
 
-	g_free (data);
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
 }
 
 static void
@@ -62,59 +98,57 @@ eog_fullscreen_plugin_finalize (GObject *object)
 }
 
 static void
-impl_activate (EogPlugin *plugin,
-	       EogWindow *window)
+eog_fullscreen_plugin_activate (PeasActivatable *activatable)
 {
-	GtkWidget *view = eog_window_get_view (window);
-	WindowData *data;
+	EogFullscreenPlugin *plugin = EOG_FULLSCREEN_PLUGIN (activatable);
+	GtkWidget *view = eog_window_get_view (EOG_WINDOW (plugin->window));
 
 	eog_debug (DEBUG_PLUGINS);
 
-	data = g_new (WindowData, 1);
+	plugin->signal_id = g_signal_connect (G_OBJECT (view),
+					      "button-press-event",
+					      G_CALLBACK (on_button_press),
+					      plugin->window);
+}
 
-	data->signal_id = g_signal_connect (G_OBJECT (view),
-			   		    "button-press-event",
-			  		    G_CALLBACK (on_button_press),
-			  		    window);
+static void
+eog_fullscreen_plugin_deactivate (PeasActivatable *activatable)
+{
+	EogFullscreenPlugin *plugin = EOG_FULLSCREEN_PLUGIN (activatable);
+	GtkWidget *view = eog_window_get_view (EOG_WINDOW (plugin->window));
 
-	g_object_set_data_full (G_OBJECT (window),
-				WINDOW_DATA_KEY,
-				data,
-				(GDestroyNotify) free_window_data);
+	g_signal_handler_disconnect (view, plugin->signal_id);
 }
 
 static void
-impl_deactivate	(EogPlugin *plugin,
-		 EogWindow *window)
+eog_fullscreen_plugin_class_init (EogFullscreenPluginClass *klass)
 {
-	GtkWidget *view = eog_window_get_view (window);
-	WindowData *data;
-
-	data = (WindowData *) g_object_get_data (G_OBJECT (window),
-						 WINDOW_DATA_KEY);
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-	g_signal_handler_disconnect (view, data->signal_id);
+	object_class->finalize = eog_fullscreen_plugin_finalize;
+	object_class->set_property = eog_fullscreen_plugin_set_property;
+	object_class->get_property = eog_fullscreen_plugin_get_property;
 
-	g_object_set_data (G_OBJECT (window),
-			   WINDOW_DATA_KEY,
-			   NULL);
+	g_object_class_override_property (object_class, PROP_OBJECT, "object");
 }
 
 static void
-impl_update_ui (EogPlugin *plugin,
-		EogWindow *window)
+eog_fullscreen_plugin_class_finalize (EogFullscreenPluginClass *klass)
 {
 }
 
 static void
-eog_fullscreen_plugin_class_init (EogFullscreenPluginClass *klass)
+peas_activatable_iface_init (PeasActivatableInterface *iface)
 {
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-	EogPluginClass *plugin_class = EOG_PLUGIN_CLASS (klass);
-
-	object_class->finalize = eog_fullscreen_plugin_finalize;
+	iface->activate = eog_fullscreen_plugin_activate;
+	iface->deactivate = eog_fullscreen_plugin_deactivate;
+}
 
-	plugin_class->activate = impl_activate;
-	plugin_class->deactivate = impl_deactivate;
-	plugin_class->update_ui = impl_update_ui;
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+	eog_fullscreen_plugin_register_type (G_TYPE_MODULE (module));
+	peas_object_module_register_extension_type (module,
+						    PEAS_TYPE_ACTIVATABLE,
+						    EOG_TYPE_FULLSCREEN_PLUGIN);
 }
diff --git a/plugins/fullscreen/eog-fullscreen-plugin.h b/plugins/fullscreen/eog-fullscreen-plugin.h
index 8286c3e..aff0746 100644
--- a/plugins/fullscreen/eog-fullscreen-plugin.h
+++ b/plugins/fullscreen/eog-fullscreen-plugin.h
@@ -3,7 +3,9 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <eog-plugin.h>
+#include <gtk/gtk.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
 
 G_BEGIN_DECLS
 
@@ -27,7 +29,9 @@ typedef struct _EogFullscreenPlugin		EogFullscreenPlugin;
 
 struct _EogFullscreenPlugin
 {
-	EogPlugin parent_instance;
+	PeasExtensionBase parent_instance;
+	GtkWidget *window;
+	gulong signal_id;
 };
 
 /*
@@ -37,7 +41,7 @@ typedef struct _EogFullscreenPluginClass	EogFullscreenPluginClass;
 
 struct _EogFullscreenPluginClass
 {
-	EogPluginClass parent_class;
+	PeasExtensionBaseClass parent_class;
 };
 
 /*
@@ -46,7 +50,7 @@ struct _EogFullscreenPluginClass
 GType	eog_fullscreen_plugin_get_type		(void) G_GNUC_CONST;
 
 /* All the plugins must implement this function */
-G_MODULE_EXPORT GType register_eog_plugin (GTypeModule *module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
 
 G_END_DECLS
 
diff --git a/plugins/reload/eog-reload-plugin.c b/plugins/reload/eog-reload-plugin.c
index beedae1..88e3ed4 100644
--- a/plugins/reload/eog-reload-plugin.c
+++ b/plugins/reload/eog-reload-plugin.c
@@ -7,20 +7,27 @@
 #include <gmodule.h>
 #include <glib/gi18n-lib.h>
 
+#include <libpeas/peas.h>
+#include <libpeasui/peas-ui.h>
+
 #include <eog-debug.h>
 #include <eog-scroll-view.h>
 #include <eog-thumb-view.h>
 #include <eog-image.h>
 
-#define WINDOW_DATA_KEY "EogReloadWindowData"
+static void peas_activatable_iface_init (PeasActivatableInterface *iface);
 
-EOG_PLUGIN_REGISTER_TYPE(EogReloadPlugin, eog_reload_plugin)
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (EogReloadPlugin,
+                                eog_reload_plugin,
+                                PEAS_TYPE_EXTENSION_BASE,
+                                0,
+                                G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+                                                               peas_activatable_iface_init))
 
-typedef struct
-{
-	GtkActionGroup *ui_action_group;
-	guint ui_id;
-} WindowData;
+enum {
+  PROP_0,
+  PROP_OBJECT
+};
 
 static void
 reload_cb (GtkAction	*action,
@@ -49,15 +56,43 @@ static const GtkActionEntry action_entries[] =
 };
 
 static void
-free_window_data (WindowData *data)
+eog_reload_plugin_set_property (GObject      *object,
+				guint         prop_id,
+				const GValue *value,
+				GParamSpec   *pspec)
 {
-	g_return_if_fail (data != NULL);
-
-	eog_debug (DEBUG_PLUGINS);
-
-	g_object_unref (data->ui_action_group);
+	EogReloadPlugin *plugin = EOG_RELOAD_PLUGIN (object);
+
+	switch (prop_id)
+	{
+	case PROP_OBJECT:
+		plugin->window = GTK_WIDGET (g_value_dup_object (value));
+		break;
+
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
 
-	g_free (data);
+static void
+eog_reload_plugin_get_property (GObject    *object,
+				guint       prop_id,
+				GValue     *value,
+				GParamSpec *pspec)
+{
+	EogReloadPlugin *plugin = EOG_RELOAD_PLUGIN (object);
+
+	switch (prop_id)
+	{
+	case PROP_OBJECT:
+		g_value_set_object (value, plugin->window);
+		break;
+
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
 }
 
 static void
@@ -75,77 +110,82 @@ eog_reload_plugin_finalize (GObject *object)
 }
 
 static void
-impl_activate (EogPlugin *plugin,
-	       EogWindow *window)
+eog_reload_plugin_activate (PeasActivatable *activatable)
 {
 	GtkUIManager *manager;
-	WindowData *data;
+	EogReloadPlugin *plugin = EOG_RELOAD_PLUGIN (activatable);
 
 	eog_debug (DEBUG_PLUGINS);
 
-	data = g_new (WindowData, 1);
+	manager = eog_window_get_ui_manager (EOG_WINDOW (plugin->window));
 
-	manager = eog_window_get_ui_manager (window);
+	plugin->ui_action_group = gtk_action_group_new ("EogReloadPluginActions");
 
-	data->ui_action_group = gtk_action_group_new ("EogReloadPluginActions");
-
-	gtk_action_group_set_translation_domain (data->ui_action_group,
+	gtk_action_group_set_translation_domain (plugin->ui_action_group,
 						 GETTEXT_PACKAGE);
 
-	gtk_action_group_add_actions (data->ui_action_group,
+	gtk_action_group_add_actions (plugin->ui_action_group,
 				      action_entries,
 				      G_N_ELEMENTS (action_entries),
-				      window);
+				      plugin->window);
 
 	gtk_ui_manager_insert_action_group (manager,
-					    data->ui_action_group,
+					    plugin->ui_action_group,
 					    -1);
 
-	g_object_set_data_full (G_OBJECT (window),
-				WINDOW_DATA_KEY,
-				data,
-				(GDestroyNotify) free_window_data);
-
-	data->ui_id = gtk_ui_manager_add_ui_from_string (manager,
-							 ui_definition,
-							 -1, NULL);
-	g_warn_if_fail (data->ui_id != 0);
+	plugin->ui_id = gtk_ui_manager_add_ui_from_string (manager,
+							   ui_definition,
+							   -1, NULL);
+	g_warn_if_fail (plugin->ui_id != 0);
+	g_print ("activate\n");
 }
 
 static void
-impl_deactivate	(EogPlugin *plugin,
-		 EogWindow *window)
+eog_reload_plugin_deactivate	(PeasActivatable *activatable)
 {
 	GtkUIManager *manager;
-	WindowData *data;
+	EogReloadPlugin *plugin = EOG_RELOAD_PLUGIN (activatable);
 
 	eog_debug (DEBUG_PLUGINS);
 
-	manager = eog_window_get_ui_manager (window);
-
-	data = (WindowData *) g_object_get_data (G_OBJECT (window),
-						 WINDOW_DATA_KEY);
-	g_return_if_fail (data != NULL);
+	manager = eog_window_get_ui_manager (EOG_WINDOW (plugin->window));
 
 	gtk_ui_manager_remove_ui (manager,
-				  data->ui_id);
+				  plugin->ui_id);
 
 	gtk_ui_manager_remove_action_group (manager,
-					    data->ui_action_group);
-
-	g_object_set_data (G_OBJECT (window),
-			   WINDOW_DATA_KEY,
-			   NULL);
+					    plugin->ui_action_group);
 }
 
 static void
 eog_reload_plugin_class_init (EogReloadPluginClass *klass)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-	EogPluginClass *plugin_class = EOG_PLUGIN_CLASS (klass);
 
 	object_class->finalize = eog_reload_plugin_finalize;
+	object_class->set_property = eog_reload_plugin_set_property;
+	object_class->get_property = eog_reload_plugin_get_property;
+
+	g_object_class_override_property (object_class, PROP_OBJECT, "object");
+}
+
+static void
+eog_reload_plugin_class_finalize (EogReloadPluginClass *klass)
+{
+}
+
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface)
+{
+	iface->activate = eog_reload_plugin_activate;
+	iface->deactivate = eog_reload_plugin_deactivate;
+}
 
-	plugin_class->activate = impl_activate;
-	plugin_class->deactivate = impl_deactivate;
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+	eog_reload_plugin_register_type (G_TYPE_MODULE (module));
+	peas_object_module_register_extension_type (module,
+						    PEAS_TYPE_ACTIVATABLE,
+						    EOG_TYPE_RELOAD_PLUGIN);
 }
diff --git a/plugins/reload/eog-reload-plugin.h b/plugins/reload/eog-reload-plugin.h
index d53e5ae..ac3f17c 100644
--- a/plugins/reload/eog-reload-plugin.h
+++ b/plugins/reload/eog-reload-plugin.h
@@ -3,7 +3,10 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <eog-plugin.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
+
+#include <eog-window.h>
 
 G_BEGIN_DECLS
 
@@ -27,7 +30,10 @@ typedef struct _EogReloadPlugin		EogReloadPlugin;
 
 struct _EogReloadPlugin
 {
-	EogPlugin parent_instance;
+	PeasExtensionBase parent_instance;
+	GtkWidget *window;
+	GtkActionGroup *ui_action_group;
+	guint ui_id;
 };
 
 /*
@@ -37,7 +43,7 @@ typedef struct _EogReloadPluginClass	EogReloadPluginClass;
 
 struct _EogReloadPluginClass
 {
-	EogPluginClass parent_class;
+	PeasExtensionBaseClass parent_class;
 };
 
 /*
@@ -46,7 +52,7 @@ struct _EogReloadPluginClass
 GType	eog_reload_plugin_get_type		(void) G_GNUC_CONST;
 
 /* All the plugins must implement this function */
-G_MODULE_EXPORT GType register_eog_plugin (GTypeModule *module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
 
 G_END_DECLS
 
diff --git a/plugins/statusbar-date/eog-statusbar-date-plugin.c b/plugins/statusbar-date/eog-statusbar-date-plugin.c
index 17aab94..a253ca4 100644
--- a/plugins/statusbar-date/eog-statusbar-date-plugin.c
+++ b/plugins/statusbar-date/eog-statusbar-date-plugin.c
@@ -1,6 +1,6 @@
 /* Statusbar Date -- Shows the EXIF date in EOG's statusbar
  *
- * Copyright (C) 2008 The Free Software Foundation
+ * Copyright (C) 2008-2010 The Free Software Foundation
  *
  * Author: Claudio Saavedra  <csaavedra gnome org>
  *
@@ -28,32 +28,28 @@
 #include <gmodule.h>
 #include <glib/gi18n-lib.h>
 
+#include <libpeas/peas.h>
+#include <libpeasui/peas-ui.h>
+
 #include <eog-debug.h>
 #include <eog-scroll-view.h>
 #include <eog-image.h>
 #include <eog-thumb-view.h>
 #include <eog-exif-util.h>
 
+static void peas_activatable_iface_init (PeasActivatableInterface *iface);
 
-#define WINDOW_DATA_KEY "EogStatusbarDateWindowData"
-
-EOG_PLUGIN_REGISTER_TYPE(EogStatusbarDatePlugin, eog_statusbar_date_plugin)
-
-typedef struct
-{
-	GtkWidget *statusbar_date;
-	gulong signal_id;
-} WindowData;
-
-static void
-free_window_data (WindowData *data)
-{
-	g_return_if_fail (data != NULL);
-
-	eog_debug (DEBUG_PLUGINS);
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (EogStatusbarDatePlugin,
+                                eog_statusbar_date_plugin,
+                                PEAS_TYPE_EXTENSION_BASE,
+                                0,
+                                G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+                                                               peas_activatable_iface_init))
 
-	g_free (data);
-}
+enum {
+  PROP_0,
+  PROP_OBJECT
+};
 
 static void
 statusbar_set_date (GtkStatusbar *statusbar, EogThumbView *view)
@@ -93,10 +89,51 @@ statusbar_set_date (GtkStatusbar *statusbar, EogThumbView *view)
 }
 
 static void
-selection_changed_cb (EogThumbView *view, WindowData *data)
+selection_changed_cb (EogThumbView *view, EogStatusbarDatePlugin *plugin)
 {
-	statusbar_set_date (GTK_STATUSBAR (data->statusbar_date), view);
+	statusbar_set_date (GTK_STATUSBAR (plugin->statusbar_date), view);
 }
+
+static void
+eog_statusbar_date_plugin_set_property (GObject      *object,
+				guint         prop_id,
+				const GValue *value,
+				GParamSpec   *pspec)
+{
+	EogStatusbarDatePlugin *plugin = EOG_STATUSBAR_DATE_PLUGIN (object);
+
+	switch (prop_id)
+	{
+	case PROP_OBJECT:
+		plugin->window = GTK_WIDGET (g_value_dup_object (value));
+		break;
+
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+eog_statusbar_date_plugin_get_property (GObject    *object,
+				guint       prop_id,
+				GValue     *value,
+				GParamSpec *pspec)
+{
+	EogStatusbarDatePlugin *plugin = EOG_STATUSBAR_DATE_PLUGIN (object);
+
+	switch (prop_id)
+	{
+	case PROP_OBJECT:
+		g_value_set_object (value, plugin->window);
+		break;
+
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
 static void
 eog_statusbar_date_plugin_init (EogStatusbarDatePlugin *plugin)
 {
@@ -112,69 +149,72 @@ eog_statusbar_date_plugin_finalize (GObject *object)
 }
 
 static void
-impl_activate (EogPlugin *plugin,
-	       EogWindow *window)
+eog_statusbar_date_plugin_activate (PeasActivatable *activatable)
 {
+	EogStatusbarDatePlugin *plugin = EOG_STATUSBAR_DATE_PLUGIN (activatable);
+	EogWindow *window = EOG_WINDOW (plugin->window);
 	GtkWidget *statusbar = eog_window_get_statusbar (window);
 	GtkWidget *thumbview = eog_window_get_thumb_view (window);
-	WindowData *data;
 
 	eog_debug (DEBUG_PLUGINS);
 
-	data = g_new (WindowData, 1);
-	data->statusbar_date = gtk_statusbar_new ();
-	gtk_widget_set_size_request (data->statusbar_date, 200, 10);
+	plugin->statusbar_date = gtk_statusbar_new ();
+	gtk_widget_set_size_request (plugin->statusbar_date, 200, 10);
 	gtk_box_pack_end (GTK_BOX (statusbar),
-			  data->statusbar_date,
+			  plugin->statusbar_date,
 			  FALSE, FALSE, 0);
 
-	data->signal_id = g_signal_connect_after (G_OBJECT (thumbview), "selection_changed",
-						  G_CALLBACK (selection_changed_cb), data);
+	plugin->signal_id = g_signal_connect_after (G_OBJECT (thumbview),
+						    "selection_changed",
+						    G_CALLBACK (selection_changed_cb), plugin);
 
-	statusbar_set_date (GTK_STATUSBAR (data->statusbar_date),
+	statusbar_set_date (GTK_STATUSBAR (plugin->statusbar_date),
 			    EOG_THUMB_VIEW (eog_window_get_thumb_view (window)));
-
-	g_object_set_data_full (G_OBJECT (window),
-				WINDOW_DATA_KEY,
-				data,
-				(GDestroyNotify) free_window_data);
 }
 
 static void
-impl_deactivate	(EogPlugin *plugin,
-		 EogWindow *window)
+eog_statusbar_date_plugin_deactivate (PeasActivatable *activatable)
 {
+	EogStatusbarDatePlugin *plugin = EOG_STATUSBAR_DATE_PLUGIN (activatable);
+	EogWindow *window = EOG_WINDOW (plugin->window);
 	GtkWidget *statusbar = eog_window_get_statusbar (window);
 	GtkWidget *view = eog_window_get_thumb_view (window);
-	WindowData *data;
 
-	data = (WindowData *) g_object_get_data (G_OBJECT (window),
-						 WINDOW_DATA_KEY);
+	g_signal_handler_disconnect (view, plugin->signal_id);
 
-	g_signal_handler_disconnect (view, data->signal_id);
+	gtk_container_remove (GTK_CONTAINER (statusbar),
+			      plugin->statusbar_date);
+}
 
-	gtk_container_remove (GTK_CONTAINER (statusbar), data->statusbar_date);
+static void
+eog_statusbar_date_plugin_class_init (EogStatusbarDatePluginClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-	g_object_set_data (G_OBJECT (window),
-			   WINDOW_DATA_KEY,
-			   NULL);
-}
+	object_class->finalize = eog_statusbar_date_plugin_finalize;
+	object_class->set_property = eog_statusbar_date_plugin_set_property;
+	object_class->get_property = eog_statusbar_date_plugin_get_property;
+	
+	g_object_class_override_property (object_class, PROP_OBJECT, "object");
+ }
 
 static void
-impl_update_ui (EogPlugin *plugin,
-		EogWindow *window)
+eog_statusbar_date_plugin_class_finalize (EogStatusbarDatePluginClass *klass)
 {
 }
 
 static void
-eog_statusbar_date_plugin_class_init (EogStatusbarDatePluginClass *klass)
+peas_activatable_iface_init (PeasActivatableInterface *iface)
 {
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-	EogPluginClass *plugin_class = EOG_PLUGIN_CLASS (klass);
-
-	object_class->finalize = eog_statusbar_date_plugin_finalize;
+	iface->activate = eog_statusbar_date_plugin_activate;
+	iface->deactivate = eog_statusbar_date_plugin_deactivate;
+}
 
-	plugin_class->activate = impl_activate;
-	plugin_class->deactivate = impl_deactivate;
-	plugin_class->update_ui = impl_update_ui;
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+	eog_statusbar_date_plugin_register_type (G_TYPE_MODULE (module));
+	peas_object_module_register_extension_type (module,
+						    PEAS_TYPE_ACTIVATABLE,
+						    EOG_TYPE_STATUSBAR_DATE_PLUGIN);
 }
diff --git a/plugins/statusbar-date/eog-statusbar-date-plugin.h b/plugins/statusbar-date/eog-statusbar-date-plugin.h
index a7aa33c..4f6ded6 100644
--- a/plugins/statusbar-date/eog-statusbar-date-plugin.h
+++ b/plugins/statusbar-date/eog-statusbar-date-plugin.h
@@ -24,7 +24,9 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <eog-plugin.h>
+#include <gtk/gtk.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
 
 G_BEGIN_DECLS
 
@@ -48,7 +50,10 @@ typedef struct _EogStatusbarDatePlugin		EogStatusbarDatePlugin;
 
 struct _EogStatusbarDatePlugin
 {
-	EogPlugin parent_instance;
+	PeasExtensionBase parent_instance;
+	GtkWidget *window;
+	GtkWidget *statusbar_date;
+	gulong signal_id;
 };
 
 /*
@@ -58,7 +63,7 @@ typedef struct _EogStatusbarDatePluginClass	EogStatusbarDatePluginClass;
 
 struct _EogStatusbarDatePluginClass
 {
-	EogPluginClass parent_class;
+	PeasExtensionBaseClass parent_class;
 };
 
 /*
@@ -67,7 +72,7 @@ struct _EogStatusbarDatePluginClass
 GType	eog_statusbar_date_plugin_get_type		(void) G_GNUC_CONST;
 
 /* All the plugins must implement this function */
-G_MODULE_EXPORT GType register_eog_plugin (GTypeModule *module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
 
 G_END_DECLS
 



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