[pitivi/T3404-intermediary_format: 1/4] mainwindow: Do not of purge clips when an asset is removed



commit 5d872f22686e5e2d49957c1d293c3a47e0b56080
Author: Thibault Saunier <tsaunier gnome org>
Date:   Tue Dec 1 16:30:54 2015 +0100

    mainwindow: Do not of purge clips when an asset is removed
    
    That does not belong to the main window but to the media library
    that have a much better knowledge of what is going on

 pitivi/mainwindow.py        |    7 -------
 pitivi/medialibrary.py      |    1 +
 pitivi/timeline/timeline.py |    6 +++---
 3 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 1eff8d9..4e72f2b 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -572,11 +572,6 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
         self.save_action.set_enabled(True)
         self.updateTitle()
 
-    def _mediaLibrarySourceRemovedCb(self, unused_project, asset):
-        """When a clip is removed from the Media Library, tell the timeline
-        to remove all instances of that clip."""
-        self.timeline_ui.purgeObject(asset.get_id())
-
     def _builderConnectCb(self, builder, gobject, signal_name, handler_name,
                           connect_object, flags, user_data):
         id_ = gobject.connect(signal_name, getattr(self, handler_name))
@@ -1056,7 +1051,6 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
     def _connectToProject(self, project):
         # FIXME GES we should re-enable this when possible
         # medialibrary.connect("missing-plugins", self._sourceListMissingPluginsCb)
-        project.connect("asset-removed", self._mediaLibrarySourceRemovedCb)
         project.connect("project-changed", self._projectChangedCb)
         project.connect(
             "rendering-settings-changed", self._renderingSettingsChangedCb)
@@ -1111,7 +1105,6 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
             self.settings.lastProjectFolder = folder_path
 
     def _disconnectFromProject(self, project):
-        project.disconnect_by_func(self._mediaLibrarySourceRemovedCb)
         project.disconnect_by_func(self._projectChangedCb)
         project.disconnect_by_func(self._renderingSettingsChangedCb)
 
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index a9f07a6..cd237b6 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -812,6 +812,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
         for row in rows:
             asset = model[row.get_path()][COL_ASSET]
             self.app.project_manager.current_project.remove_asset(asset)
+            self.app.gui.timeline_ui.purgeObject(asset.props.id)
         self.app.action_log.commit()
 
     def _sourceIsUsed(self, asset):
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index f8cb351..89e12b3 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1218,9 +1218,9 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
         """Remove all instances of an asset from the timeline."""
         layers = self.bTimeline.get_layers()
         for layer in layers:
-            for tlobj in layer.get_clips():
-                if asset_id == tlobj.get_id():
-                    layer.remove_clip(tlobj)
+            for clip in layer.get_clips():
+                if asset_id == clip.get_id():
+                    layer.remove_clip(clip)
         self._project.pipeline.commit_timeline()
 
     def setProjectManager(self, projectmanager):


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