[PATCH 5/5] Add a delete-event handler for the main window
David Shea
dshea at redhat.com
Mon Jun 16 19:09:17 UTC 2014
If someone does tell the window to close, we don't want anaconda to just
disappear.
---
pyanaconda/ui/gui/__init__.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index 38576a1..24cf966 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -246,6 +246,9 @@ class MainWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self)
+ # Treat an attempt to close the window the same as hitting quit
+ self.connect("delete-event", self._on_delete_event)
+
# Create a stack and a list of what's been added to the stack
self._stack = Gtk.Stack()
self._stack_contents = set()
@@ -271,6 +274,15 @@ class MainWindow(Gtk.Window):
screen = self.get_screen()
self.set_default_size(screen.get_width(), screen.get_height())
+ def _on_delete_event(self, widget, event, user_data=None):
+ # Use the quit-clicked signal on the the current standalone, even if the
+ # standalone is not currently displayed.
+ if self.current_action:
+ self.current_action.window.emit("quit-clicked")
+
+ # Stop the window from being closed here
+ return True
+
@property
def current_action(self):
return self._current_action
--
2.0.0
More information about the anaconda-patches
mailing list