Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37848055
en ru br
ALT Linux repos
S:1.8.1-alt1
5.0: 0.12.1-alt1
4.1: 0.11.4-alt1.1.qa1
4.0: 0.11.4-alt1

Group :: Networking/Instant messaging
RPM: gajim

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: gajim-0.12-sequential-dialogues.patch
Download


commit 9b07598db55816c36a58071ef788c5dcb641e0ef
Author: Alex V. Myltsev <avm@altlinux.org>
Date:   Mon Aug 4 10:51:19 2008 +0400
    Maintain a dialog queue to show the passphrase dialogs sequentially.
    Gajim 0.12 has mostly asynchronous dialogues, which is good,
    but showing many dialogues on the screen can be confusing
    and inconvenient. This patch adds a queue so that password
    dialogues are only displayed sequentially.
diff --git a/src/dialogs.py b/src/dialogs.py
index 7ffad29..7a71074 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -199,7 +199,7 @@ class EditGroupsDialog:
 		renderer.connect('toggled', self.group_toggled_cb)
 		column.set_attributes(renderer, active = 1, inconsistent = 2)
 
-class PassphraseDialog:
+class PassphraseDialogImplementation:
 	'''Class for Passphrase dialog'''
 	def __init__(self, titletext, labeltext, checkbuttontext=None,
 	ok_handler=None, cancel_handler=None):
@@ -257,6 +257,43 @@ class PassphraseDialog:
 		if self.cancel_handler and not self.ok:
 			self.cancel_handler()
 
+""" The dialog queue.
+The head of the queue is the active dialog (on screen),
+the rest are waiting to be shown."""
+dialog_queue = []
+
+class PassphraseDialog:
+	def __init__(self, *args, **kwargs):
+		self.params = args, kwargs
+		if not dialog_queue:
+			self.show()
+		dialog_queue.append(self)
+
+	def show(self):
+		args, kwargs = self.params
+		for handler_name in 'ok_handler', 'cancel_handler':
+			if handler_name in kwargs:
+				handler = kwargs[handler_name]
+				if isinstance(handler, tuple):
+					handler = (self.wrap_handler(handler[0]),) + handler[1:]
+				else:
+					handler = self.wrap_handler(handler)
+				kwargs[handler_name] = handler
+
+		PassphraseDialogImplementation(*args, **kwargs)
+
+	def close(self):
+		head = dialog_queue.pop(0)
+		assert head is self
+		if dialog_queue:
+			dialog_queue[0].show()
+
+	def wrap_handler(self, handler):
+		def wrapper(*args, **kwargs):
+			self.close()
+			handler(*args, **kwargs)
+		return wrapper
+
 class ChooseGPGKeyDialog:
 	'''Class for GPG key dialog'''
 	def __init__(self, title_text, prompt_text, secret_keys, on_response,
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin