[PATCH] Only show the "SYSTEM" heading if there are data mount points under it.

Chris Lumens clumens at redhat.com
Tue Dec 9 16:38:45 UTC 2014


This is very similar to a previous patch for the "DATA" heading, so I made some
changes to make it all more general.
---
 pyanaconda/ui/gui/spokes/lib/accordion.py | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/lib/accordion.py b/pyanaconda/ui/gui/spokes/lib/accordion.py
index 844f725..4aee64c 100644
--- a/pyanaconda/ui/gui/spokes/lib/accordion.py
+++ b/pyanaconda/ui/gui/spokes/lib/accordion.py
@@ -157,13 +157,17 @@ class Page(Gtk.Box):
         self._dataLabel = self._make_category_label(_("DATA"))
         really_hide(self._dataLabel)
         self._dataBox.add(self._dataLabel)
-        self._dataBox.connect("add", self._onDataAdded)
-        self._dataBox.connect("remove", self._onDataRemoved)
+        self._dataBox.connect("add", self._onSelectorAdded, self._dataLabel)
+        self._dataBox.connect("remove", self._onSelectorRemoved, self._dataLabel)
         self.add(self._dataBox)
 
         # Create the System label and a box to store all its members in.
         self._systemBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
-        self._systemBox.add(self._make_category_label(_("SYSTEM")))
+        self._systemLabel = self._make_category_label(_("SYSTEM"))
+        really_hide(self._systemLabel)
+        self._systemBox.add(self._systemLabel)
+        self._systemBox.connect("add", self._onSelectorAdded, self._systemLabel)
+        self._systemBox.connect("remove", self._onSelectorRemoved, self._systemLabel)
         self.add(self._systemBox)
 
         self.members = []
@@ -227,14 +231,14 @@ class Page(Gtk.Box):
         # _onSelectorClicked
         cb(selector)
 
-    def _onDataAdded(self, container, widget):
-        really_show(self._dataLabel)
+    def _onSelectorAdded(self, container, widget, label):
+        really_show(label)
 
-    def _onDataRemoved(self, container, widget):
+    def _onSelectorRemoved(self, container, widget, label):
         # This runs before widget is removed from container, so if it's the last
         # item then the container will still not be empty.
         if len(container.get_children()) == 1:
-            really_hide(self._dataLabel)
+            really_hide(label)
 
 class UnknownPage(Page):
     def __init__(self, title):
-- 
1.9.3



More information about the anaconda-patches mailing list