[pitivi] mainwindow: Clear the library simultaneously to the timeline on project closure



commit 9ddc78dafbada5e3a1adcfbda688beb5a3bb54f7
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Thu Sep 5 00:14:42 2013 -0400

    mainwindow: Clear the library simultaneously to the timeline on project closure
    
    Otherwise, when you ask to open another project, the timeline gets cleared
    but clips are still showing up in the media library, which gives a broken feel.

 pitivi/mainwindow.py |   10 +++++++++-
 pitivi/project.py    |    2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 0549c01..13198d4 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -977,10 +977,18 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         return res
 
     def _projectManagerProjectClosedCb(self, projectManager, project):
-        # we must disconnect from the project pipeline before it is released
+        """
+        This happens immediately when the user asks to load another project,
+        after the user confirmed that unsaved changes can be discarded but
+        before the filechooser to pick the new project to load appears...
+        We can then expect another project to be loaded soon afterwards.
+        """
+        # We must disconnect from the project pipeline before it is released:
         if project.pipeline is not None:
             project.pipeline.deactivatePositionListener()
 
+        self.info("Project closed - clearing the media library and timeline")
+        self.medialibrary.storemodel.clear()
         self.timeline_ui.setTimeline(None)
         self.clipconfig.timeline = None
         return False
diff --git a/pitivi/project.py b/pitivi/project.py
index a4943e3..d98e827 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -369,7 +369,7 @@ class ProjectManager(Signallable, Loggable):
 
         self.info("closing running project %s", self.current_project.uri)
         if not self.emit("closing-project", self.current_project):
-            self.error("Could not close project")
+            self.warning("Could not close project - this could be because there were unsaved changes and the 
user cancelled when prompted about them")
             return False
 
         self.emit("project-closed", self.current_project)


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