Commit eef9e264 authored by Yann Leboulanger's avatar Yann Leboulanger

don't call twice cancel handler

parent c6425563
...@@ -1290,8 +1290,9 @@ def get_button(self, index): ...@@ -1290,8 +1290,9 @@ def get_button(self, index):
class HigDialog(gtk.MessageDialog): class HigDialog(gtk.MessageDialog):
def __init__(self, parent, type_, buttons, pritext, sectext, def __init__(self, parent, type_, buttons, pritext, sectext,
on_response_ok = None, on_response_cancel = None, on_response_yes = None, on_response_ok=None, on_response_cancel=None, on_response_yes=None,
on_response_no = None): on_response_no=None):
self.call_cancel_on_destroy = True
gtk.MessageDialog.__init__(self, parent, gtk.MessageDialog.__init__(self, parent,
type_, buttons, message_format = pritext) type_, buttons, message_format = pritext)
...@@ -1319,6 +1320,8 @@ def __init__(self, parent, type_, buttons, pritext, sectext, ...@@ -1319,6 +1320,8 @@ def __init__(self, parent, type_, buttons, pritext, sectext,
self.connect('destroy', self.on_dialog_destroy) self.connect('destroy', self.on_dialog_destroy)
def on_dialog_destroy(self, widget): def on_dialog_destroy(self, widget):
if not self.call_cancel_on_destroy:
cancel_handler = self.possible_responses[gtk.STOCK_CANCEL] cancel_handler = self.possible_responses[gtk.STOCK_CANCEL]
if not cancel_handler: if not cancel_handler:
return False return False
...@@ -1631,6 +1634,7 @@ def on_response_cancel(self, widget): ...@@ -1631,6 +1634,7 @@ def on_response_cancel(self, widget):
self.user_response_cancel[0](*self.user_response_cancel[1:]) self.user_response_cancel[0](*self.user_response_cancel[1:])
else: else:
self.user_response_cancel() self.user_response_cancel()
self.call_cancel_on_destroy = False
self.destroy() self.destroy()
def is_checked(self): def is_checked(self):
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