[PATCH 3/5] Add a free space line under every disk in the reclaim dialog.

Chris Lumens clumens at redhat.com
Wed Feb 27 20:43:10 UTC 2013


This is to help communicate how much total free space there is, in the case
where you've got enough but choose to go into the reclaim dialog to do some
other things anyway.
---
 pyanaconda/ui/gui/spokes/lib/resize.glade |  2 +-
 pyanaconda/ui/gui/spokes/lib/resize.py    | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/ui/gui/spokes/lib/resize.glade b/pyanaconda/ui/gui/spokes/lib/resize.glade
index 11eefcb..3ccb00e 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.glade
+++ b/pyanaconda/ui/gui/spokes/lib/resize.glade
@@ -141,7 +141,7 @@
                         <child>
                           <object class="GtkCellRendererText" id="diskRenderer"/>
                           <attributes>
-                            <attribute name="text">1</attribute>
+                            <attribute name="markup">1</attribute>
                           </attributes>
                         </child>
                       </object>
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py
index 1f1d990..4bb25cf 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -118,6 +118,8 @@ class ResizeDialog(GUIObject):
 
         canShrinkSomething = False
 
+        free_space = self.storage.getFreeSpace(disks=disks)
+
         for disk in disks:
             # First add the disk itself.
             editable = not disk.protected
@@ -165,6 +167,20 @@ class ResizeDialog(GUIObject):
                                                  dev.size])
                     diskReclaimableSpace += freeSize
 
+            # And then add another uneditable line that lists how much space is
+            # already free in the disk.
+            diskFree = free_space[disk.name][0]
+            converted = diskFree.convertTo(spec="mb")
+            if int(converted):
+                self._diskStore.append(itr, [disk.id,
+                                             _("""<span foreground='grey' style='italic'>Free space</span>"""),
+                                             "",
+                                             "<span foreground='grey' style='italic'>%s</span>" % size_str(diskFree),
+                                             _(PRESERVE),
+                                             False,
+                                             self._get_tooltip(disk),
+                                             float(converted)])
+
             # And then go back and fill in the total reclaimable space for the
             # disk, now that we know what each partition has reclaimable.
             self._diskStore[itr][RECLAIMABLE_COL] = self._diskStore[itr][RECLAIMABLE_COL] % size_str(diskReclaimableSpace)
-- 
1.8.1.2



More information about the anaconda-patches mailing list