diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2009-07-29 15:33:02 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2009-07-29 15:33:02 (GMT) |
commit | 872b18a103a43ce6b4d5d7de6287443864aa040c (patch) | |
tree | 49c38a1d4eb55398fe008780796ccae4b782844c /src/sugar/activity/activity.py | |
parent | 0cf445eb0faf941bc37141d972ff49b9269d8c4b (diff) |
Fix review issues
Diffstat (limited to 'src/sugar/activity/activity.py')
-rw-r--r-- | src/sugar/activity/activity.py | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py index a4690e5..76a349f 100644 --- a/src/sugar/activity/activity.py +++ b/src/sugar/activity/activity.py @@ -75,6 +75,7 @@ from sugar.graphics.icon import Icon from sugar.graphics.xocolor import XoColor from sugar.graphics.toolbar import Toolbar, ToolbarButton from sugar.graphics.radiopalette import RadioPalette, RadioMenuButton +from sugar.graphics.radiotoolbutton import RadioToolButton from sugar.datastore import datastore from sugar.session import XSMPClient from sugar import wm @@ -1054,35 +1055,36 @@ def paste_button(**kwargs): return paste def share_button(activity, **kwargs): - quiet_trigger = [] - - def neighborhood_cb(): - if quiet_trigger: - return + def neighborhood_cb(button): activity.share() palette = RadioPalette() - private = palette.append( + + private = RadioToolButton( icon_name='zoom-home', tooltip=_('Private')) - neighborhood = palette.append( + palette.append(private) + + neighborhood = RadioToolButton( icon_name='zoom-neighborhood', - tooltip=_('My Neighborhood'), - toggled_cb=neighborhood_cb) + group=private, + tooltip=_('My Neighborhood')) + neighborhood.connect('clicked', neighborhood_cb) + palette.append(neighborhood) def update_share(): - quiet_trigger.append(True) - - if activity.get_shared(): - private.props.sensitive = False - neighborhood.props.sensitive = False - neighborhood.props.active = True - else: - private.props.sensitive = True - neighborhood.props.sensitive = True - private.props.active = True - - quiet_trigger.pop() + neighborhood.handler_block_by_func(neighborhood_cb) + try: + if activity.get_shared(): + private.props.sensitive = False + neighborhood.props.sensitive = False + neighborhood.props.active = True + else: + private.props.sensitive = True + neighborhood.props.sensitive = True + private.props.active = True + finally: + neighborhood.handler_unblock_by_func(neighborhood_cb) activity.connect('shared', lambda activity: update_share()) activity.connect('joined', lambda activity: update_share()) |