[gtranslator/gtk3] Port codeview plugin to libpeas.



commit 2a31f9c6d7c8c18d957e1852e8a6baaec53a5fc2
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Mon Nov 8 10:17:57 2010 +0100

    Port codeview plugin to libpeas.

 plugins/codeview/Makefile.am                       |   21 +-
 ...-code-view-dialog.ui => gtr-codeview-dialog.ui} |    0
 ...ce-code-view-plugin.c => gtr-codeview-plugin.c} |  221 +++++++++++++-------
 plugins/codeview/gtr-codeview-plugin.h             |   58 +++++
 ...n.desktop.in => gtr-codeview.plugin.desktop.in} |    6 +-
 plugins/codeview/gtr-source-code-view-plugin.h     |   74 -------
 plugins/codeview/gtr-viewer.c                      |   16 +-
 plugins/codeview/gtr-viewer.h                      |   31 +--
 8 files changed, 232 insertions(+), 195 deletions(-)
---
diff --git a/plugins/codeview/Makefile.am b/plugins/codeview/Makefile.am
index 1b56cb9..847293b 100644
--- a/plugins/codeview/Makefile.am
+++ b/plugins/codeview/Makefile.am
@@ -4,19 +4,16 @@ plugindir = $(libdir)/gtranslator/plugins
 INCLUDES = \
 	-I$(top_srcdir) 				\
 	-I$(top_srcdir)/src				\
-	-I$(top_srcdir)/src/plugin-system		\
-	$(GTRANSLATOR_CFLAGS) 				\
+	$(GTRANSLATOR_CFLAGS)				\
 	$(WARN_CFLAGS)					\
-	$(DISABLE_DEPRECATED)				\
-	-DDATADIR=\""$(pkgdatadir)"\"                   \
-	-DGTR_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
+	$(DISABLE_DEPRECATED)
 
 plugin_LTLIBRARIES = \
 	libsourcecodeview.la
 
 libsourcecodeview_la_SOURCES = \
-	gtr-source-code-view-plugin.c \
-	gtr-source-code-view-plugin.h \
+	gtr-codeview-plugin.c \
+	gtr-codeview-plugin.h \
 	gtr-viewer.c \
 	gtr-viewer.h
 
@@ -27,16 +24,16 @@ libsourcecodeview_la_LDFLAGS = \
 uidir = $(pkgdatadir)/ui
 
 ui_DATA =  \
-        gtr-viewer.ui \
-	gtr-source-code-view-dialog.ui
+	gtr-viewer.ui \
+	gtr-codeview-dialog.ui
 
 # Plugin Info
 
-plugin_in_files = gtr-source-code-view.gtranslator-plugin.desktop.in
+plugin_in_files = gtr-codeview.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.codeview.gschema.xml
 
diff --git a/plugins/codeview/gtr-source-code-view-dialog.ui b/plugins/codeview/gtr-codeview-dialog.ui
similarity index 100%
rename from plugins/codeview/gtr-source-code-view-dialog.ui
rename to plugins/codeview/gtr-codeview-dialog.ui
diff --git a/plugins/codeview/gtr-source-code-view-plugin.c b/plugins/codeview/gtr-codeview-plugin.c
similarity index 74%
rename from plugins/codeview/gtr-source-code-view-plugin.c
rename to plugins/codeview/gtr-codeview-plugin.c
index 12b81a0..19b1d89 100644
--- a/plugins/codeview/gtr-source-code-view-plugin.c
+++ b/plugins/codeview/gtr-codeview-plugin.c
@@ -20,13 +20,15 @@
 #include <config.h>
 #endif
 
-#include "gtr-source-code-view-plugin.h"
+#include "gtr-codeview-plugin.h"
 #include "gtr-context.h"
 #include "gtr-dirs.h"
 #include "gtr-utils.h"
 #include "gtr-viewer.h"
 #include "gtr-window.h"
+#include "gtr-window-activatable.h"
 
+#include <libpeas-gtk/peas-gtk-configurable.h>
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 #include <string.h>
@@ -37,18 +39,15 @@
 #define GTR_SETTINGS_PROGRAM_CMD "program-cmd"
 #define GTR_SETTINGS_LINE_CMD "line-cmd"
 
