[pitivi] timeline: Connect only once to selection-changed



commit bc3d5e642508a9c7fe8e63d2104ee52ee451b6cc
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Thu Apr 27 01:12:47 2017 +0200

    timeline: Connect only once to selection-changed
    
    Reviewed-by: Thibault Saunier <tsaunier gnome org>
    Differential Revision: https://phabricator.freedesktop.org/D1734

 pitivi/timeline/timeline.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 7d62fa4..0083a1d 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1396,8 +1396,6 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
             self.ges_timeline = None
 
         self.timeline.setProject(self._project)
-        self.timeline.selection.connect(
-            "selection-changed", self._selectionChangedCb)
 
     def updateActions(self):
         selection_non_empty = bool(self.timeline.selection)
@@ -1459,6 +1457,9 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
         if not in_devel():
             self.gapless_button.hide()
 
+        self.timeline.selection.connect(
+            "selection-changed", self.__selection_changed_cb)
+
     def _getLongestLayer(self):
         """Returns the longest layer."""
         layers = self.ges_timeline.get_layers()
@@ -1854,7 +1855,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
 
         self.timeline.set_best_zoom_ratio(allow_zoom_in=True)
 
-    def _selectionChangedCb(self, selection):
+    def __selection_changed_cb(self, unused_selection):
         """Handles selection changing."""
         self.updateActions()
 


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