[vinagre: 17/22] Port everything to Peas



commit f9131b616773adb7febc3759db6988f42b426918
Author: Jonh Wendell <jwendell gnome org>
Date:   Fri Jul 30 16:37:13 2010 +0200

    Port everything to Peas

 vinagre/vinagre-applet.c              |   10 +++---
 vinagre/vinagre-bookmarks-migration.c |   12 ++++----
 vinagre/vinagre-bookmarks-ui.c        |   30 +++++++++---------
 vinagre/vinagre-bookmarks.c           |   12 ++++----
 vinagre/vinagre-commands.c            |    4 ++-
 vinagre/vinagre-connect.c             |   43 ++++++++++++++-------------
 vinagre/vinagre-connection.c          |   51 ++++++++++++++++-----------------
 vinagre/vinagre-fav.c                 |   10 +++---
 vinagre/vinagre-main.c                |   11 ++++---
 vinagre/vinagre-mdns.c                |   23 ++++++++------
 vinagre/vinagre-plugin-dialog.c       |    5 ++-
 vinagre/vinagre-tab.c                 |   40 ++++++++++++-------------
 vinagre/vinagre-utils.c               |    4 +-
 vinagre/vinagre-utils.h               |    3 +-
 vinagre/vinagre-window.c              |   17 ++++-------
 15 files changed, 137 insertions(+), 138 deletions(-)
---
diff --git a/vinagre/vinagre-applet.c b/vinagre/vinagre-applet.c
index 83e13d5..b51fabb 100644
--- a/vinagre/vinagre-applet.c
+++ b/vinagre/vinagre-applet.c
@@ -30,7 +30,7 @@
 #include "vinagre-utils.h"
 #include "vinagre-connection.h"
 #include "vinagre-commands.h"
-#include "vinagre-plugin.h"
+#include "vinagre-protocol-ext.h"
 #include "vinagre-plugins-engine.h"
 
 #include <config.h>
@@ -298,7 +298,7 @@ fill_recursive_menu (GSList *entries, GtkWidget *menu)
     {
       VinagreBookmarksEntry *entry = VINAGRE_BOOKMARKS_ENTRY (l->data);
       VinagreConnection     *conn;
-      VinagrePlugin         *plugin;
+      VinagreProtocolExt    *ext;
 
       switch (vinagre_bookmarks_entry_get_node (entry))
 	{
@@ -319,10 +319,10 @@ fill_recursive_menu (GSList *entries, GtkWidget *menu)
 
 	  case VINAGRE_BOOKMARKS_ENTRY_NODE_CONN:
 	    conn = vinagre_bookmarks_entry_get_conn (entry);
-	    plugin = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
-								    vinagre_connection_get_protocol (conn));
+	    ext = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
+								 vinagre_connection_get_protocol (conn));
 
-	    image = gtk_image_new_from_icon_name (vinagre_plugin_get_icon_name (plugin),
+	    image = gtk_image_new_from_icon_name (vinagre_protocol_ext_get_icon_name (ext),
 						  GTK_ICON_SIZE_MENU);
 	    item = gtk_image_menu_item_new_with_label (vinagre_connection_get_name (conn));
 	    gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
diff --git a/vinagre/vinagre-bookmarks-migration.c b/vinagre/vinagre-bookmarks-migration.c
index a8139f1..f6debaa 100644
--- a/vinagre/vinagre-bookmarks-migration.c
+++ b/vinagre/vinagre-bookmarks-migration.c
@@ -34,7 +34,7 @@
 #include "vinagre-connection.h"
 #include "vinagre-bookmarks-migration.h"
 #include "vinagre-bookmarks.h"
-#include "vinagre-plugin.h"
+#include "vinagre-protocol-ext.h"
 #include "vinagre-plugins-engine.h"
 #include "vinagre-dirs.h"
 #include "vinagre-utils.h"
@@ -156,11 +156,11 @@ create_list (GKeyFile *kf)
   GSList *entries;
   gchar **conns;
   gsize   length, i;
-  VinagrePlugin *plugin;
+  VinagreProtocolExt *ext;
 
-  plugin = g_hash_table_lookup (vinagre_plugin_engine_get_plugins_by_protocol (vinagre_plugins_engine_get_default ()),
-				"vnc");
-  if (!plugin)
+  ext = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (), "vnc");
+
+  if (!ext)
     {
       g_warning (_("Error while migrating bookmarks: VNC plugin is not activated"));
       return NULL;
@@ -178,7 +178,7 @@ create_list (GKeyFile *kf)
       if (!s_value)
         continue;
 
-      conn = vinagre_plugin_new_connection (plugin);
+      conn = vinagre_protocol_ext_new_connection (ext);
       i_value = g_key_file_get_integer (kf, conns[i], "port", NULL);
       if (i_value == 0)
         i_value = 5900;
diff --git a/vinagre/vinagre-bookmarks-ui.c b/vinagre/vinagre-bookmarks-ui.c
index 17fd6bd..af1cca2 100644
--- a/vinagre/vinagre-bookmarks-ui.c
+++ b/vinagre/vinagre-bookmarks-ui.c
@@ -24,7 +24,7 @@
 #include "vinagre-bookmarks-ui.h"
 #include "vinagre-utils.h"
 #include "vinagre-bookmarks-tree.h"
-#include "vinagre-plugin.h"
+#include "vinagre-protocol-ext.h"
 #include "vinagre-plugins-engine.h"
 
 static void
@@ -118,16 +118,16 @@ show_dialog_conn (VinagreBookmarks      *book,
 		  VinagreBookmarksEntry *entry,
 		  gboolean               is_add)
 {
-  gchar             *str, *host, *error_str, *protocol;
-  gint               port;
-  GtkBuilder        *xml;
-  GtkWidget         *dialog, *host_entry, *name_entry, *fs_check;
-  GtkWidget         *folder_box, *tree, *save_button, *plugin_box;
-  GtkWidget         *plugin_options, *protocol_label;
-  VinagreConnection *conn;
-  const gchar       *name;
-  VinagrePlugin     *plugin;
-  gchar             **props;
+  gchar              *str, *host, *error_str, *protocol;
+  gint                port;
+  GtkBuilder         *xml;
+  GtkWidget          *dialog, *host_entry, *name_entry, *fs_check;
+  GtkWidget          *folder_box, *tree, *save_button, *plugin_box;
+  GtkWidget          *plugin_options, *protocol_label;
+  VinagreConnection  *conn;
+  const gchar        *name;
+  VinagreProtocolExt *ext;
+  gchar              **props;
 
   xml = vinagre_utils_get_builder (NULL, NULL);
   dialog         = GTK_WIDGET (gtk_builder_get_object (xml, "bookmarks_add_edit_conn_dialog"));
@@ -155,15 +155,15 @@ show_dialog_conn (VinagreBookmarks      *book,
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fs_check),
 				vinagre_connection_get_fullscreen (conn));
 
-  plugin = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
-							  vinagre_connection_get_protocol (conn));
-  plugin_options = vinagre_plugin_get_connect_widget (plugin, conn);
+  ext = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
+						       vinagre_connection_get_protocol (conn));
+  plugin_options = vinagre_protocol_ext_get_connect_widget (ext, conn);
   if (plugin_options)
     gtk_box_pack_start (GTK_BOX (plugin_box), plugin_options, TRUE, TRUE, 0);
   else
     gtk_widget_hide (plugin_box);
 
-  props = vinagre_plugin_get_public_description (plugin);
+  props = vinagre_protocol_ext_get_public_description (ext);
   /* Translators: %s is a protocol name, like VNC or SSH */
   str = g_strdup_printf (_("(Protocol: %s)"), props[0]);
   gtk_label_set_label (GTK_LABEL (protocol_label), str);
diff --git a/vinagre/vinagre-bookmarks.c b/vinagre/vinagre-bookmarks.c
index 6bb04ba..8ce69a9 100644
--- a/vinagre/vinagre-bookmarks.c
+++ b/vinagre/vinagre-bookmarks.c
@@ -28,9 +28,9 @@
 #include "vinagre-bookmarks-entry.h"
 #include "vinagre-bookmarks-migration.h"
 #include "vinagre-connection.h"
-#include "vinagre-plugin.h"
 #include "vinagre-plugins-engine.h"
 #include "vinagre-dirs.h"
+#include "vinagre-protocol-ext.h"
 
 struct _VinagreBookmarksPrivate
 {
@@ -242,7 +242,7 @@ vinagre_bookmarks_parse_item (xmlNode *root)
   xmlNode               *curr;
   xmlChar               *s_value;
   gchar                 *protocol = NULL;
-  VinagrePlugin         *plugin;
+  VinagreProtocolExt    *ext;
 
   /* Loop to discover the protocol */
   for (curr = root->children; curr; curr = curr->next)
@@ -259,15 +259,15 @@ vinagre_bookmarks_parse_item (xmlNode *root)
   if (!protocol)
     protocol = g_strdup ("vnc");
 
-  plugin = g_hash_table_lookup (vinagre_plugin_engine_get_plugins_by_protocol (vinagre_plugins_engine_get_default ()),
-				protocol);
-  if (!plugin)
+  ext = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (), protocol);
+
+  if (!ext)
     {
       g_warning (_("The protocol %s is not supported."), protocol);
       goto out;
     }
 
-  conn = vinagre_plugin_new_connection (plugin);
+  conn = vinagre_protocol_ext_new_connection (ext);
   vinagre_connection_parse_item (conn, root);
 
   if (vinagre_connection_get_host (conn))
diff --git a/vinagre/vinagre-commands.c b/vinagre/vinagre-commands.c
index 993b9ce..4597f43 100644
--- a/vinagre/vinagre-commands.c
+++ b/vinagre/vinagre-commands.c
@@ -39,7 +39,7 @@
 #include "vinagre-window-private.h"
 #include "vinagre-prefs.h"
 #include "vinagre-cache-prefs.h"
