[emerillon/gtk3] placemarks-plugin: Port to libpeas



commit 9805930c3667f0df7014c0e944a9c5548281d677
Author: Andreas Henriksson <andreas fatal se>
Date:   Thu Aug 4 15:56:37 2011 +0200

    placemarks-plugin: Port to libpeas

 plugins/placemarks/placemarks.c                    |   38 ++++++++++++-------
 plugins/placemarks/placemarks.h                    |   12 +++----
 ...ks.emerillon-plugin.in => placemarks.plugin.in} |    5 +--
 3 files changed, 31 insertions(+), 24 deletions(-)
---
diff --git a/plugins/placemarks/placemarks.c b/plugins/placemarks/placemarks.c
index b42ff90..3f7c08e 100644
--- a/plugins/placemarks/placemarks.c
+++ b/plugins/placemarks/placemarks.c
@@ -32,7 +32,13 @@
 #include "manage-dialog.h"
 #include "placemarks-model.h"
 
-G_DEFINE_TYPE (PlacemarksPlugin, placemarks_plugin, ETHOS_TYPE_PLUGIN)
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (PlacemarksPlugin, placemarks_plugin, PEAS_TYPE_EXTENSION_BASE,
+                                0,
+                                G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+                                                               peas_activatable_iface_init));
 
 struct _PlacemarksPluginPrivate
 {
@@ -550,7 +556,7 @@ row_deleted_cb (GtkTreeModel *tree_model,
 }
 
 static void
-activated (EthosPlugin *plugin)
+placemarks_plugin_activate (PeasActivatable *plugin)
 {
   PlacemarksPluginPrivate *priv;
   GtkUIManager *manager;
@@ -603,7 +609,7 @@ activated (EthosPlugin *plugin)
 }
 
 static void
-deactivated (EthosPlugin *plugin)
+placemarks_plugin_deactivate (PeasActivatable *plugin)
 {
   GtkUIManager *manager;
   PlacemarksPluginPrivate *priv;
@@ -623,13 +629,12 @@ deactivated (EthosPlugin *plugin)
 static void
 placemarks_plugin_class_init (PlacemarksPluginClass *klass)
 {
-  EthosPluginClass *plugin_class;
-
   g_type_class_add_private (klass, sizeof (PlacemarksPluginPrivate));
+}
 
-  plugin_class = ETHOS_PLUGIN_CLASS (klass);
-  plugin_class->activated = activated;
-  plugin_class->deactivated = deactivated;
+static void
+placemarks_plugin_class_finalize(PlacemarksPluginClass *klass)
+{
 }
 
 static void
@@ -642,14 +647,19 @@ placemarks_plugin_init (PlacemarksPlugin *plugin)
   plugin->priv->deleted_cb_id = 0;
 }
 
-EthosPlugin*
-placemarks_plugin_new (void)
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface)
 {
-  return g_object_new (PLACEMARKS_TYPE_PLUGIN, NULL);
+  iface->activate = placemarks_plugin_activate;
+  iface->deactivate = placemarks_plugin_deactivate;
 }
 
-G_MODULE_EXPORT EthosPlugin*
-ethos_plugin_register (void)
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
 {
-  return placemarks_plugin_new ();
+  placemarks_plugin_register_type (G_TYPE_MODULE (module));
+
+  peas_object_module_register_extension_type (module,
+                                              PEAS_TYPE_ACTIVATABLE,
+                                              PLACEMARKS_TYPE_PLUGIN);
 }
diff --git a/plugins/placemarks/placemarks.h b/plugins/placemarks/placemarks.h
index 597caa8..9d980b4 100644
--- a/plugins/placemarks/placemarks.h
+++ b/plugins/placemarks/placemarks.h
@@ -21,8 +21,7 @@
 #define __PLACEMARKS_PLUGIN_H__
 
 #include <glib-object.h>
-#include <ethos/ethos.h>
-#include <ethos/ethos-ui.h>
+#include <libpeas/peas.h>
 
 G_BEGIN_DECLS
 
@@ -39,7 +38,7 @@ typedef struct _PlacemarksPluginPrivate PlacemarksPluginPrivate;
 
 struct _PlacemarksPlugin
 {
-  EthosPlugin parent;
+  PeasExtensionBase parent;
 
   /*< private >*/
   PlacemarksPluginPrivate *priv;
@@ -47,12 +46,11 @@ struct _PlacemarksPlugin
 
 struct _PlacemarksPluginClass
 {
-  EthosPluginClass parent_class;
+  PeasExtensionBaseClass parent_class;
 };
 
-GType        placemarks_plugin_get_type (void);
-EthosPlugin* placemarks_plugin_new      (void);
-G_MODULE_EXPORT EthosPlugin* ethos_plugin_register (void);
+GType                placemarks_plugin_get_type (void);
+G_MODULE_EXPORT void peas_register_types(PeasObjectModule *module);
 
 G_END_DECLS
 
diff --git a/plugins/placemarks/placemarks.emerillon-plugin.in b/plugins/placemarks/placemarks.plugin.in
similarity index 87%
rename from plugins/placemarks/placemarks.emerillon-plugin.in
rename to plugins/placemarks/placemarks.plugin.in
index 6051905..ead2da8 100644
--- a/plugins/placemarks/placemarks.emerillon-plugin.in
+++ b/plugins/placemarks/placemarks.plugin.in
@@ -1,8 +1,7 @@
-[Emerillon Plugin]
+[Plugin]
 _Name=Placemarks
 Module=placemarks
 _Description=Remembers your favorite view points
-IAge=1
 Authors=Pierre-Luc Beaudoin <pierre-luc beaudoin novopia com>
 Copyright=Copyright  2009 Novopia Inc.
-
+IAge=2



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