From fd2be16f2486af5d70f0c6715a2d5f3d36b98f9f Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Fri, 29 Jun 2007 08:19:13 +0000 Subject: [PATCH] make the ask password for groupchat window async and entry visibility to False. fixes #3265 --- src/dialogs.py | 1 + src/gajim.py | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/dialogs.py b/src/dialogs.py index e9b9837c9..597deb265 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -1073,6 +1073,7 @@ class InputDialog: def on_okbutton_clicked(self, widget): user_input = self.input_entry.get_text().decode('utf-8') + self.cancel_handler = None self.dialog.destroy() if isinstance(self.ok_handler, tuple): self.ok_handler[0](user_input, *self.ok_handler[1:]) diff --git a/src/gajim.py b/src/gajim.py index d8d756412..12f1a13c9 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -1219,15 +1219,12 @@ class Interface: #('GC_PASSWORD_REQUIRED', account, (room_jid, nick)) room_jid = array[0] nick = array[1] - dlg = dialogs.InputDialog(_('Password Required'), - _('A Password is required to join the room %s. Please type it') % \ - room_jid, is_modal = True) - response = dlg.get_response() - if response == gtk.RESPONSE_OK: - password = dlg.input_entry.get_text() - gajim.connections[account].join_gc(nick, room_jid, password) - gajim.gc_passwords[room_jid] = password - else: + + def on_ok(text): + gajim.connections[account].join_gc(nick, room_jid, text) + gajim.gc_passwords[room_jid] = text + + def on_cancel(): # get and destroy window if room_jid in gajim.interface.minimized_controls[account]: self.roster.on_disconnect(None, room_jid, account) @@ -1236,6 +1233,11 @@ class Interface: ctrl = win.get_control(room_jid, account) win.remove_tab(ctrl, 3) + dlg = dialogs.InputDialog(_('Password Required'), + _('A Password is required to join the room %s. Please type it') % \ + room_jid, is_modal=False, ok_handler=on_ok, cancel_handler=on_cancel) + dlg.input_entry.set_visibility(False) + def handle_event_gc_invitation(self, account, array): #('GC_INVITATION', (room_jid, jid_from, reason, password)) jid = gajim.get_jid_without_resource(array[1])