[pitivi] medialibrary: Connect to the project in a single place



commit d9c7346033e7de7e25d4af8d49de27c28e08ddbf
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sun Feb 14 03:51:32 2016 +0100

    medialibrary: Connect to the project in a single place
    
    Differential Revision: https://phabricator.freedesktop.org/D776

 pitivi/medialibrary.py |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index b9c3901..dc7cf19 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -1398,9 +1398,6 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
                     iconview.select_path(current_cursor_pos)
 
     def __disconnectFromProject(self):
-        if not self._project:
-            return
-
         self._project.disconnect_by_func(self._assetAddedCb)
         self._project.disconnect_by_func(self._assetLoadingProgressCb)
         self._project.disconnect_by_func(self._assetRemovedCb)
@@ -1409,10 +1406,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
         self._project.disconnect_by_func(self.__projectSettingsSetFromImportedAssetCb)
 
     def _newProjectCreatedCb(self, unused_project_manager, project):
-        if self._project is project:
-            return
-
-        self.__disconnectFromProject()
+        assert (not self._project)
 
         self._project = project
         self._resetErrorList()
@@ -1421,11 +1415,6 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
         self._connectToProject(project)
 
     def _newProjectLoadedCb(self, unused_project_manager, project):
-        if self._project is not project:
-            self._project = project
-            self.storemodel.clear()
-            self._connectToProject(project)
-
         # Make sure that the sources added to the project are added
         self._flushPendingRows()
 
@@ -1434,8 +1423,10 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
         self._project = None
 
     def _projectClosedCb(self, unused_project_manager, unused_project):
+        self.__disconnectFromProject()
         self._project_settings_set_infobar.hide()
         self.storemodel.clear()
+        self._project = None
 
     def _addUris(self, uris):
         if self._project:


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