[emerillon/gtk3] map-position-plugin: Port to libpeas
- From: Andreas Henriksson <ah src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [emerillon/gtk3] map-position-plugin: Port to libpeas
- Date: Fri, 5 Aug 2011 01:30:22 +0000 (UTC)
commit 6f8ce4245a3033c476878d73c8edf0c30d731bf2
Author: Andreas Henriksson <andreas fatal se>
Date: Thu Aug 4 16:21:46 2011 +0200
map-position-plugin: Port to libpeas
plugins/map-position/map-position.c | 66 +++++++++++--------
plugins/map-position/map-position.h | 36 +++++------
....emerillon-plugin.in => map-position.plugin.in} | 5 +-
3 files changed, 57 insertions(+), 50 deletions(-)
---
diff --git a/plugins/map-position/map-position.c b/plugins/map-position/map-position.c
index 5693d50..0d592eb 100644
--- a/plugins/map-position/map-position.c
+++ b/plugins/map-position/map-position.c
@@ -28,9 +28,15 @@
#include "emerillon/emerillon.h"
-G_DEFINE_TYPE (MousePositionPlugin, map_position_plugin, ETHOS_TYPE_PLUGIN)
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (MapPositionPlugin, map_position_plugin, PEAS_TYPE_EXTENSION_BASE,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+ peas_activatable_iface_init));
-struct _MousePositionPluginPrivate
+struct _MapPositionPluginPrivate
{
EmerillonWindow *window;
ChamplainView *map_view;
@@ -42,13 +48,13 @@ struct _MousePositionPluginPrivate
static void
moved_cb (GObject *gobject,
GParamSpec *pspec,
- MousePositionPlugin *plugin)
+ MapPositionPlugin *plugin)
{
gdouble lat, lon;
gchar *position;
- MousePositionPluginPrivate *priv;
+ MapPositionPluginPrivate *priv;
- priv = MOUSE_POSITION_PLUGIN (plugin)->priv;
+ priv = MAP_POSITION_PLUGIN (plugin)->priv;
g_object_get (priv->map_view,
"latitude", &lat,
"longitude", &lon,
@@ -63,11 +69,11 @@ moved_cb (GObject *gobject,
}
static void
-activated (EthosPlugin *plugin)
+map_position_plugin_activate (PeasActivatable *plugin)
{
- MousePositionPluginPrivate *priv;
+ MapPositionPluginPrivate *priv;
- priv = MOUSE_POSITION_PLUGIN (plugin)->priv;
+ priv = MAP_POSITION_PLUGIN (plugin)->priv;
priv->window = EMERILLON_WINDOW (emerillon_window_dup_default ());
priv->map_view = emerillon_window_get_map_view (priv->window);
@@ -78,48 +84,52 @@ activated (EthosPlugin *plugin)
G_CALLBACK (moved_cb),
plugin);
- moved_cb (NULL, NULL, MOUSE_POSITION_PLUGIN (plugin));
+ moved_cb (NULL, NULL, MAP_POSITION_PLUGIN (plugin));
}
static void
-deactivated (EthosPlugin *plugin)
+map_position_plugin_deactivate (PeasActivatable *plugin)
{
- MousePositionPluginPrivate *priv;
+ MapPositionPluginPrivate *priv;
- priv = MOUSE_POSITION_PLUGIN (plugin)->priv;
+ priv = MAP_POSITION_PLUGIN (plugin)->priv;
g_signal_handler_disconnect (priv->map_view, priv->signal_id);
gtk_statusbar_pop (priv->statusbar, 0);
}
static void
-map_position_plugin_class_init (MousePositionPluginClass *klass)
+map_position_plugin_class_init (MapPositionPluginClass *klass)
{
- EthosPluginClass *plugin_class;
-
- g_type_class_add_private (klass, sizeof (MousePositionPluginPrivate));
+ g_type_class_add_private (klass, sizeof (MapPositionPluginPrivate));
+}
- plugin_class = ETHOS_PLUGIN_CLASS (klass);
- plugin_class->activated = activated;
- plugin_class->deactivated = deactivated;
+static void
+map_position_plugin_class_finalize(MapPositionPluginClass *klass)
+{
}
static void
-map_position_plugin_init (MousePositionPlugin *plugin)
+map_position_plugin_init (MapPositionPlugin *plugin)
{
plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
- MOUSE_POSITION_TYPE_PLUGIN,
- MousePositionPluginPrivate);
+ MAP_POSITION_TYPE_PLUGIN,
+ MapPositionPluginPrivate);
}
-EthosPlugin*
-map_position_plugin_new (void)
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface)
{
- return g_object_new (MOUSE_POSITION_TYPE_PLUGIN, NULL);
+ iface->activate = map_position_plugin_activate;
+ iface->deactivate = map_position_plugin_deactivate;
}
-G_MODULE_EXPORT EthosPlugin*
-ethos_plugin_register (void)
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
{
- return map_position_plugin_new ();
+ map_position_plugin_register_type (G_TYPE_MODULE (module));
+
+ peas_object_module_register_extension_type (module,
+ PEAS_TYPE_ACTIVATABLE,
+ MAP_POSITION_TYPE_PLUGIN);
}
diff --git a/plugins/map-position/map-position.h b/plugins/map-position/map-position.h
index 5ba9bab..89eae02 100644
--- a/plugins/map-position/map-position.h
+++ b/plugins/map-position/map-position.h
@@ -21,38 +21,36 @@
#define __MOUSE_POSITION_PLUGIN_H__
#include <glib-object.h>
-#include <ethos/ethos.h>
-#include <ethos/ethos-ui.h>
+#include <libpeas/peas.h>
G_BEGIN_DECLS
-#define MOUSE_POSITION_TYPE_PLUGIN (map_position_plugin_get_type())
-#define MOUSE_POSITION_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOUSE_POSITION_TYPE_PLUGIN, MousePositionPlugin))
-#define MOUSE_POSITION_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOUSE_POSITION_TYPE_PLUGIN, MousePositionPluginClass))
-#define MOUSE_POSITION_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOUSE_POSITION_TYPE_PLUGIN))
-#define MOUSE_POSITION_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOUSE_POSITION_TYPE_PLUGIN))
-#define MOUSE_POSITION_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOUSE_POSITION_TYPE_PLUGIN, MousePositionPluginClass))
+#define MAP_POSITION_TYPE_PLUGIN (map_position_plugin_get_type())
+#define MAP_POSITION_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAP_POSITION_TYPE_PLUGIN, MapPositionPlugin))
+#define MAP_POSITION_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAP_POSITION_TYPE_PLUGIN, MapPositionPluginClass))
+#define MAP_POSITION_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAP_POSITION_TYPE_PLUGIN))
+#define MAP_POSITION_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAP_POSITION_TYPE_PLUGIN))
+#define MAP_POSITION_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAP_POSITION_TYPE_PLUGIN, MapPositionPluginClass))
-typedef struct _MousePositionPlugin MousePositionPlugin;
-typedef struct _MousePositionPluginClass MousePositionPluginClass;
-typedef struct _MousePositionPluginPrivate MousePositionPluginPrivate;
+typedef struct _MapPositionPlugin MapPositionPlugin;
+typedef struct _MapPositionPluginClass MapPositionPluginClass;
+typedef struct _MapPositionPluginPrivate MapPositionPluginPrivate;
-struct _MousePositionPlugin
+struct _MapPositionPlugin
{
- EthosPlugin parent;
+ PeasExtensionBase parent;
/*< private >*/
- MousePositionPluginPrivate *priv;
+ MapPositionPluginPrivate *priv;
};
-struct _MousePositionPluginClass
+struct _MapPositionPluginClass
{
- EthosPluginClass parent_class;
+ PeasExtensionBaseClass parent_class;
};
-GType map_position_plugin_get_type (void);
-EthosPlugin* map_position_plugin_new (void);
-G_MODULE_EXPORT EthosPlugin* ethos_plugin_register (void);
+GType map_position_plugin_get_type (void);
+G_MODULE_EXPORT void peas_register_types(PeasObjectModule *module);
G_END_DECLS
diff --git a/plugins/map-position/map-position.emerillon-plugin.in b/plugins/map-position/map-position.plugin.in
similarity index 89%
rename from plugins/map-position/map-position.emerillon-plugin.in
rename to plugins/map-position/map-position.plugin.in
index b8a96f6..31545fd 100644
--- a/plugins/map-position/map-position.emerillon-plugin.in
+++ b/plugins/map-position/map-position.plugin.in
@@ -1,8 +1,7 @@
-[Emerillon Plugin]
+[Plugin]
_Name=Map Position
Module=map-position
_Description=Display in the statusbar the coordinates at the center of the map
-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]