[Pkg-sugar-commit] [sugar-toolkit] 01/05: Sugar-toolkit: Pack page in ToolbarButton when is connected to the window - OLPC #10930
Jonas Smedegaard
dr at jones.dk
Thu Apr 16 18:52:36 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag v0.92.4
in repository sugar-toolkit.
commit 3a81ba74385881b8638e800cdfdbb73a3708e7af
Author: Gonzalo Odiard <godiard at gmail.com>
Date: Tue Jul 12 16:15:24 2011 -0300
Sugar-toolkit: Pack page in ToolbarButton when is connected to the window - OLPC #10930
To add the accelerator to the ToolButton the activity must have set
the 'sugar-accel-group' before. The patch does make the ToolbarButton
listen to the 'hierarchy-changed' signal and repack itself accordingly.
Since the ToolButtons of the subtoolbar do listen to 'hierarchy-changed'
as well to set the accelerator they will set it accordingly.
This fixes the accelerators for new-style-toolbar activities
like Terminal, TurtleArt and Paint, more info in #10930.
Signed-by-off: Gonzalo Odiard <gonzalo at laptop.org>
Acked-by: Simon Schampijer <simon at laptop.org>
---
src/sugar/graphics/toolbarbox.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/sugar/graphics/toolbarbox.py b/src/sugar/graphics/toolbarbox.py
index b674e8d..2f455f5 100644
--- a/src/sugar/graphics/toolbarbox.py
+++ b/src/sugar/graphics/toolbarbox.py
@@ -36,6 +36,15 @@ class ToolbarButton(ToolButton):
self.connect('clicked',
lambda widget: self.set_expanded(not self.is_expanded()))
+ self.connect('hierarchy-changed', self.__hierarchy_changed_cb)
+
+ def __hierarchy_changed_cb(self, tool_button, previous_toplevel):
+ if hasattr(self.parent, 'owner'):
+ if self.page_widget:
+ self._unparent()
+ self.parent.owner.pack_start(self.page_widget)
+ self.set_expanded(False)
+
def get_toolbar_box(self):
if not hasattr(self.parent, 'owner'):
return None
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-toolkit.git
More information about the pkg-sugar-commit
mailing list