[pitivi/ges: 205/287] Restore unused sources selection



commit f3013195155b306b5bac9213585b24a0394f7470
Author: Mathieu Duponchelle <seeed laposte net>
Date:   Tue Dec 27 13:33:55 2011 +0100

    Restore unused sources selection

 pitivi/medialibrary.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index a8850c8..13eeda4 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -876,6 +876,14 @@ class MediaLibraryWidget(gtk.VBox, Loggable):
             self.app.current.sources.removeUri(uri)
         self.app.action_log.commit()
 
+    def _checkUsedSource(self, timeline, uri):
+        layers = timeline.get_layers()
+        for layer in layers:
+            for tlobj in layer.get_objects():
+                if tlobj.get_uri() == uri:
+                    return True
+        return False
+
     def _selectUnusedSources(self):
         """
         Select, in the media library, unused sources in the project.
@@ -886,8 +894,8 @@ class MediaLibraryWidget(gtk.VBox, Loggable):
         model = self.storemodel
         selection = self.treeview.get_selection()
         for source in sources:
-            if not self.app.current.timeline.usesFactory(source):
-                unused_sources_uris.append(source.uri)
+            if not self._checkUsedSource(self.app.current.timeline, source.get_uri()):
+                unused_sources_uris.append(source.get_uri())
 
         # Hack around the fact that making selections (in a treeview/iconview)
         # deselects what was previously selected



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