[gtranslator] Port open tran plugin to libpeas.



commit 138dbdb2ddf671a8a55813bf1d16e72e82e8065c
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Tue Nov 9 16:45:00 2010 +0100

    Port open tran plugin to libpeas.

 configure.ac                                       |    9 +-
 plugins/open-tran/Makefile.am                      |   29 +--
 plugins/open-tran/gtr-open-tran-panel.c            |   16 +-
 plugins/open-tran/gtr-open-tran-panel.h            |   30 +--
 plugins/open-tran/gtr-open-tran-plugin.c           |  253 ++++++++++++--------
 plugins/open-tran/gtr-open-tran-plugin.h           |   37 +--
 ....desktop.in => gtr-open-tran.plugin.desktop.in} |    6 +-
 7 files changed, 200 insertions(+), 180 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c1e94c3..3d428b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,7 +86,7 @@ SOURCEVIEW_REQUIRED=2.90.0
 GDL_REQUIRED=2.91.1
 GDICT_OPTIONAL=100
 GTKSPELL_OPTIONAL=100
-JSON_GLIB_OPTIONAL=100
+JSON_GLIB_OPTIONAL=0.12.0
 
 AC_SUBST(GTK_REQUIRED)
 AC_SUBST(GLIB_REQUIRED)
@@ -172,10 +172,9 @@ dnl -------------------------------------------------------------------
 dnl Check for json-glib, needed for Open-tran
 dnl -------------------------------------------------------------------
 if test "x$enable_opentran" != "xno"; then
-	PKG_CHECK_MODULES(JSON_GLIB,                            \
-		json-glib-1.0 >= JSON_GLIB_OPTIONAL,
-		have_json_glib=yes,
-		have_json_glib=no)
+	PKG_CHECK_MODULES(JSON_GLIB, [
+		json-glib-1.0 >= $JSON_GLIB_OPTIONAL
+		], have_json_glib=yes, have_json_glib=no)
 	if test x"$have_json_glib" = "xyes"; then
 		AC_DEFINE(LIBJSON_GLIB_1_0, 1, [Define if libjson-glib support is enabled])
 	fi
diff --git a/plugins/open-tran/Makefile.am b/plugins/open-tran/Makefile.am
index 6ca17c8..8c4ab54 100644
--- a/plugins/open-tran/Makefile.am
+++ b/plugins/open-tran/Makefile.am
@@ -1,18 +1,13 @@
 # Open-tran Panel plugin
 plugindir = $(libdir)/gtranslator/plugins
 
-INCLUDES =                                                      \
-	-I$(top_srcdir) 				\
+INCLUDES =						\
+	-I$(top_srcdir)					\
 	-I$(top_srcdir)/src				\
-	-I$(top_srcdir)/src/plugin-system		\
-	-I$(top_srcdir)/src/toolbareditor		\
-	-DPIXMAPSDIR=\""$(datadir)"/pixmaps/gtranslator\"       \
-	-DDATADIR=\""$(pkgdatadir)"\"                           \
-	$(GTRANSLATOR_CFLAGS) 				\
+	$(GTRANSLATOR_CFLAGS)				\
 	$(JSON_GLIB_CFLAGS)				\
 	$(WARN_CFLAGS)					\
-	$(DISABLE_DEPRECATED)				\
-	-DGTR_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
+	$(DISABLE_DEPRECATED)
 
 plugin_LTLIBRARIES = libopentran.la
 
@@ -24,7 +19,7 @@ libopentran_la_SOURCES = \
 
 libopentran_la_LDFLAGS = \
 	$(PLUGIN_LIBTOOL_FLAGS)				\
-	$(GTRANSLATOR_LIBS)					\
+	$(GTRANSLATOR_LIBS)				\
 	$(JSON_GLIB_LIBS)
 
 uidir = $(pkgdatadir)/ui
@@ -34,10 +29,10 @@ ui_DATA =  \
 
 pixmaps_dir = $(datadir)/pixmaps/gtranslator
 pixmaps__DATA = \
