[emerillon/gtk3] Use Totem plugin macro for Placemarks plugin



commit eaa39a5b929b10fcc36257169d443adb84fb8d45
Author: Andreas Henriksson <andreas fatal se>
Date:   Tue Aug 9 17:28:19 2011 +0200

    Use Totem plugin macro for Placemarks plugin

 plugins/Makefile.am                |    1 -
 plugins/placemarks/manage-dialog.h |   10 ++++++
 plugins/placemarks/placemarks.c    |   63 +++++++----------------------------
 plugins/placemarks/placemarks.h    |   57 --------------------------------
 4 files changed, 23 insertions(+), 108 deletions(-)
---
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index ed8540a..18dd09d 100755
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -27,7 +27,6 @@ placemarks_libplacemarks_la_SOURCES = \
 	placemarks/manage-dialog.h  \
 	placemarks/manage-dialog.c  \
 	placemarks/placemarks-model.h  \
-	placemarks/placemarks.h  \
 	placemarks/placemarks.c
 
 placemarks_libplacemarks_la_LIBADD = \
diff --git a/plugins/placemarks/manage-dialog.h b/plugins/placemarks/manage-dialog.h
index b71576e..6965f2d 100644
--- a/plugins/placemarks/manage-dialog.h
+++ b/plugins/placemarks/manage-dialog.h
@@ -23,6 +23,16 @@
 #include <gtk/gtk.h>
 #include <champlain/champlain.h>
 
+#define TYPE_ADD_DIALOG            (add_dialog_get_type ())
+#define ADD_DIALOG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ADD_DIALOG, AddDialog))
+#define ADD_DIALOG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  TYPE_ADD_DIALOG, AddDialogClass))
+#define IS_ADD_DIALOG(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ADD_DIALOG))
+#define IS_ADD_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  TYPE_ADD_DIALOG))
+#define ADD_DIALOG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  TYPE_ADD_DIALOG, AddDialogClass))
+
+#define ADD_DIALOG_ERROR           (add_dialog_error_quark ())
+
+
 G_BEGIN_DECLS
 
 typedef struct _ManageDialog ManageDialog;
diff --git a/plugins/placemarks/placemarks.c b/plugins/placemarks/placemarks.c
index a0a9c02..33a63c9 100644
--- a/plugins/placemarks/placemarks.c
+++ b/plugins/placemarks/placemarks.c
@@ -21,7 +21,7 @@
 #include "config.h"
 #endif
 
-#include "placemarks.h"
+#include "cut-paste/totem-plugin.h"
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
@@ -32,15 +32,14 @@
 #include "manage-dialog.h"
 #include "placemarks-model.h"
 
-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));
+#define PLACEMARKS_TYPE_PLUGIN            (placemarks_plugin_get_type())
+#define PLACEMARKS_PLUGIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLACEMARKS_TYPE_PLUGIN, PlacemarksPlugin))
+#define PLACEMARKS_PLUGIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  PLACEMARKS_TYPE_PLUGIN, PlacemarksPluginClass))
+#define PLACEMARKS_IS_PLUGIN(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PLACEMARKS_TYPE_PLUGIN))
+#define PLACEMARKS_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  PLACEMARKS_TYPE_PLUGIN))
+#define PLACEMARKS_PLUGIN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  PLACEMARKS_TYPE_PLUGIN, PlacemarksPluginClass))
 
-struct _PlacemarksPluginPrivate
+typedef struct
 {
   EmerillonWindow *window;
   ChamplainView *map_view;
@@ -56,7 +55,9 @@ struct _PlacemarksPluginPrivate
   /** Layer with placemark markers */
   ChamplainMarkerLayer *markers_layer;
   guint deleted_cb_id;
-};
+} PlacemarksPluginPrivate;
+
+TOTEM_PLUGIN_REGISTER (PLACEMARKS_TYPE_PLUGIN, PlacemarksPlugin, placemarks_plugin);
 
 /**
  * Go to the specified placemark
@@ -556,7 +557,7 @@ row_deleted_cb (GtkTreeModel *tree_model,
 }
 
 static void
-placemarks_plugin_activate (PeasActivatable *plugin)
+impl_activate (PeasActivatable *plugin)
 {
   PlacemarksPluginPrivate *priv;
   GtkUIManager *manager;
@@ -609,7 +610,7 @@ placemarks_plugin_activate (PeasActivatable *plugin)
 }
 
 static void
-placemarks_plugin_deactivate (PeasActivatable *plugin)
+impl_deactivate (PeasActivatable *plugin)
 {
   GtkUIManager *manager;
   PlacemarksPluginPrivate *priv;
@@ -625,41 +626,3 @@ placemarks_plugin_deactivate (PeasActivatable *plugin)
 
   g_object_unref (priv->model);
 }
-
-static void
-placemarks_plugin_class_init (PlacemarksPluginClass *klass)
-{
-  g_type_class_add_private (klass, sizeof (PlacemarksPluginPrivate));
-}
-
-static void
-placemarks_plugin_class_finalize(PlacemarksPluginClass *klass)
-{
-}
-
-static void
-placemarks_plugin_init (PlacemarksPlugin *plugin)
-{
-  plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
-                                              PLACEMARKS_TYPE_PLUGIN,
-                                              PlacemarksPluginPrivate);
-  plugin->priv->placemark_count = 0;
-  plugin->priv->deleted_cb_id = 0;
-}
-
-static void
-peas_activatable_iface_init (PeasActivatableInterface *iface)
-{
-  iface->activate = placemarks_plugin_activate;
-  iface->deactivate = placemarks_plugin_deactivate;
-}
-
-G_MODULE_EXPORT void
-peas_register_types (PeasObjectModule *module)
-{
-  placemarks_plugin_register_type (G_TYPE_MODULE (module));
-
-  peas_object_module_register_extension_type (module,
-                                              PEAS_TYPE_ACTIVATABLE,
-                                              PLACEMARKS_TYPE_PLUGIN);
-}



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