[pitivi/1.0] layer: Fix menubutton flicker



commit a430942b8b26a8e1eb1e69d66bfd3e7fd7c4bce3
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Fri Sep 14 17:00:48 2018 +0200

    layer: Fix menubutton flicker
    
    By avoiding to re-set the icon when nothing changes, the flicker is
    gone.
    
    Fixes #2241

 pitivi/timeline/layer.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/timeline/layer.py b/pitivi/timeline/layer.py
index 6a00fd2a..1a7864eb 100644
--- a/pitivi/timeline/layer.py
+++ b/pitivi/timeline/layer.py
@@ -58,6 +58,7 @@ class LayerControls(Gtk.EventBox, Loggable):
         self.ges_layer = ges_layer
         self.ges_timeline = self.ges_layer.get_timeline()
         self.app = app
+        self.__icon = None
 
         hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
         self.add(hbox)
@@ -221,8 +222,11 @@ class LayerControls(Gtk.EventBox, Loggable):
             icon = "video-x-generic"
         else:
             icon = "audio-x-generic"
-        image = Gtk.Image.new_from_icon_name(icon, Gtk.IconSize.BUTTON)
-        self.menubutton.props.image = image
+
+        if icon != self.__icon:
+            image = Gtk.Image.new_from_icon_name(icon, Gtk.IconSize.BUTTON)
+            self.menubutton.props.image = image
+            self.__icon = icon
 
         # TODO: Use media_types to determine which controls to show.
 


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