[vinagre] Migrate to GtkApplication



commit f2b426d2df1ae25d3777131d49b18a3df78743be
Author: Jonh Wendell <jwendell gnome org>
Date:   Thu Jul 15 14:50:09 2010 -0300

    Migrate to GtkApplication
    
    Closes #596733

 plugins/vnc/vinagre-vnc-listener.c |    7 +-
 po/POTFILES.in                     |    2 +-
 vinagre/Makefile.am                |   10 +-
 vinagre/bacon-message-connection.c |  396 ------------------------------------
 vinagre/bacon-message-connection.h |   43 ----
 vinagre/vinagre-app.c              |  306 ----------------------------
 vinagre/vinagre-app.h              |   74 -------
 vinagre/vinagre-bacon.c            |  296 ---------------------------
 vinagre/vinagre-bacon.h            |   27 ---
 vinagre/vinagre-main.c             |  153 ++++-----------
 vinagre/vinagre-options.c          |  227 +++++++++++++++++++++
 vinagre/vinagre-options.h          |   48 +++++
 vinagre/vinagre-plugins-engine.c   |    9 +-
 13 files changed, 321 insertions(+), 1277 deletions(-)
---
diff --git a/plugins/vnc/vinagre-vnc-listener.c b/plugins/vnc/vinagre-vnc-listener.c
index 0a29fd0..e7a5a18 100644
--- a/plugins/vnc/vinagre-vnc-listener.c
+++ b/plugins/vnc/vinagre-vnc-listener.c
@@ -32,7 +32,6 @@
 
 #include <glib/gi18n.h>
 #include <vinagre/vinagre-commands.h>
-#include <vinagre/vinagre-app.h>
 #include "vinagre-vnc-listener.h"
 #include "vinagre-vnc-connection.h"
 
