Skip to content

Commit 473e928

Browse files
committed
bin/meld: Hack the style to give LinkMaps GtkTextView's background
1 parent c4b4c09 commit 473e928

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

bin/meld

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,19 @@ def setup_resources():
201201
Gdk.Screen.get_default(), provider,
202202
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
203203

204+
# This is a hack to get the LinkMap to use Gtk.TextView background
205+
# colour. Ideally we'd have a symbolic colour, or could more easily
206+
# do this on the widget itself.
207+
textview = Gtk.TextView()
208+
textview_context = textview.get_style_context()
209+
bg_colour = textview_context.get_background_color(Gtk.StateFlags.NORMAL)
210+
linkmap_css = "LinkMap { background-color: %s; }" % bg_colour.to_string()
211+
linkmap_provider = Gtk.CssProvider()
212+
linkmap_provider.load_from_data(linkmap_css)
213+
Gtk.StyleContext.add_provider_for_screen(
214+
Gdk.Screen.get_default(), linkmap_provider,
215+
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
216+
204217
style_path = os.path.join(meld.conf.DATADIR, "styles")
205218
GtkSource.StyleSchemeManager.get_default().append_search_path(style_path)
206219

0 commit comments

Comments
 (0)