[meld: 180/180] bin/meld: Hack the style to give LinkMaps GtkTextView's background



commit 473e9289b5de8ae01689bf1e23abdcc00784ccbb
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Jul 12 12:06:20 2015 +1000

    bin/meld: Hack the style to give LinkMaps GtkTextView's background

 bin/meld |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/bin/meld b/bin/meld
index 2b75aba..264306e 100755
--- a/bin/meld
+++ b/bin/meld
@@ -201,6 +201,19 @@ def setup_resources():
         Gdk.Screen.get_default(), provider,
         Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
 
+    # This is a hack to get the LinkMap to use Gtk.TextView background
+    # colour. Ideally we'd have a symbolic colour, or could more easily
+    # do this on the widget itself.
+    textview = Gtk.TextView()
+    textview_context = textview.get_style_context()
+    bg_colour = textview_context.get_background_color(Gtk.StateFlags.NORMAL)
+    linkmap_css = "LinkMap { background-color: %s; }" % bg_colour.to_string()
+    linkmap_provider = Gtk.CssProvider()
+    linkmap_provider.load_from_data(linkmap_css)
+    Gtk.StyleContext.add_provider_for_screen(
+        Gdk.Screen.get_default(), linkmap_provider,
+        Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
+
     style_path = os.path.join(meld.conf.DATADIR, "styles")
     GtkSource.StyleSchemeManager.get_default().append_search_path(style_path)
 


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