Disable the existing signal before connecting the new (to menuitem in systray menu). Fixed #6819

This commit is contained in:
Denis Fomin 2011-03-08 21:55:16 +03:00
parent 316fdc7b62
commit 5dc76a23e7
1 changed files with 7 additions and 4 deletions

View File

@ -45,6 +45,7 @@ class StatusIcon:
def __init__(self):
self.single_message_handler_id = None
self.show_roster_handler_id = None
self.new_chat_handler_id = None
# click somewhere else does not popdown menu. workaround this.
self.added_hide_menuitem = False
@ -335,14 +336,16 @@ class StatusIcon:
sounds_mute_menuitem.set_active(not gajim.config.get('sounds_on'))
win = gajim.interface.roster.window
if self.show_roster_handler_id:
show_roster_menuitem.handler_disconnect(self.show_roster_handler_id)
if win.get_property('has-toplevel-focus'):
show_roster_menuitem.get_children()[0].set_label(_('Hide _Roster'))
show_roster_menuitem.connect('activate',
self.on_hide_roster_menuitem_activate)
self.show_roster_handler_id = show_roster_menuitem.connect(
'activate', self.on_hide_roster_menuitem_activate)
else:
show_roster_menuitem.get_children()[0].set_label(_('Show _Roster'))
show_roster_menuitem.connect('activate',
self.on_show_roster_menuitem_activate)
self.show_roster_handler_id = show_roster_menuitem.connect(
'activate', self.on_show_roster_menuitem_activate)
if os.name == 'nt':
if self.added_hide_menuitem is False: