summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2012-03-20 15:45:33 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-22 14:40:41 +0000
commite587c1ef3f747e6fdbdd0ccd895fc1c3daca14ae (patch)
tree0a76eeb9ab091becbf22f1e8cba7429966f84c0d
parentf460c2f10d4bf5a995c392136c1dd561984b1167 (diff)
downloadpoky-e587c1ef3f747e6fdbdd0ccd895fc1c3daca14ae.tar.gz
ui/crumbs/persistenttooltip: fix colours on darker themes
Darker gtk+ themes, such as the one used in Ubuntu Unity, revealed that the PersistentTooltip styling wasn't setting the label colour correctly. Set the label foreground colour to the tooltip_fg_colour value as read from gtk-color-scheme property of the system settings. (From Poky rev: 0934cfcea5986dbdc50e7159ee907c70b0b3e587) (Bitbake rev: ab15ef585e51e4c85a4a55aa6b35fbf3b53f3805) Signed-off-by: Joshua Lock <josh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/ui/crumbs/persistenttooltip.py26
1 files changed, 21 insertions, 5 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/persistenttooltip.py b/bitbake/lib/bb/ui/crumbs/persistenttooltip.py
index e9cc380b0a..d065ab2c07 100644
--- a/bitbake/lib/bb/ui/crumbs/persistenttooltip.py
+++ b/bitbake/lib/bb/ui/crumbs/persistenttooltip.py
@@ -38,6 +38,11 @@ class PersistentTooltip(gtk.Window):
38 def __init__(self, markup): 38 def __init__(self, markup):
39 gtk.Window.__init__(self, gtk.WINDOW_POPUP) 39 gtk.Window.__init__(self, gtk.WINDOW_POPUP)
40 40
41 # Inherit the system theme for a tooltip
42 style = gtk.rc_get_style_by_paths(gtk.settings_get_default(),
43 'gtk-tooltip', 'gtk-tooltip', gobject.TYPE_NONE)
44 self.set_style(style)
45
41 # The placement of the close button on the tip should reflect how the 46 # The placement of the close button on the tip should reflect how the
42 # window manager of the users system places close buttons. Try to read 47 # window manager of the users system places close buttons. Try to read
43 # the metacity gconf key to determine whether the close button is on the 48 # the metacity gconf key to determine whether the close button is on the
@@ -96,17 +101,28 @@ class PersistentTooltip(gtk.Window):
96 hbox.show() 101 hbox.show()
97 vbox.pack_end(hbox, True, True, 6) 102 vbox.pack_end(hbox, True, True, 6)
98 self.label = gtk.Label() 103 self.label = gtk.Label()
104 # We want to match the colours of the normal tooltips, as dictated by
105 # the users gtk+-2.0 theme, wherever possible - on some systems this
106 # requires explicitly setting a fg_color for the label which matches the
107 # tooltip_fg_color
108 settings = gtk.settings_get_default()
109 colours = settings.get_property('gtk-color-scheme').split('\n')
110 # remove any empty lines, there's likely to be a trailing one after
111 # calling split on a dictionary-like string
112 colours = filter(None, colours)
113 for col in colours:
114 item, val = col.split(': ')
115 if item == 'tooltip_fg_color':
116 style = self.label.get_style()
117 style.fg[gtk.STATE_NORMAL] = gtk.gdk.color_parse(val)
118 self.label.set_style(style)
119 break # we only care for the tooltip_fg_color
99 self.label.set_markup(markup) 120 self.label.set_markup(markup)
100 self.label.show() 121 self.label.show()
101 hbox.pack_end(self.label, True, True, 6) 122 hbox.pack_end(self.label, True, True, 6)
102 123
103 self.connect("key-press-event", self._catch_esc_cb) 124 self.connect("key-press-event", self._catch_esc_cb)
104 125
105 # Inherit the system theme for a tooltip
106 style = gtk.rc_get_style_by_paths(gtk.settings_get_default(),
107 'gtk-tooltip', 'gtk-tooltip', gobject.TYPE_NONE)
108 self.set_style(style)
109
110 self.add(vbox) 126 self.add(vbox)
111 127
112 """ 128 """