[Mattj] improve join groupchat behaviour. Fixes #5383

This commit is contained in:
Yann Leboulanger 2009-10-31 19:35:46 +01:00
parent e10ff2c907
commit 48c82ae7fa
2 changed files with 22 additions and 16 deletions

View File

@ -853,7 +853,7 @@ class ConversationTextview(gobject.GObject):
gajim.interface.instances[self.account]['join_gc'].window.present()
else:
try:
dialogs.JoinGroupchatWindow(account=None, room_jid=room_jid)
dialogs.JoinGroupchatWindow(account=self.account, room_jid=room_jid)
except GajimGeneralException:
pass

View File

@ -1922,7 +1922,7 @@ class JoinGroupchatWindow:
'''automatic is a dict like {'invities': []}
If automatic is not empty, this means room must be automaticaly configured
and when done, invities must be automatically invited'''
self.xml = gtkgui_helpers.get_glade('join_groupchat_window.glade')
if account:
if room_jid != '' and room_jid in gajim.gc_connected[account] and\
gajim.gc_connected[account][room_jid]:
@ -1934,7 +1934,9 @@ class JoinGroupchatWindow:
ErrorDialog(_('You are not connected to the server'),
_('You can not join a group chat unless you are connected.'))
raise GajimGeneralException, 'You must be connected to join a groupchat'
else:
self.xml = gtkgui_helpers.get_glade('join_groupchat_window.glade')
account_label = self.xml.get_widget('account_label')
account_combobox = self.xml.get_widget('account_combobox')
account_label.set_no_show_all(False)
@ -1944,10 +1946,14 @@ class JoinGroupchatWindow:
cell = gtk.CellRendererText()
account_combobox.pack_start(cell, True)
account_combobox.add_attribute(cell, 'text', 0)
account_combobox.set_active(-1)
# Add accounts, set current as active if it matches 'account'
for acct in [a for a in gajim.connections if \
gajim.account_is_connected(a)]:
account_combobox.append_text(acct)
account_combobox.set_active(-1)
if account and account == acct:
account_combobox.set_active(liststore.iter_n_children(None)-1)
self.account = account
self.automatic = automatic