-        gnome.png \
-        kde.ico \
-        mozilla.png \
-        debian.png \
+	gnome.png \
+	kde.ico \
+	mozilla.png \
+	debian.png \
 	open-tran.png \
 	suse.png \
 	xfce.png \
@@ -48,11 +43,11 @@ pixmaps__DATA = \
 
 # Plugin Info
 
-plugin_in_files = gtr-open-tran.gtranslator-plugin.desktop.in
+plugin_in_files = gtr-open-tran.plugin.desktop.in
 
-%.gtranslator.plugin: %.gtranslator-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
 
-plugin_DATA = $(plugin_in_files:.gtranslator-plugin.desktop.in=.gtranslator.plugin)
+plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
 
 gsettings_SCHEMAS = org.gnome.gtranslator.plugins.open-tran.gschema.xml
 
diff --git a/plugins/open-tran/gtr-open-tran-panel.c b/plugins/open-tran/gtr-open-tran-panel.c
index a3bad0d..3605865 100644
--- a/plugins/open-tran/gtr-open-tran-panel.c
+++ b/plugins/open-tran/gtr-open-tran-panel.c
@@ -24,7 +24,6 @@
 #include "gtr-application.h"
 #include "gtr-window.h"
 #include "gtr-header.h"
-#include "gtr-plugin.h"
 
 #include <string.h>
 
@@ -57,7 +56,7 @@
 #define FEDORA_ICON      PIXMAPSDIR"/fedora.png"
 #define MANDRIVA_ICON    PIXMAPSDIR"/mandriva.png"
 
-GTR_PLUGIN_DEFINE_TYPE (GtrOpenTranPanel, gtr_open_tran_panel, GTK_TYPE_VBOX)
+G_DEFINE_DYNAMIC_TYPE (GtrOpenTranPanel, gtr_open_tran_panel, GTK_TYPE_VBOX)
 
 struct _GtrOpenTranPanelPrivate
 {
@@ -538,7 +537,7 @@ gtr_open_tran_panel_dispose (GObject * object)
 }
 
 static void
-gtr_open_tran_panel_class_init (GtrOpenTranPanelClass * klass)
+gtr_open_tran_panel_class_init (GtrOpenTranPanelClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
@@ -547,6 +546,11 @@ gtr_open_tran_panel_class_init (GtrOpenTranPanelClass * klass)
   object_class->dispose = gtr_open_tran_panel_dispose;
 }
 
+static void
+gtr_open_tran_panel_class_finalize (GtrOpenTranPanelClass *klass)
+{
+}
+
 GtkWidget *
 gtr_open_tran_panel_new (GtrWindow * window)
 {
@@ -558,3 +562,9 @@ gtr_open_tran_panel_new (GtrWindow * window)
 
   return GTK_WIDGET (panel);
 }
+
+void
+_gtr_open_tran_panel_register_type (GTypeModule *type_module)
+{
+  gtr_open_tran_panel_register_type (type_module);
+}
diff --git a/plugins/open-tran/gtr-open-tran-panel.h b/plugins/open-tran/gtr-open-tran-panel.h
index 910287b..041e744 100644
--- a/plugins/open-tran/gtr-open-tran-panel.h
+++ b/plugins/open-tran/gtr-open-tran-panel.h
@@ -26,9 +26,7 @@
 #include "gtr-window.h"
 
 G_BEGIN_DECLS
-/*
- * Type checking and casting macros
- */
+
 #define GTR_TYPE_OPEN_TRAN_PANEL		(gtr_open_tran_panel_get_type ())
 #define GTR_OPEN_TRAN_PANEL(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), GTR_TYPE_OPEN_TRAN_PANEL, GtrOpenTranPanel))
 #define GTR_OPEN_TRAN_PANEL_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), GTR_TYPE_OPEN_TRAN_PANEL, GtrOpenTranPanelClass))
