[network-manager-applet] applet: create agent if --shell-debug is used (bgo #729334)



commit ab35481ce58258e80db6bef833c8c62e1190db08
Author: Dan Williams <dcbw redhat com>
Date:   Thu May 1 09:38:02 2014 -0500

    applet: create agent if --shell-debug is used (bgo #729334)
    
    The applet agent wouldn't be created if --shell-debug was used, which
    somewhat defeats the purpose of --shell-debug (which is to act like
    nm-applet isn't running under gnome-shell for debugging purposes).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=729334

 src/applet.c |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index 46e3fd7..59691f6 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -3523,6 +3523,18 @@ applet_embedded_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
 }
 
 static void
+register_agent (NMApplet *applet)
+{
+       applet->agent = applet_agent_new ();
+       g_assert (applet->agent);
+       g_signal_connect (applet->agent, APPLET_AGENT_GET_SECRETS,
+                         G_CALLBACK (applet_agent_get_secrets_cb), applet);
+       g_signal_connect (applet->agent, APPLET_AGENT_CANCEL_SECRETS,
+                         G_CALLBACK (applet_agent_cancel_secrets_cb), applet);
+       nm_secret_agent_register (NM_SECRET_AGENT (applet->agent));
+}
+
+static void
 shell_version_changed_cb (NMShellWatcher *watcher, GParamSpec *pspec, gpointer user_data)
 {
        NMApplet *applet = user_data;
@@ -3551,14 +3563,7 @@ shell_version_changed_cb (NMShellWatcher *watcher, GParamSpec *pspec, gpointer u
        } else {
                /* No shell */
                g_debug ("gnome-shell is not running, registering secret agent");
-
-               applet->agent = applet_agent_new ();
-               g_assert (applet->agent);
-               g_signal_connect (applet->agent, APPLET_AGENT_GET_SECRETS,
-                                 G_CALLBACK (applet_agent_get_secrets_cb), applet);
-               g_signal_connect (applet->agent, APPLET_AGENT_CANCEL_SECRETS,
-                                 G_CALLBACK (applet_agent_cancel_secrets_cb), applet);
-               nm_secret_agent_register (NM_SECRET_AGENT (applet->agent));
+               register_agent (applet);
        }
 }
 
@@ -3721,7 +3726,8 @@ initable_init (GInitable *initable, GCancellable *cancellable, GError **error)
                                      "notify::shell-version",
                                      G_CALLBACK (shell_version_changed_cb),
                                      applet);
-       }
+       } else
+               register_agent (applet);
 
        return TRUE;
 }


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