[totem] Port sidebar-test plugin to libpeas



commit ddf3551f2877d72c4d4ecf66f78bd5ac779f09a6
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Jun 16 17:59:58 2010 +0100

    Port sidebar-test plugin to libpeas
    
    https://bugzilla.gnome.org/show_bug.cgi?id=604830

 src/plugins/sidebar-test/Makefile.am          |    1 +
 src/plugins/sidebar-test/totem-sidebar-test.c |   38 ++++++------------------
 2 files changed, 11 insertions(+), 28 deletions(-)
---
diff --git a/src/plugins/sidebar-test/Makefile.am b/src/plugins/sidebar-test/Makefile.am
index ff75e89..a389037 100644
--- a/src/plugins/sidebar-test/Makefile.am
+++ b/src/plugins/sidebar-test/Makefile.am
@@ -29,6 +29,7 @@ libsidebar_test_la_CPPFLAGS = $(common_defines)
 
 libsidebar_test_la_CFLAGS = \
 	$(DEPENDENCY_CFLAGS)	\
+	$(PEAS_CFLAGS)		\
 	$(WARN_CFLAGS)		\
 	$(DBUS_CFLAGS)		\
 	$(AM_CFLAGS)		\
diff --git a/src/plugins/sidebar-test/totem-sidebar-test.c b/src/plugins/sidebar-test/totem-sidebar-test.c
index 58c1d03..dd6c57f 100644
--- a/src/plugins/sidebar-test/totem-sidebar-test.c
+++ b/src/plugins/sidebar-test/totem-sidebar-test.c
@@ -45,34 +45,22 @@
 
 typedef struct
 {
-	TotemPlugin   parent;
+	PeasExtensionBase parent;
 } TotemSidebarTestPlugin;
 
 typedef struct
 {
-	TotemPluginClass parent_class;
+	PeasExtensionBaseClass parent_class;
 } TotemSidebarTestPluginClass;
 
 
-G_MODULE_EXPORT GType register_totem_plugin		(GTypeModule *module);
 GType	totem_sidebar_test_plugin_get_type		(void) G_GNUC_CONST;
 
-static void totem_sidebar_test_plugin_finalize		(GObject *object);
-static gboolean impl_activate				(TotemPlugin *plugin, TotemObject *totem, GError **error);
-static void impl_deactivate				(TotemPlugin *plugin, TotemObject *totem);
-
-TOTEM_PLUGIN_REGISTER(TotemSidebarTestPlugin, totem_sidebar_test_plugin)
+TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_SIDEBAR_TEST_PLUGIN, TotemSidebarTestPlugin, totem_sidebar_test_plugin)
 
 static void
 totem_sidebar_test_plugin_class_init (TotemSidebarTestPluginClass *klass)
 {
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-	TotemPluginClass *plugin_class = TOTEM_PLUGIN_CLASS (klass);
-
-	object_class->finalize = totem_sidebar_test_plugin_finalize;
-
-	plugin_class->activate = impl_activate;
-	plugin_class->deactivate = impl_deactivate;
 }
 
 static void
@@ -81,17 +69,11 @@ totem_sidebar_test_plugin_init (TotemSidebarTestPlugin *plugin)
 }
 
 static void
-totem_sidebar_test_plugin_finalize (GObject *object)
-{
-	G_OBJECT_CLASS (totem_sidebar_test_plugin_parent_class)->finalize (object);
-}
-
-static gboolean
-impl_activate (TotemPlugin *plugin,
-	       TotemObject *totem,
-	       GError **error)
+impl_activate (PeasActivatable *plugin,
+	       GObject *object)
 {
 	GtkWidget *label;
+	TotemObject *totem = TOTEM_OBJECT (object);
 
 	label = gtk_label_new ("This is a test sidebar main widget");
 	gtk_widget_show (label);
@@ -100,14 +82,14 @@ impl_activate (TotemPlugin *plugin,
 				"Sidebar Test",
 				label);
 	g_message ("Just added a test sidebar");
-
-	return TRUE;
 }
 
 static void
-impl_deactivate	(TotemPlugin *plugin,
-		 TotemObject *totem)
+impl_deactivate	(PeasActivatable *plugin,
+		 GObject *object)
 {
+	TotemObject *totem = TOTEM_OBJECT (object);
+
 	totem_remove_sidebar_page (totem, "sidebar-test");
 	g_message ("Just removed a test sidebar");
 }



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