[pitivi] preset: Reuse alter_style_class



commit 915f38b1bf05a89dea48afa732a786abb7f8e602
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sat Sep 17 01:17:58 2016 +0200

    preset: Reuse alter_style_class
    
    Differential Revision: https://phabricator.freedesktop.org/D1325

 pitivi/preset.py   |    6 ++----
 pitivi/utils/ui.py |    4 ++--
 2 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/preset.py b/pitivi/preset.py
index 8c1ecc7..22efa38 100644
--- a/pitivi/preset.py
+++ b/pitivi/preset.py
@@ -30,6 +30,7 @@ from pitivi.configure import get_renderpresets_dir
 from pitivi.configure import get_videopresets_dir
 from pitivi.settings import xdg_data_home
 from pitivi.utils.loggable import Loggable
+from pitivi.utils.ui import alter_style_class
 
 
 class DeserializeException(Exception):
@@ -80,10 +81,7 @@ class PresetManager(GObject.Object, Loggable):
         combo.connect("changed", self._presetChangedCb)
 
         entry = combo.get_child()
-        style_context = entry.get_style_context()
-        style_provider = Gtk.CssProvider()
-        style_provider.load_from_data("GtkEntry.unsaved {font-style:italic;}".encode('UTF-8'))
-        style_context.add_provider(style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
+        alter_style_class("GtkEntry.unsaved", entry, "font-style:italic;")
 
         action_group = Gio.SimpleActionGroup()
         menu_model = Gio.Menu()
diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py
index f21bd13..d2e61e9 100644
--- a/pitivi/utils/ui.py
+++ b/pitivi/utils/ui.py
@@ -493,8 +493,8 @@ def get_value_from_model(model, key):
 
 def alter_style_class(style_class, target_widget, css_style):
     css_provider = Gtk.CssProvider()
-    toolbar_css = "%s { %s }" % (style_class, css_style)
-    css_provider.load_from_data(toolbar_css.encode('UTF-8'))
+    css = "%s { %s }" % (style_class, css_style)
+    css_provider.load_from_data(css.encode('UTF-8'))
     style_context = target_widget.get_style_context()
     style_context.add_provider(
         css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)


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