[gnome-control-center/gbsneto/interactive-test-panels: 12/13] panel-list: Dynamically show Details/Devices row



commit 70b5404ce6e976d293458056503f76f7774b9b67
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Nov 9 00:02:32 2018 -0200

    panel-list: Dynamically show Details/Devices row
    
    This is just a nicety for the test mode; when there are no
    panels added under those categories, do not show the rows.

 shell/cc-panel-list.c  | 6 ++++++
 shell/cc-panel-list.ui | 2 --
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/shell/cc-panel-list.c b/shell/cc-panel-list.c
index 070342aba..485480ff0 100644
--- a/shell/cc-panel-list.c
+++ b/shell/cc-panel-list.c
@@ -952,6 +952,12 @@ cc_panel_list_add_panel (CcPanelList        *self,
 
   g_hash_table_insert (self->id_to_data, data->id, data);
   g_hash_table_insert (self->id_to_search_data, search_data->id, search_data);
+
+  /* Only show the Devices/Details rows when there's at least one panel */
+  if (category == CC_CATEGORY_DEVICES)
+    gtk_widget_show (GTK_WIDGET (self->devices_row));
+  else if (category == CC_CATEGORY_DETAILS)
+    gtk_widget_show (GTK_WIDGET (self->details_row));
 }
 
 /**
diff --git a/shell/cc-panel-list.ui b/shell/cc-panel-list.ui
index 10daec9fe..b870eb96b 100644
--- a/shell/cc-panel-list.ui
+++ b/shell/cc-panel-list.ui
@@ -14,7 +14,6 @@
         <signal name="row-activated" handler="row_activated_cb" object="CcPanelList" swapped="no" />
         <child>
           <object class="GtkListBoxRow" id="devices_row">
-            <property name="visible">True</property>
             <property name="can_focus">True</property>
             <child>
               <object class="GtkBox">
@@ -72,7 +71,6 @@
         </child>
         <child>
           <object class="GtkListBoxRow" id="details_row">
-            <property name="visible">True</property>
             <property name="can_focus">True</property>
             <child>
               <object class="GtkBox">


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