Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Quiñones <manuq@laptop.org>2012-11-28 21:47:24 (GMT)
committer Manuel Quiñones <manuq@laptop.org>2012-11-29 11:28:48 (GMT)
commitd418d1cbdd44953e4b8ea146a8195ed1651ce03e (patch)
tree14247e8e55e737c0ea702d6044a9c75a2a09643b
parent06fab044e263ba76574dadbe9005a5e2c4fd1ef2 (diff)
Tray: wrap them in EventBoxes in order to make them themeable - SL #3565
We have to convert the boxes to EventBoxes because otherwise the background is not themeable [1] [1] https://bugzilla.gnome.org/show_bug.cgi?id=678790 Signed-off-by: Manuel Quiñones <manuq@laptop.org> Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r--src/sugar3/graphics/tray.py35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/sugar3/graphics/tray.py b/src/sugar3/graphics/tray.py
index 0b3ca9a..9d12883 100644
--- a/src/sugar3/graphics/tray.py
+++ b/src/sugar3/graphics/tray.py
@@ -47,7 +47,7 @@ class _TrayViewport(Gtk.Viewport):
self._can_scroll_next = False
self._can_scroll_prev = False
- GObject.GObject.__init__(self)
+ Gtk.Viewport.__init__(self)
self.set_shadow_type(Gtk.ShadowType.NONE)
@@ -138,6 +138,7 @@ class _TrayViewport(Gtk.Viewport):
def _size_allocate_cb(self, viewport, allocation):
bar_minimum, bar_natural = self.traybar.get_preferred_size()
+
if self.orientation == Gtk.Orientation.HORIZONTAL:
scrollable = bar_minimum.width > allocation.width
else:
@@ -170,6 +171,8 @@ class _TrayViewport(Gtk.Viewport):
class _TrayScrollButton(ToolButton):
+ __gtype_name__ = 'SugarTrayScrollButton'
+
def __init__(self, icon_name, scroll_direction):
ToolButton.__init__(self)
self._viewport = None
@@ -224,7 +227,7 @@ ALIGN_TO_START = 0
ALIGN_TO_END = 1
-class HTray(Gtk.HBox):
+class HTray(Gtk.EventBox):
__gtype_name__ = 'SugarHTray'
@@ -238,17 +241,21 @@ class HTray(Gtk.HBox):
self._drag_active = False
self.align = ALIGN_TO_START
- GObject.GObject.__init__(self, **kwargs)
+ Gtk.EventBox.__init__(self, **kwargs)
+
+ self._box = Gtk.HBox()
+ self.add(self._box)
+ self._box.show()
scroll_left = _TrayScrollButton('go-left', _PREVIOUS_PAGE)
- self.pack_start(scroll_left, False, False, 0)
+ self._box.pack_start(scroll_left, False, False, 0)
self._viewport = _TrayViewport(Gtk.Orientation.HORIZONTAL)
- self.pack_start(self._viewport, True, True, 0)
+ self._box.pack_start(self._viewport, True, True, 0)
self._viewport.show()
scroll_right = _TrayScrollButton('go-right', _NEXT_PAGE)
- self.pack_start(scroll_right, False, False, 0)
+ self._box.pack_start(scroll_right, False, False, 0)
scroll_left.viewport = self._viewport
scroll_right.viewport = self._viewport
@@ -310,7 +317,7 @@ class HTray(Gtk.HBox):
self._viewport.scroll_to_item(item)
-class VTray(Gtk.VBox):
+class VTray(Gtk.EventBox):
__gtype_name__ = 'SugarVTray'
@@ -324,17 +331,21 @@ class VTray(Gtk.VBox):
self._drag_active = False
self.align = ALIGN_TO_START
- GObject.GObject.__init__(self, **kwargs)
+ Gtk.EventBox.__init__(self, **kwargs)
+
+ self._box = Gtk.VBox()
+ self.add(self._box)
+ self._box.show()
scroll_up = _TrayScrollButton('go-up', _PREVIOUS_PAGE)
- self.pack_start(scroll_up, False, False, 0)
+ self._box.pack_start(scroll_up, False, False, 0)
self._viewport = _TrayViewport(Gtk.Orientation.VERTICAL)
- self.pack_start(self._viewport, True, True, 0)
+ self._box.pack_start(self._viewport, True, True, 0)
self._viewport.show()
scroll_down = _TrayScrollButton('go-down', _NEXT_PAGE)
- self.pack_start(scroll_down, False, False, 0)
+ self._box.pack_start(scroll_down, False, False, 0)
scroll_up.viewport = self._viewport
scroll_down.viewport = self._viewport
@@ -407,7 +418,7 @@ class _IconWidget(Gtk.EventBox):
__gtype_name__ = 'SugarTrayIconWidget'
def __init__(self, icon_name=None, xo_color=None):
- GObject.GObject.__init__(self)
+ Gtk.EventBox.__init__(self)
self.set_app_paintable(True)
self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK |