From 60ccf85716158a61c4527bd4c7f925f343f5b791 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
Date: Wed, 31 Oct 2012 11:44:20 -0300
Subject: [PATCH toolkit-gtk3] Set correct background for subtoolbars - SL
#3987
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
Do it by painting a rectangle before the top outline is painted. The
rectangle color is determined by the parent class, because the
subtoolbar can be in a palette or in the toolbar box. This has to be
done this way because the modify_bg is not doing its job anymore when
set_app_paintable is True, and the documentation say we can't rely on
it. Also, revert 7fc29c9d which was a first attempt.
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
---
src/sugar3/graphics/toolbarbox.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/sugar3/graphics/toolbarbox.py b/src/sugar3/graphics/toolbarbox.py
index ee709dd..4d5c3be 100644
a
|
b
|
class _Box(Gtk.EventBox): |
270 | 270 | GObject.GObject.__init__(self) |
271 | 271 | self.set_app_paintable(True) |
272 | 272 | self._toolbar_button = toolbar_button |
273 | | self.modify_bg(Gtk.StateType.NORMAL, |
274 | | style.COLOR_TOOLBAR_GREY.get_gdk_color()) |
275 | 273 | |
276 | 274 | def do_draw(self, cr): |
277 | 275 | button_alloc = self._toolbar_button.get_allocation() |
278 | 276 | |
| 277 | allocation = self.get_allocation() |
| 278 | if type(self.get_parent()) == ToolbarBox: |
| 279 | cr.set_source_rgba(*style.COLOR_TOOLBAR_GREY.get_rgba()) |
| 280 | else: |
| 281 | cr.set_source_rgba(0, 0, 0, 1) |
| 282 | cr.rectangle(0, 0, allocation.width, allocation.height) |
| 283 | cr.fill() |
| 284 | |
279 | 285 | cr.set_line_width(style.FOCUS_LINE_WIDTH * 2) |
280 | 286 | cr.set_source_rgba(*style.COLOR_BUTTON_GREY.get_rgba()) |
281 | 287 | cr.move_to(0, 0) |