-#include "vinagre-plugin.h"
+#include "vinagre-protocol-ext.h"
 #include "vinagre-plugins-engine.h"
 #include "vinagre-plugin-dialog.h"
 
@@ -127,6 +127,7 @@ vinagre_cmd_machine_open (GtkAction     *action,
   gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), FALSE);
   gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
 
+/* TODO
   plugins = (GSList *) vinagre_plugins_engine_get_plugin_list (vinagre_plugins_engine_get_default ());
   i = 0;
   for (; plugins; plugins = plugins->next)
@@ -143,6 +144,7 @@ vinagre_cmd_machine_open (GtkAction     *action,
 	  i++;
 	}
     }
+*/
   if (i == 0)
     {
       vinagre_utils_show_error (_("There are no supported files"),
diff --git a/vinagre/vinagre-connect.c b/vinagre/vinagre-connect.c
index 3ec88b0..2a253ab 100644
--- a/vinagre/vinagre-connect.c
+++ b/vinagre/vinagre-connect.c
@@ -37,7 +37,7 @@
 #include "vinagre-prefs.h"
 #include "vinagre-cache-prefs.h"
 #include "vinagre-plugins-engine.h"
-#include "vinagre-plugin.h"
+#include "vinagre-protocol-ext.h"
 #include "vinagre-dirs.h"
 
 typedef struct {
@@ -129,7 +129,7 @@ protocol_combo_changed (GtkComboBox *combo, VinagreConnectDialog *dialog)
 static void
 setup_protocol (VinagreConnectDialog *dialog)
 {
-  GHashTable      *plugins;
+  GHashTable      *extensions;
   GHashTableIter  hash_iter;
   gpointer        key, value;
   GtkTreeIter     tree_iter;
@@ -138,31 +138,32 @@ setup_protocol (VinagreConnectDialog *dialog)
   gint            selected, i;
 
   dialog->protocol_store = gtk_list_store_new (N_PROTOCOLS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_OBJECT, G_TYPE_OBJECT);
-  plugins = vinagre_plugin_engine_get_plugins_by_protocol (vinagre_plugins_engine_get_default ());
+  extensions = vinagre_plugins_engine_get_plugins_by_protocol (vinagre_plugins_engine_get_default ());
   last_protocol = vinagre_cache_prefs_get_string ("connection", "last-protocol", NULL);
 
-  g_hash_table_iter_init (&hash_iter, plugins);
+  g_hash_table_iter_init (&hash_iter, extensions);
   selected = 0;
   i = 0;
   while (g_hash_table_iter_next (&hash_iter, &key, &value)) 
     {
-      gchar         **description;
-      VinagrePlugin *plugin = VINAGRE_PLUGIN (value);
-      GtkWidget     *widget;
+      gchar **description;
+      GtkWidget *widget;
+      VinagreProtocolExt *ext =  (VinagreProtocolExt *)value;
 
-      description = vinagre_plugin_get_public_description (plugin);
+      description = vinagre_protocol_ext_get_public_description (ext);
       if (!description || !description[0])
 	continue;
 
-      widget = vinagre_plugin_get_connect_widget (plugin, NULL);
+      //widget = vinagre_protocol_ext_get_connect_widget (ext, NULL);
+      widget = NULL;
 
       gtk_list_store_append (dialog->protocol_store, &tree_iter);
       gtk_list_store_set (dialog->protocol_store, &tree_iter,
 			  PROTOCOL_NAME, description[0],
 			  PROTOCOL_DESCRIPTION, description[1],
-			  PROTOCOL_MDNS, vinagre_plugin_get_mdns_service (plugin),
+			  PROTOCOL_MDNS, vinagre_protocol_ext_get_mdns_service (ext),
 			  PROTOCOL_OPTIONS, widget,
-			  PROTOCOL_PLUGIN, plugin,
+			  PROTOCOL_PLUGIN, ext,
 			  -1);
 
       if (last_protocol && g_str_equal (last_protocol, description[0]))
@@ -330,7 +331,7 @@ vinagre_connect_find_button_cb (GtkButton            *button,
   GtkTreeIter   tree_iter;
   gchar         *service;
   GtkWidget     *options = NULL;
-  VinagrePlugin *plugin = NULL;
+  VinagreProtocol *plugin = NULL;
 
   if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (dialog->protocol_combo),
 				      &tree_iter))
@@ -380,7 +381,7 @@ vinagre_connect_find_button_cb (GtkButton            *button,
 
       g_free (tmp);
       if (plugin && options)
-	vinagre_plugin_parse_mdns_dialog (plugin, options, d);
+	vinagre_protocol_parse_mdns_dialog (plugin, options, d);
     }
 
   g_free (service);
@@ -431,11 +432,11 @@ VinagreConnection *vinagre_connect (VinagreWindow *window)
 
   if (result == GTK_RESPONSE_OK)
     {
-      gchar         *host = NULL, *error_msg = NULL, *protocol = NULL, *actual_host;
-      gint          port;
-      VinagrePlugin *plugin;
-      GtkWidget     *options;
-      GtkTreeIter   iter;
+      gchar *host = NULL, *error_msg = NULL, *protocol = NULL, *actual_host;
+      gint port;
+      GtkWidget *options;
+      GtkTreeIter iter;
+      VinagreProtocolExt *ext;
 
       host = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog.host_entry));
       gtk_widget_hide (GTK_WIDGET (dialog.dialog));
@@ -454,14 +455,14 @@ VinagreConnection *vinagre_connect (VinagreWindow *window)
       gtk_tree_model_get (GTK_TREE_MODEL (dialog.protocol_store), &iter,
 			  PROTOCOL_NAME, &protocol,
 			  PROTOCOL_OPTIONS, &options,
-			  PROTOCOL_PLUGIN, &plugin,
+			  PROTOCOL_PLUGIN, &ext,
 		      -1);
 
       vinagre_cache_prefs_set_string ("connection", "last-protocol", protocol);
       g_free (protocol);
       vinagre_cache_prefs_set_boolean ("connection", "fullscreen", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog.fullscreen_check)));
 
-      conn = vinagre_plugin_new_connection (plugin);
+      conn = vinagre_protocol_ext_new_connection (ext);
       if (vinagre_connection_split_string (host,
 					   vinagre_connection_get_protocol (conn),
 					   &protocol,
@@ -487,7 +488,7 @@ VinagreConnection *vinagre_connect (VinagreWindow *window)
 				    GTK_WINDOW (window));
 	}
 
-      g_object_unref (plugin);
+      g_object_unref (ext);
       if (options)
 	g_object_unref (options);
 
diff --git a/vinagre/vinagre-connection.c b/vinagre/vinagre-connection.c
index f4c607a..42b7d84 100644
--- a/vinagre/vinagre-connection.c
+++ b/vinagre/vinagre-connection.c
@@ -26,7 +26,7 @@
 #include "vinagre-connection.h"
 #include "vinagre-enums.h"
 #include "vinagre-bookmarks.h"
-#include "vinagre-plugin.h"
+#include "vinagre-protocol-ext.h"
 #include "vinagre-plugins-engine.h"
 #include "vinagre-utils.h"
 
@@ -495,7 +495,7 @@ vinagre_connection_split_string (const gchar *uri,
   gint    lport;
   gchar  *lhost;
   gchar   ipv6_host[255] = {0,};
-  VinagrePlugin *plugin;
+  VinagreProtocolExt *ext;
 
   *error_msg = NULL;
   *host = NULL;
@@ -519,9 +519,9 @@ vinagre_connection_split_string (const gchar *uri,
       lhost = (gchar *) uri;
     }
 
-  plugin = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
-							  *protocol);
-  if (!plugin)
+  ext = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
+						       *protocol);
+  if (!ext)
     {
       *error_msg = g_strdup_printf (_("The protocol %s is not supported."), *protocol);
       g_free (*protocol);
@@ -545,12 +545,12 @@ vinagre_connection_split_string (const gchar *uri,
   if (g_strrstr (lhost, "::") != NULL)
     {
       server = g_strsplit (lhost, "::", 2);
-      lport = server[1] ? atoi (server[1]) : vinagre_plugin_get_default_port (plugin);
+      lport = server[1] ? atoi (server[1]) : vinagre_protocol_ext_get_default_port (ext);
     }
   else
     {
       server = g_strsplit (lhost, ":", 2);
-      lport = server[1] ? atoi (server[1]) : vinagre_plugin_get_default_port (plugin);
+      lport = server[1] ? atoi (server[1]) : vinagre_protocol_ext_get_default_port (ext);
 
       if ((g_str_equal (*protocol, "vnc")) && (lport < 1024))
         lport += 5900;
@@ -573,7 +573,7 @@ vinagre_connection_new_from_string (const gchar *uri, gchar **error_msg, gboolea
   VinagreConnection *conn = NULL;
   gint    port;
   gchar  *host, *protocol;
-  VinagrePlugin *plugin;
+  VinagreProtocolExt *ext;
 
   if (!vinagre_connection_split_string (uri, NULL, &protocol, &host, &port, error_msg))
     return NULL;
@@ -585,12 +585,12 @@ vinagre_connection_new_from_string (const gchar *uri, gchar **error_msg, gboolea
 				     port);
   if (!conn)
     {
-      plugin = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
-							      protocol);
-      if (!plugin)
+      ext = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
+							   protocol);
+      if (!ext)
 	goto finalize;
 
-      conn = vinagre_plugin_new_connection (plugin);
+      conn = vinagre_protocol_ext_new_connection (ext);
       vinagre_connection_set_host (conn, host);
       vinagre_connection_set_port (conn, port);
     }
@@ -608,9 +608,9 @@ vinagre_connection_new_from_file (const gchar *uri, gchar **error_msg, gboolean
   gchar             *data;
   GFile             *file_a;
   GError            *error;
-  GHashTable        *plugins;
+  GHashTable        *extensions;
   GHashTableIter     iter;
-  gpointer           plugin;
+  gpointer           ext;
 
   *error_msg = NULL;
   data = NULL;
@@ -636,14 +636,14 @@ vinagre_connection_new_from_file (const gchar *uri, gchar **error_msg, gboolean
       goto the_end;
     }
 
-  plugins = vinagre_plugin_engine_get_plugins_by_protocol (vinagre_plugins_engine_get_default ());
-  g_hash_table_iter_init (&iter, plugins);
-  while (g_hash_table_iter_next (&iter, NULL, &plugin))
+  extensions = vinagre_plugins_engine_get_plugins_by_protocol (vinagre_plugins_engine_get_default ());
+  g_hash_table_iter_init (&iter, extensions);
+  while (g_hash_table_iter_next (&iter, NULL, &ext))
     {
-      conn = vinagre_plugin_new_connection_from_file (VINAGRE_PLUGIN (plugin),
-						      data,
-						      use_bookmarks,
-						      error_msg);
+      conn = vinagre_protocol_ext_new_connection_from_file ((VinagreProtocolExt *)ext,
+							    data,
+							    use_bookmarks,
+							    error_msg);
       g_free (*error_msg);
       *error_msg = NULL;
       if (conn)
@@ -667,7 +667,7 @@ vinagre_connection_get_string_rep (VinagreConnection *conn,
   GString *uri;
   gchar *result;
   gboolean is_ipv6;
-  VinagrePlugin *plugin;
+  VinagreProtocolExt *ext;
 
   g_return_val_if_fail (VINAGRE_IS_CONNECTION (conn), NULL);
 
@@ -687,10 +687,9 @@ vinagre_connection_get_string_rep (VinagreConnection *conn,
   if (is_ipv6)
     g_string_append_c (uri, ']');
 
-  plugin = g_hash_table_lookup (vinagre_plugin_engine_get_plugins_by_protocol (vinagre_plugins_engine_get_default ()),
-				conn->priv->protocol);
-  if (plugin)
-    if (vinagre_plugin_get_default_port (plugin) != conn->priv->port)
+  ext = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (), conn->priv->protocol);
+  if (ext)
+    if (vinagre_protocol_ext_get_default_port (ext) != conn->priv->port)
       g_string_append_printf (uri, "::%d", conn->priv->port);
 
   result = uri->str;
diff --git a/vinagre/vinagre-fav.c b/vinagre/vinagre-fav.c
index b92da9b..70c7c6f 100644
--- a/vinagre/vinagre-fav.c
+++ b/vinagre/vinagre-fav.c
@@ -30,7 +30,7 @@
 #include "vinagre-bookmarks-ui.h"
 #include "vinagre-window-private.h"
 #include "vinagre-bookmarks-entry.h"
-#include "vinagre-plugin.h"
+#include "vinagre-protocol-ext.h"
 #include "vinagre-plugins-engine.h"
 #include "vinagre-commands.h"
 
@@ -963,7 +963,7 @@ vinagre_fav_fill_bookmarks (GtkTreeStore *store, GSList *list, GtkTreeIter *pare
   GSList                *l;
   GtkTreeIter            iter;
   VinagreConnection     *conn;
-  VinagrePlugin         *plugin;
+  VinagreProtocolExt    *ext;
 
  for (l = list; l; l = l->next)
     {
@@ -996,10 +996,10 @@ vinagre_fav_fill_bookmarks (GtkTreeStore *store, GSList *list, GtkTreeIter *pare
 	  case VINAGRE_BOOKMARKS_ENTRY_NODE_CONN:
 	    conn = vinagre_bookmarks_entry_get_conn (entry);
 	    name = vinagre_connection_get_best_name (conn);
-	    plugin = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
-								    vinagre_connection_get_protocol (conn));
+	    ext = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
+								 vinagre_connection_get_protocol (conn));
 
-	    pixbuf = vinagre_plugin_get_icon (plugin, 16);
+	    pixbuf = vinagre_protocol_ext_get_icon (ext, 16);
 
 	    gtk_tree_store_append (store, &iter, parent_iter);
 	    gtk_tree_store_set (store, &iter,
diff --git a/vinagre/vinagre-main.c b/vinagre/vinagre-main.c
index 7a895b6..cb012f0 100644
--- a/vinagre/vinagre-main.c
+++ b/vinagre/vinagre-main.c
@@ -34,10 +34,10 @@
 #include "vinagre-utils.h"
 #include "vinagre-prefs.h"
 #include "vinagre-cache-prefs.h"
-#include "vinagre-plugins-engine.h"
 #include "vinagre-debug.h"
 #include "vinagre-ssh.h"
 #include "vinagre-options.h"
+#include "vinagre-protocol-ext.h"
 
 #ifdef HAVE_TELEPATHY
 #include "vinagre-tubes-manager.h"
@@ -53,7 +53,7 @@ int main (int argc, char **argv) {
   GSList               *l, *plugins;
   GtkWindow            *window;
   GtkApplication       *app;
-  VinagrePluginsEngine *engine;
+//  VinagrePluginsEngine *engine;
 #ifdef HAVE_TELEPATHY
   VinagreTubesManager *vinagre_tubes_manager;
 #endif
@@ -73,8 +73,8 @@ int main (int argc, char **argv) {
 
   /* Init plugins engine */
   vinagre_debug_message (DEBUG_APP, "Init plugins");
-  engine = vinagre_plugins_engine_get_default ();
-  plugins = (GSList *) vinagre_plugins_engine_get_plugin_list (engine);
+  //engine = vinagre_plugins_engine_get_default ();
+  //plugins = (GSList *) vinagre_plugins_engine_get_plugin_list (engine);
 
   /* Setup command line options */
   context = g_option_context_new (_("- Remote Desktop Viewer"));
@@ -85,6 +85,7 @@ int main (int argc, char **argv) {
   g_option_context_add_group (context, g_irepository_get_option_group ());
 #endif
 
+/*
   for (l = plugins; l; l = l->next)
     {
       GSList            *groups, *l2;
@@ -98,7 +99,7 @@ int main (int argc, char **argv) {
 	g_option_context_add_group (context, (GOptionGroup *)l2->data);
       g_slist_free (groups);
     }
-
+*/
   g_option_context_parse (context, &argc, &argv, &error);
   g_option_context_free (context);
   if (error)
diff --git a/vinagre/vinagre-mdns.c b/vinagre/vinagre-mdns.c
index 29ebdac..704d254 100644
--- a/vinagre/vinagre-mdns.c
+++ b/vinagre/vinagre-mdns.c
@@ -27,7 +27,9 @@
 #include "vinagre-connection.h"
 #include "vinagre-bookmarks-entry.h"
 #include "vinagre-plugins-engine.h"
-#include "vinagre-plugin.h"
+#include "vinagre-protocol-ext.h"
+
+typedef struct {void *plugin; char*name;} VinagrePluginInfo;
 
 typedef struct
 {
@@ -94,7 +96,7 @@ mdns_resolver_found (GaServiceResolver *resolver,
     }
 
   avahi_address_snprint (a, sizeof(a), address);
-  conn = vinagre_plugin_new_connection (b_entry->info->plugin);
+  conn = vinagre_protocol_new_connection (b_entry->info->plugin);
   g_object_set (conn,
                 "name", name,
                 "port", port,
@@ -189,7 +191,7 @@ static void
 destroy_browser_entry (BrowserEntry *entry)
 {
   g_object_unref (entry->browser);
-  _vinagre_plugin_info_unref (entry->info);
+//  _vinagre_plugin_info_unref (entry->info);
   g_free (entry);
 }
 
@@ -202,10 +204,10 @@ vinagre_mdns_add_service (VinagrePluginInfo *info,
   const gchar      *service;
   BrowserEntry     *entry;
 
-  if (!vinagre_plugin_info_is_active (info))
-    return;
+//  if (!vinagre_plugin_info_is_active (info))
+//    return;
 
-  service = vinagre_plugin_get_mdns_service (info->plugin);
+  service = vinagre_protocol_get_mdns_service (info->plugin);
   if (!service)
     return;
 
@@ -245,7 +247,7 @@ vinagre_mdns_add_service (VinagrePluginInfo *info,
 
   entry = g_new (BrowserEntry, 1);
   entry->browser = g_object_ref (browser);
-  _vinagre_plugin_info_ref (info);
+  //_vinagre_plugin_info_ref (info);
   entry->info = info;
   g_hash_table_insert (mdns->priv->browsers, (gpointer)service, entry);
 }
@@ -286,12 +288,12 @@ plugin_deactivated_cb (VinagrePluginsEngine *engine,
 {
   const gchar *service;
 
-  service = vinagre_plugin_get_mdns_service (info->plugin);
+  service = vinagre_protocol_get_mdns_service (info->plugin);
   if (!service)
     return;
 
   vinagre_mdns_remove_entries_by_protocol (mdns,
-					   vinagre_plugin_get_protocol (info->plugin));
+					   vinagre_protocol_get_protocol (info->plugin));
   g_hash_table_remove (mdns->priv->browsers, (gconstpointer)service);
 
 }
@@ -319,11 +321,12 @@ vinagre_mdns_init (VinagreMdns *mdns)
     }
 
   engine = vinagre_plugins_engine_get_default ();
+/*
   plugins = (GSList *)vinagre_plugins_engine_get_plugin_list (engine);
   g_slist_foreach (plugins,
 		   (GFunc)vinagre_mdns_add_service,
 		   mdns);
-
+*/
   g_signal_connect_after (engine,
 			  "activate-plugin",
 			  G_CALLBACK (plugin_activated_cb),
diff --git a/vinagre/vinagre-plugin-dialog.c b/vinagre/vinagre-plugin-dialog.c
index 17d0348..578d383 100644
--- a/vinagre/vinagre-plugin-dialog.c
+++ b/vinagre/vinagre-plugin-dialog.c
@@ -20,9 +20,10 @@
  */
 
 #include <glib/gi18n.h>
+#include <libpeasui/peas-ui-plugin-manager.h>
 
 #include "vinagre-plugin-dialog.h"
-#include "vinagre-debug.h"
+#include "vinagre-plugins-engine.h"
 
 static GtkWidget *plugin_dialog = NULL;
 
@@ -61,7 +62,7 @@ setup_plugins_page (VinagrePluginDialog *dlg)
 {
   GtkWidget *page_content;
 
-  page_content = vinagre_plugin_manager_new ();
+  page_content = peas_ui_plugin_manager_new (PEAS_ENGINE (vinagre_plugins_engine_get_default ()));
   g_return_if_fail (page_content != NULL);
 
   gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
diff --git a/vinagre/vinagre-tab.c b/vinagre/vinagre-tab.c
index 89ef902..3dd90f6 100644
--- a/vinagre/vinagre-tab.c
+++ b/vinagre/vinagre-tab.c
@@ -31,7 +31,7 @@
 #include "vinagre-utils.h"
 #include "vinagre-prefs.h"
 #include "view/autoDrawer.h"
-#include "vinagre-plugin.h"
+#include "vinagre-protocol-ext.h"
 #include "vinagre-plugins-engine.h"
 
 #define VINAGRE_TAB_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), VINAGRE_TYPE_TAB, VinagreTabPrivate))
@@ -250,11 +250,11 @@ static void
 active_connections_button_clicked  (GtkToolButton *button,
 				    VinagreTab    *tab)
 {
-  GSList            *connections, *l;
-  VinagrePlugin     *plugin;
-  VinagreConnection *conn;
-  GtkWidget         *menu, *item, *image;
-  gchar             *str, *label;
+  GSList             *connections, *l;
+  VinagreProtocolExt *ext;
+  VinagreConnection  *conn;
+  GtkWidget          *menu, *item, *image;
+  gchar              *str, *label;
 
   menu = gtk_menu_new ();
 
@@ -262,10 +262,10 @@ active_connections_button_clicked  (GtkToolButton *button,
   for (l = connections; l; l = l->next)
     {
       conn = VINAGRE_TAB (l->data)->priv->conn;
-      plugin = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
-							      vinagre_connection_get_protocol (conn));
+      ext = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
+							   vinagre_connection_get_protocol (conn));
       item = gtk_image_menu_item_new_with_label ("");
-      image = gtk_image_new_from_icon_name (vinagre_plugin_get_icon_name (plugin),
+      image = gtk_image_new_from_icon_name (vinagre_protocol_ext_get_icon_name (ext),
 					    GTK_ICON_SIZE_MENU);
       gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
 
@@ -524,18 +524,17 @@ vinagre_tab_init (VinagreTab *tab)
 GtkWidget *
 vinagre_tab_new (VinagreConnection *conn, VinagreWindow *window)
 {
-  VinagrePlugin *plugin;
-  const gchar   *protocol = vinagre_connection_get_protocol (conn);
+  VinagreProtocolExt *ext;
+  const gchar *protocol = vinagre_connection_get_protocol (conn);
 
-  plugin = g_hash_table_lookup (vinagre_plugin_engine_get_plugins_by_protocol (vinagre_plugins_engine_get_default ()),
-				protocol);
-  if (!plugin)
+  ext = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (), protocol);
+  if (!ext)
     {
       g_warning (_("The protocol %s is not supported."), protocol);
       return NULL;
     }
 
-  return vinagre_plugin_new_tab (plugin, conn, window);
+  return vinagre_protocol_ext_new_tab (ext, conn, window);
 }
 
 gchar *
@@ -938,17 +937,16 @@ vinagre_tab_free_actions (GSList *actions)
 const gchar *
 vinagre_tab_get_icon_name (VinagreTab *tab)
 {
-  const gchar   *protocol;
-  VinagrePlugin *plugin;
+  const gchar *protocol;
+  VinagreProtocolExt *ext;
 
   g_return_val_if_fail (VINAGRE_IS_TAB (tab), NULL);
 
   protocol = vinagre_connection_get_protocol (tab->priv->conn);
-  plugin = g_hash_table_lookup (vinagre_plugin_engine_get_plugins_by_protocol (vinagre_plugins_engine_get_default ()),
-				protocol);
-  g_return_val_if_fail (plugin != NULL, NULL);
+  ext = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (), protocol);
+  g_return_val_if_fail (ext != NULL, NULL);
 
-  return vinagre_plugin_get_icon_name (plugin);
+  return vinagre_protocol_ext_get_icon_name (ext);
 }
 
 /* vim: set ts=8: */
diff --git a/vinagre/vinagre-utils.c b/vinagre/vinagre-utils.c
index 95201f9..1ebf294 100644
--- a/vinagre/vinagre-utils.c
+++ b/vinagre/vinagre-utils.c
@@ -141,7 +141,7 @@ vinagre_utils_get_ui_xml_filename (void)
  *  if the file cannot be found. In this case an error dialog will be shown.
  */
 GtkBuilder *
-vinagre_utils_get_builder (VinagrePlugin *plugin, const gchar *filename)
+vinagre_utils_get_builder (void *plugin, const gchar *filename)
 {
   GtkBuilder *xml = NULL;
   GError     *error = NULL;
@@ -149,7 +149,7 @@ vinagre_utils_get_builder (VinagrePlugin *plugin, const gchar *filename)
 
   if (plugin)
     {
-      plugin_datadir = vinagre_plugin_get_data_dir (plugin);
+      //plugin_datadir = vinagre_plugin_get_data_dir (plugin);
       actual_filename = g_build_filename (plugin_datadir, filename, NULL);
       g_free (plugin_datadir);
     }
diff --git a/vinagre/vinagre-utils.h b/vinagre/vinagre-utils.h
index 6b66ad1..8a10a90 100644
--- a/vinagre/vinagre-utils.h
+++ b/vinagre/vinagre-utils.h
@@ -23,7 +23,6 @@
 
 #include <gtk/gtk.h>
 #include <glib.h>
-#include "vinagre-plugin.h"
 
 /* useful macro */
 #define GBOOLEAN_TO_POINTER(i) ((gpointer) ((i) ? 2 : 1))
@@ -46,7 +45,7 @@ void		vinagre_utils_toggle_widget_visible	(GtkWidget *widget);
 
 const gchar	*vinagre_utils_get_ui_filename		(void);
 const gchar	*vinagre_utils_get_ui_xml_filename	(void);
-GtkBuilder	*vinagre_utils_get_builder		(VinagrePlugin *plugin, const gchar *filename);
+GtkBuilder	*vinagre_utils_get_builder		(void *plugin, const gchar *filename);
 
 gchar		*vinagre_utils_escape_underscores	(const gchar *text,
 							 gssize      length);
diff --git a/vinagre/vinagre-window.c b/vinagre/vinagre-window.c
index 1da0e98..9f011d0 100644
--- a/vinagre/vinagre-window.c
+++ b/vinagre/vinagre-window.c
@@ -42,7 +42,7 @@
 #include "vinagre-ui.h"
 #include "vinagre-window-private.h"
 #include "vinagre-bookmarks-entry.h"
-#include "vinagre-plugin.h"
+#include "vinagre-protocol-ext.h"
 #include "vinagre-plugins-engine.h"
 #include "vinagre-dirs.h"
 
@@ -63,8 +63,7 @@ vinagre_window_dispose (GObject *object)
 
   if (!window->priv->dispose_has_run)
     {
-      vinagre_plugins_engine_deactivate_plugins (vinagre_plugins_engine_get_default (),
-						 window);
+      peas_engine_garbage_collect (PEAS_ENGINE (vinagre_plugins_engine_get_default ()));
       window->priv->dispose_has_run = TRUE;
     }
 
@@ -495,7 +494,7 @@ vinagre_window_populate_bookmarks (VinagreWindow *window,
   GtkAction             *action;
   VinagreWindowPrivate  *p = window->priv;
   VinagreConnection     *conn;
-  VinagrePlugin         *plugin;
+  VinagreProtocolExt    *ext;
 
   for (l = entries; l; l = l->next)
     {
@@ -533,8 +532,8 @@ vinagre_window_populate_bookmarks (VinagreWindow *window,
 
 	  case VINAGRE_BOOKMARKS_ENTRY_NODE_CONN:
 	    conn = vinagre_bookmarks_entry_get_conn (entry);
-	    plugin = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
-								    vinagre_connection_get_protocol (conn));
+	    ext = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
+								 vinagre_connection_get_protocol (conn));
 
 	    action_name = vinagre_connection_get_best_name (conn);
 	    action_label = vinagre_utils_escape_underscores (action_name, -1);
@@ -552,7 +551,7 @@ vinagre_window_populate_bookmarks (VinagreWindow *window,
 				     NULL);
 	    g_object_set (G_OBJECT (action),
 			  "icon-name",
-			  vinagre_plugin_get_icon_name (plugin),
+			  vinagre_protocol_ext_get_icon_name (ext),
 			  NULL);
 	    g_object_set_data (G_OBJECT (action), "conn", conn);
 	    gtk_action_group_add_action (p->bookmarks_list_action_group,
@@ -801,10 +800,6 @@ vinagre_window_init (VinagreWindow *window)
                             window);
 #endif
 
-  vinagre_plugins_engine_activate_plugins (vinagre_plugins_engine_get_default (),
-					   window);
-
-
   g_idle_add ((GSourceFunc) vinagre_window_check_first_run, window);
 }
 



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