[pitivi] mainwindow: Check for unsaved changes before (not after) loading a new project



commit 189e1bcf728d43b1370ec8b309b2037f150e44f0
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Wed Aug 21 22:08:23 2013 -0400

    mainwindow: Check for unsaved changes before (not after) loading a new project
    
    This makes for a much less awkward flow and actually allows users to cancel
    the closure of their current project if they are unsure.
    
    Fixes bug #706539

 pitivi/mainwindow.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index c15a677..54e5b41 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -774,6 +774,12 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         abt.show()
 
     def openProject(self):
+        # Requesting project closure at this point in time prompts users about
+        # unsaved changes (if any); much better than having ProjectManager
+        # trigger this *after* the user already chose a new project to load...
+        if not self.app.projectManager.closeRunningProject():
+            return  # The user has not made a decision, don't do anything
+
         chooser = Gtk.FileChooserDialog(_("Open File..."),
             self,
             action=Gtk.FileChooserAction.OPEN,


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