[PATCH 1/3] Add a "Delete All" button to the reclaim dialog.
Chris Lumens
clumens at redhat.com
Tue Jun 4 17:27:32 UTC 2013
This allows for clearing all editable disks in one button click. It is
positioned on the far right of the list of action buttons and schedules a
delete action for all disks. Should you later wish to undo this action,
the button will also do a preserve all.
This also required moving the shrink slider down.
---
pyanaconda/ui/gui/spokes/lib/resize.glade | 50 ++++++++++++++++++++-----------
pyanaconda/ui/gui/spokes/lib/resize.py | 39 ++++++++++++++++++------
2 files changed, 63 insertions(+), 26 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.glade b/pyanaconda/ui/gui/spokes/lib/resize.glade
index 3a4c5eb..bd6cdd4 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.glade
+++ b/pyanaconda/ui/gui/spokes/lib/resize.glade
@@ -53,13 +53,13 @@
<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>
@@ -69,14 +69,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 +213,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>
@@ -247,7 +248,7 @@
</child>
<child>
<object class="GtkButton" id="shrinkButton">
- <property name="label" translatable="yes">_Shrink to</property>
+ <property name="label" translatable="yes">_Shrink</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -262,20 +263,18 @@
</packing>
</child>
<child>
- <object class="GtkScale" id="resizeSlider">
+ <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="margin_left">12</property>
- <property name="margin_right">12</property>
- <property name="adjustment">resizeAdjustment</property>
- <property name="round_digits">1</property>
- <property name="digits">0</property>
- <signal name="format-value" handler="resize_slider_format" swapped="no"/>
- <signal name="value-changed" handler="on_resize_value_changed" swapped="no"/>
+ <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">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
+ <property name="pack_type">end</property>
<property name="position">3</property>
</packing>
</child>
@@ -287,6 +286,23 @@
</packing>
</child>
<child>
+ <object class="GtkScale" id="resizeSlider">
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="margin_bottom">12</property>
+ <property name="adjustment">resizeAdjustment</property>
+ <property name="round_digits">0</property>
+ <property name="digits">0</property>
+ <signal name="format-value" handler="resize_slider_format" swapped="no"/>
+ <signal name="value-changed" handler="on_resize_value_changed" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="reclaimableSpaceLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -298,7 +314,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">5</property>
</packing>
</child>
<child>
@@ -313,7 +329,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
@@ -328,7 +344,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">6</property>
+ <property name="position">7</property>
</packing>
</child>
</object>
@@ -342,7 +358,7 @@
</child>
<action-widgets>
<action-widget response="0">cancelButton</action-widget>
- <action-widget response="1">resizeButton</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..2df4c59 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -317,18 +317,18 @@ class ResizeDialog(GUIObject):
return False
def on_preserve_clicked(self, button):
- self._actionChanged(PRESERVE)
+ (model, itr) = self.builder.get_object("diskView-selection").get_selected()
+ self._actionChanged(itr, PRESERVE)
def on_shrink_clicked(self, button):
- self._actionChanged(SHRINK)
+ (model, itr) = self.builder.get_object("diskView-selection").get_selected()
+ self._actionChanged(itr, SHRINK)
def on_delete_clicked(self, button):
- self._actionChanged(DELETE)
-
- def _actionChanged(self, newAction):
- selection = self.builder.get_object("diskView-selection")
- (model, itr) = selection.get_selected()
+ (model, itr) = self.builder.get_object("diskView-selection").get_selected()
+ self._actionChanged(itr, DELETE)
+ def _actionChanged(self, itr, newAction):
if not itr:
return
@@ -340,7 +340,7 @@ class ResizeDialog(GUIObject):
# it contains.
device = self.storage.devicetree.getDeviceByID(selectedRow[DEVICE_ID_COL])
if device.isDisk and device.partitioned:
- partItr = model.iter_children(itr)
+ partItr = self._diskStore.iter_children(itr)
while partItr:
self._diskStore[partItr][ACTION_COL] = _(newAction)
@@ -352,7 +352,7 @@ class ResizeDialog(GUIObject):
part = self.storage.devicetree.getDeviceByID(self._diskStore[partItr][DEVICE_ID_COL])
self._diskStore[partItr][EDITABLE_COL] = not part.protected
- partItr = model.iter_next(partItr)
+ partItr = self._diskStore.iter_next(partItr)
# And then we're keeping a running tally of how much space the user
# has selected to reclaim, so reflect that in the UI.
@@ -386,6 +386,27 @@ class ResizeDialog(GUIObject):
def on_resize_clicked(self, *args):
self._diskStore.foreach(self._scheduleActions, None)
+ def on_delete_all_clicked(self, button, *args):
+ if button.get_label() == _("Delete _all"):
+ action = DELETE
+ button.set_label(_("Preserve _all"))
+ else:
+ action = PRESERVE
+ button.set_label(_("Delete _all"))
+
+ itr = self._diskStore.get_iter_first()
+ while itr:
+ if not self._diskStore[itr][EDITABLE_COL]:
+ itr = self._diskStore.iter_next(itr)
+ continue
+
+ (ident, ) = self._diskStore.get(itr, DEVICE_ID_COL)
+ device = self.storage.devicetree.getDeviceByID(ident)
+ if device.isDisk:
+ self._actionChanged(itr, action)
+
+ itr = self._diskStore.iter_next(itr)
+
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