Author: asterix
Date: 2007-10-01 19:11:47 +0200 (Mon, 01 Oct 2007)
New Revision: 8882
Modified:
trunk/src/dialogs.py
trunk/src/groupchat_control.py
trunk/src/gtkgui_helpers.py
trunk/src/roster_window.py
Log:
fix ConfirmationDialogCheck callback behaviour
Modified: trunk/src/dialogs.py
===================================================================
--- trunk/src/dialogs.py 2007-10-01 09:40:34 UTC (rev 8881)
+++ trunk/src/dialogs.py 2007-10-01 17:11:47 UTC (rev 8882)
@@ -1090,12 +1090,19 @@
def on_response_ok(self, widget):
if self.user_response_ok:
- self.user_response_ok(self.is_checked())
+ if isinstance(self.user_response_ok, tuple):
+ self.user_response_ok[0](self.is_checked(),
+ *self.user_response_ok[1:])
+ else:
+ self.user_response_ok(self.is_checked())
self.destroy()
def on_response_cancel(self, widget):
if self.user_response_cancel:
- self.user_response_cancel()
+ if isinstance(self.user_response_cancel, tuple):
+ self.user_response_cancel[0](*self.user_response_ok[1:])
+ else:
+ self.user_response_cancel()
self.destroy()
def is_checked(self):
Modified: trunk/src/groupchat_control.py
===================================================================
--- trunk/src/groupchat_control.py 2007-10-01 09:40:34 UTC (rev 8881)
+++ trunk/src/groupchat_control.py 2007-10-01 17:11:47 UTC (rev 8882)
@@ -1598,8 +1598,6 @@
if dialog.is_checked(): # user does not want to be asked again
gajim.config.set('confirm_close_muc', False)
- dialog.destroy()
-
return retval
def set_control_active(self, state):
Modified: trunk/src/gtkgui_helpers.py
===================================================================
--- trunk/src/gtkgui_helpers.py 2007-10-01 09:40:34 UTC (rev 8881)
+++ trunk/src/gtkgui_helpers.py 2007-10-01 17:11:47 UTC (rev 8882)
@@ -644,12 +644,10 @@
else:
path_to_kde_file = None
- def set_gajim_as_xmpp_handler(widget = None):
- if widget:
+ def set_gajim_as_xmpp_handler(is_checked=None):
+ if is_checked != None:
# come from confirmation dialog
- gajim.config.set('check_if_gajim_is_default',
- dlg.checkbutton.get_active())
- dlg.destroy()
+ gajim.config.set('check_if_gajim_is_default', is_checked)
path_to_gajim_script, typ = get_abspath_for_script('gajim-remote', True)
if path_to_gajim_script:
if typ == 'svn':
@@ -712,10 +710,9 @@
sectext = _('Would you like to make Gajim the default Jabber client?')
checktext = _('Always check to see if Gajim is the default Jabber client '
'on startup')
- def on_cancel(widget):
+ def on_cancel():
gajim.config.set('check_if_gajim_is_default',
- dlg.checkbutton.get_active())
- dlg.destroy()
+ dlg.is_checked())
dlg = dialogs.ConfirmationDialogCheck(pritext, sectext, checktext,
set_gajim_as_xmpp_handler, on_cancel)
if gajim.config.get('check_if_gajim_is_default'):
Modified: trunk/src/roster_window.py
===================================================================
--- trunk/src/roster_window.py 2007-10-01 09:40:34 UTC (rev 8881)
+++ trunk/src/roster_window.py 2007-10-01 17:11:47 UTC (rev 8882)
@@ -3319,12 +3319,11 @@
def on_req_usub(self, widget, list_):
'''Remove a contact. list_ is a list of (contact, account) tuples'''
- def on_ok(widget, list_):
- self.dialog.destroy()
+ def on_ok(is_checked, list_):
remove_auth = True
if len(list_) == 1:
contact = list_[0][0]
- if contact.sub != 'to' and self.dialog.is_checked():
+ if contact.sub != 'to' and is_checked:
remove_auth = False
for (contact, account) in list_:
gajim.connections[account].unsubscribe(contact.jid, remove_auth)
@@ -4804,10 +4803,9 @@
'server'),
_('Your server does not support storing metacontacts information. '
'So those information will not be saved on next reconnection.'))
- def merge_contacts(widget = None):
- if widget: # dialog has been shown
- dlg.destroy()
- if dlg.is_checked(): # user does not want to be asked again
+ def merge_contacts(is_checked=None):
+ if is_checked != None: # dialog has been shown
+ if is_checked: # user does not want to be asked again
gajim.config.set('confirm_metacontacts', 'no')
else:
gajim.config.set('confirm_metacontacts', 'yes')