[network-manager-applet] applet: support --no-agent (bgo #744163)



commit 55c39272f5f66c5127799833464a9f498179de22
Author: Pavel Šimerda <psimerda redhat com>
Date:   Thu Jan 15 10:20:40 2015 +0100

    applet: support --no-agent (bgo #744163)
    
    This is especially useful when debugging with G_DEBUG=fatal-warnings
    in cases when you don't expect the agent to register successfully,
    e.g. due to an already registered nm-applet.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744163

 src/applet.c |    4 +++-
 src/main.c   |    3 +++
 2 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index f15d463..ee027a5 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -95,6 +95,7 @@
 #define NOTIFY_CAPS_ACTIONS_KEY "actions"
 
 extern gboolean shell_debug;
+extern gboolean with_agent;
 
 static void nma_initable_interface_init (GInitableIface *iface, gpointer iface_data);
 
@@ -3627,7 +3628,8 @@ initable_init (GInitable *initable, GCancellable *cancellable, GError **error)
                          G_CALLBACK (applet_embedded_cb), NULL);
        applet_embedded_cb (G_OBJECT (applet->status_icon), NULL, NULL);
 
-       register_agent (applet);
+       if (with_agent)
+               register_agent (applet);
 
        return TRUE;
 }
diff --git a/src/main.c b/src/main.c
index 61043d0..27f2ec5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -38,6 +38,7 @@
 
 static GMainLoop *loop = NULL;
 gboolean shell_debug = FALSE;
+gboolean with_agent = TRUE;
 
 static void
 signal_handler (int signo, siginfo_t *info, void *data)
@@ -89,6 +90,8 @@ int main (int argc, char *argv[])
                }
                if (!strcmp (argv[i], "--shell-debug"))
                        shell_debug = TRUE;
+               if (!strcmp (argv[i], "--no-agent"))
+                       with_agent = FALSE;
        }
 
        bindtextdomain (GETTEXT_PACKAGE, NMALOCALEDIR);


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