remove switch to menuitems in a better way

This commit is contained in:
Nikos Kouremenos 2005-08-08 15:47:10 +00:00
parent 028bfbb6f0
commit 5aec9060cd
1 changed files with 6 additions and 3 deletions

View File

@ -62,7 +62,6 @@ class Chat:
self.names = {} # what is printed in the tab (eg. user.name) self.names = {} # what is printed in the tab (eg. user.name)
self.childs = {} # holds the contents for every tab (VBox) self.childs = {} # holds the contents for every tab (VBox)
self.popup_is_shown = False # is a context menu shown or not? self.popup_is_shown = False # is a context menu shown or not?
self.how_many_switch_to = 0 # how many switch to menuitems we have added
# the following vars are used to keep history of user's messages # the following vars are used to keep history of user's messages
self.sent_history = {} self.sent_history = {}
@ -233,7 +232,12 @@ class Chat:
childs[5].hide() childs[5].hide()
childs[5].set_no_show_all(True) childs[5].set_no_show_all(True)
for child in childs[6:]: # start looping after Add to roster start_removing_from = 6 # this is from the seperator and after
else:
start_removing_from = 7 # # this is from the seperator and after
for child in childs[start_removing_from:]:
menu.remove(child) menu.remove(child)
return menu return menu
@ -279,7 +283,6 @@ class Chat:
item.connect('activate', lambda obj, jid:self.set_active_tab( item.connect('activate', lambda obj, jid:self.set_active_tab(
jid), jid) jid), jid)
menu.append(item) menu.append(item)
self.how_many_switch_to += 1
# show the menu # show the menu
menu.popup(None, None, None, event.button, event.time) menu.popup(None, None, None, event.button, event.time)