summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2012-03-13 13:06:45 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-20 15:21:36 +0000
commitd8b3caa085bad90f021e5102d43deaf653e04c1d (patch)
tree63535854ce768b77b38133be8319769f30f9f3af /bitbake
parent854f3a521a7d84dd59e5e3d9e28b00b67da8a80f (diff)
downloadpoky-d8b3caa085bad90f021e5102d43deaf653e04c1d.tar.gz
ui/crumbs/persistenttooltip: try to reflect WM close button position
When the user is running a desktop where the close button is on the left we try to detect that and position the tooltip close button appropriately. Where we can't easily determine this we default to placing the close button on the right. Tested on Ubuntu/Unity and Fedora/Gnome Shell. (Bitbake rev: 09147098a63c33dc05dc39b7fe4da4df8e2dbd4c) Signed-off-by: Joshua Lock <josh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/ui/crumbs/persistenttooltip.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/persistenttooltip.py b/bitbake/lib/bb/ui/crumbs/persistenttooltip.py
index 0167363380..bae697e0d7 100644
--- a/bitbake/lib/bb/ui/crumbs/persistenttooltip.py
+++ b/bitbake/lib/bb/ui/crumbs/persistenttooltip.py
@@ -20,6 +20,10 @@
20 20
21import gobject 21import gobject
22import gtk 22import gtk
23try:
24 import gconf
25except:
26 pass
23 27
24class PersistentTooltip(gtk.Window): 28class PersistentTooltip(gtk.Window):
25 """ 29 """
@@ -34,6 +38,21 @@ class PersistentTooltip(gtk.Window):
34 def __init__(self, markup): 38 def __init__(self, markup):
35 gtk.Window.__init__(self, gtk.WINDOW_POPUP) 39 gtk.Window.__init__(self, gtk.WINDOW_POPUP)
36 40
41 # 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
43 # the metacity gconf key to determine whether the close button is on the
44 # left or the right.
45 # In the case that we can't determine the users configuration we default
46 # to close buttons being on the right.
47 __button_right = True
48 try:
49 client = gconf.client_get_default()
50 order = client.get_string("/apps/metacity/general/button_layout")
51 if order and order.endswith(":"):
52 __button_right = False
53 except NameError:
54 pass
55
37 # We need to ensure we're only shown once 56 # We need to ensure we're only shown once
38 self.shown = False 57 self.shown = False
39 58
@@ -65,7 +84,10 @@ class PersistentTooltip(gtk.Window):
65 self.button.set_can_default(True) 84 self.button.set_can_default(True)
66 self.button.grab_focus() 85 self.button.grab_focus()
67 self.button.show() 86 self.button.show()
68 hbox.pack_end(self.button, False, False, 0) 87 if __button_right:
88 hbox.pack_end(self.button, False, False, 0)
89 else:
90 hbox.pack_start(self.button, False, False, 0)
69 91
70 self.set_default(self.button) 92 self.set_default(self.button)
71 93