[network-manager-applet/dcbw/fixes: 1/2] applet: create agent if --shell-debug is used



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

    applet: create agent if --shell-debug is used
    
    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).

 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]