[PATCH] Allow going to the reclaim dialog even for autopart (#1014671).

Chris Lumens clumens at redhat.com
Fri Jan 10 18:47:37 UTC 2014


The previous set of patches had one shortcoming:  If you had enough space to
install and were doing autopart, but still wanted to reclaim space, you could
not get to that dialog.  While I think relatively few people will fall into
this path, we spent a lot of time making it work previously and the reclaim
dialog is the nicest place to shrink other partitions.
---
 pyanaconda/ui/gui/spokes/storage.glade | 27 +++++++++++++++++++++++----
 pyanaconda/ui/gui/spokes/storage.py    | 30 ++++++++++++++++++++++++++++--
 2 files changed, 51 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/storage.glade b/pyanaconda/ui/gui/spokes/storage.glade
index eff46e4..3232bcf 100644
--- a/pyanaconda/ui/gui/spokes/storage.glade
+++ b/pyanaconda/ui/gui/spokes/storage.glade
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Tue Jan  7 16:44:29 2014 -->
+<!-- Generated with glade 3.16.0 on Fri Jan 10 11:15:22 2014 -->
 <interface>
   <!-- interface-requires gtk+ 3.6 -->
   <!-- interface-requires AnacondaWidgets 1.0 -->
@@ -768,7 +768,6 @@
                                 <property name="margin_left">18</property>
                                 <property name="margin_right">18</property>
                                 <property name="vexpand">False</property>
-                                <property name="row_spacing">6</property>
                                 <property name="column_spacing">6</property>
                                 <child>
                                   <object class="GtkLabel" id="label10">
@@ -791,6 +790,7 @@
                                   <object class="GtkLabel" id="label11">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
+                                    <property name="margin_top">6</property>
                                     <property name="xalign">0</property>
                                     <property name="label" translatable="yes">Encryption</property>
                                     <attributes>
@@ -799,7 +799,7 @@
                                   </object>
                                   <packing>
                                     <property name="left_attach">0</property>
-                                    <property name="top_attach">2</property>
+                                    <property name="top_attach">3</property>
                                     <property name="width">2</property>
                                     <property name="height">1</property>
                                   </packing>
@@ -832,6 +832,7 @@
                                     <property name="xalign">0</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">autopartRadioButton</property>
+                                    <signal name="toggled" handler="on_custom_toggled" swapped="no"/>
                                   </object>
                                   <packing>
                                     <property name="left_attach">1</property>
@@ -888,7 +889,25 @@
                                   </object>
                                   <packing>
                                     <property name="left_attach">0</property>
-                                    <property name="top_attach">3</property>
+                                    <property name="top_attach">4</property>
+                                    <property name="width">2</property>
+                                    <property name="height">1</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="reclaimCheckbox">
+                                    <property name="label" translatable="yes">I would like to _make additional space available.</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="margin_left">12</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="draw_indicator">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">0</property>
+                                    <property name="top_attach">2</property>
                                     <property name="width">2</property>
                                     <property name="height">1</property>
                                   </packing>
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 9eeac2f..9dbd945 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -1,6 +1,6 @@
 # Storage configuration spoke classes
 #
-# Copyright (C) 2011-2013  Red Hat, Inc.
+# Copyright (C) 2011-2014  Red Hat, Inc.
 #
 # This copyrighted material is made available to anyone wishing to use,
 # modify, copy, or redistribute it subject to the terms and conditions of
@@ -265,6 +265,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
     def _grabObjects(self):
         self._customPart = self.builder.get_object("customRadioButton")
         self._encrypted = self.builder.get_object("encryptionCheckbox")
+        self._reclaim = self.builder.get_object("reclaimCheckbox")
 
     def _applyDiskSelection(self, use_names):
         onlyuse = use_names[:]
@@ -730,7 +731,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         if disk_free >= required_space + auto_swap:
             dialog = None
         elif disks_size >= required_space:
-            if self._customPart.get_active():
+            if self._customPart.get_active() or self._reclaim.get_active():
                 dialog = None
             else:
                 dialog = InstallOptions1Dialog(self.data, payload=self.payload)
@@ -745,7 +746,22 @@ class StorageSpoke(NormalSpoke, StorageChecker):
             # Plenty of room - there's no need to pop up a dialog, so just send
             # the user to wherever they asked to go.  That's either the custom
             # spoke or the hub.
+            #    - OR -
+            # Not enough room, but the user checked the reclaim button.
+
+            # But first, we need to ask about an encryption passphrase if that
+            # checkbox was active.
             self.encrypted = self._encrypted.get_active()
+            if not self._check_encrypted():
+                return
+
+            # Oh and then we might also want to go to the reclaim dialog.
+            if self._reclaim.get_active():
+                self.apply()
+                if not self._show_resize_dialog(disks):
+                    # User pressed cancel on the reclaim dialog, so don't leave
+                    # the storage spoke.
+                    return
 
             if self._customPart.get_active():
                 self.autopart = False
@@ -800,6 +816,16 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         rc = self.run_lightbox_dialog(resizeDialog)
         return rc
 
+    def on_custom_toggled(self, button):
+        # The custom button won't be active until after this handler is run,
+        # so we have to negate everything here.
+        self._reclaim.set_sensitive(not button.get_active())
+
+        if self._reclaim.get_sensitive():
+            self._reclaim.set_has_tooltip(False)
+        else:
+            self._reclaim.set_tooltip_text(_("You'll be able to make space available during custom partitioning."))
+
     def on_specialized_clicked(self, button):
         # Don't want to run apply or execute in this case, since we have to
         # collect some more disks first.  The user will be back to this spoke.
-- 
1.8.3.1



More information about the anaconda-patches mailing list