@@ -42,13 +40,9 @@ G_BEGIN_DECLS
 #define GTR_SETTINGS_USE_MIRROR_SERVER "use-mirror-server"
 #define GTR_SETTINGS_MIRROR_SERVER_URL "mirror-server-url"
 
-/* Private structure type */
+typedef struct _GtrOpenTranPanel        GtrOpenTranPanel;
 typedef struct _GtrOpenTranPanelPrivate GtrOpenTranPanelPrivate;
-
-/*
- * Main object structure
- */
-typedef struct _GtrOpenTranPanel GtrOpenTranPanel;
+typedef struct _GtrOpenTranPanelClass   GtrOpenTranPanelClass;
 
 struct _GtrOpenTranPanel
 {
@@ -58,24 +52,16 @@ struct _GtrOpenTranPanel
   GtrOpenTranPanelPrivate *priv;
 };
 
-/*
- * Class definition
- */
-typedef struct _GtrOpenTranPanelClass GtrOpenTranPanelClass;
-
 struct _GtrOpenTranPanelClass
 {
   GtkVBoxClass parent_class;
 };
 
-/*
- * Public methods
- */
-GType
-gtr_open_tran_panel_get_type (void)
-  G_GNUC_CONST;
-     GType gtr_open_tran_panel_register_type (GTypeModule * module);
-     GtkWidget *gtr_open_tran_panel_new (GtrWindow * window);
+GType gtr_open_tran_panel_get_type (void) G_GNUC_CONST;
+
+GtkWidget *gtr_open_tran_panel_new (GtrWindow * window);
+
+void _gtr_open_tran_panel_register_type (GTypeModule *type_module);
 
 G_END_DECLS
 #endif /* __OPEN_TRAN_PANEL_H__ */
diff --git a/plugins/open-tran/gtr-open-tran-plugin.c b/plugins/open-tran/gtr-open-tran-plugin.c
index e7f2e88..c4d7128 100644
--- a/plugins/open-tran/gtr-open-tran-plugin.c
+++ b/plugins/open-tran/gtr-open-tran-plugin.c
@@ -26,14 +26,15 @@
 #include "gtr-application.h"
 #include "gtr-dirs.h"
 #include "gtr-window.h"
+#include "gtr-window-activatable.h"
 #include "gtr-utils.h"
 
+#include <libpeas-gtk/peas-gtk-configurable.h>
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 #include <libxml/nanohttp.h>
 
 #define OPEN_TRAN_PLUGIN_ICON "open-tran.png"
-#define WINDOW_DATA_KEY "GtrOpenTranPluginWindowData"
 
 #define GTR_OPEN_TRAN_PLUGIN_GET_PRIVATE(object) \
 				(G_TYPE_INSTANCE_GET_PRIVATE ((object),	\
@@ -44,8 +45,8 @@ struct _GtrOpenTranPluginPrivate
 {
   GSettings *settings;
 
-  /* Dialog stuff */
-  GtkWidget *dialog;
+  GtrWindow *window;
+  GtkWidget *opentran;
 
   GtkWidget *main_box;
   GtkWidget *search_code_entry;
@@ -55,17 +56,26 @@ struct _GtrOpenTranPluginPrivate
   GtkWidget *mirror_server_frame_entry;
 };
 
-typedef struct
+enum
 {
-  GtkWidget *panel;
-  guint context_id;
-} WindowData;
+  PROP_0,
+  PROP_WINDOW
+};
 
-GTR_PLUGIN_REGISTER_TYPE_WITH_CODE (GtrOpenTranPlugin,
-                                    gtr_open_tran_plugin,
-                                    gtr_open_tran_panel_register_type
-                                    (module);
-  )
+static void gtr_window_activatable_iface_init (GtrWindowActivatableInterface *iface);
+static void peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (GtrOpenTranPlugin,
+                                gtr_open_tran_plugin,
+                                PEAS_TYPE_EXTENSION_BASE,
+                                0,
+                                G_IMPLEMENT_INTERFACE_DYNAMIC (GTR_TYPE_WINDOW_ACTIVATABLE,
+                                                               gtr_window_activatable_iface_init)
+                                G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_GTK_TYPE_CONFIGURABLE,
+                                                               peas_gtk_configurable_iface_init) \
+                                                                                                 \
+                                _gtr_open_tran_panel_register_type (type_module)                 \
+)
 
 static void
 gtr_open_tran_plugin_init (GtrOpenTranPlugin * plugin)
