From 303c0f6a719c74114fdaec588c44a7549f5ced90 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Thu, 7 Aug 2008 15:51:23 +0000
Subject: [PATCH] 2 less blocking windows

---
 src/config.py | 12 ++++++------
 src/gajim.py  | 14 ++++++--------
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/config.py b/src/config.py
index 103d9c6ac0..f6367ffbf9 100644
--- a/src/config.py
+++ b/src/config.py
@@ -1384,14 +1384,14 @@ class AccountsWindow:
 				gobject.timeout_add(500, login, self.current_account, show_before,
 					status_before)
 
+			def on_yes(checked):
+				relog()
+			def on_no():
+				if self.resend_presence:
+					self.resend()
 			self.dialog = dialogs.YesNoDialog(_('Relogin now?'),
 				_('If you want all the changes to apply instantly, '
-				'you must relogin.'))
-			resp = self.dialog.get_response()
-			if resp == gtk.RESPONSE_YES:
-				relog()
-			elif self.resend_presence:
-				self.resend()
+				'you must relogin.'), on_response_yes=on_yes, on_response_no=on_no)
 		elif self.resend_presence:
 			self.resend()
 
diff --git a/src/gajim.py b/src/gajim.py
index 134152b162..d520b9f425 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -1855,20 +1855,18 @@ class Interface:
 			self.instances[account]['privacy_lists'].privacy_list_removed(name)
 
 	def handle_event_zc_name_conflict(self, account, data):
-		dlg = dialogs.InputDialog(_('Username Conflict'),
-			_('Please type a new username for your local account'),
-			is_modal = True)
-		dlg.input_entry.set_text(data)
-		response = dlg.get_response()
-		if response == gtk.RESPONSE_OK:
-			new_name = dlg.input_entry.get_text()
+		def on_ok(new_name):
 			gajim.config.set_per('accounts', account, 'name', new_name)
 			status = gajim.connections[account].status
 			gajim.connections[account].username = new_name
 			gajim.connections[account].change_status(status, '')
-		else:
+		def on_cancel():
 			gajim.connections[account].change_status('offline','')
 
+		dlg = dialogs.InputDialog(_('Username Conflict'),
+			_('Please type a new username for your local account'), input_str=data,
+			is_modal=True, ok_handler=on_ok, cancel_handler=on_cancel)
+
 	def handle_event_ping_sent(self, account, contact):
 		if contact.jid == contact.get_full_jid():
 			# If contact is a groupchat user
-- 
GitLab