[emerillon/gtk3] Use totem plugin macro for Copy Link plugin



commit cb57e4b513c614a9c1309eeb35ff80fb94205c00
Author: Andreas Henriksson <andreas fatal se>
Date:   Tue Aug 9 17:21:18 2011 +0200

    Use totem plugin macro for Copy Link plugin

 plugins/Makefile.am           |    1 -
 plugins/copy-link/copy-link.c |   61 +++++++++--------------------------------
 plugins/copy-link/copy-link.h |   57 --------------------------------------
 3 files changed, 13 insertions(+), 106 deletions(-)
---
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 8dc985a..4a374ac 100755
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -42,7 +42,6 @@ plugins_in_files += \
 	copy-link/copy-link.plugin.in
 
 copy_link_libcopy_link_la_SOURCES = \
-	copy-link/copy-link.h  \
 	copy-link/copy-link.c
 
 copy_link_libcopy_link_la_LIBADD = \
diff --git a/plugins/copy-link/copy-link.c b/plugins/copy-link/copy-link.c
index 54142c2..1f09fac 100644
--- a/plugins/copy-link/copy-link.c
+++ b/plugins/copy-link/copy-link.c
@@ -21,26 +21,25 @@
 #include "config.h"
 #endif
 
-#include "copy-link.h"
+#include "cut-paste/totem-plugin.h"
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
 #include "emerillon/emerillon.h"
 
-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 COPY_LINK_TYPE_PLUGIN            (copy_link_plugin_get_type())
+#define COPY_LINK_PLUGIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), COPY_LINK_TYPE_PLUGIN, CopyLinkPlugin))
+#define COPY_LINK_PLUGIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  COPY_LINK_TYPE_PLUGIN, CopyLinkPluginClass))
+#define COPY_LINK_IS_PLUGIN(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COPY_LINK_TYPE_PLUGIN))
+#define COPY_LINK_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  COPY_LINK_TYPE_PLUGIN))
+#define COPY_LINK_PLUGIN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  COPY_LINK_TYPE_PLUGIN, CopyLinkPluginClass))
 
 #define OSM_ID "copy_link_osm"
 #define GOOGLE_ID "copy_link_google"
 #define YAHOO_ID "copy_link_yahoo"
 
-struct _CopyLinkPluginPrivate
+typedef struct
 {
   EmerillonWindow *window;
   ChamplainView *map_view;
@@ -50,7 +49,9 @@ struct _CopyLinkPluginPrivate
   guint osm_ui_id;
   guint google_ui_id;
   guint yahoo_ui_id;
-};
+} CopyLinkPluginPrivate;
+
+TOTEM_PLUGIN_REGISTER (COPY_LINK_TYPE_PLUGIN, CopyLinkPlugin, copy_link_plugin);
 
 #define LEN 255
 
@@ -183,7 +184,7 @@ static const GtkActionEntry action_entries[] =
 };
 
 static void
-copy_link_plugin_activate (PeasActivatable *plugin)
+impl_activate (PeasActivatable *plugin)
 {
   CopyLinkPluginPrivate *priv;
   GtkUIManager *manager;
@@ -219,7 +220,7 @@ copy_link_plugin_activate (PeasActivatable *plugin)
 }
 
 static void
-copy_link_plugin_deactivate (PeasActivatable *plugin)
+impl_deactivate (PeasActivatable *plugin)
 {
   GtkUIManager *manager;
   CopyLinkPluginPrivate *priv;
@@ -233,39 +234,3 @@ copy_link_plugin_deactivate (PeasActivatable *plugin)
 
   gtk_ui_manager_remove_ui (manager, priv->ui_id);
 }
-
-static void
-copy_link_plugin_class_init (CopyLinkPluginClass *klass)
-{
-  g_type_class_add_private (klass, sizeof (CopyLinkPluginPrivate));
-}
-
-static void
-copy_link_plugin_class_finalize(CopyLinkPluginClass *klass)
-{
-}
-
-static void
-copy_link_plugin_init (CopyLinkPlugin *plugin)
-{
-  plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
-                                              COPY_LINK_TYPE_PLUGIN,
-                                              CopyLinkPluginPrivate);
-}
-
-static void
-peas_activatable_iface_init (PeasActivatableInterface *iface)
-{
-  iface->activate = copy_link_plugin_activate;
-  iface->deactivate = copy_link_plugin_deactivate;
-}
-
-G_MODULE_EXPORT void
-peas_register_types (PeasObjectModule *module)
-{
-  copy_link_plugin_register_type (G_TYPE_MODULE (module));
-
-  peas_object_module_register_extension_type (module,
-                                              PEAS_TYPE_ACTIVATABLE,
-                                              COPY_LINK_TYPE_PLUGIN);
-}



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