Commit 0585a847 authored by Yann Leboulanger's avatar Yann Leboulanger

fix ConfirmationDialogCheck callback behaviour

parent ebfa1eba
......@@ -1090,12 +1090,19 @@ class ConfirmationDialogCheck(ConfirmationDialog):
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):
......
......@@ -1598,8 +1598,6 @@ class GroupchatControl(ChatControlBase):
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):
......
......@@ -644,12 +644,10 @@ def possibly_set_gajim_as_xmpp_handler():
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 @@ Description=xmpp
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'):
......
......@@ -3319,12 +3319,11 @@ class RosterWindow:
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 @@ class RosterWindow:
'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')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment