From 2b5ec0886d5290f4d3a0a347ff164b9eaef83fd1 Mon Sep 17 00:00:00 2001
Message-Id: <2b5ec0886d5290f4d3a0a347ff164b9eaef83fd1.1338307395.git.humitos@gmail.com>
From: Manuel Kaufmann <humitos@gmail.com>
Date: Tue, 29 May 2012 13:01:18 -0300
Subject: [PATCH Read] 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>
---
readactivity.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/readactivity.py b/readactivity.py
index c0092d5..5e23b86 100644
a
|
b
|
from sugar3.graphics.toolbarbox import ToolbarBox |
39 | 39 | from sugar3.graphics.toolbarbox import ToolbarButton |
40 | 40 | from sugar3.graphics.toolcombobox import ToolComboBox |
41 | 41 | from sugar3.graphics.toggletoolbutton import ToggleToolButton |
| 42 | from sugar3.graphics.alert import ConfirmationAlert |
42 | 43 | from sugar3.activity.widgets import ActivityToolbarButton |
43 | 44 | from sugar3.activity.widgets import StopButton |
44 | 45 | from sugar3 import network |
… |
… |
class ReadActivity(activity.Activity): |
477 | 478 | if self._bookmarker.props.active: |
478 | 479 | self._sidebar.add_bookmark(page) |
479 | 480 | else: |
| 481 | alert = ConfirmationAlert() |
| 482 | alert.props.title = _('Delete bookmark') |
| 483 | alert.props.msg = _('All the information related ' |
| 484 | 'with this bookmark will be lost') |
| 485 | self.add_alert(alert) |
| 486 | alert.connect('response', self.__alert_response_cb, page) |
| 487 | alert.show() |
| 488 | |
| 489 | def __alert_response_cb(self, alert, response_id, page): |
| 490 | self.remove_alert(alert) |
| 491 | |
| 492 | if response_id is Gtk.ResponseType.OK: |
480 | 493 | self._sidebar.del_bookmark(page) |
| 494 | elif response_id is Gtk.ResponseType.CANCEL: |
| 495 | self._bookmarker.handler_block(self._bookmarker_toggle_handler_id) |
| 496 | self._bookmarker.props.active = True |
| 497 | self._bookmarker.handler_unblock(\ |
| 498 | self._bookmarker_toggle_handler_id) |
481 | 499 | |
482 | 500 | def __page_changed_cb(self, model, page_from, page_to): |
483 | 501 | self._update_nav_buttons(page_to) |