Minor tweaks

This commit is contained in:
Aleksey Lim 2009-07-30 05:43:36 +00:00
parent 2655a8ccad
commit e03fd4ddde

View File

@ -1055,9 +1055,6 @@ def paste_button(**kwargs):
return paste return paste
def share_button(activity, **kwargs): def share_button(activity, **kwargs):
def neighborhood_cb(button):
activity.share()
palette = RadioPalette() palette = RadioPalette()
private = RadioToolButton( private = RadioToolButton(
@ -1067,11 +1064,12 @@ def share_button(activity, **kwargs):
neighborhood = RadioToolButton( neighborhood = RadioToolButton(
icon_name='zoom-neighborhood', icon_name='zoom-neighborhood',
group=private) group=private)
neighborhood.connect('clicked', neighborhood_cb) neighborhood_handle = neighborhood.connect('clicked',
lambda button: activity.share())
palette.append(neighborhood, _('My Neighborhood')) palette.append(neighborhood, _('My Neighborhood'))
def update_share(): def update_share():
neighborhood.handler_block_by_func(neighborhood_cb) neighborhood.handler_block(neighborhood_handle)
try: try:
if activity.get_shared(): if activity.get_shared():
private.props.sensitive = False private.props.sensitive = False
@ -1082,7 +1080,7 @@ def share_button(activity, **kwargs):
neighborhood.props.sensitive = True neighborhood.props.sensitive = True
private.props.active = True private.props.active = True
finally: finally:
neighborhood.handler_unblock_by_func(neighborhood_cb) neighborhood.handler_unblock(neighborhood_handle)
activity.connect('shared', lambda activity: update_share()) activity.connect('shared', lambda activity: update_share())
activity.connect('joined', lambda activity: update_share()) activity.connect('joined', lambda activity: update_share())