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



commit 5664b5ec8f986d6a027bc3f24a7a8f4ff707026b
Author: Johannes Schmid <jhs gnome org>
Date:   Sun Jun 26 11:42:50 2011 +0200

    search-plugin: Port to libpeas

 plugins/search/search.c                            |   43 ++++++++++++-------
 plugins/search/search.h                            |   12 ++---
 ...search.emerillon-plugin.in => search.plugin.in} |    5 +-
 3 files changed, 34 insertions(+), 26 deletions(-)
---
diff --git a/plugins/search/search.c b/plugins/search/search.c
index 850820c..73281cb 100644
--- a/plugins/search/search.c
+++ b/plugins/search/search.c
@@ -27,7 +27,13 @@
 #include <rest/rest-proxy-call.h>
 #include <rest/rest-xml-parser.h>
 
-G_DEFINE_TYPE (SearchPlugin, search_plugin, ETHOS_TYPE_PLUGIN)
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (SearchPlugin, search_plugin, PEAS_TYPE_EXTENSION_BASE,
+                                0,
+                                G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+                                                               peas_activatable_iface_init));
 
 enum {
   COL_ORDER,
@@ -180,7 +186,7 @@ result_cb (RestProxyCall *call,
         min_lon = flon;
 
       /* Create the marker */
-      marker = champlain_label_new();
+      marker = CHAMPLAIN_LABEL(champlain_label_new());
       champlain_label_set_text (marker, symbol);
       champlain_location_set_location (CHAMPLAIN_LOCATION(marker),
           flat,
@@ -369,7 +375,7 @@ select_function_cb (GtkTreeSelection *selection,
 }
 
 static void
-activated (EthosPlugin *plugin)
+search_plugin_activate (PeasActivatable *plugin)
 {
   GtkWidget *window, *toolbar, *sidebar, *scrolled;
   gint count = 0;
@@ -490,7 +496,7 @@ activated (EthosPlugin *plugin)
 }
 
 static void
-deactivated (EthosPlugin *plugin)
+search_plugin_deactivate (PeasActivatable *plugin)
 {
   GtkWidget *window, *toolbar, *sidebar;
   ChamplainView *view;
@@ -531,13 +537,13 @@ deactivated (EthosPlugin *plugin)
 static void
 search_plugin_class_init (SearchPluginClass *klass)
 {
-  EthosPluginClass *plugin_class;
-
   g_type_class_add_private (klass, sizeof (SearchPluginPrivate));
+}
+
+static void
+search_plugin_class_finalize(SearchPluginClass *klass)
+{
 
-  plugin_class = ETHOS_PLUGIN_CLASS (klass);
-  plugin_class->activated = activated;
-  plugin_class->deactivated = deactivated;
 }
 
 static void
@@ -548,14 +554,19 @@ search_plugin_init (SearchPlugin *plugin)
                                               SearchPluginPrivate);
 }
 
-EthosPlugin*
-search_plugin_new (void)
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface)
 {
-  return g_object_new (SEARCH_TYPE_PLUGIN, NULL);
+  iface->activate = search_plugin_activate;
+  iface->deactivate = search_plugin_deactivate;
 }
 
-G_MODULE_EXPORT EthosPlugin*
-ethos_plugin_register (void)
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
 {
-  return search_plugin_new ();
-}
+  search_plugin_register_type (G_TYPE_MODULE (module));
+
+  peas_object_module_register_extension_type (module,
+                                              PEAS_TYPE_ACTIVATABLE,
+                                              SEARCH_TYPE_PLUGIN);
+}
\ No newline at end of file
diff --git a/plugins/search/search.h b/plugins/search/search.h
index 8b986d0..ea10e92 100644
--- a/plugins/search/search.h
+++ b/plugins/search/search.h
@@ -21,8 +21,7 @@
 #define __SEARCH_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 _SearchPluginPrivate SearchPluginPrivate;
 
 struct _SearchPlugin
 {
-  EthosPlugin parent;
+  PeasExtensionBase parent;
 
   /*< private >*/
   SearchPluginPrivate *priv;
@@ -47,12 +46,11 @@ struct _SearchPlugin
 
 struct _SearchPluginClass
 {
-  EthosPluginClass parent_class;
+  PeasExtensionBaseClass parent_class;
 };
 
-GType        search_plugin_get_type (void);
-EthosPlugin* search_plugin_new      (void);
-G_MODULE_EXPORT EthosPlugin* ethos_plugin_register (void);
+GType                 search_plugin_get_type (void);
+G_MODULE_EXPORT void  peas_register_types(PeasObjectModule *module);
 
 G_END_DECLS
 
diff --git a/plugins/search/search.emerillon-plugin.in b/plugins/search/search.plugin.in
similarity index 86%
rename from plugins/search/search.emerillon-plugin.in
rename to plugins/search/search.plugin.in
index 3345f43..b5cad02 100644
--- a/plugins/search/search.emerillon-plugin.in
+++ b/plugins/search/search.plugin.in
@@ -1,8 +1,7 @@
-[Emerillon Plugin]
+[Plugin]
 _Name=Search
 Module=search
 _Description=Allows searching GeoNames database
-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]