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

Bug#687895: unblock: network-manager-applet/0.9.4.1-2



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package network-manager-applet

- it enablex xz compression (nm-applet is part of the GNOME stack, so
  it's relevant for the CD1 issue).
- fixes the GNOME Shell integration wrt authentication dialogs, which
  also needs another patch to reliably detect the GNOME Shell version.
- Adds basic support for gnome-bluetooth 3.4. Without that patch, DUN
  via bluetooth is completely broken.

All patches are cherry-picked from upstream Git.

debdiff is attached.

Cheers,
Michael

unblock network-manager-applet/0.9.4.1-2


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.5-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/debian/changelog b/debian/changelog
index 16e8572..dded885 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,21 @@
+network-manager-applet (0.9.4.1-2) unstable; urgency=low
+
+  * debian/rules: Use xz compression for binary packages.
+  * debian/control: Add network-manager-openconnect-gnome to Suggests.
+    (Closes: #670724)
+  * debian/patches/02-fix-shell-version-detecting-code.patch,
+    debian/patches/03-dont-handle-VPN-secrets-with-GNOME-Shell-3.4.patch: Fix
+    race condition on session startup when detecting the GNOME Shell version
+    and only handle VPN authentication requests with GNOME Shell < 3.4
+    otherwise nm-applet and the Shell fight over who gets to handle secrets.
+    Patches cherry-picked from upstream Git. (Closes: #680963)
+  * debian/patches/04-gnome-bluetooth-3.4-support.patch: Add support for
+    gnome-bluetooth 3.4 which uses GDBusProxy instead of DBusGProxy. This
+    fixes the timeouts when creating DUN connections. Patch cherry-picked from
+    upstream Git. (Closes: #680866)
+
+ -- Michael Biebl <biebl@debian.org>  Tue, 11 Sep 2012 21:51:03 +0200
+
 network-manager-applet (0.9.4.1-1) unstable; urgency=low
 
   * New upstream release.
diff --git a/debian/control b/debian/control
index cb7af9b..f82a5a9 100644
--- a/debian/control
+++ b/debian/control
@@ -45,6 +45,7 @@ Recommends:
  gnome-bluetooth,
  iso-codes
 Suggests:
+ network-manager-openconnect-gnome,
  network-manager-openvpn-gnome,
  network-manager-vpnc-gnome,
  network-manager-pptp-gnome
diff --git a/debian/patches/02-fix-shell-version-detecting-code.patch b/debian/patches/02-fix-shell-version-detecting-code.patch
new file mode 100644
index 0000000..04cb431
--- /dev/null
+++ b/debian/patches/02-fix-shell-version-detecting-code.patch
@@ -0,0 +1,501 @@
+commit 0c997a95d5b82ea6733e001478db1e2490b49575
+Author: Dan Winship <danw@gnome.org>
+Date:   Fri Mar 30 11:13:04 2012 -0400
+
+    applet: fix up the shell-version-detecting code
+    
+    GNOME Shell claims its name on D-Bus without actually setting up its
+    interfaces first, so if you try to query its properties right away, it
+    fails. And GDBusProxy assumes (reasonably) that an object that doesn't
+    implement the Properties interface when it first appears isn't going
+    to start implementing it later, so the proxy will always think there
+    are no properties there.
+    
+    So, to fix this, we have to destroy the proxy if we hit this bug, and
+    then recreate it after a delay. Since this is getting complicated now,
+    abstract all the shell-version-checking into a separate object.
+    
+    Also, don't do floating-point comparisons on version numbers, since
+    floating point is inexact.
+
+Index: network-manager-applet/src/Makefile.am
+===================================================================
+--- network-manager-applet.orig/src/Makefile.am	2012-07-10 15:25:50.692290285 +0200
++++ network-manager-applet/src/Makefile.am	2012-07-10 15:40:38.603094778 +0200
+@@ -59,7 +59,9 @@
+ 	applet-device-bt.c \
+ 	applet-device-wimax.h \
+ 	applet-device-wimax.c \
+-	fallback-icon.h
++	fallback-icon.h \
++	shell-watcher.h \
++	shell-watcher.c
+ 
+ nm_applet_LDADD = \
+ 	-lm \
+Index: network-manager-applet/src/applet.c
+===================================================================
+--- network-manager-applet.orig/src/applet.c	2012-07-10 15:25:50.692290285 +0200
++++ network-manager-applet/src/applet.c	2012-07-10 15:40:38.607094809 +0200
+@@ -79,6 +79,7 @@
+ #include "applet-vpn-request.h"
+ #include "utils.h"
+ #include "gconf-helpers.h"
++#include "shell-watcher.h"
+ 
+ #define NOTIFY_CAPS_ACTIONS_KEY "actions"
+ 
+@@ -2955,7 +2956,7 @@
+ 	NMApplet *applet = NM_APPLET (user_data);
+ 
+ 	/* If the shell is running and the agent just got registered, unregister it */
+-	if (   (applet->shell_version >= 3.4)
++	if (   (nm_shell_watcher_version_at_least (applet->shell_watcher, 3, 4))
+ 	    && nm_secret_agent_get_registered (NM_SECRET_AGENT (agent))) {
+ 		g_message ("Stopping registered applet secret agent because GNOME Shell is running");
+ 		nm_secret_agent_unregister (NM_SECRET_AGENT (agent));
+@@ -3249,55 +3250,16 @@
+ 	return FALSE;
+ }
+ 
+-static gboolean
+-get_shell_version (GDBusProxy *proxy, gdouble *out_version)
+-{
+-	GVariant *v;
+-	char *version, *p;
+-	gboolean success = FALSE;
+-	gdouble converted;
+-
+-	/* Ask for the shell's version */
+-	v = g_dbus_proxy_get_cached_property (proxy, "ShellVersion");
+-	if (v) {
+-		g_warn_if_fail (g_variant_is_of_type (v, G_VARIANT_TYPE_STRING));
+-		version = g_variant_dup_string (v, NULL);
+-		if (version) {
+-			/* Terminate at the second dot if there is one */
+-			p = strchr (version, '.');
+-			if (p && (p = strchr (p + 1, '.')))
+-				*p = '\0';
+-
+-			converted = strtod (version, NULL);
+-			g_warn_if_fail (converted > 0);
+-			g_warn_if_fail (converted < 1000);
+-			if (converted > 0 && converted < 1000) {
+-				*out_version = converted;
+-				success = TRUE;
+-			}
+-			g_free (version);
+-		}
+-		g_variant_unref (v);
+-	}
+-	return success;
+-}
+-
+ static void
+-name_owner_changed_cb (GDBusProxy *proxy, GParamSpec *pspec, gpointer user_data)
++shell_version_changed_cb (NMShellWatcher *watcher, GParamSpec *pspec, gpointer user_data)
+ {
+ 	NMApplet *applet = user_data;
+-	char *owner;
+ 
+-	owner = g_dbus_proxy_get_name_owner (proxy);
+-	if (owner) {
+-		applet->shell_version = 0;
++	if (nm_shell_watcher_version_at_least (watcher, 3, 4)) {
+ 		if (applet->agent_start_id)
+ 			g_source_remove (applet->agent_start_id);
+ 
+-		if (   get_shell_version (proxy, &applet->shell_version)
+-		    && applet->shell_version >= 3.4
+-		    && applet->agent
+-		    && nm_secret_agent_get_registered (NM_SECRET_AGENT (applet->agent))) {
++		if (applet->agent && nm_secret_agent_get_registered (NM_SECRET_AGENT (applet->agent))) {
+ 			g_message ("Stopping applet secret agent because GNOME Shell appeared");
+ 			nm_secret_agent_unregister (NM_SECRET_AGENT (applet->agent));
+ 		}
+@@ -3305,14 +3267,12 @@
+ 		/* If the shell quit and our agent wasn't already registered, do it
+ 		 * now on a delay (just in case the shell is restarting.
+ 		 */
+-		applet->shell_version = 0;
+ 		if (applet->agent_start_id)
+ 			g_source_remove (applet->agent_start_id);
+ 
+ 		if (nm_secret_agent_get_registered (NM_SECRET_AGENT (applet->agent)) == FALSE)
+ 			applet->agent_start_id = g_timeout_add_seconds (4, delayed_start_agent, applet);
+ 	}
+-	g_free (owner);
+ }
+ #endif
+ 
+@@ -3469,19 +3429,11 @@
+ 
+ #if GLIB_CHECK_VERSION(2,26,0)
+ 	/* Watch GNOME Shell so we can unregister our applet agent if it appears */
+-	applet->shell_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+-	                                                     G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
+-	                                                     NULL,
+-	                                                     "org.gnome.Shell",
+-	                                                     "/org/gnome/Shell",
+-	                                                     "org.gnome.Shell",
+-	                                                     NULL,
+-	                                                     NULL);
+-	g_signal_connect (applet->shell_proxy,
+-	                  "notify::g-name-owner",
+-	                  G_CALLBACK (name_owner_changed_cb),
++	applet->shell_watcher = nm_shell_watcher_new ();
++	g_signal_connect (applet->shell_watcher,
++	                  "notify::shell-version",
++	                  G_CALLBACK (shell_version_changed_cb),
+ 	                  applet);
+-	name_owner_changed_cb (applet->shell_proxy, NULL, applet);
+ #endif
+ 
+ 	return G_OBJECT (applet);
+@@ -3551,8 +3503,8 @@
+ 		dbus_g_connection_unref (applet->session_bus);
+ 
+ #if GLIB_CHECK_VERSION(2,26,0)
+-	if (applet->shell_proxy)
+-		g_object_unref (applet->shell_proxy);
++	if (applet->shell_watcher)
++		g_object_unref (applet->shell_watcher);
+ #endif
+ 	if (applet->agent_start_id)
+ 		g_source_remove (applet->agent_start_id);
+Index: network-manager-applet/src/applet.h
+===================================================================
+--- network-manager-applet.orig/src/applet.h	2012-07-10 15:25:50.692290285 +0200
++++ network-manager-applet/src/applet.h	2012-07-10 15:40:38.607094809 +0200
+@@ -46,6 +46,7 @@
+ #include <nm-active-connection.h>
+ #include <nm-remote-settings.h>
+ #include "applet-agent.h"
++#include "shell-watcher.h"
+ 
+ #define NM_TYPE_APPLET			(nma_get_type())
+ #define NM_APPLET(object)		(G_TYPE_CHECK_INSTANCE_CAST((object), NM_TYPE_APPLET, NMApplet))
+@@ -85,10 +86,9 @@
+ 	DBusGConnection *session_bus;
+ 
+ #if GLIB_CHECK_VERSION(2,26,0)
+-	GDBusProxy *shell_proxy;
++	NMShellWatcher *shell_watcher;
+ #endif
+ 	guint agent_start_id;
+-	gdouble shell_version;
+ 
+ 	NMClient *nm_client;
+ 	NMRemoteSettings *settings;
+Index: network-manager-applet/src/shell-watcher.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ network-manager-applet/src/shell-watcher.c	2012-07-10 15:40:38.611094840 +0200
+@@ -0,0 +1,242 @@
++/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
++/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
++ *
++ * 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, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Copyright (C) 2012 Red Hat, Inc.
++ */
++
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#include <stdlib.h>
++
++#include "shell-watcher.h"
++
++#if GLIB_CHECK_VERSION(2,26,0)
++
++G_DEFINE_TYPE (NMShellWatcher, nm_shell_watcher, G_TYPE_OBJECT)
++
++struct NMShellWatcherPrivate {
++	GDBusProxy *shell_proxy;
++	guint signal_id;
++
++	guint retry_timeout;
++	guint retries;
++
++	guint shell_version;
++};
++
++enum {
++	PROP_0,
++	PROP_SHELL_VERSION,
++	LAST_PROP
++};
++
++static void create_gnome_shell_proxy (NMShellWatcher *watcher);
++
++static gboolean
++retry_create_shell_proxy (gpointer user_data)
++{
++	NMShellWatcher *watcher = user_data;
++	NMShellWatcherPrivate *priv = watcher->priv;
++
++	priv->retry_timeout = 0;
++	create_gnome_shell_proxy (watcher);
++	return FALSE;
++}
++
++static void
++try_update_version (NMShellWatcher *watcher)
++{
++	NMShellWatcherPrivate *priv = watcher->priv;
++	GVariant *v;
++	char *version, *p;
++
++	v = g_dbus_proxy_get_cached_property (priv->shell_proxy, "ShellVersion");
++	if (!v) {
++		/* The shell has claimed the name, but not yet registered its interfaces...
++		 * (https://bugzilla.gnome.org/show_bug.cgi?id=673182). There's no way
++		 * to make GDBusProxy re-read the properties at this point, so we
++		 * have to destroy this proxy and try again.
++		 */
++		if (priv->signal_id) {
++			g_signal_handler_disconnect (priv->shell_proxy, priv->signal_id);
++			priv->signal_id = 0;
++		}
++		g_object_unref (priv->shell_proxy);
++		priv->shell_proxy = NULL;
++
++		priv->retry_timeout = g_timeout_add_seconds (2, retry_create_shell_proxy, watcher); 
++		return;
++	}
++
++	g_warn_if_fail (g_variant_is_of_type (v, G_VARIANT_TYPE_STRING));
++	version = g_variant_dup_string (v, NULL);
++	if (version) {
++		guint major, minor;
++
++		major = strtoul (version, &p, 10);
++		if (*p == '.')
++			minor = strtoul (p + 1, NULL, 10);
++		else
++			minor = 0;
++
++		g_warn_if_fail (major < 256);
++		g_warn_if_fail (minor < 256);
++
++		priv->shell_version = (major << 8) | minor;
++		g_object_notify (G_OBJECT (watcher), "shell-version");
++	}
++
++	g_variant_unref (v);
++}
++
++static void
++name_owner_changed_cb (GDBusProxy *proxy, GParamSpec *pspec, gpointer user_data)
++{
++	NMShellWatcher *watcher = user_data;
++	NMShellWatcherPrivate *priv = watcher->priv;
++	char *owner;
++
++	owner = g_dbus_proxy_get_name_owner (proxy);
++	if (owner) {
++		try_update_version (watcher);
++		g_free (owner);
++	} else if (priv->shell_version) {
++		priv->shell_version = 0;
++		g_object_notify (G_OBJECT (watcher), "shell-version");
++	}
++}
++
++static void
++got_shell_proxy (GObject *source, GAsyncResult *result, gpointer user_data)
++{
++	NMShellWatcher *watcher = user_data;
++	NMShellWatcherPrivate *priv = watcher->priv;
++	GError *error = NULL;
++
++	priv->shell_proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
++	if (!priv->shell_proxy) {
++		g_warning ("Could not create GDBusProxy for org.gnome.Shell: %s", error->message);
++		g_error_free (error);
++		return;
++	}
++
++	priv->signal_id = g_signal_connect (priv->shell_proxy,
++	                                    "notify::g-name-owner",
++	                                    G_CALLBACK (name_owner_changed_cb),
++	                                    watcher);
++
++	name_owner_changed_cb (priv->shell_proxy, NULL, watcher);
++	g_object_unref (watcher);
++}
++
++static void
++create_gnome_shell_proxy (NMShellWatcher *watcher)
++{
++	NMShellWatcherPrivate *priv = watcher->priv;
++
++	if (priv->retries++ == 5) {
++		g_warning ("Could not find ShellVersion property on org.gnome.Shell after 5 tries");
++		return;
++	}
++
++	g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
++	                          G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
++	                          NULL,
++	                          "org.gnome.Shell",
++	                          "/org/gnome/Shell",
++	                          "org.gnome.Shell",
++	                          NULL,
++	                          got_shell_proxy,
++	                          g_object_ref (watcher));
++}
++
++static void
++nm_shell_watcher_init (NMShellWatcher *watcher)
++{
++	watcher->priv = G_TYPE_INSTANCE_GET_PRIVATE (watcher, NM_TYPE_SHELL_WATCHER,
++	                                             NMShellWatcherPrivate);
++	create_gnome_shell_proxy (watcher);
++}
++
++static void
++get_property (GObject *object, guint prop_id,
++              GValue *value, GParamSpec *pspec)
++{
++	NMShellWatcher *watcher = NM_SHELL_WATCHER (object);
++
++	switch (prop_id) {
++	case PROP_SHELL_VERSION:
++		g_value_set_uint (value, watcher->priv->shell_version);
++		break;
++	default:
++		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
++		break;
++	}
++}
++
++static void
++finalize (GObject *object)
++{
++	NMShellWatcher *watcher = NM_SHELL_WATCHER (object);
++	NMShellWatcherPrivate *priv = watcher->priv;
++
++	if (priv->retry_timeout)
++		g_source_remove (priv->retry_timeout);
++	if (priv->signal_id)
++		g_signal_handler_disconnect (priv->shell_proxy, priv->signal_id);
++	if (priv->shell_proxy)
++		g_object_unref (priv->shell_proxy);
++
++	G_OBJECT_CLASS (nm_shell_watcher_parent_class)->finalize (object);
++}
++
++static void
++nm_shell_watcher_class_init (NMShellWatcherClass *klass)
++{
++	GObjectClass *oclass = G_OBJECT_CLASS (klass);
++
++	g_type_class_add_private (klass, sizeof (NMShellWatcherPrivate));
++
++	oclass->get_property = get_property;
++	oclass->finalize = finalize;
++
++	g_object_class_install_property (oclass, PROP_SHELL_VERSION,
++	                                 g_param_spec_uint ("shell-version",
++	                                                    "Shell version",
++	                                                    "Running GNOME Shell version, eg, 0x0304",
++	                                                    0, 0xFFFF, 0,
++	                                                    G_PARAM_READABLE |
++	                                                    G_PARAM_STATIC_STRINGS));
++}
++
++NMShellWatcher *
++nm_shell_watcher_new (void)
++{
++	return g_object_new (NM_TYPE_SHELL_WATCHER, NULL);
++}
++
++gboolean
++nm_shell_watcher_version_at_least (NMShellWatcher *watcher, guint major, guint minor)
++{
++	guint version = (major << 8) | minor;
++
++	return watcher->priv->shell_version >= version;
++}
++
++#endif /* GLIB_CHECK_VERSION(2,26,0) */
+Index: network-manager-applet/src/shell-watcher.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ network-manager-applet/src/shell-watcher.h	2012-07-10 15:40:38.611094840 +0200
+@@ -0,0 +1,60 @@
++/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
++/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
++ *
++ * 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, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Copyright (C) 2012 Red Hat, Inc.
++ */
++
++#ifndef SHELL_WATCHER_H
++#define SHELL_WATCHER_H
++
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#include <gio/gio.h>
++
++#if GLIB_CHECK_VERSION(2,26,0)
++
++#define NM_TYPE_SHELL_WATCHER			(nm_shell_watcher_get_type())
++#define NM_SHELL_WATCHER(object)		(G_TYPE_CHECK_INSTANCE_CAST((object), NM_TYPE_SHELL_WATCHER, NMShellWatcher))
++#define NM_SHELL_WATCHER_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SHELL_WATCHER, NMShellWatcherClass))
++#define NM_IS_SHELL_WATCHER(object)		(G_TYPE_CHECK_INSTANCE_TYPE((object), NM_TYPE_SHELL_WATCHER))
++#define NM_IS_SHELL_WATCHER_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_SHELL_WATCHER))
++#define NM_SHELL_WATCHER_GET_CLASS(object)	(G_TYPE_INSTANCE_GET_CLASS((object), NM_TYPE_SHELL_WATCHER, NMShellWatcherClass))
++
++typedef struct NMShellWatcherPrivate NMShellWatcherPrivate;
++
++typedef struct {
++	GObject parent_instance;
++
++	NMShellWatcherPrivate *priv;
++} NMShellWatcher;
++
++typedef struct {
++	GObjectClass parent_class;
++} NMShellWatcherClass;
++
++GType nm_shell_watcher_get_type (void);
++
++NMShellWatcher *nm_shell_watcher_new (void);
++
++gboolean nm_shell_watcher_version_at_least (NMShellWatcher *watcher,
++                                            guint major, guint minor);
++
++#endif /* GLIB_CHECK_VERSION(2,26,0) */
++
++#endif
diff --git a/debian/patches/03-dont-handle-VPN-secrets-with-GNOME-Shell-3.4.patch b/debian/patches/03-dont-handle-VPN-secrets-with-GNOME-Shell-3.4.patch
new file mode 100644
index 0000000..259278b
--- /dev/null
+++ b/debian/patches/03-dont-handle-VPN-secrets-with-GNOME-Shell-3.4.patch
@@ -0,0 +1,114 @@
+commit 43c61d4d04398244fb76bf020727919f78e4101f
+Author: Dan Williams <dcbw@redhat.com>
+Date:   Thu Aug 2 21:19:05 2012 -0500
+
+    applet: only handle VPN secrets with GNOME Shell < 3.4
+    
+    GNOME Shell 3.2 and lower don't handle VPN secrets, so the applet
+    still needs to do that.  But they do handle other secrets, so instead
+    of having the applet and the Shell fight over who gets to handle
+    secrets, defer non-VPN secrets to the Shell.
+
+diff --git a/src/applet-agent.c b/src/applet-agent.c
+index 7957f26..8952683 100644
+--- a/src/applet-agent.c
++++ b/src/applet-agent.c
+@@ -45,6 +45,7 @@ G_DEFINE_TYPE (AppletAgent, applet_agent, NM_TYPE_SECRET_AGENT);
+ 
+ typedef struct {
+ 	GHashTable *requests;
++	gboolean vpn_only;
+ 
+ 	gboolean disposed;
+ } AppletAgentPrivate;
+@@ -487,6 +488,16 @@ get_secrets (NMSecretAgent *agent,
+ 		return;
+ 	}
+ 
++	/* Only handle non-VPN secrets if we're supposed to */
++	if (priv->vpn_only == TRUE) {
++		error = g_error_new_literal (NM_SECRET_AGENT_ERROR,
++		                             NM_SECRET_AGENT_ERROR_NO_SECRETS,
++		                             "Only handling VPN secrets at this time.");
++		callback (agent, connection, NULL, error, callback_data);
++		g_error_free (error);
++		return;
++	}
++
+ 	/* For everything else we scrape the keyring for secrets first, and ask
+ 	 * later if required.
+ 	 */
+@@ -782,6 +793,15 @@ delete_secrets (NMSecretAgent *agent,
+ 	r->keyring_calls = g_slist_append (r->keyring_calls, call);
+ }
+ 
++void
++applet_agent_handle_vpn_only (AppletAgent *agent, gboolean vpn_only)
++{
++	g_return_if_fail (agent != NULL);
++	g_return_if_fail (APPLET_IS_AGENT (agent));
++
++	APPLET_AGENT_GET_PRIVATE (agent)->vpn_only = vpn_only;
++}
++
+ /*******************************************************/
+ 
+ AppletAgent *
+diff --git a/src/applet-agent.h b/src/applet-agent.h
+index 6e8af97..2e1be3e 100644
+--- a/src/applet-agent.h
++++ b/src/applet-agent.h
+@@ -64,5 +64,7 @@ GType applet_agent_get_type (void) G_GNUC_CONST;
+ 
+ AppletAgent *applet_agent_new (void);
+ 
++void applet_agent_handle_vpn_only (AppletAgent *agent, gboolean vpn_only);
++
+ #endif /* _APPLET_AGENT_H_ */
+ 
+diff --git a/src/applet.c b/src/applet.c
+index 50c80bc..dc4cbad 100644
+--- a/src/applet.c
++++ b/src/applet.c
+@@ -3255,23 +3255,32 @@ shell_version_changed_cb (NMShellWatcher *watcher, GParamSpec *pspec, gpointer u
+ {
+ 	NMApplet *applet = user_data;
+ 
+-	if (nm_shell_watcher_version_at_least (watcher, 3, 4)) {
+-		if (applet->agent_start_id)
+-			g_source_remove (applet->agent_start_id);
++	if (applet->agent_start_id) {
++		g_source_remove (applet->agent_start_id);
++		applet->agent_start_id = 0;
++	}
+ 
+-		if (applet->agent && nm_secret_agent_get_registered (NM_SECRET_AGENT (applet->agent))) {
++	if (!applet->agent)
++		return;
++
++	if (nm_shell_watcher_version_at_least (watcher, 3, 4)) {
++		/* GNOME Shell handles all secrets requests */
++		if (nm_secret_agent_get_registered (NM_SECRET_AGENT (applet->agent))) {
+ 			g_message ("Stopping applet secret agent because GNOME Shell appeared");
+ 			nm_secret_agent_unregister (NM_SECRET_AGENT (applet->agent));
+ 		}
++	} else if (nm_shell_watcher_version_at_least (watcher, 3, 2)) {
++		/* GNOME Shell handles everything except VPN secrets requests */
++		if (nm_secret_agent_get_registered (NM_SECRET_AGENT (applet->agent)))
++			g_message ("Applet secret agent handling only VPN secrets because GNOME Shell appeared");
++		applet_agent_handle_vpn_only (applet->agent, TRUE);
+ 	} else {
+ 		/* If the shell quit and our agent wasn't already registered, do it
+-		 * now on a delay (just in case the shell is restarting.
++		 * now on a delay (just in case the shell is restarting).
+ 		 */
+-		if (applet->agent_start_id)
+-			g_source_remove (applet->agent_start_id);
+-
+-		if (nm_secret_agent_get_registered (NM_SECRET_AGENT (applet->agent)) == FALSE)
++		if (!nm_secret_agent_get_registered (NM_SECRET_AGENT (applet->agent)))
+ 			applet->agent_start_id = g_timeout_add_seconds (4, delayed_start_agent, applet);
++		applet_agent_handle_vpn_only (applet->agent, FALSE);
+ 	}
+ }
+ #endif
diff --git a/debian/patches/04-gnome-bluetooth-3.4-support.patch b/debian/patches/04-gnome-bluetooth-3.4-support.patch
new file mode 100644
index 0000000..2d93944
--- /dev/null
+++ b/debian/patches/04-gnome-bluetooth-3.4-support.patch
@@ -0,0 +1,113 @@
+commit dac307f98ff7c6ac9eb1f934b6b362066df9368d
+Author: Jürg Billeter <j@bitron.ch>
+Date:   Tue Aug 7 15:18:18 2012 -0500
+
+    bluetooth: fix GNOME Bluetooth plugin for 3.3 and later (bgo #678018)
+    
+    gnome-bluetooth 3.4 uses GDBusProxy instead of DBusGProxy. This patch
+    adds support for gnome-bluetooth 3.4 and keeps support for older
+    versions.
+    
+    (cleanups by dcbw)
+    (thanks for transparently breaking ABI, gnome-bluetooth!)
+
+diff --git a/src/gnome-bluetooth/bt-widget.c b/src/gnome-bluetooth/bt-widget.c
+index bf55695..4de3f84 100644
+--- a/src/gnome-bluetooth/bt-widget.c
++++ b/src/gnome-bluetooth/bt-widget.c
+@@ -807,38 +807,56 @@ dun_start (PluginInfo *info)
+ 								 NULL);
+ 
+ 	/* Get the device we're looking for */
+-	info->dun_proxy = NULL;
+-	if (get_device_iter (info->btmodel, info->bdaddr, &iter))
+-		gtk_tree_model_get (info->btmodel, &iter, BLUETOOTH_COLUMN_PROXY, &info->dun_proxy, -1);
++	if (!info->dun_proxy) {
++		if (get_device_iter (info->btmodel, info->bdaddr, &iter)) {
++			gpointer proxy = NULL;
++
++			gtk_tree_model_get (info->btmodel, &iter, BLUETOOTH_COLUMN_PROXY, &proxy, -1);
++
++			/* At some point gnome-bluetooth switched to gdbus, so we don't know
++			 * if the proxy will be a DBusGProxy (dbus-glib) or a GDBusProxy (gdbus).
++			 */
++			if (G_IS_DBUS_PROXY (proxy)) {
++				info->dun_proxy = dbus_g_proxy_new_for_name (info->bus,
++				                                             BLUEZ_SERVICE,
++				                                             g_dbus_proxy_get_object_path (G_DBUS_PROXY (proxy)),
++				                                             BLUEZ_SERIAL_INTERFACE);
++				g_object_unref (proxy);
++			} else if (DBUS_IS_G_PROXY (proxy)) {
++				info->dun_proxy = proxy;
++				dbus_g_proxy_set_interface (info->dun_proxy, BLUEZ_SERIAL_INTERFACE);
++			} else {
++				dun_error (info, __func__, error, _("failed to find Bluetooth device (unknown gnome-bluetooth proxy object type)."));
++				goto out;
++			}
++		}
++	}
++	g_assert (info->dun_proxy);
+ 
+-	if (info->dun_proxy) {
+-		info->dun_timeout_id = g_timeout_add_seconds (45, dun_timeout_cb, info);
+-
+-		dbus_g_proxy_set_interface (info->dun_proxy, BLUEZ_SERIAL_INTERFACE);
+-
+-		g_message ("%s: calling Connect...", __func__);
+-
+-		/* Watch for BT device property changes */
+-		dbus_g_object_register_marshaller (_nma_marshal_VOID__STRING_BOXED,
+-		                                   G_TYPE_NONE,
+-		                                   G_TYPE_STRING, G_TYPE_VALUE,
+-		                                   G_TYPE_INVALID);
+-		dbus_g_proxy_add_signal (info->dun_proxy, "PropertyChanged",
+-		                         G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
+-		dbus_g_proxy_connect_signal (info->dun_proxy, "PropertyChanged",
+-		                             G_CALLBACK (dun_property_changed), info, NULL);
+-
+-		/* Request a connection to the device and get the port */
+-		dbus_g_proxy_begin_call_with_timeout (info->dun_proxy, "Connect",
+-		                                      dun_connect_cb,
+-		                                      info,
+-		                                      NULL,
+-		                                      20000,
+-		                                      G_TYPE_STRING, "dun",
+-		                                      G_TYPE_INVALID);
+-	} else
+-		dun_error (info, __func__, error, _("could not find the Bluetooth device."));
++	info->dun_timeout_id = g_timeout_add_seconds (45, dun_timeout_cb, info);
+ 
++	g_message ("%s: calling Connect...", __func__);
++
++	/* Watch for BT device property changes */
++	dbus_g_object_register_marshaller (_nma_marshal_VOID__STRING_BOXED,
++	                                   G_TYPE_NONE,
++	                                   G_TYPE_STRING, G_TYPE_VALUE,
++	                                   G_TYPE_INVALID);
++	dbus_g_proxy_add_signal (info->dun_proxy, "PropertyChanged",
++	                         G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
++	dbus_g_proxy_connect_signal (info->dun_proxy, "PropertyChanged",
++	                             G_CALLBACK (dun_property_changed), info, NULL);
++
++	/* Request a connection to the device and get the port */
++	dbus_g_proxy_begin_call_with_timeout (info->dun_proxy, "Connect",
++	                                      dun_connect_cb,
++	                                      info,
++	                                      NULL,
++	                                      20000,
++	                                      G_TYPE_STRING, "dun",
++	                                      G_TYPE_INVALID);
++
++out:
+ 	g_message ("%s: finished", __func__);
+ }
+ 
+@@ -934,6 +952,8 @@ plugin_info_destroy (gpointer data)
+ {
+ 	PluginInfo *info = data;
+ 
++	g_message ("%s: NM Bluetooth widget info being destroyed", __func__);
++
+ 	g_free (info->bdaddr);
+ 	g_free (info->rfcomm_iface);
+ 	if (info->pan_connection)
diff --git a/debian/patches/series b/debian/patches/series
index f66cb64..735c473 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,5 @@
 # Debian patches for network-manager-applet
 01-format-security.patch
+02-fix-shell-version-detecting-code.patch
+03-dont-handle-VPN-secrets-with-GNOME-Shell-3.4.patch
+04-gnome-bluetooth-3.4-support.patch
diff --git a/debian/rules b/debian/rules
index 5fc8119..df09841 100755
--- a/debian/rules
+++ b/debian/rules
@@ -26,4 +26,7 @@ override_dh_install:
 	dh_install
 	find debian/network-manager-gnome/ -name \*.la -o -name \*.a | xargs rm -f
 
+override_dh_builddeb:
+	dh_builddeb -- -Zxz
+
 override_dh_auto_test:

Reply to: