make the ask password for groupchat window async and entry visibility to False. fixes #3265

This commit is contained in:
Yann Leboulanger 2007-06-29 08:19:13 +00:00
parent c8d808d956
commit fd2be16f24
2 changed files with 12 additions and 9 deletions

View File

@ -1073,6 +1073,7 @@ class InputDialog:
def on_okbutton_clicked(self, widget): def on_okbutton_clicked(self, widget):
user_input = self.input_entry.get_text().decode('utf-8') user_input = self.input_entry.get_text().decode('utf-8')
self.cancel_handler = None
self.dialog.destroy() self.dialog.destroy()
if isinstance(self.ok_handler, tuple): if isinstance(self.ok_handler, tuple):
self.ok_handler[0](user_input, *self.ok_handler[1:]) self.ok_handler[0](user_input, *self.ok_handler[1:])

View File

@ -1219,15 +1219,12 @@ class Interface:
#('GC_PASSWORD_REQUIRED', account, (room_jid, nick)) #('GC_PASSWORD_REQUIRED', account, (room_jid, nick))
room_jid = array[0] room_jid = array[0]
nick = array[1] nick = array[1]
dlg = dialogs.InputDialog(_('Password Required'),
_('A Password is required to join the room %s. Please type it') % \ def on_ok(text):
room_jid, is_modal = True) gajim.connections[account].join_gc(nick, room_jid, text)
response = dlg.get_response() gajim.gc_passwords[room_jid] = text
if response == gtk.RESPONSE_OK:
password = dlg.input_entry.get_text() def on_cancel():
gajim.connections[account].join_gc(nick, room_jid, password)
gajim.gc_passwords[room_jid] = password
else:
# get and destroy window # get and destroy window
if room_jid in gajim.interface.minimized_controls[account]: if room_jid in gajim.interface.minimized_controls[account]:
self.roster.on_disconnect(None, room_jid, account) self.roster.on_disconnect(None, room_jid, account)
@ -1236,6 +1233,11 @@ class Interface:
ctrl = win.get_control(room_jid, account) ctrl = win.get_control(room_jid, account)
win.remove_tab(ctrl, 3) 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): def handle_event_gc_invitation(self, account, array):
#('GC_INVITATION', (room_jid, jid_from, reason, password)) #('GC_INVITATION', (room_jid, jid_from, reason, password))
jid = gajim.get_jid_without_resource(array[1]) jid = gajim.get_jid_without_resource(array[1])