fix ConfirmationDialogCheck callback behaviour

This commit is contained in:
Yann Leboulanger 2007-10-01 17:11:47 +00:00
parent ebfa1eba40
commit 0585a8475f
4 changed files with 19 additions and 19 deletions

View File

@ -1090,11 +1090,18 @@ class ConfirmationDialogCheck(ConfirmationDialog):
def on_response_ok(self, widget):
if self.user_response_ok:
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:
if isinstance(self.user_response_cancel, tuple):
self.user_response_cancel[0](*self.user_response_ok[1:])
else:
self.user_response_cancel()
self.destroy()

View File

@ -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):

View File

@ -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'):

View File

@ -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')