[pitivi: 12/14] Connect to the delete-event so we can stop pitivi from closing if there are



commit 8431d256cfc30cada838ccae2b5c2acaffa3e373
Author: Alessandro Decina <alessandro d gmail com>
Date:   Wed Jun 24 12:28:44 2009 +0200

    Connect to the delete-event so we can stop pitivi from closing if there are
    unsaved changes.

 pitivi/ui/mainwindow.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index 5e42282..e9895d1 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -339,7 +339,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
         """ Create the graphical interface """
         self.set_title("%s v%s" % (APPNAME, pitivi_version))
         self.set_geometry_hints(min_width=800, min_height=480)
-        self.connect("destroy", self._destroyCb)
+        self.connect("delete-event", self._deleteCb)
         self.connect("configure-event", self._configureCb)
 
         # main menu & toolbar
@@ -467,9 +467,12 @@ class PitiviMainWindow(gtk.Window, Loggable):
             self.settings.mainWindowWidth = event.width
             self.settings.mainWindowHeight = event.height
 
-    def _destroyCb(self, unused_widget, unused_data=None):
+    def _deleteCb(self, unused_widget, unused_data=None):
+        if not self.app.shutdown():
+            return True
+
         self._saveWindowSettings()
-        self.app.shutdown()
+        return False
 
     def _exposeEventCb(self, unused_widget, event):
         if self._do_pending_fullscreen:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]