diff --git a/src/conversation_textview.py b/src/conversation_textview.py index f4d4a2804..837e2a0ce 100644 --- a/src/conversation_textview.py +++ b/src/conversation_textview.py @@ -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 diff --git a/src/dialogs.py b/src/dialogs.py index 1f8c1abaf..56246179d 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -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,21 +1934,27 @@ 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: - account_label = self.xml.get_widget('account_label') - account_combobox = self.xml.get_widget('account_combobox') - account_label.set_no_show_all(False) - account_combobox.set_no_show_all(False) - liststore = gtk.ListStore(str) - account_combobox.set_model(liststore) - cell = gtk.CellRendererText() - account_combobox.pack_start(cell, True) - account_combobox.add_attribute(cell, 'text', 0) - 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) + 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) + account_combobox.set_no_show_all(False) + liststore = gtk.ListStore(str) + account_combobox.set_model(liststore) + 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) + if account and account == acct: + account_combobox.set_active(liststore.iter_n_children(None)-1) + self.account = account self.automatic = automatic self._empty_required_widgets = []