[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() gajim.interface.instances[self.account]['join_gc'].window.present()
else: else:
try: try:
dialogs.JoinGroupchatWindow(account=None, room_jid=room_jid) dialogs.JoinGroupchatWindow(account=self.account, room_jid=room_jid)
except GajimGeneralException: except GajimGeneralException:
pass pass

View File

@ -1922,7 +1922,7 @@ class JoinGroupchatWindow:
'''automatic is a dict like {'invities': []} '''automatic is a dict like {'invities': []}
If automatic is not empty, this means room must be automaticaly configured If automatic is not empty, this means room must be automaticaly configured
and when done, invities must be automatically invited''' and when done, invities must be automatically invited'''
self.xml = gtkgui_helpers.get_glade('join_groupchat_window.glade')
if account: if account:
if room_jid != '' and room_jid in gajim.gc_connected[account] and\ if room_jid != '' and room_jid in gajim.gc_connected[account] and\
gajim.gc_connected[account][room_jid]: gajim.gc_connected[account][room_jid]:
@ -1934,20 +1934,26 @@ class JoinGroupchatWindow:
ErrorDialog(_('You are not connected to the server'), ErrorDialog(_('You are not connected to the server'),
_('You can not join a group chat unless you are connected.')) _('You can not join a group chat unless you are connected.'))
raise GajimGeneralException, 'You must be connected to join a groupchat' raise GajimGeneralException, 'You must be connected to join a groupchat'
else:
account_label = self.xml.get_widget('account_label') self.xml = gtkgui_helpers.get_glade('join_groupchat_window.glade')
account_combobox = self.xml.get_widget('account_combobox')
account_label.set_no_show_all(False) account_label = self.xml.get_widget('account_label')
account_combobox.set_no_show_all(False) account_combobox = self.xml.get_widget('account_combobox')
liststore = gtk.ListStore(str) account_label.set_no_show_all(False)
account_combobox.set_model(liststore) account_combobox.set_no_show_all(False)
cell = gtk.CellRendererText() liststore = gtk.ListStore(str)
account_combobox.pack_start(cell, True) account_combobox.set_model(liststore)
account_combobox.add_attribute(cell, 'text', 0) cell = gtk.CellRendererText()
for acct in [a for a in gajim.connections if \ account_combobox.pack_start(cell, True)
gajim.account_is_connected(a)]: account_combobox.add_attribute(cell, 'text', 0)
account_combobox.append_text(acct) account_combobox.set_active(-1)
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)
if account and account == acct:
account_combobox.set_active(liststore.iter_n_children(None)-1)
self.account = account self.account = account
self.automatic = automatic self.automatic = automatic