From 429c3bfd58a2a53a78fa105088738d49e815888b Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Fri, 12 Oct 2012 14:37:33 -0400 Subject: 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. --- pyanaconda/ui/gui/spokes/custom.glade | 50 +++++++++++++++++++++++------------ pyanaconda/ui/gui/spokes/custom.py | 17 +++++++++--- 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? False vertical 2 + + + True + False + 0 + 0 + Are you sure you want to delete all of the data on %s? + True + + + True + True + 0 + + + + + Delete all other filesystems in the %s root as well. + True + True + False + 0 + True + + + False + True + 1 + + False @@ -249,11 +279,11 @@ use. Try something else? _Cancel - False True True + True + True True - False True @@ -285,21 +315,7 @@ use. Try something else? False True end - 0 - - - - - True - False - Are you sure you want to delete -all of the data on %s? - True - - - False - True - 1 + 2 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) -- cgit