From 6bcd6642896e0f75922ac25c367e5e128b67bd01 Mon Sep 17 00:00:00 2001 From: James Cameron Date: Thu, 1 Jun 2017 13:15:21 +1000 Subject: [PATCH] Save As - track stop buttons in Activity instance Track the stop buttons for the activity, so that they can be set insensitive or not in a later patch. Our API allows for more than one stop button, though the use of more than one is very rare. --- src/sugar3/activity/activity.py | 4 ++++ src/sugar3/activity/widgets.py | 1 + 2 files changed, 5 insertions(+) diff --git a/src/sugar3/activity/activity.py b/src/sugar3/activity/activity.py index 0f555fc3..9d67873f 100644 --- a/src/sugar3/activity/activity.py +++ b/src/sugar3/activity/activity.py @@ -448,6 +448,10 @@ class Activity(Window, Gtk.Container): bundle = get_bundle_instance(get_bundle_path()) self.set_icon_from_file(bundle.get_icon()) + self._stop_buttons = [] + + def add_stop_button(self, button): + self._stop_buttons.append(button) def run_main_loop(self): Gtk.main() diff --git a/src/sugar3/activity/widgets.py b/src/sugar3/activity/widgets.py index ddd105e3..b1b0e2d2 100644 --- a/src/sugar3/activity/widgets.py +++ b/src/sugar3/activity/widgets.py @@ -86,6 +86,7 @@ class StopButton(ToolButton): self.props.tooltip = _('Stop') self.props.accelerator = 'Q' self.connect('clicked', self.__stop_button_clicked_cb, activity) + activity.add_stop_button(self) def __stop_button_clicked_cb(self, button, activity): activity.close()