summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2012-10-12 14:37:33 -0400
committerChris Lumens <clumens@redhat.com>2012-10-15 10:24:45 -0400
commit429c3bfd58a2a53a78fa105088738d49e815888b (patch)
tree1eb58dfb4e99acc540e6c1a7205fa911904e9ba1
parentbfc36eebfd56aad010964f63b9d76e75f520d546 (diff)
downloadanaconda-429c3bfd58a2a53a78fa105088738d49e815888b.tar.gz
anaconda-429c3bfd58a2a53a78fa105088738d49e815888b.tar.xz
anaconda-429c3bfd58a2a53a78fa105088738d49e815888b.zip
Add support for deleting an entire root via the existing ConfirmDeleteDialog.
You've already bought into doing something destructive, so why not have the chance to really tear things up? Also, make the cancel button the default action.
-rw-r--r--pyanaconda/ui/gui/spokes/custom.glade50
-rw-r--r--pyanaconda/ui/gui/spokes/custom.py17
2 files changed, 47 insertions, 20 deletions
diff --git a/pyanaconda/ui/gui/spokes/custom.glade b/pyanaconda/ui/gui/spokes/custom.glade
index c377e6af9..b4ae700b0 100644
--- a/pyanaconda/ui/gui/spokes/custom.glade
+++ b/pyanaconda/ui/gui/spokes/custom.glade
@@ -242,6 +242,36 @@ use. Try something else?</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
+ <child>
+ <object class="GtkLabel" id="confirmLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Are you sure you want to delete all of the data on %s?</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="removeAllCheckbox">
+ <property name="label" translatable="yes">Delete all other filesystems in the %s root as well.</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area2">
<property name="can_focus">False</property>
@@ -249,11 +279,11 @@ use. Try something else?</property>
<child>
<object class="GtkButton" id="deleteCancelButton">
<property name="label" translatable="yes">_Cancel</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_delete_cancel_clicked" swapped="no"/>
</object>
@@ -285,21 +315,7 @@ use. Try something else?</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="confirmLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Are you sure you want to delete
-all of the data on %s?</property>
- <property name="wrap">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 3150f6d25..8b780a342 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -248,16 +248,23 @@ class ConfirmDeleteDialog(GUIObject):
mainWidgetName = "confirmDeleteDialog"
uiFile = "spokes/custom.glade"
+ @property
+ def deleteAll(self):
+ return self._removeAll.get_active()
+
def on_delete_cancel_clicked(self, button, *args):
self.window.destroy()
def on_delete_confirm_clicked(self, button, *args):
self.window.destroy()
- def refresh(self, mountpoint, device):
+ def refresh(self, mountpoint, device, rootName):
GUIObject.refresh(self)
label = self.builder.get_object("confirmLabel")
+ self._removeAll = self.builder.get_object("removeAllCheckbox")
+ self._removeAll.set_label(self._removeAll.get_label() % rootName)
+
if mountpoint:
txt = "%s (%s)" % (mountpoint, device)
else:
@@ -1709,13 +1716,17 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
dialog = ConfirmDeleteDialog(self.data)
with enlightbox(self.window, dialog.window):
dialog.refresh(getattr(device.format, "mountpoint", ""),
- device.name)
+ device.name, selector._root.name)
rc = dialog.run()
if rc == 0:
return
- self._destroy_device(device)
+ if dialog.deleteAll:
+ for dev in selector._root.swaps + selector._root.mounts.values():
+ self._destroy_device(dev)
+ else:
+ self._destroy_device(device)
log.info("ui: removed device %s" % device.name)