[gnome-control-center] shell: Revert "Let panels have their own commandline flags"



commit c84722248e41946fd995cff3ce773f9b80b2f4d7
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Wed Jul 8 18:04:41 2015 +0200

    shell: Revert "Let panels have their own commandline flags"
    
    This reverts commit 31a8a99440cce715b2e32ca71a6cbf650eab012a.
    
    This was meant for bgo#695885 which has stalled for a while, so this
    feature has no in-tree user. This commit removes it for now, this can be
    readded when users for it materialize.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751597

 panels/keyboard/cc-keyboard-panel.c               |   10 ++++------
 panels/network/cc-network-panel.c                 |    3 +--
 panels/online-accounts/cc-online-accounts-panel.c |    6 +++---
 panels/sound/cc-sound-panel.c                     |    5 ++---
 shell/cc-application.c                            |    6 ------
 shell/cc-panel-loader.c                           |   17 -----------------
 shell/cc-panel-loader.h                           |    2 --
 shell/cc-panel.c                                  |   12 ------------
 shell/cc-panel.h                                  |    4 ----
 9 files changed, 10 insertions(+), 55 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-panel.c b/panels/keyboard/cc-keyboard-panel.c
index db857b9..1efc7e2 100644
--- a/panels/keyboard/cc-keyboard-panel.c
+++ b/panels/keyboard/cc-keyboard-panel.c
@@ -90,19 +90,17 @@ cc_keyboard_panel_set_property (GObject      *object,
       page = section = NULL;
       switch (g_variant_n_children (parameters))
         {
-          case 3:
-            g_variant_get_child (parameters, 2, "v", &v);
+          case 2:
+            g_variant_get_child (parameters, 1, "v", &v);
             section = g_variant_get_string (v, NULL);
             g_variant_unref (v);
             /* fall-through */
-          case 2:
-            g_variant_get_child (parameters, 1, "v", &v);
+          case 1:
+            g_variant_get_child (parameters, 0, "v", &v);
             page = g_variant_get_string (v, NULL);
             g_variant_unref (v);
             cc_keyboard_panel_set_page (panel, page, section);
             /* fall-through */
-          case 1:
-            /* No flags expected, fall-through */
           case 0:
             break;
           default:
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 1f09613..0e70581 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -167,8 +167,7 @@ variant_av_to_string_array (GVariant *array)
         count = g_variant_iter_init (&iter, array);
         strv = g_ptr_array_sized_new (count + 1);
         while (g_variant_iter_next (&iter, "v", &v)) {
-                if (g_variant_is_of_type (v, G_VARIANT_TYPE_STRING))
-                        g_ptr_array_add (strv, (gpointer *)g_variant_get_string (v, NULL));
+                g_ptr_array_add (strv, (gpointer *)g_variant_get_string (v, NULL));
                 g_variant_unref (v);
         }
         g_ptr_array_add (strv, NULL); /* NULL-terminate the strv data array */
diff --git a/panels/online-accounts/cc-online-accounts-panel.c 
b/panels/online-accounts/cc-online-accounts-panel.c
index 6295209..2f68ede 100644
--- a/panels/online-accounts/cc-online-accounts-panel.c
+++ b/panels/online-accounts/cc-online-accounts-panel.c
@@ -159,12 +159,12 @@ cc_goa_panel_set_property (GObject *object,
           const gchar *first_arg = NULL;
 
           parameters = g_value_get_variant (value);
-          if (parameters == NULL || g_variant_n_children (parameters) == 0)
+          if (parameters == NULL)
             return;
 
-          if (g_variant_n_children (parameters) > 1)
+          if (g_variant_n_children (parameters) > 0)
             {
-                g_variant_get_child (parameters, 1, "v", &v);
+                g_variant_get_child (parameters, 0, "v", &v);
                 if (g_variant_is_of_type (v, G_VARIANT_TYPE_STRING))
                   first_arg = g_variant_get_string (v, NULL);
                 else
diff --git a/panels/sound/cc-sound-panel.c b/panels/sound/cc-sound-panel.c
index b9d5d0f..d715e9a 100644
--- a/panels/sound/cc-sound-panel.c
+++ b/panels/sound/cc-sound-panel.c
@@ -54,10 +54,9 @@ cc_sound_panel_set_property (GObject      *object,
                 GVariant *parameters;
 
                 parameters = g_value_get_variant (value);
-                if (parameters && g_variant_n_children (parameters) > 1) {
+                if (parameters && g_variant_n_children (parameters) > 0) {
                         GVariant *v;
-                        /* Skip the first child, we don't expect any flag */
-                        g_variant_get_child (parameters, 1, "v", &v);
+                        g_variant_get_child (parameters, 0, "v", &v);
                         gvc_mixer_dialog_set_page (self->dialog, g_variant_get_string (v, NULL));
                         g_variant_unref (v);
                 }
diff --git a/shell/cc-application.c b/shell/cc-application.c
index e64b154..936f902 100644
--- a/shell/cc-application.c
+++ b/shell/cc-application.c
@@ -131,22 +131,18 @@ cc_application_command_line (GApplication *application,
   int retval = 0;
   GOptionContext *context;
   GError *error = NULL;
-  GVariantBuilder *flags_builder;
 
   verbose = FALSE;
   show_overview = FALSE;
   show_help = FALSE;
   start_panels = NULL;
 
-  flags_builder = g_variant_builder_new (G_VARIANT_TYPE_VARDICT);
-
   argv = g_application_command_line_get_arguments (command_line, &argc);
 
   context = g_option_context_new (N_("- Settings"));
   g_option_context_add_main_entries (context, all_options, GETTEXT_PACKAGE);
   g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
   g_option_context_add_group (context, gtk_get_option_group (TRUE));
-  cc_panel_loader_add_option_groups (context, flags_builder);
   g_option_context_set_help_enabled (context, FALSE);
 
   start_panels = NULL;
@@ -231,8 +227,6 @@ cc_application_command_line (GApplication *application,
         g_debug ("No extra argument");
 
       builder = g_variant_builder_new (G_VARIANT_TYPE ("av"));
-      g_variant_builder_add (builder, "v", g_variant_builder_end (flags_builder));
-
       for (i = 1; start_panels[i] != NULL; i++)
         g_variant_builder_add (builder, "v", g_variant_new_string (start_panels[i]));
       parameters = g_variant_builder_end (builder);
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index 26576dc..de9c5df 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -216,21 +216,4 @@ cc_panel_loader_load_by_name (CcShell     *shell,
                        NULL);
 }
 
-void
-cc_panel_loader_add_option_groups (GOptionContext  *context,
-                                   GVariantBuilder *builder)
-{
-  int i;
-
-  for (i = 0; i < G_N_ELEMENTS (all_panels); i++)
-    {
-      GType (*get_type) (void);
-      get_type = all_panels[i].get_type;
-      GOptionGroup *group = cc_panel_get_option_group (get_type(), builder);
-      if (group == NULL)
-        continue;
-      g_option_context_add_group (context, group);
-    }
-}
-
 #endif /* CC_PANEL_LOADER_NO_GTYPES */
diff --git a/shell/cc-panel-loader.h b/shell/cc-panel-loader.h
index 23599cb..4994424 100644
--- a/shell/cc-panel-loader.h
+++ b/shell/cc-panel-loader.h
@@ -30,8 +30,6 @@ G_BEGIN_DECLS
 
 void     cc_panel_loader_fill_model     (CcShellModel  *model);
 GList   *cc_panel_loader_get_panels     (void);
-void     cc_panel_loader_add_option_groups (GOptionContext  *context,
-                                            GVariantBuilder *builder);
 CcPanel *cc_panel_loader_load_by_name   (CcShell       *shell,
                                          const char    *name,
                                          GVariant      *parameters);
diff --git a/shell/cc-panel.c b/shell/cc-panel.c
index 2522b49..7765a4c 100644
--- a/shell/cc-panel.c
+++ b/shell/cc-panel.c
@@ -280,15 +280,3 @@ cc_panel_get_help_uri (CcPanel *panel)
 
   return NULL;
 }
-
-GOptionGroup *
-cc_panel_get_option_group (GType            panel_type,
-                           GVariantBuilder *builder)
-{
-  GOptionGroup *options = NULL;
-  CcPanelClass *class = CC_PANEL_CLASS (g_type_class_ref (panel_type));
-  if (class->get_option_group != NULL)
-    options = class->get_option_group (builder);
-  g_type_class_unref (class);
-  return options;
-}
diff --git a/shell/cc-panel.h b/shell/cc-panel.h
index 593eef7..ef77e91 100644
--- a/shell/cc-panel.h
+++ b/shell/cc-panel.h
@@ -74,16 +74,12 @@ struct _CcPanelClass
   /*< private >*/
   GtkBinClass parent_class;
 
-  GOptionGroup * (* get_option_group) (GVariantBuilder *builder);
   GPermission * (* get_permission) (CcPanel *panel);
   const char  * (* get_help_uri)   (CcPanel *panel);
 };
 
 GType        cc_panel_get_type         (void);
 
-GOptionGroup *cc_panel_get_option_group (GType            panel_type,
-                                         GVariantBuilder *builder);
-
 CcShell*     cc_panel_get_shell        (CcPanel     *panel);
 
 GPermission *cc_panel_get_permission   (CcPanel     *panel);


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