Ticket #3195: 0001-sl-3195-Same-behaviour-of-cancel-buttons-in-Software.patch

File 0001-sl-3195-Same-behaviour-of-cancel-buttons-in-Software.patch, 3.2 KB (added by ajay_garg, 11 years ago)
  • extensions/cpsection/updater/view.py

    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): 
    167167
    168168    def __cancel_button_clicked_cb(self, button):
    169169        self._model.cancel()
     170        self._control_panel._cancel_clicked_cb(self._control_panel)
    170171
    171172    def _finished_updating(self, installed_updates):
    172173        logging.debug('ActivityUpdater._finished_updating')
  • src/jarabe/controlpanel/gui.py

    diff --git a/src/jarabe/controlpanel/gui.py b/src/jarabe/controlpanel/gui.py
    index b4879c6..f61c298 100644
    a b class ControlPanel(gtk.Window): 
    232232            self._section_view = view_class(model,
    233233                                            self._options[option]['alerts'])
    234234
     235            self._section_view.pass_control_panel_object(self)
    235236            self._set_canvas(self._section_view)
    236237            self._section_view.show()
    237238        finally:
    class ControlPanel(gtk.Window): 
    283284
    284285        return options
    285286
     287    # Kinda private version !!
     288    # Reason :: 'Double-Trailing-Underscore-Name-Mangling'
    286289    def __cancel_clicked_cb(self, widget):
    287290        self._section_view.undo()
    288291        self._options[self._current_option]['alerts'] = []
    289292        self._section_toolbar.accept_button.set_sensitive(True)
    290293        self._show_main_view()
    291294
     295    # Kinda public version !!
     296    def _cancel_clicked_cb(section_view, control_panel):
     297        control_panel.__cancel_clicked_cb(None)
     298
    292299    def __accept_clicked_cb(self, widget):
    293300        if self._section_view.needs_restart:
    294301            self._section_toolbar.accept_button.set_sensitive(False)
  • src/jarabe/controlpanel/sectionview.py

    diff --git a/src/jarabe/controlpanel/sectionview.py b/src/jarabe/controlpanel/sectionview.py
    index 4b5751f..8c2617c 100644
    a b class SectionView(gtk.VBox): 
    3939        self.needs_restart = False
    4040        self.restart_alerts = []
    4141        self.restart_msg = _('Changes require restart')
     42        self._control_panel = None
    4243
    4344    def do_set_property(self, pspec, value):
    4445        if pspec.name == 'is-valid':
    class SectionView(gtk.VBox): 
    5253    def undo(self):
    5354        """Undo here the changes that have been made in this section."""
    5455        pass
     56
     57    def pass_control_panel_object(self, control_panel):
     58        self._control_panel = control_panel