From eed172661ce7806949d1505c088d2c41de3970c1 Mon Sep 17 00:00:00 2001
From: Ajay Garg <ajay@sugarlabs.org>
Date: Fri, 9 Dec 2011 22:42:30 +0530
Subject: [PATCH 1/2] sl#3195: Same behaviour of cancel buttons, in
Software-Update
Organization: Sugar Labs Foundation
Now, the behaviour upon clicking the 'Software-Update-cancel-button' is
the same as the behaviour upon clicking the
'SectionView-ToolBar-cancel-button'.
Signed-off-by: Ajay Garg <ajay@sugarlabs.org>
---
extensions/cpsection/updater/view.py | 1 +
src/jarabe/controlpanel/gui.py | 7 +++++++
src/jarabe/controlpanel/sectionview.py | 4 ++++
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/extensions/cpsection/updater/view.py b/extensions/cpsection/updater/view.py
index d257b56..b4e1fc3 100644
a
|
b
|
class ActivityUpdater(SectionView): |
167 | 167 | |
168 | 168 | def __cancel_button_clicked_cb(self, button): |
169 | 169 | self._model.cancel() |
| 170 | self._control_panel._cancel_clicked_cb(self._control_panel) |
170 | 171 | |
171 | 172 | def _finished_updating(self, installed_updates): |
172 | 173 | logging.debug('ActivityUpdater._finished_updating') |
diff --git a/src/jarabe/controlpanel/gui.py b/src/jarabe/controlpanel/gui.py
index b4879c6..f61c298 100644
a
|
b
|
class ControlPanel(gtk.Window): |
232 | 232 | self._section_view = view_class(model, |
233 | 233 | self._options[option]['alerts']) |
234 | 234 | |
| 235 | self._section_view.pass_control_panel_object(self) |
235 | 236 | self._set_canvas(self._section_view) |
236 | 237 | self._section_view.show() |
237 | 238 | finally: |
… |
… |
class ControlPanel(gtk.Window): |
283 | 284 | |
284 | 285 | return options |
285 | 286 | |
| 287 | # Kinda private version !! |
| 288 | # Reason :: 'Double-Trailing-Underscore-Name-Mangling' |
286 | 289 | def __cancel_clicked_cb(self, widget): |
287 | 290 | self._section_view.undo() |
288 | 291 | self._options[self._current_option]['alerts'] = [] |
289 | 292 | self._section_toolbar.accept_button.set_sensitive(True) |
290 | 293 | self._show_main_view() |
291 | 294 | |
| 295 | # Kinda public version !! |
| 296 | def _cancel_clicked_cb(section_view, control_panel): |
| 297 | control_panel.__cancel_clicked_cb(None) |
| 298 | |
292 | 299 | def __accept_clicked_cb(self, widget): |
293 | 300 | if self._section_view.needs_restart: |
294 | 301 | self._section_toolbar.accept_button.set_sensitive(False) |
diff --git a/src/jarabe/controlpanel/sectionview.py b/src/jarabe/controlpanel/sectionview.py
index 4b5751f..8c2617c 100644
a
|
b
|
class SectionView(gtk.VBox): |
39 | 39 | self.needs_restart = False |
40 | 40 | self.restart_alerts = [] |
41 | 41 | self.restart_msg = _('Changes require restart') |
| 42 | self._control_panel = None |
42 | 43 | |
43 | 44 | def do_set_property(self, pspec, value): |
44 | 45 | if pspec.name == 'is-valid': |
… |
… |
class SectionView(gtk.VBox): |
52 | 53 | def undo(self): |
53 | 54 | """Undo here the changes that have been made in this section.""" |
54 | 55 | pass |
| 56 | |
| 57 | def pass_control_panel_object(self, control_panel): |
| 58 | self._control_panel = control_panel |