[gnome-control-center] shell: use the correct command line argument during panel activation



commit 1204832568425d20a29ae16f6fe33992d8a1b3bf
Author: Thomas Wood <thomas wood intel com>
Date:   Mon Jul 12 18:07:47 2010 +0100

    shell: use the correct command line argument during panel activation
    
    Use the second argument from the argv list in the activation callback to
    make sure the correct panel is loaded, since the first argument is the
    application binary name.

 shell/control-center.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/shell/control-center.c b/shell/control-center.c
index 7139fda..5a5b152 100644
--- a/shell/control-center.c
+++ b/shell/control-center.c
@@ -29,21 +29,23 @@
 #include <string.h>
 
 static void
-application_prepare_action_cb (GApplication *application, GVariant *arguments,
-                               GVariant *platform_data, GnomeControlCenter *shell)
+application_prepare_action_cb (GApplication       *application,
+                               GVariant           *arguments,
+                               GVariant           *platform_data,
+                               GnomeControlCenter *shell)
 {
-  GVariantIter iter;
-  GVariant *temp = NULL;
+  gchar **argv;
+  gsize length;
 
   gnome_control_center_present (shell);
 
-  /* we only care about the first argv */
-  g_variant_iter_init (&iter, arguments);
-  temp = g_variant_iter_next_value (&iter);
-  if (temp != NULL)
+  argv = g_variant_get_bytestring_array (arguments, &length);
+
+  if (length == 2)
     {
       GError *err = NULL;
-      const gchar *id = g_variant_get_bytestring (temp);
+      const gchar *id = argv[1];
+
       if (!cc_shell_set_active_panel_from_id (CC_SHELL (shell), id, &err))
         {
           if (err)



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