@@ -152,7 +151,7 @@ static gboolean
 incoming (GIOChannel *source, GIOCondition condition, VinagreVncListener *listener)
 {
   VinagreConnection *conn;
-  VinagreWindow *window;
+  GtkWindow *window;
   int cl_sock;
   struct sockaddr_in6 client_addr;
   char client_name[INET6_ADDRSTRLEN];
@@ -162,7 +161,7 @@ incoming (GIOChannel *source, GIOCondition condition, VinagreVncListener *listen
   if (cl_sock < 0)
     g_error ("accept() failed");
 
-  window = vinagre_app_get_active_window (vinagre_app_get_default ());
+  window = gtk_application_get_window (GTK_APPLICATION (g_application_get_instance ()));
   if (!window)
     {
       g_warning (_("Incoming VNC connection arrived but there is no active window"));
@@ -176,7 +175,7 @@ incoming (GIOChannel *source, GIOCondition condition, VinagreVncListener *listen
     vinagre_connection_set_host (conn, client_name);
   vinagre_connection_set_port (conn, ntohs (client_addr.sin6_port));
 
-  vinagre_cmd_direct_connect (conn, window);
+  vinagre_cmd_direct_connect (conn, VINAGRE_WINDOW (window));
 
   return TRUE;
 }
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 90719df..a987518 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -23,7 +23,6 @@ plugins/vnc/vinagre-vnc-listener-dialog.c
 plugins/vnc/vinagre-vnc-listener.c
 [type: gettext/glade]plugins/vnc/vnc.ui
 vinagre/GNOME_VinagreApplet.server.in.in
-vinagre/vinagre-app.c
 vinagre/vinagre-applet.c
 vinagre/vinagre-bookmarks.c
 vinagre/vinagre-bookmarks-migration.c
@@ -37,6 +36,7 @@ vinagre/vinagre-fav.c
 vinagre/vinagre-main.c
 vinagre/vinagre-mdns.c
 vinagre/vinagre-notebook.c
+vinagre/vinagre-options.c
 vinagre/vinagre-plugin-dialog.c
 vinagre/vinagre-plugin-manager.c
 vinagre/vinagre-prefs.c
diff --git a/vinagre/Makefile.am b/vinagre/Makefile.am
index 4c42c60..181b7e0 100644
--- a/vinagre/Makefile.am
+++ b/vinagre/Makefile.am
@@ -16,7 +16,6 @@ INCLUDES = 						\
 	$(NULL)
 
 NOINST_H_FILES = \
-  bacon-message-connection.h \
   vinagre-enums.h \
   vinagre-marshal.h \
   vinagre-object-module.h \
@@ -31,8 +30,6 @@ NOINST_H_FILES = \
   $(NULL)
 
 INST_H_FILES = \
-  vinagre-app.h \
-  vinagre-bacon.h \
   vinagre-bookmarks-entry.h \
   vinagre-bookmarks.h \
   vinagre-bookmarks-migration.h \
@@ -67,9 +64,6 @@ header_DATA = $(INST_H_FILES)
 noinst_LTLIBRARIES = libvinagre.la
 
 handwritten_sources = \
-  bacon-message-connection.c  \
-  vinagre-app.c \
-  vinagre-bacon.c \
   vinagre-bookmarks.c \
   vinagre-bookmarks-entry.c \
   vinagre-bookmarks-migration.c \
@@ -124,7 +118,8 @@ libvinagre_la_LIBADD += $(VINAGRE_LIBS)
 bin_PROGRAMS = vinagre
 
 vinagre_SOURCES = \
-  vinagre-main.c
+  vinagre-main.c  \
+  vinagre-options.h vinagre-options.c
 
 vinagre_LDADD = \
 	libvinagre.la \
@@ -186,7 +181,6 @@ vinagre_applet_SOURCES =					\
 	vinagre-notebook.h vinagre-notebook.c \
 	vinagre-tab.h vinagre-tab.c \
 	vinagre-prefs.h vinagre-prefs.c \
-	vinagre-app.h vinagre-app.c \
 	vinagre-object-module.h vinagre-object-module.c \
 	vinagre-dirs.h vinagre-dirs.c \
 	vinagre-fav.h vinagre-fav.c \
diff --git a/vinagre/vinagre-main.c b/vinagre/vinagre-main.c
index b2d224b..16ab153 100644
--- a/vinagre/vinagre-main.c
+++ b/vinagre/vinagre-main.c
@@ -22,25 +22,20 @@
 #include <config.h>
 #endif
 
-#include <glib.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <locale.h>
 
-#include "vinagre-connection.h"
-#include "vinagre-commands.h"
-#include "vinagre-bookmarks.h"
 #include "vinagre-window.h"
-#include "vinagre-app.h"
 #include "vinagre-utils.h"
 #include "vinagre-prefs.h"
 #include "vinagre-cache-prefs.h"
-#include "vinagre-bacon.h"
 #include "vinagre-plugins-engine.h"
 #include "vinagre-plugin-info.h"
 #include "vinagre-plugin-info-priv.h"
 #include "vinagre-debug.h"
 #include "vinagre-ssh.h"
+#include "vinagre-options.h"
 
 #ifdef HAVE_TELEPATHY
 #include "vinagre-tubes-manager.h"
@@ -50,113 +45,25 @@
 #include "vinagre-mdns.h"
 #endif
 
-/* command line */
-static gchar **files = NULL;
-static gchar **remaining_args = NULL;
-static GSList *servers = NULL;
-static gboolean new_window = FALSE;
-static gboolean fullscreen = FALSE;
-
-static const GOptionEntry options [] =
-{
-  { "fullscreen", 'f', 0, G_OPTION_ARG_NONE, &fullscreen,
-  /* Translators: this is a command line option (run vinagre --help) */
-    N_("Open vinagre in fullscreen mode"), NULL },
-
-  { "new-window", 'n', 0, G_OPTION_ARG_NONE, &new_window,
-  /* Translators: this is a command line option (run vinagre --help) */
-    N_("Create a new toplevel window in an existing instance of vinagre"), NULL },
-
-  { "file", 'F', 0, G_OPTION_ARG_FILENAME_ARRAY, &files,
-  /* Translators: this is a command line option (run vinagre --help) */
-    N_("Open a file recognized by vinagre"), N_("filename")},
-
-  { 
-    G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &remaining_args,
-  /* Translators: this is a command line option (run vinagre --help) */
-    NULL, N_("[server:port]") },
-
-  { NULL }
-};
-
-static void
-vinagre_main_process_command_line (VinagreWindow *window)
-{
-  gint               i;
-  VinagreConnection *conn;
-  gchar             *error;
-  GSList            *errors = NULL;
-
-  if (files)
-    {
-      for (i = 0; files[i]; i++) 
-	{
-	  conn = vinagre_connection_new_from_file (files[i], &error, FALSE);
-	  if (conn)
-	    servers = g_slist_prepend (servers, conn);
-	  else
-	    {
-	      errors = g_slist_prepend (errors,
-					g_strdup_printf ("<i>%s</i>: %s",
-							files[i],
-							error ? error : _("Unknown error")));
-	      if (error)
-	        g_free (error);
-	    }
-	}
-      g_strfreev (files);
-    }
-
-  if (remaining_args)
-    {
-      for (i = 0; remaining_args[i]; i++) 
-	{
-	  conn = vinagre_connection_new_from_string (remaining_args[i], &error, TRUE);
-	  if (conn)
-	    servers = g_slist_prepend (servers, conn);
-	  else
-	    errors = g_slist_prepend (errors,
-				      g_strdup_printf ("<i>%s</i>: %s",
-						       remaining_args[i],
-						       error ? error : _("Unknown error")));
-
-	  if (error)
-	    g_free (error);
-	}
-
-      g_strfreev (remaining_args);
-    }
-
-  if (errors)
-    {
-      vinagre_utils_show_many_errors (ngettext ("The following error has occurred:",
-						"The following errors have occurred:",
-						g_slist_length (errors)),
-				      errors,
-				      window?GTK_WINDOW (window):NULL);
-      g_slist_free (errors);
-    }
-}
-
 int main (int argc, char **argv) {
   GOptionContext       *context;
   GError               *error = NULL;
   GSList               *l, *plugins;
-  VinagreWindow        *window;
-  VinagreApp           *app;
+  GtkWindow            *window;
+  GtkApplication       *app;
   VinagrePluginsEngine *engine;
 #ifdef HAVE_TELEPATHY
   VinagreTubesManager *vinagre_tubes_manager;
 #endif
 
-  if (!g_thread_supported ())
-    g_thread_init (NULL);
   g_type_init();
+  g_set_application_name (_("Remote Desktop Viewer"));
 
   /* Setup debugging */
   vinagre_debug_init ();
   vinagre_debug_message (DEBUG_APP, "Startup");
 
+  /* i18n */
   setlocale (LC_ALL, "");
   bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -169,7 +76,7 @@ int main (int argc, char **argv) {
 
   /* Setup command line options */
   context = g_option_context_new (_("- Remote Desktop Viewer"));
-  g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
+  g_option_context_add_main_entries (context, all_options, GETTEXT_PACKAGE);
   g_option_context_add_group (context, gtk_get_option_group (TRUE));
 
   for (l = plugins; l; l = l->next)
@@ -198,27 +105,33 @@ int main (int argc, char **argv) {
       return 1;
     }
 
-  g_set_application_name (_("Remote Desktop Viewer"));
-  vinagre_main_process_command_line (NULL);
-
-  vinagre_bacon_start (servers, new_window);
+  g_clear_error (&error);
+  app = g_initable_new (GTK_TYPE_APPLICATION,
+			NULL,
+			&error,
+			"application-id", "org.gnome.Vinagre",
+			"argv", g_variant_new_bytestring_array ((const gchar * const*)argv, argc),
+			"default-quit", FALSE,
+			NULL);
+  if (!app)
+    g_error ("%s", error->message);
+
+  if (g_application_is_remote (G_APPLICATION (app)))
+    {
+      vinagre_options_invoke_remote_instance (app, &optionstate);
+      return 0;
+    }
 
+  vinagre_options_register_actions (app);
   vinagre_cache_prefs_init ();
-  app = vinagre_app_get_default ();
-  window = vinagre_app_create_window (app, NULL);
-  gtk_widget_show (GTK_WIDGET(window));
-
-  vinagre_utils_handle_debug ();
 
-  for (l = servers; l; l = l->next)
-    {
-      VinagreConnection *conn = l->data;
+  window = GTK_WINDOW (vinagre_window_new ());
+  gtk_application_add_window (app, window);
+  gtk_widget_show (GTK_WIDGET (window));
 
-      vinagre_connection_set_fullscreen (conn, fullscreen);
-      vinagre_cmd_direct_connect (conn, window);
-      g_object_unref (conn);
-    }
-  g_slist_free (servers);
+  vinagre_utils_handle_debug ();
+  optionstate.new_window = FALSE;
+  vinagre_options_process_command_line (window, &optionstate);
 
 #ifdef HAVE_TELEPATHY
    vinagre_tubes_manager = vinagre_tubes_manager_new (window);
@@ -227,7 +140,11 @@ int main (int argc, char **argv) {
   /* fake call, just to ensure this symbol will be present at vinagre.so */
   vinagre_ssh_connect (NULL, NULL, -1, NULL, NULL, NULL, NULL, NULL);
 
-  gtk_main ();
+  g_signal_connect (app,
+		    "action-with-data",
+		    G_CALLBACK (vinagre_options_handle_action),
+		    NULL);
+  gtk_application_run (app);
 
 #ifdef HAVE_TELEPATHY
   g_object_unref (vinagre_tubes_manager);
@@ -235,10 +152,12 @@ int main (int argc, char **argv) {
   g_object_unref (vinagre_bookmarks_get_default ());
   g_object_unref (vinagre_prefs_get_default ());
   vinagre_cache_prefs_finalize ();
+  g_object_unref (app);
 #ifdef VINAGRE_ENABLE_AVAHI
   g_object_unref (vinagre_mdns_get_default ());
 #endif
 
+
   return 0;
 }
 /* vim: set ts=8: */
diff --git a/vinagre/vinagre-options.c b/vinagre/vinagre-options.c
new file mode 100644
index 0000000..f07eeca
--- /dev/null
+++ b/vinagre/vinagre-options.c
@@ -0,0 +1,227 @@
+/*
+ * vinagre-options.c
+ * This file is part of vinagre
+ *
+ * Copyright (C) 2010 - Jonh Wendell <wendell bani com br>
+ *
+ * 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 2 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
+ * MERCHANTABILITY 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/>.
+ */
+
+#include "vinagre-options.h"
+#include "vinagre-connection.h"
+#include "vinagre-window.h"
+
+const GOptionEntry all_options [] =
+{
+  { "fullscreen", 'f', 0, G_OPTION_ARG_NONE, &optionstate.fullscreen,
+  /* Translators: this is a command line option (run vinagre --help) */
+    N_("Open vinagre in fullscreen mode"), NULL },
+
+  { "new-window", 'n', 0, G_OPTION_ARG_NONE, &optionstate.new_window,
+  /* Translators: this is a command line option (run vinagre --help) */
+    N_("Create a new toplevel window in an existing instance of vinagre"), NULL },
+
+  { "file", 'F', 0, G_OPTION_ARG_FILENAME_ARRAY, &optionstate.files,
+  /* Translators: this is a command line option (run vinagre --help) */
+    N_("Open a file recognized by vinagre"), N_("filename")},
+
+  { 
+    G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &optionstate.uris,
+  /* Translators: this is a command line option (run vinagre --help) */
+    NULL, N_("[server:port]") },
+
+  { NULL }
+};
+
+VinagreCmdLineOptions optionstate;
+
+void
+vinagre_options_register_actions (GtkApplication *app)
+{
+  GApplication *g_app = G_APPLICATION (app);
+  g_application_add_action (g_app, "uris", "List of machines to connect to");
+}
+
+void
+vinagre_options_process_command_line (GtkWindow *window, const VinagreCmdLineOptions *options)
+{
+  gint               i;
+  VinagreConnection *conn;
+  gchar             *error;
+  GSList            *errors, *servers, *l;
+  VinagreWindow     *v_window;
+  GtkApplication    *app;
+
+  errors = servers = NULL;
+
+  if (options->files)
+    {
+      for (i = 0; options->files[i]; i++) 
+	{
+	  conn = vinagre_connection_new_from_file (options->files[i], &error, FALSE);
+	  if (conn)
+	    servers = g_slist_prepend (servers, conn);
+	  else
+	    {
+	      errors = g_slist_prepend (errors,
+					g_strdup_printf ("<i>%s</i>: %s",
+							options->files[i],
+							error ? error : _("Unknown error")));
+	      g_free (error);
+	    }
+	}
+      g_strfreev (options->files);
+    }
+
+  if (options->uris)
+    {
+      for (i = 0; options->uris[i]; i++) 
+	{
+	  conn = vinagre_connection_new_from_string (options->uris[i], &error, TRUE);
+	  if (conn)
+	    servers = g_slist_prepend (servers, conn);
+	  else
+	    errors = g_slist_prepend (errors,
+				      g_strdup_printf ("<i>%s</i>: %s",
+						       options->uris[i],
+						       error ? error : _("Unknown error")));
+	  g_free (error);
+	}
+
+      g_strfreev (options->uris);
+    }
+
+  app = GTK_APPLICATION (g_application_get_instance ());
+  if (servers &&
+      options->new_window)
+    {
+      v_window = vinagre_window_new ();
+      gtk_widget_show (GTK_WIDGET (v_window));
+      gtk_application_add_window (app, GTK_WINDOW (v_window));
+    }
+  else
+    {
+      v_window = VINAGRE_WINDOW (window);
+    }
+
+  for (l = servers; l; l = l->next)
+    {
+      VinagreConnection *conn = l->data;
+
+      vinagre_connection_set_fullscreen (conn, options->fullscreen);
+      vinagre_cmd_direct_connect (conn, v_window);
+      g_object_unref (conn);
+    }
+  g_slist_free (servers);
+
+  if (errors)
+    {
+      vinagre_utils_show_many_errors (ngettext ("The following error has occurred:",
+						"The following errors have occurred:",
+						g_slist_length (errors)),
+				      errors,
+				      window);
+      g_slist_free (errors);
+    }
+
+  gtk_window_present (GTK_WINDOW (v_window));
+}
+
+void
+vinagre_options_invoke_remote_instance (GtkApplication *app, const VinagreCmdLineOptions *options)
+{
+  GVariantBuilder builder;
+  GVariant *data;
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
+
+  if (options->files)
+    {
+      g_variant_builder_add (&builder,
+			     "{sv}",
+			     "files",
+			     g_variant_new_bytestring_array ((const gchar * const*)options->files, -1));
+      g_strfreev (options->files);
+    }
+
+  if (options->uris)
+    {
+      g_variant_builder_add (&builder,
+			     "{sv}",
+			     "args",
+			     g_variant_new_bytestring_array ((const gchar * const*)options->uris, -1));
+      g_strfreev (options->uris);
+    }
+
+  g_variant_builder_add (&builder,
+			 "{sv}",
+			 "new_window",
+			 g_variant_new_boolean (options->new_window));
+
+  g_variant_builder_add (&builder,
+			 "{sv}",
+			 "fullscreen",
+			 g_variant_new_boolean (options->fullscreen));
+
+
+  data = g_variant_builder_end (&builder);
+  g_application_invoke_action (G_APPLICATION (app), "uris", data);
+  g_variant_unref (data);
+}
+
+void
+vinagre_options_handle_action (GApplication *app,
+			       gchar        *action,
+			       GVariant     *data,
+			       gpointer      user_data)
+{
+  GVariantIter iter;
+  gchar *key;
+  GVariant *value;
+  const gchar **files, **uris;
+
+  if (g_strcmp0 (action, "uris") != 0)
+    {
+      g_message ("Received an unknown action: %s", action);
+      return;
+    }
+
+  files = uris = NULL;
+  memset (&optionstate, 0, sizeof optionstate);
+
+  g_variant_iter_init (&iter, data);
+  while (g_variant_iter_loop (&iter, "{sv}", &key, &value))
+    {
+      if (g_strcmp0 (key, "files") == 0)
+	{
+	  optionstate.files = (gchar **) g_variant_dup_bytestring_array (value, NULL);
+	}
+      else if (g_strcmp0 (key, "args") == 0)
+	{
+	  optionstate.uris = (gchar **) g_variant_dup_bytestring_array (value, NULL);
+	}
+      else if (g_strcmp0 (key, "new_window") == 0)
+	{
+	  optionstate.new_window = g_variant_get_boolean (value);
+	}
+      else if (g_strcmp0 (key, "fullscreen") == 0)
+	{
+	  optionstate.fullscreen = g_variant_get_boolean (value);
+	}
+    }
+
+  vinagre_options_process_command_line (gtk_application_get_window (GTK_APPLICATION (app)),
+					&optionstate);
+}
+/* vim: set ts=8: */
diff --git a/vinagre/vinagre-options.h b/vinagre/vinagre-options.h
new file mode 100644
index 0000000..dcc11df
--- /dev/null
+++ b/vinagre/vinagre-options.h
@@ -0,0 +1,48 @@
+/*
+ * vinagre-options.h
+ * This file is part of vinagre
+ *
+ * Copyright (C) 2010 - Jonh Wendell <wendell bani com br>
+ *
+ * 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 2 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
+ * MERCHANTABILITY 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 __VINAGRE_OPTIONS_H__
+#define __VINAGRE_OPTIONS_H__
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+typedef struct {
+  gchar **files;
+  gchar **uris;
+  gboolean new_window;
+  gboolean fullscreen;
+} VinagreCmdLineOptions;
+
+extern const GOptionEntry all_options[];
+extern VinagreCmdLineOptions optionstate;
+
+void vinagre_options_register_actions       (GtkApplication *app);
+void vinagre_options_process_command_line   (GtkWindow *window,
+					     const VinagreCmdLineOptions *options);
+void vinagre_options_invoke_remote_instance (GtkApplication *app,
+					     const VinagreCmdLineOptions *options);
+void vinagre_options_handle_action          (GApplication *app,
+					     gchar        *action,
+					     GVariant     *data,
+					     gpointer      user_data);
+
+#endif  /* __VINAGRE_OPTIONS_H__ */
+/* vim: set ts=8: */
diff --git a/vinagre/vinagre-plugins-engine.c b/vinagre/vinagre-plugins-engine.c
index dabdb98..237d680 100644
--- a/vinagre/vinagre-plugins-engine.c
+++ b/vinagre/vinagre-plugins-engine.c
@@ -31,7 +31,6 @@
 #include "vinagre-plugin-info-priv.h"
 #include "vinagre-plugin.h"
 #include "vinagre-debug.h"
-#include "vinagre-app.h"
 #include "vinagre-prefs.h"
 #include "vinagre-plugin-loader.h"
 #include "vinagre-object-module.h"
@@ -624,7 +623,7 @@ static void
 vinagre_plugins_engine_activate_plugin_real (VinagrePluginsEngine *engine,
 					     VinagrePluginInfo    *info)
 {
-  const GList *wins;
+  const GSList *wins;
   const gchar *protocol;
   VinagrePluginInfo *plugin_protocol;
 
@@ -648,7 +647,7 @@ vinagre_plugins_engine_activate_plugin_real (VinagrePluginsEngine *engine,
     }
 
   /* activate plugin for all windows */
-  wins = vinagre_app_get_windows (vinagre_app_get_default ());
+  wins = gtk_application_get_windows (GTK_APPLICATION (g_application_get_instance ()));
   for (; wins != NULL; wins = wins->next)
     vinagre_plugin_activate (info->plugin, VINAGRE_WINDOW (wins->data));
 }
@@ -692,7 +691,7 @@ static void
 vinagre_plugins_engine_deactivate_plugin_real (VinagrePluginsEngine *engine,
 					       VinagrePluginInfo    *info)
 {
-  const GList *wins;
+  const GSList *wins;
   VinagrePluginLoader *loader;
 
   if (!vinagre_plugin_info_is_active (info) || 
@@ -707,7 +706,7 @@ vinagre_plugins_engine_deactivate_plugin_real (VinagrePluginsEngine *engine,
     }
   else
     {
-      wins = vinagre_app_get_windows (vinagre_app_get_default ());
+      wins = gtk_application_get_windows (GTK_APPLICATION (g_application_get_instance ()));
       for (; wins != NULL; wins = wins->next)
 	call_plugin_deactivate (info->plugin, VINAGRE_WINDOW (wins->data));
     }



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