-#define GTR_SOURCE_CODE_VIEW_PLUGIN_GET_PRIVATE(object) \
+#define GTR_CODE_VIEW_PLUGIN_GET_PRIVATE(object) \
 				(G_TYPE_INSTANCE_GET_PRIVATE ((object),	\
-				GTR_TYPE_SOURCE_CODE_VIEW_PLUGIN,		\
-				GtrSourceCodeViewPluginPrivate))
+				GTR_TYPE_CODE_VIEW_PLUGIN,		\
+				GtrCodeViewPluginPrivate))
 
-struct _GtrSourceCodeViewPluginPrivate
+struct _GtrCodeViewPluginPrivate
 {
   GSettings *settings;
 
-  /* Dialog stuff */
-  GtkWidget *dialog;
-
   GtkWidget *main_box;
   GtkWidget *use_editor_checkbutton;
   GtkWidget *program_box;
@@ -60,13 +59,28 @@ struct _GtrSourceCodeViewPluginPrivate
   GSList *tags;
 };
 
-GTR_PLUGIN_REGISTER_TYPE (GtrSourceCodeViewPlugin,
-                          gtr_source_code_view_plugin)
+enum
+{
+  PROP_0,
+  PROP_WINDOW
+};
+
+static void gtr_window_activatable_iface_init (GtrWindowActivatableInterface *iface);
+static void peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (GtrCodeViewPlugin,
+                                gtr_code_view_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))
 
 static void
 insert_link (GtkTextBuffer * buffer, GtkTextIter * iter,
              const gchar * path, gint * line,
-             GtrSourceCodeViewPlugin * plugin,
+             GtrCodeViewPlugin * plugin,
              const gchar * msgid)
 {
   GtkTextTag *tag;
@@ -126,7 +140,7 @@ show_in_editor (const gchar * program_name,
 }
 
 static void
-show_source (GtrSourceCodeViewPlugin * plugin, const gchar * path, gint line)
+show_source (GtrCodeViewPlugin * plugin, const gchar * path, gint line)
 {
   gboolean use_editor;
 
@@ -212,7 +226,7 @@ out:
 }
 
 static void
-follow_if_link (GtrSourceCodeViewPlugin * plugin,
+follow_if_link (GtrCodeViewPlugin * plugin,
                 GtkWidget * text_view, GtkTextIter * iter)
 {
   GSList *tags = NULL, *tagp = NULL;
@@ -270,7 +284,7 @@ follow_if_link (GtrSourceCodeViewPlugin * plugin,
 
 static gboolean
 event_after (GtkWidget * text_view,
-             GdkEvent * ev, GtrSourceCodeViewPlugin * plugin)
+             GdkEvent * ev, GtrCodeViewPlugin * plugin)
 {
   GtkTextIter start, end, iter;
   GtkTextBuffer *buffer;
@@ -389,31 +403,77 @@ visibility_notify_event (GtkWidget * text_view, GdkEventVisibility * event)
 }
 
 static void
-gtr_source_code_view_plugin_init (GtrSourceCodeViewPlugin * plugin)
+gtr_code_view_plugin_init (GtrCodeViewPlugin *plugin)
 {
-  plugin->priv = GTR_SOURCE_CODE_VIEW_PLUGIN_GET_PRIVATE (plugin);
+  plugin->priv = GTR_CODE_VIEW_PLUGIN_GET_PRIVATE (plugin);
 
   plugin->priv->settings = g_settings_new ("org.gnome.gtranslator.plugins.codeview");
   plugin->priv->tags = NULL;
 }
 
 static void
-gtr_source_code_view_plugin_dispose (GObject * object)
+gtr_code_view_plugin_dispose (GObject *object)
 {
-  GtrSourceCodeViewPlugin *plugin = GTR_SOURCE_CODE_VIEW_PLUGIN (object);
+  GtrCodeViewPluginPrivate *priv = GTR_CODE_VIEW_PLUGIN (object)->priv;
+
+  if (priv->settings != NULL)
+    {
+      g_object_unref (priv->settings);
+      priv->settings = NULL;
+    }
 
-  if (plugin->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_source_code_view_plugin_parent_class)->dispose (object);
+  G_OBJECT_CLASS (gtr_code_view_plugin_parent_class)->dispose (object);
+}
+
+static void
+gtr_code_view_plugin_set_property (GObject      *object,
+                                   guint         prop_id,
+                                   const GValue *value,
+                                   GParamSpec   *pspec)
+{
+  GtrCodeViewPluginPrivate *priv = GTR_CODE_VIEW_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
+gtr_code_view_plugin_get_property (GObject    *object,
+                                   guint       prop_id,
+                                   GValue     *value,
+                                   GParamSpec *pspec)
+{
+  GtrCodeViewPluginPrivate *priv = GTR_CODE_VIEW_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
 showed_message_cb (GtrTab * tab,
-                   GtrMsg * msg, GtrSourceCodeViewPlugin * plugin)
+                   GtrMsg * msg, GtrCodeViewPlugin * plugin)
 {
   const gchar *filename = NULL;
   gint i = 0;
@@ -463,7 +523,7 @@ showed_message_cb (GtrTab * tab,
 }
 
 static void
-delete_text_and_tags (GtrTab * tab, GtrSourceCodeViewPlugin * plugin)
+delete_text_and_tags (GtrTab * tab, GtrCodeViewPlugin * plugin)
 {
   GSList *tagp = NULL, *tags;
   GtkTextBuffer *buffer;
@@ -509,7 +569,7 @@ delete_text_and_tags (GtrTab * tab, GtrSourceCodeViewPlugin * plugin)
 
 static void
 message_edition_finished_cb (GtrTab * tab,
-                             GtrMsg * msg, GtrSourceCodeViewPlugin * plugin)
+                             GtrMsg * msg, GtrCodeViewPlugin * plugin)
 {
   delete_text_and_tags (tab, plugin);
 }
@@ -517,7 +577,7 @@ message_edition_finished_cb (GtrTab * tab,
 static void
 on_context_panel_reloaded (GtrContextPanel         *panel,
                            GtrMsg                  *msg,
-                           GtrSourceCodeViewPlugin *plugin)
+                           GtrCodeViewPlugin *plugin)
 {
   GtrTab *tab;
 
@@ -529,7 +589,7 @@ on_context_panel_reloaded (GtrContextPanel         *panel,
 static void
 page_added_cb (GtkNotebook * notebook,
                GtkWidget * child,
-               guint page_num, GtrSourceCodeViewPlugin * plugin)
+               guint page_num, GtrCodeViewPlugin * plugin)
 {
   GtrContextPanel *panel;
   GtkTextView *view;
@@ -555,21 +615,20 @@ page_added_cb (GtkNotebook * notebook,
 
 static void
 use_editor_toggled (GtkToggleButton * button,
-                    GtrSourceCodeViewPlugin * plugin)
+                    GtrCodeViewPlugin * plugin)
 {
   gtk_widget_set_sensitive (plugin->priv->program_box,
                             gtk_toggle_button_get_active (button));
 }
 
 static GtkWidget *
-get_configuration_dialog (GtrSourceCodeViewPlugin * plugin)
+get_configuration_dialog (GtrCodeViewPlugin *plugin)
 {
-
   gboolean ret;
   GtkWidget *error_widget;
   gchar *path;
   gchar *root_objects[] = {
-    "dialog",
+    "main_box",
     NULL
   };
 
@@ -577,7 +636,6 @@ get_configuration_dialog (GtrSourceCodeViewPlugin * plugin)
   ret = gtr_utils_get_ui_objects (path,
                                   root_objects,
                                   &error_widget,
-                                  "dialog", &plugin->priv->dialog,
                                   "main_box", &plugin->priv->main_box,
                                   "use_editor",
                                   &plugin->priv->use_editor_checkbutton,
@@ -587,14 +645,15 @@ get_configuration_dialog (GtrSourceCodeViewPlugin * plugin)
                                   &plugin->priv->program_cmd_entry,
                                   "line_cmd",
                                   &plugin->priv->line_cmd_entry, NULL);
-  g_free (path);
 
   if (!ret)
     {
-      //FIXME: We have to show a dialog
+      g_error ("Error loading file \"%s\"", path);
     }
 
-  //Use editor
+  g_free (path);
+
+  /* Use editor */
   g_signal_connect (plugin->priv->use_editor_checkbutton, "toggled",
                     G_CALLBACK (use_editor_toggled), plugin);
 
@@ -616,15 +675,15 @@ get_configuration_dialog (GtrSourceCodeViewPlugin * plugin)
                    "text",
                    G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
 
-  return plugin->priv->dialog;
+  return plugin->priv->main_box;
 }
 
 static void
-impl_activate (GtrPlugin * plugin, GtrWindow * window)
+gtr_code_view_plugin_activate (GtrWindowActivatable *activatable)
 {
+  GtrCodeViewPluginPrivate *priv = GTR_CODE_VIEW_PLUGIN (activatable)->priv;
   GtkWidget *notebook;
   GList *tabs, *l;
-  GtrSourceCodeViewPlugin *source_code_view = GTR_SOURCE_CODE_VIEW_PLUGIN (plugin);
 
   /*
    * Cursors
@@ -632,43 +691,42 @@ impl_activate (GtrPlugin * plugin, GtrWindow * window)
   hand_cursor = gdk_cursor_new (GDK_HAND2);
   regular_cursor = gdk_cursor_new (GDK_XTERM);
 
-  notebook = GTK_WIDGET (gtr_window_get_notebook (window));
-
-  source_code_view->priv->window = window;
+  notebook = GTK_WIDGET (gtr_window_get_notebook (priv->window));
 
   g_signal_connect (notebook, "page-added",
-                    G_CALLBACK (page_added_cb), plugin);
+                    G_CALLBACK (page_added_cb), activatable);
 
   /*
    * If we already have tabs opened we have to add them
    */
-  tabs = gtr_window_get_all_tabs (window);
+  tabs = gtr_window_get_all_tabs (priv->window);
   for (l = tabs; l != NULL; l = g_list_next (l))
     {
       GtrPo *po;
       GList *msg;
 
       page_added_cb (GTK_NOTEBOOK (notebook),
-                     l->data, 0, GTR_SOURCE_CODE_VIEW_PLUGIN (plugin));
+                     l->data, 0, GTR_CODE_VIEW_PLUGIN (activatable));
 
       po = gtr_tab_get_po (GTR_TAB (l->data));
       msg = gtr_po_get_current_message (po);
 
       showed_message_cb (GTR_TAB (l->data),
-                         msg->data, GTR_SOURCE_CODE_VIEW_PLUGIN (plugin));
+                         msg->data, GTR_CODE_VIEW_PLUGIN (activatable));
     }
 }
 
 static void
-impl_deactivate (GtrPlugin * plugin, GtrWindow * window)
+gtr_code_view_plugin_deactivate (GtrWindowActivatable *activatable)
 {
+  GtrCodeViewPluginPrivate *priv = GTR_CODE_VIEW_PLUGIN (activatable)->priv;
   GList *tabs, *l;
   GtkTextView *view;
   GtrContextPanel *panel;
   GtkWidget *notebook;
 
-  tabs = gtr_window_get_all_tabs (window);
-  notebook = GTK_WIDGET (gtr_window_get_notebook (window));
+  tabs = gtr_window_get_all_tabs (priv->window);
+  notebook = GTK_WIDGET (gtr_window_get_notebook (priv->window));
 
   for (l = tabs; l != NULL; l = g_list_next (l))
     {
@@ -676,56 +734,67 @@ impl_deactivate (GtrPlugin * plugin, GtrWindow * window)
       view = gtr_context_panel_get_context_text_view (panel);
 
       delete_text_and_tags (GTR_TAB (l->data),
-                            GTR_SOURCE_CODE_VIEW_PLUGIN (plugin));
+                            GTR_CODE_VIEW_PLUGIN (activatable));
 
       g_signal_handlers_disconnect_by_func (l->data,
-                                            showed_message_cb, plugin);
+                                            showed_message_cb, activatable);
 
-      g_signal_handlers_disconnect_by_func (view, event_after, window);
+      g_signal_handlers_disconnect_by_func (view, event_after, priv->window);
       g_signal_handlers_disconnect_by_func (view, motion_notify_event, NULL);
       g_signal_handlers_disconnect_by_func (view,
                                             visibility_notify_event, NULL);
     }
 
-  g_signal_handlers_disconnect_by_func (notebook, page_added_cb, plugin);
+  g_signal_handlers_disconnect_by_func (notebook, page_added_cb, activatable);
 }
 
-static void
-configure_dialog_response_cb (GtkWidget * widget,
-                              gint response, GtrSourceCodeViewPlugin * plugin)
+static GtkWidget *
+gtr_code_view_create_configure_widget (PeasGtkConfigurable *configurable)
 {
-  gtk_widget_destroy (plugin->priv->dialog);
+  return get_configuration_dialog (GTR_CODE_VIEW_PLUGIN (configurable));
 }
 
-static GtkWidget *
-impl_create_configure_dialog (GtrPlugin * plugin)
+static void
+gtr_code_view_plugin_class_init (GtrCodeViewPluginClass * klass)
 {
-  GtkWidget *dialog;
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  dialog = get_configuration_dialog (GTR_SOURCE_CODE_VIEW_PLUGIN (plugin));
+  object_class->dispose = gtr_code_view_plugin_dispose;
+  object_class->set_property = gtr_code_view_plugin_set_property;
+  object_class->get_property = gtr_code_view_plugin_get_property;
 
-  g_signal_connect (dialog,
-                    "response",
-                    G_CALLBACK (configure_dialog_response_cb),
-                    GTR_SOURCE_CODE_VIEW_PLUGIN (plugin));
-  g_signal_connect (dialog,
-                    "destroy", G_CALLBACK (gtk_widget_destroy), &dialog);
+  g_object_class_override_property (object_class, PROP_WINDOW, "window");
 
-  return dialog;
+  g_type_class_add_private (object_class, sizeof (GtrCodeViewPluginPrivate));
 }
 
 static void
-gtr_source_code_view_plugin_class_init (GtrSourceCodeViewPluginClass * klass)
+gtr_code_view_plugin_class_finalize (GtrCodeViewPluginClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GtrPluginClass *plugin_class = GTR_PLUGIN_CLASS (klass);
+}
 
-  object_class->dispose = gtr_source_code_view_plugin_dispose;
+static void
+peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface)
+{
+  iface->create_configure_widget = gtr_code_view_create_configure_widget;
+}
 
-  plugin_class->activate = impl_activate;
-  plugin_class->deactivate = impl_deactivate;
-  plugin_class->create_configure_dialog = impl_create_configure_dialog;
+static void
+gtr_window_activatable_iface_init (GtrWindowActivatableInterface *iface)
+{
+  iface->activate = gtr_code_view_plugin_activate;
+  iface->deactivate = gtr_code_view_plugin_deactivate;
+}
 
-  g_type_class_add_private (object_class,
-                            sizeof (GtrSourceCodeViewPluginPrivate));
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+  gtr_code_view_plugin_register_type (G_TYPE_MODULE (module));
+
+  peas_object_module_register_extension_type (module,
+                                              GTR_TYPE_WINDOW_ACTIVATABLE,
+                                              GTR_TYPE_CODE_VIEW_PLUGIN);
+  peas_object_module_register_extension_type (module,
+                                              PEAS_GTK_TYPE_CONFIGURABLE,
+                                              GTR_TYPE_CODE_VIEW_PLUGIN);
 }
diff --git a/plugins/codeview/gtr-codeview-plugin.h b/plugins/codeview/gtr-codeview-plugin.h
new file mode 100644
index 0000000..1c47c64
--- /dev/null
+++ b/plugins/codeview/gtr-codeview-plugin.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2008  Ignacio Casal Quinteiro <nacho resa gmail com>
+ * 
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU General Public License as published by
+ *     the Free Software Foundation, either version 3 of the License, or
+ *     (at your option) any later version.
+ * 
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANPOILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ * 
+ *     You should have received a copy of the GNU General Public License
+ *     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __GTR_CODE_VIEW_PLUGIN_H__
+#define __GTR_CODE_VIEW_PLUGIN_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
+
+G_BEGIN_DECLS
+
+#define GTR_TYPE_CODE_VIEW_PLUGIN		(gtr_code_view_plugin_get_type ())
+#define GTR_CODE_VIEW_PLUGIN(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), GTR_TYPE_CODE_VIEW_PLUGIN, GtrCodeViewPlugin))
+#define GTR_CODE_VIEW_PLUGIN_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), GTR_TYPE_CODE_VIEW_PLUGIN, GtrCodeViewPluginClass))
+#define GTR_IS_CODE_VIEW_PLUGIN(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GTR_TYPE_CODE_VIEW_PLUGIN))
+#define GTR_IS_CODE_VIEW_PLUGIN_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GTR_TYPE_CODE_VIEW_PLUGIN))
+#define GTR_CODE_VIEW_PLUGIN_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GTR_TYPE_CODE_VIEW_PLUGIN_PLUGIN, GtrCodeViewPluginClass))
+
+typedef struct _GtrCodeViewPlugin        GtrCodeViewPlugin;
+typedef struct _GtrCodeViewPluginPrivate GtrCodeViewPluginPrivate;
+typedef struct _GtrCodeViewPluginClass   GtrCodeViewPluginClass;
+
+struct _GtrCodeViewPlugin
+{
+  PeasExtensionBase parent_instance;
+
+  /* private */
+  GtrCodeViewPluginPrivate *priv;
+};
+
+struct _GtrCodeViewPluginClass
+{
+  PeasExtensionBaseClass parent_class;
+};
+
+GType gtr_code_view_plugin_get_type (void) G_GNUC_CONST;
+
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
+
+G_END_DECLS
+#endif /* __GTR_CODE_VIEW_PLUGIN_H__ */
diff --git a/plugins/codeview/gtr-source-code-view.gtranslator-plugin.desktop.in b/plugins/codeview/gtr-codeview.plugin.desktop.in
similarity index 57%
rename from plugins/codeview/gtr-source-code-view.gtranslator-plugin.desktop.in
rename to plugins/codeview/gtr-codeview.plugin.desktop.in
index de0ed39..eaf8713 100644
--- a/plugins/codeview/gtr-source-code-view.gtranslator-plugin.desktop.in
+++ b/plugins/codeview/gtr-codeview.plugin.desktop.in
@@ -1,8 +1,8 @@
-[Gtranslator Plugin]
+[Plugin]
 Module=sourcecodeview
 IAge=2
 _Name=Source Code View
 _Description=Show the message in the source code.
-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
diff --git a/plugins/codeview/gtr-viewer.c b/plugins/codeview/gtr-viewer.c
index d36f0d8..c78a83b 100644
--- a/plugins/codeview/gtr-viewer.c
+++ b/plugins/codeview/gtr-viewer.c
@@ -40,14 +40,16 @@
 
 
 G_DEFINE_TYPE (GtrViewer, gtr_viewer, GTK_TYPE_DIALOG)
-     struct _GtrViewerPrivate
-     {
-       GtkWidget *main_box;
-       GtkWidget *view;
-       GtkWidget *filename_label;
-     };
-
-     static void dialog_response_handler (GtkDialog * dlg, gint res_id)
+
+struct _GtrViewerPrivate
+{
+  GtkWidget *main_box;
+  GtkWidget *view;
+  GtkWidget *filename_label;
+};
+
+static void
+dialog_response_handler (GtkDialog * dlg, gint res_id)
 {
   switch (res_id)
     {
diff --git a/plugins/codeview/gtr-viewer.h b/plugins/codeview/gtr-viewer.h
index 85e4ac9..2843ce9 100644
--- a/plugins/codeview/gtr-viewer.h
+++ b/plugins/codeview/gtr-viewer.h
@@ -26,22 +26,17 @@
 #include "gtr-msg.h"
 
 G_BEGIN_DECLS
-/*
- * Type checking and casting macros
- */
+
 #define GTR_TYPE_VIEWER		(gtr_viewer_get_type ())
 #define GTR_VIEWER(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), GTR_TYPE_VIEWER, GtrViewer))
 #define GTR_VIEWER_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST((k), GTR_TYPE_VIEWER, GtrViewerClass))
-#define GTR_IS_VIEWER(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GTR_TYPE_VIEWER))
+#define GTR_IS_VIEWER(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GTR_TYPE_VIEWER))
 #define GTR_IS_VIEWER_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GTR_TYPE_VIEWER))
 #define GTR_VIEWER_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GTR_TYPE_VIEWER, GtrViewerClass))
-/* Private structure type */
-typedef struct _GtrViewerPrivate GtrViewerPrivate;
 
-/*
- * Main object structure
- */
-typedef struct _GtrViewer GtrViewer;
+typedef struct _GtrViewer        GtrViewer;
+typedef struct _GtrViewerPrivate GtrViewerPrivate;
+typedef struct _GtrViewerClass   GtrViewerClass;
 
 struct _GtrViewer
 {
@@ -51,26 +46,16 @@ struct _GtrViewer
   GtrViewerPrivate *priv;
 };
 
-/*
- * Class definition
- */
-typedef struct _GtrViewerClass GtrViewerClass;
-
 struct _GtrViewerClass
 {
   GtkDialogClass parent_class;
 };
 
-/*
- * Public methods
- */
-GType
-gtr_viewer_get_type (void)
-  G_GNUC_CONST;
+GType gtr_viewer_get_type (void) G_GNUC_CONST;
 
-     GType gtr_viewer_register_type (GTypeModule * module);
+GType gtr_viewer_register_type (GTypeModule * module);
 
-     void gtr_show_viewer (GtrWindow * window, const gchar * path, gint line);
+void gtr_show_viewer (GtrWindow * window, const gchar * path, gint line);
 
 G_END_DECLS
 #endif /* __VIEWER_H__ */



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