diff options
author | Manuel Kaufmann <humitos@gmail.com> | 2012-05-29 16:01:18 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2012-06-01 19:01:54 (GMT) |
commit | 8f59aced1452fd766f4acac9a2392582d2db6dcb (patch) | |
tree | 266ff47219c2fe8a24af7d6f6d9a35a0b12fd42c /readactivity.py | |
parent | ece922e0cdc3c7a7a9da01f0a32f10af1de5654d (diff) |
Alert the user when he removes a bookmark SL #1274
Alert the user with a Confirmation Alert when he / she removes a bookmark
informing that the bookmark information will be lost.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'readactivity.py')
-rw-r--r-- | readactivity.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/readactivity.py b/readactivity.py index c0092d5..5e23b86 100644 --- a/readactivity.py +++ b/readactivity.py @@ -39,6 +39,7 @@ from sugar3.graphics.toolbarbox import ToolbarBox from sugar3.graphics.toolbarbox import ToolbarButton from sugar3.graphics.toolcombobox import ToolComboBox from sugar3.graphics.toggletoolbutton import ToggleToolButton +from sugar3.graphics.alert import ConfirmationAlert from sugar3.activity.widgets import ActivityToolbarButton from sugar3.activity.widgets import StopButton from sugar3 import network @@ -477,7 +478,24 @@ class ReadActivity(activity.Activity): if self._bookmarker.props.active: self._sidebar.add_bookmark(page) else: + alert = ConfirmationAlert() + alert.props.title = _('Delete bookmark') + alert.props.msg = _('All the information related ' + 'with this bookmark will be lost') + self.add_alert(alert) + alert.connect('response', self.__alert_response_cb, page) + alert.show() + + def __alert_response_cb(self, alert, response_id, page): + self.remove_alert(alert) + + if response_id is Gtk.ResponseType.OK: self._sidebar.del_bookmark(page) + elif response_id is Gtk.ResponseType.CANCEL: + self._bookmarker.handler_block(self._bookmarker_toggle_handler_id) + self._bookmarker.props.active = True + self._bookmarker.handler_unblock(\ + self._bookmarker_toggle_handler_id) def __page_changed_cb(self, model, page_from, page_to): self._update_nav_buttons(page_to) |