[emerillon/gtk3] copy-link-plugin: Port to libpeas



commit 217b0b91e7598057cefb991c94347467b00c46ea
Author: Andreas Henriksson <andreas fatal se>
Date:   Thu Aug 4 16:10:10 2011 +0200

    copy-link-plugin: Port to libpeas

 plugins/copy-link/copy-link.c                      |   38 ++++++++++++-------
 plugins/copy-link/copy-link.h                      |   12 +++----
 ...ink.emerillon-plugin.in => copy-link.plugin.in} |    5 +--
 3 files changed, 31 insertions(+), 24 deletions(-)
---
diff --git a/plugins/copy-link/copy-link.c b/plugins/copy-link/copy-link.c
index 8375657..54142c2 100644
--- a/plugins/copy-link/copy-link.c
+++ b/plugins/copy-link/copy-link.c
@@ -28,7 +28,13 @@
 
 #include "emerillon/emerillon.h"
 
-G_DEFINE_TYPE (CopyLinkPlugin, copy_link_plugin, ETHOS_TYPE_PLUGIN)
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (CopyLinkPlugin, copy_link_plugin, PEAS_TYPE_EXTENSION_BASE,
+                                0,
+                                G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+                                                               peas_activatable_iface_init));
 
 #define OSM_ID "copy_link_osm"
 #define GOOGLE_ID "copy_link_google"
@@ -177,7 +183,7 @@ static const GtkActionEntry action_entries[] =
 };
 
 static void
-activated (EthosPlugin *plugin)
+copy_link_plugin_activate (PeasActivatable *plugin)
 {
   CopyLinkPluginPrivate *priv;
   GtkUIManager *manager;
@@ -213,7 +219,7 @@ activated (EthosPlugin *plugin)
 }
 
 static void
-deactivated (EthosPlugin *plugin)
+copy_link_plugin_deactivate (PeasActivatable *plugin)
 {
   GtkUIManager *manager;
   CopyLinkPluginPrivate *priv;
@@ -231,13 +237,12 @@ deactivated (EthosPlugin *plugin)
 static void
 copy_link_plugin_class_init (CopyLinkPluginClass *klass)
 {
-  EthosPluginClass *plugin_class;
-
   g_type_class_add_private (klass, sizeof (CopyLinkPluginPrivate));
+}
 
-  plugin_class = ETHOS_PLUGIN_CLASS (klass);
-  plugin_class->activated = activated;
-  plugin_class->deactivated = deactivated;
+static void
+copy_link_plugin_class_finalize(CopyLinkPluginClass *klass)
+{
 }
 
 static void
@@ -248,14 +253,19 @@ copy_link_plugin_init (CopyLinkPlugin *plugin)
                                               CopyLinkPluginPrivate);
 }
 
-EthosPlugin*
-copy_link_plugin_new (void)
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface)
 {
-  return g_object_new (COPY_LINK_TYPE_PLUGIN, NULL);
+  iface->activate = copy_link_plugin_activate;
+  iface->deactivate = copy_link_plugin_deactivate;
 }
 
-G_MODULE_EXPORT EthosPlugin*
-ethos_plugin_register (void)
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
 {
-  return copy_link_plugin_new ();
+  copy_link_plugin_register_type (G_TYPE_MODULE (module));
+
+  peas_object_module_register_extension_type (module,
+                                              PEAS_TYPE_ACTIVATABLE,
+                                              COPY_LINK_TYPE_PLUGIN);
 }
diff --git a/plugins/copy-link/copy-link.h b/plugins/copy-link/copy-link.h
index d896012..db2bee6 100644
--- a/plugins/copy-link/copy-link.h
+++ b/plugins/copy-link/copy-link.h
@@ -21,8 +21,7 @@
 #define __COPY_LINK_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 _CopyLinkPluginPrivate CopyLinkPluginPrivate;
 
 struct _CopyLinkPlugin
 {
-  EthosPlugin parent;
+  PeasExtensionBase parent;
 
   /*< private >*/
   CopyLinkPluginPrivate *priv;
@@ -47,12 +46,11 @@ struct _CopyLinkPlugin
 
 struct _CopyLinkPluginClass
 {
-  EthosPluginClass parent_class;
+  PeasExtensionBaseClass parent_class;
 };
 
-GType        copy_link_plugin_get_type (void);
-EthosPlugin* copy_link_plugin_new      (void);
-G_MODULE_EXPORT EthosPlugin* ethos_plugin_register (void);
+GType                copy_link_plugin_get_type (void);
+G_MODULE_EXPORT void peas_register_types(PeasObjectModule *module);
 
 G_END_DECLS
 
diff --git a/plugins/copy-link/copy-link.emerillon-plugin.in b/plugins/copy-link/copy-link.plugin.in
similarity index 88%
rename from plugins/copy-link/copy-link.emerillon-plugin.in
rename to plugins/copy-link/copy-link.plugin.in
index 04806b6..0c3ba1e 100644
--- a/plugins/copy-link/copy-link.emerillon-plugin.in
+++ b/plugins/copy-link/copy-link.plugin.in
@@ -1,8 +1,7 @@
-[Emerillon Plugin]
+[Plugin]
 _Name=Copy link to Web
 Module=copy-link
 _Description=Provides a link for current view to major online maps
-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]