Save As - document keep failure

- add a comment to explain the causes of keep failure,

- rename the keep failure response callback to fit convention,

- fix typo and whitespace nearby.
This commit is contained in:
James Cameron 2017-06-01 13:10:55 +10:00
parent 286387b22e
commit b1d1129759

View File

@ -851,7 +851,7 @@ class Activity(Window, Gtk.Container):
This method is called by the close() method below. In general,
activities should not override this method. This method is part of the
public API of an Acivity, and should behave in standard ways. Use your
public API of an Activity, and should behave in standard ways. Use your
own implementation of write_file() to save your Activity specific data.
'''
@ -1048,6 +1048,11 @@ class Activity(Window, Gtk.Container):
pservice.share_activity(self, private=private)
def _show_keep_failed_dialog(self):
'''
A keep error means the activity write_file method raised an
exception before writing the file, or the datastore cannot be
written to.
'''
alert = Alert()
alert.props.title = _('Keep error')
alert.props.msg = _('Keep error: all changes will be lost')
@ -1060,11 +1065,11 @@ class Activity(Window, Gtk.Container):
alert.add_button(Gtk.ResponseType.OK, _('Stop anyway'), stop_icon)
self.add_alert(alert)
alert.connect('response', self._keep_failed_dialog_response_cb)
alert.connect('response', self.__keep_failed_dialog_response_cb)
self.reveal()
def _keep_failed_dialog_response_cb(self, alert, response_id):
def __keep_failed_dialog_response_cb(self, alert, response_id):
self.remove_alert(alert)
if response_id == Gtk.ResponseType.OK:
self.close(skip_save=True)