@@ -80,63 +90,109 @@ gtr_open_tran_plugin_init (GtrOpenTranPlugin * plugin)
 static void
 gtr_open_tran_plugin_dispose (GObject * object)
 {
-  GtrOpenTranPlugin *plugin = GTR_OPEN_TRAN_PLUGIN (object);
+  GtrOpenTranPluginPrivate *priv = GTR_OPEN_TRAN_PLUGIN (object)->priv;
 
   xmlNanoHTTPCleanup ();
 
-  if (plugin->priv->settings)
+  if (priv->settings)
+    {
+      g_object_unref (priv->settings);
+      priv->settings = NULL;
+    }
+
+  if (priv->window != NULL)
     {
-      g_object_unref (plugin->priv->settings);
-      plugin->priv->settings = NULL;
+      g_object_unref (priv->window);
+      priv->window = NULL;
     }
 
   G_OBJECT_CLASS (gtr_open_tran_plugin_parent_class)->dispose (object);
 }
 
+static void
+gtr_open_tran_plugin_set_property (GObject      *object,
+                                   guint         prop_id,
+                                   const GValue *value,
+                                   GParamSpec   *pspec)
+{
+  GtrOpenTranPluginPrivate *priv = GTR_OPEN_TRAN_PLUGIN (object)->priv;
+
+  switch (prop_id)
+    {
+      case PROP_WINDOW:
+        priv->window = GTR_WINDOW (g_value_dup_object (value));
+        break;
+
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}
 
 static void
-impl_activate (GtrPlugin * plugin, GtrWindow * window)
+gtr_open_tran_plugin_get_property (GObject    *object,
+                                   guint       prop_id,
+                                   GValue     *value,
+                                   GParamSpec *pspec)
 {
-  GtkWidget *opentran;
+  GtrOpenTranPluginPrivate *priv = GTR_OPEN_TRAN_PLUGIN (object)->priv;
+
+  switch (prop_id)
+    {
+      case PROP_WINDOW:
+        g_value_set_object (value, priv->window);
+        break;
+
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}
+
+static void
+gtr_open_tran_plugin_activate (GtrWindowActivatable *activatable)
+{
+  GtrOpenTranPluginPrivate *priv = GTR_OPEN_TRAN_PLUGIN (activatable)->priv;
 
   gtr_application_register_icon (GTR_APP, "open-tran.png",
                                  "open-tran-plugin-icon");
 
-  opentran = gtr_open_tran_panel_new (window);
-  gtk_widget_show (opentran);
+  priv->opentran = gtr_open_tran_panel_new (priv->window);
+  gtk_widget_show (priv->opentran);
 
-  gtr_window_add_widget (window,
-                         opentran,
+  gtr_window_add_widget (priv->window,
+                         priv->opentran,
                          "GtrOpenTranPlugin",
                          _("Open Tran"),
-                         "open-tran-plugin-icon", GTR_WINDOW_PLACEMENT_LEFT);
-
-  g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, opentran);
+                         "open-tran-plugin-icon",
+                         GTR_WINDOW_PLACEMENT_LEFT);
 }
 
 static void
-impl_deactivate (GtrPlugin * plugin, GtrWindow * window)
+gtr_open_tran_plugin_deactivate (GtrWindowActivatable *activatable)
 {
-  GtkWidget *opentran;
-
-  opentran = (GtkWidget *) g_object_get_data (G_OBJECT (window),
-                                              WINDOW_DATA_KEY);
-  g_return_if_fail (opentran != NULL);
+  GtrOpenTranPluginPrivate *priv = GTR_OPEN_TRAN_PLUGIN (activatable)->priv;
 
-  gtr_window_remove_widget (window, opentran);
+  gtr_window_remove_widget (priv->window, priv->opentran);
+}
 
-  g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
+static void
+use_mirror_server_toggled_cb (GtkWidget         *widget,
+                              GtrOpenTranPlugin *plugin)
+{
+  gtk_widget_set_sensitive (plugin->priv->mirror_server_frame_entry,
+                            gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
 }
 
 static GtkWidget *
 get_configuration_dialog (GtrOpenTranPlugin * plugin)
 {
-
+  GtrOpenTranPluginPrivate *priv = plugin->priv;
   gboolean ret;
   GtkWidget *error_widget;
   gchar *path;
   gchar *root_objects[] = {
-    "dialog",
+    "main_box",
     NULL
   };
 
@@ -144,19 +200,13 @@ get_configuration_dialog (GtrOpenTranPlugin * plugin)
   ret = gtr_utils_get_ui_objects (path,
                                   root_objects,
                                   &error_widget,
-                                  "dialog", &plugin->priv->dialog,
-                                  "main_box", &plugin->priv->main_box,
-                                  "search_code",
-                                  &plugin->priv->search_code_entry,
-                                  "own_code",
-                                  &plugin->priv->own_code_entry,
-                                  "use_mirror_server",
-                                  &plugin->priv->use_mirror_server_entry,
-                                  "mirror_server_url",
-                                  &plugin->priv->mirror_server_url_entry,
-                                  "mirror_server_frame",
-                                  &plugin->priv->mirror_server_frame_entry,
-				  NULL);
+                                  "main_box", &priv->main_box,
+                                  "search_code", &priv->search_code_entry,
+                                  "own_code", &priv->own_code_entry,
+                                  "use_mirror_server", &priv->use_mirror_server_entry,
+                                  "mirror_server_url", &priv->mirror_server_url_entry,
+                                  "mirror_server_frame", &priv->mirror_server_frame_entry,
+                                  NULL);
   if (!ret)
     {
       g_error (_("Error from configuration dialog %s"), path);
@@ -164,94 +214,89 @@ get_configuration_dialog (GtrOpenTranPlugin * plugin)
 
   g_free (path);
 
-  g_settings_bind (plugin->priv->settings,
+  g_settings_bind (priv->settings,
                    GTR_SETTINGS_OWN_CODE,
-                   plugin->priv->own_code_entry,
+                   priv->own_code_entry,
                    "text",
                    G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
 
-  g_settings_bind (plugin->priv->settings,
+  g_settings_bind (priv->settings,
                    GTR_SETTINGS_SEARCH_CODE,
-                   plugin->priv->search_code_entry,
+                   priv->search_code_entry,
                    "text",
                    G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
 
-  g_settings_bind (plugin->priv->settings,
+  g_settings_bind (priv->settings,
                    GTR_SETTINGS_USE_MIRROR_SERVER,
-                   plugin->priv->use_mirror_server_entry,
+                   priv->use_mirror_server_entry,
                    "active",
                    G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
 
-  g_settings_bind (plugin->priv->settings,
+  g_settings_bind (priv->settings,
                    GTR_SETTINGS_MIRROR_SERVER_URL,
-                   plugin->priv->mirror_server_url_entry,
+                   priv->mirror_server_url_entry,
                    "text",
                    G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
 
-  return plugin->priv->dialog;
-}
-
-static void
-configure_dialog_response_cb (GtkWidget * widget,
-                              gint response, GtrOpenTranPlugin * plugin)
-{
-  gtk_widget_destroy (plugin->priv->dialog);
-}
-
-static void
-use_mirror_server_toggled_cb (GtkWidget *widget,
-			      GtrOpenTranPlugin * plugin)
-{
-  GtkWidget *mirror_server_url_entry;
-  GtkWidget *mirror_server_frame_entry;
-  gboolean use_mirror_server;
-
-  mirror_server_url_entry = plugin->priv->mirror_server_url_entry;
-  mirror_server_frame_entry = plugin->priv->mirror_server_frame_entry;
-  use_mirror_server = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
-  gtk_widget_set_sensitive (mirror_server_frame_entry, use_mirror_server);
-}
-
-static GtkWidget *
-impl_create_configure_dialog (GtrPlugin * plugin)
-{
-  GtkWidget *dialog;
-  GtrOpenTranPluginPrivate *priv = GTR_OPEN_TRAN_PLUGIN (plugin)->priv;
-  gboolean use_mirror_server;
-
-  dialog = get_configuration_dialog (GTR_OPEN_TRAN_PLUGIN (plugin));
-
-  g_signal_connect (dialog,
-                    "response",
-                    G_CALLBACK (configure_dialog_response_cb),
-                    plugin);
-  g_signal_connect (dialog,
-                    "destroy", G_CALLBACK (gtk_widget_destroy), &dialog);
+  /* Set the sensitivity of the mirror server area */
+  gtk_widget_set_sensitive (priv->mirror_server_frame_entry,
+                            gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->use_mirror_server_entry)));
 
   g_signal_connect (priv->use_mirror_server_entry,
                     "toggled",
                     G_CALLBACK (use_mirror_server_toggled_cb),
                     plugin);
 
-  /* Set the sensitivity of the mirror server area */
-  use_mirror_server = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->use_mirror_server_entry));
-  gtk_widget_set_sensitive (priv->mirror_server_frame_entry,
-			    use_mirror_server);
+  return plugin->priv->main_box;
+}
 
-  return dialog;
+static GtkWidget *
+gtr_open_tran_create_configure_widget (PeasGtkConfigurable *configurable)
+{
+  return get_configuration_dialog (GTR_OPEN_TRAN_PLUGIN (configurable));
 }
 
 static void
 gtr_open_tran_plugin_class_init (GtrOpenTranPluginClass * klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GtrPluginClass *plugin_class = GTR_PLUGIN_CLASS (klass);
 
   object_class->dispose = gtr_open_tran_plugin_dispose;
+  object_class->set_property = gtr_open_tran_plugin_set_property;
+  object_class->get_property = gtr_open_tran_plugin_get_property;
 
-  plugin_class->activate = impl_activate;
-  plugin_class->deactivate = impl_deactivate;
-  plugin_class->create_configure_dialog = impl_create_configure_dialog;
+  g_object_class_override_property (object_class, PROP_WINDOW, "window");
 
   g_type_class_add_private (object_class, sizeof (GtrOpenTranPluginPrivate));
 }
+
+static void
+gtr_open_tran_plugin_class_finalize (GtrOpenTranPluginClass *klass)
+{
+}
+
+static void
+peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface)
+{
+  iface->create_configure_widget = gtr_open_tran_create_configure_widget;
+}
+
+static void
+gtr_window_activatable_iface_init (GtrWindowActivatableInterface *iface)
+{
+  iface->activate = gtr_open_tran_plugin_activate;
+  iface->deactivate = gtr_open_tran_plugin_deactivate;
+}
+
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+  gtr_open_tran_plugin_register_type (G_TYPE_MODULE (module));
+
+  peas_object_module_register_extension_type (module,
+                                              GTR_TYPE_WINDOW_ACTIVATABLE,
+                                              GTR_TYPE_OPEN_TRAN_PLUGIN);
+  peas_object_module_register_extension_type (module,
+                                              PEAS_GTK_TYPE_CONFIGURABLE,
+                                              GTR_TYPE_OPEN_TRAN_PLUGIN);
+}
diff --git a/plugins/open-tran/gtr-open-tran-plugin.h b/plugins/open-tran/gtr-open-tran-plugin.h
index 96eee6a..6ecb896 100644
--- a/plugins/open-tran/gtr-open-tran-plugin.h
+++ b/plugins/open-tran/gtr-open-tran-plugin.h
@@ -22,53 +22,38 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include "gtr-plugin.h"
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
 
 G_BEGIN_DECLS
-/*
- * Type checking and casting macros
- */
+
 #define GTR_TYPE_OPEN_TRAN_PLUGIN		(gtr_open_tran_plugin_get_type ())
 #define GTR_OPEN_TRAN_PLUGIN(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), GTR_TYPE_OPEN_TRAN_PLUGIN, GtrOpenTranPlugin))
 #define GTR_OPEN_TRAN_PLUGIN_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), GTR_TYPE_OPEN_TRAN_PLUGIN, GtrOpenTranPluginClass))
 #define GTR_IS_OPEN_TRAN_PLUGIN(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GTR_TYPE_OPEN_TRAN_PLUGIN))
 #define GTR_IS_OPEN_TRAN_PLUGIN_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GTR_TYPE_OPEN_TRAN_PLUGIN))
 #define GTR_OPEN_TRAN_PLUGIN_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GTR_TYPE_OPEN_TRAN_PLUGIN, GtrOpenTranPluginClass))
-/* Private structure type */
-typedef struct _GtrOpenTranPluginPrivate GtrOpenTranPluginPrivate;
 
-/*
- * Main object structure
- */
-typedef struct _GtrOpenTranPlugin GtrOpenTranPlugin;
+typedef struct _GtrOpenTranPlugin        GtrOpenTranPlugin;
+typedef struct _GtrOpenTranPluginPrivate GtrOpenTranPluginPrivate;
+typedef struct _GtrOpenTranPluginClass   GtrOpenTranPluginClass;
 
 struct _GtrOpenTranPlugin
 {
-  GtrPlugin parent_instance;
+  PeasExtensionBase parent_instance;
 
-  /* private */
+  /*< private >*/
   GtrOpenTranPluginPrivate *priv;
 };
 
-/*
- * Class definition
- */
-typedef struct _GtrOpenTranPluginClass GtrOpenTranPluginClass;
-
 struct _GtrOpenTranPluginClass
 {
-  GtrPluginClass parent_class;
+  PeasExtensionBaseClass parent_class;
 };
 
-/*
- * Public methods
- */
-GType
-gtr_open_tran_plugin_get_type (void)
-  G_GNUC_CONST;
+GType gtr_open_tran_plugin_get_type (void) G_GNUC_CONST;
 
-/* All the plugins must implement this function */
-     G_MODULE_EXPORT GType register_gtr_plugin (GTypeModule * module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
 
 G_END_DECLS
 #endif /* __GTR_OPEN_TRAN_PLUGIN_H__ */
diff --git a/plugins/open-tran/gtr-open-tran.gtranslator-plugin.desktop.in b/plugins/open-tran/gtr-open-tran.plugin.desktop.in
similarity index 61%
rename from plugins/open-tran/gtr-open-tran.gtranslator-plugin.desktop.in
rename to plugins/open-tran/gtr-open-tran.plugin.desktop.in
index 8c52bbf..9da5811 100644
--- a/plugins/open-tran/gtr-open-tran.gtranslator-plugin.desktop.in
+++ b/plugins/open-tran/gtr-open-tran.plugin.desktop.in
@@ -1,9 +1,9 @@
-[Gtranslator Plugin]
+[Plugin]
 Module=opentran
 IAge=2
 _Name=Open Tran
 _Description=Look for phrases in Open tran memory translation database.
 Icon=open-tran
-Authors=Ignacio Casal Quinteiro <nacho resa gmail com>
+Authors=Ignacio Casal Quinteiro <icq gnome org>
 Copyright=Copyright @ 2008 Ignacio Casal Quinteiro
-Website=http://gtranslator.sf.net
+Website=http://projects.gnome.org/gtranslator



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