[pitivi] mainwindow: Make sure the title label has no decorations



commit d440fbd7e1db79a1ebe0e197259e2f427818f59f
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Fri Jan 15 01:40:56 2016 +0100

    mainwindow: Make sure the title label has no decorations
    
    The label widgets have the "label" style which specifies a background
    color in some themes, which looks bad on the headerbar.
    
    Reviewed-by: Thibault Saunier <tsaunier gnome org>
    Differential Revision: https://phabricator.freedesktop.org/D674

 pitivi/mainwindow.py        |    5 +++--
 pitivi/timeline/timeline.py |    7 ++-----
 pitivi/utils/ui.py          |   12 ++++++++++++
 3 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 21e7715..e890b20 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -47,8 +47,8 @@ from pitivi.titleeditor import TitleEditor
 from pitivi.transitions import TransitionsListWidget
 from pitivi.utils.loggable import Loggable
 from pitivi.utils.misc import show_user_manual, path_from_uri
-from pitivi.utils.ui import info_name, beautify_time_delta, SPACING, \
-    beautify_length, TIMELINE_CSS
+from pitivi.utils.ui import clear_styles, beautify_length, \
+    beautify_time_delta, info_name, SPACING, TIMELINE_CSS
 from pitivi.viewer import ViewerContainer
 
 
@@ -1251,6 +1251,7 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
             title = APPNAME
         event_box = Gtk.EventBox()
         label = Gtk.Label()
+        clear_styles(label)
         label.set_text(title)
         event_box.add(label)
         event_box.show_all()
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 067f5d2..41f6a11 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -42,7 +42,7 @@ from pitivi.utils.loggable import Loggable
 from pitivi.utils.timeline import EditingContext, Selection, \
     TimelineError, Zoomable, \
     SELECT, SELECT_ADD
-from pitivi.utils.ui import alter_style_class, \
+from pitivi.utils.ui import alter_style_class, clear_styles, \
     set_children_state_recurse, unset_children_state_recurse, \
     EXPANDED_SIZE, SPACING, CONTROL_WIDTH, \
     PLAYHEAD_WIDTH, LAYER_HEIGHT, SNAPBAR_WIDTH, \
@@ -255,10 +255,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
         # Stuff the layers controls in a viewport so it can be scrolled.
         viewport = Gtk.Viewport(vadjustment=self.vadj)
         viewport.add(self.__layers_controls_vbox)
-        # Make sure the viewport has no border or other decorations.
-        viewport_style = viewport.get_style_context()
-        for css_class in viewport_style.list_classes():
-            viewport_style.remove_class(css_class)
+        clear_styles(viewport)
         hbox.pack_start(viewport, False, False, 0)
 
         self.get_style_context().add_class("Timeline")
diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py
index 0c3594b..c527157 100644
--- a/pitivi/utils/ui.py
+++ b/pitivi/utils/ui.py
@@ -442,6 +442,18 @@ def beautify_ETA(length):
 
 
 # -------------------- Gtk widget helpers ----------------------------------- #
+
+def clear_styles(widget):
+    """
+    Make sure the widget has no border, background or other decorations.
+
+    @type widget: L{Gtk.Widget}
+    """
+    style = widget.get_style_context()
+    for css_class in style.list_classes():
+        style.remove_class(css_class)
+
+
 def model(columns, data):
     ret = Gtk.ListStore(*columns)
     for datum in data:


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