add a disconnect menuitem to groupchat context menu in roster

This commit is contained in:
Yann Leboulanger 2007-06-15 18:55:21 +00:00
parent 0a165c813b
commit ed0bf7884f
1 changed files with 24 additions and 0 deletions

View File

@ -1832,6 +1832,20 @@ class RosterWindow:
gajim.interface.instances['logs'][contact.jid] = history_window.\
HistoryWindow(contact.jid, account)
def on_disconnect(self, widget, jid, account):
'''When disconnect menuitem is activated: disconect from room'''
ctrl = gajim.interface.minimized_controls[account][jid]
del gajim.interface.minimized_controls[account][jid]
ctrl.shutdown()
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
if not contact:
return
if contact.groups == [_('Groupchats')]:
self.remove_contact(contact, account)
gajim.contacts.remove_contact(account, contact)
self.draw_group(_('Groupchats'), account)
def on_send_single_message_menuitem_activate(self, widget, account,
contact = None):
if contact is None:
@ -2471,6 +2485,16 @@ class RosterWindow:
contact, account)
menu.append(history_menuitem)
item = gtk.SeparatorMenuItem() # separator
menu.append(item)
disconnect_menuitem = gtk.ImageMenuItem(_('_Disconnect'))
disconnect_icon = gtk.image_new_from_stock(gtk.STOCK_DISCONNECT, \
gtk.ICON_SIZE_MENU)
disconnect_menuitem.set_image(disconnect_icon)
disconnect_menuitem .connect('activate', self.on_disconnect, jid, account)
menu.append(disconnect_menuitem)
event_button = gtkgui_helpers.get_possible_button_event(event)
menu.attach_to_widget(self.tree, None)