diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 0de52ce70..d78ad5f80 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -4,6 +4,9 @@ * src/gramps.glade: Correct +/- tooltips for Data tab in Source Editor. * src/WriteGedcom.py (write_source_ref): Write confidence level (the QUAY tag) of the source reference into GEDCOM. + * src/QuestionDialog.py (MissingMediaDialog): Catch delete event + and warn the user. + * src/Utils.py (ProgressMeter) Catch delete event and warn the user. 2006-01-26 Brian Matherly * src/plugins/FamilyGroup.py: correctly put borders on the diff --git a/gramps2/src/QuestionDialog.py b/gramps2/src/QuestionDialog.py index 3092afbd1..0e787c024 100644 --- a/gramps2/src/QuestionDialog.py +++ b/gramps2/src/QuestionDialog.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2005 Donald N. Allingham +# Copyright (C) 2000-2006 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -216,9 +216,11 @@ class OkDialog: class MissingMediaDialog: def __init__(self,msg1,msg2,task1,task2,task3,parent=None): - self.xml = gtk.glade.XML(const.errdialogsFile,"missmediadialog","gramps") + self.xml = gtk.glade.XML(const.errdialogsFile, + "missmediadialog","gramps") self.top = self.xml.get_widget('missmediadialog') self.top.set_icon(ICON) + self.task1 = task1 self.task2 = task2 self.task3 = task3 @@ -236,7 +238,15 @@ class MissingMediaDialog: self.top.show() if parent: self.top.set_transient_for(parent) - response = self.top.run() + self.top.connect('delete_event',self.warn) + response = gtk.RESPONSE_DELETE_EVENT + + # Need some magic here, because an attempt to close the dialog + # with the X button not only emits the 'delete_event' signal + # but also exits with the RESPONSE_DELETE_EVENT + while response == gtk.RESPONSE_DELETE_EVENT: + response = self.top.run() + if response == 1: self.task1() elif response == 2: @@ -248,3 +258,11 @@ class MissingMediaDialog: else: self.default_action = 0 self.top.destroy() + + def warn(self,obj,obj2): + WarningDialog( + _("Attempt to force closing the dialog"), + _("Please do not force closing this important dialog.\n" + "Instead select one of the available options"), + self.top) + return True diff --git a/gramps2/src/Utils.py b/gramps2/src/Utils.py index 7ca64866a..f13bc6d04 100644 --- a/gramps2/src/Utils.py +++ b/gramps2/src/Utils.py @@ -49,6 +49,7 @@ import GrampsMime import NameDisplay import Date import Errors +from QuestionDialog import WarningDialog #------------------------------------------------------------------------- # @@ -871,6 +872,7 @@ class ProgressMeter: Specify the title and the current pass header. """ self.ptop = gtk.Dialog() + self.ptop.connect('delete_event',self.warn) self.ptop.set_has_separator(False) self.ptop.set_title(title) self.ptop.set_border_width(12) @@ -920,6 +922,13 @@ class ProgressMeter: while gtk.events_pending(): gtk.main_iteration() + def warn(self,obj,obj2): + WarningDialog( + _("Attempt to force closing the dialog"), + _("Please do not force closing this important dialog."), + self.ptop) + return True + def close(self): """ Close the progress meter