[PATCH] Add a "Delete All" button to the reclaim dialog.

Chris Lumens clumens at redhat.com
Fri May 31 20:37:20 UTC 2013


This allows for clearing all editable disks in one button click.  It is
positioned in the bottom box and functions the same way as the reclaim
space button when clicked - it immediately takes effect and returns the
user to the hub.
---
 pyanaconda/ui/gui/spokes/lib/resize.glade | 26 ++++++++++++++++++++++----
 pyanaconda/ui/gui/spokes/lib/resize.py    |  8 ++++++++
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/lib/resize.glade b/pyanaconda/ui/gui/spokes/lib/resize.glade
index 3a4c5eb..b996fef 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.glade
+++ b/pyanaconda/ui/gui/spokes/lib/resize.glade
@@ -53,13 +53,29 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="halign">end</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">0</property>
+                <property name="non_homogeneous">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="deleteAllButton">
+                <property name="label" translatable="yes">Delete _all</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+                <signal name="clicked" handler="on_delete_all_clicked" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+                <property name="non_homogeneous">True</property>
               </packing>
             </child>
             <child>
@@ -69,14 +85,14 @@
                 <property name="sensitive">False</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="halign">end</property>
                 <property name="use_underline">True</property>
                 <signal name="clicked" handler="on_resize_clicked" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
+                <property name="non_homogeneous">True</property>
               </packing>
             </child>
           </object>
@@ -213,6 +229,7 @@
               <object class="GtkBox" id="box2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="margin_top">6</property>
                 <child>
                   <object class="GtkButton" id="preserveButton">
                     <property name="label" translatable="yes">_Preserve</property>
@@ -342,7 +359,8 @@
     </child>
     <action-widgets>
       <action-widget response="0">cancelButton</action-widget>
-      <action-widget response="1">resizeButton</action-widget>
+      <action-widget response="1">deleteAllButton</action-widget>
+      <action-widget response="2">resizeButton</action-widget>
     </action-widgets>
   </object>
 </interface>
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py
index 30518aa..a9bb782 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -386,6 +386,14 @@ class ResizeDialog(GUIObject):
     def on_resize_clicked(self, *args):
         self._diskStore.foreach(self._scheduleActions, None)
 
+    def on_delete_all_clicked(self, *args):
+        for row in self._diskStore:
+            if not row[EDITABLE_COL]:
+                continue
+
+            device = self.storage.devicetree.getDeviceByID(row[DEVICE_ID_COL])
+            self.storage.recursiveRemove(device)
+
     def on_row_clicked(self, view, path, column):
         # This handles when the user clicks on a row in the view.  We use it
         # only for expanding/collapsing disk headers.
-- 
1.8.1.2



More information about the anaconda-patches mailing list