4166: Export Assistant crashes when closing or cancelling using the mouse

svn: r15738
This commit is contained in:
Benny Malengier 2010-08-15 11:59:23 +00:00
parent ee9649f5b3
commit 02c68684d6

View File

@ -94,6 +94,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
"""
#override predefined do_xxx signal handlers
__gsignals__ = {"apply": "override", "cancel": "override",
"close": "override", "prepare": "override"}
@ -116,6 +117,13 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
self.forward_button = None
gtk.Assistant.forall(self, self.get_forward_button)
## end
##workaround for bug with cancel/close button clicked
##see bug http://www.gramps-project.org/bugs/view.php?id=4166
self.cancel_button = None
gtk.Assistant.forall(self, self.get_cancel_button)
self.close_button = None
gtk.Assistant.forall(self, self.get_close_button)
## end
#set up ManagedWindow
self.top_title = _("Export Assistant")
@ -166,6 +174,22 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
if isinstance(arg, gtk.Button) and arg.get_label() == 'gtk-go-forward':
self.forward_button = arg
def get_cancel_button(self, arg):
if isinstance(arg, gtk.HBox):
arg.forall(self._cancel_btn)
def _cancel_btn(self, arg):
if isinstance(arg, gtk.Button) and arg.get_label() == 'gtk-cancel':
self.cancel_button = arg
def get_close_button(self, arg):
if isinstance(arg, gtk.HBox):
arg.forall(self._close_btn)
def _close_btn(self, arg):
if isinstance(arg, gtk.Button) and arg.get_label() == 'gtk-close':
self.close_button = arg
def build_menu_names(self, obj):
"""Override ManagedWindow method."""
return (self.top_title, None)
@ -388,18 +412,19 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
def do_apply(self):
pass
def do_cancel(self):
if self.writestarted :
return True
else :
self.close()
def do_close(self):
if self.writestarted :
return True
else :
pass
else :
## avoid bug http://www.gramps-project.org/bugs/view.php?id=4166
self.cancel_button.hide()
self.close_button.hide()
## end
self.close()
def do_cancel(self):
self.do_close()
def do_prepare(self, page):
"""
The "prepare" signal is emitted when a new page is set as the