diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2013-09-04 19:02:15 (GMT) |
---|---|---|
committer | Agustin Zubiaga <aguz@sugarlabs.org> | 2013-09-10 00:16:49 (GMT) |
commit | 30f24a8427c79983e66ff936510b4da9ef7be4ac (patch) | |
tree | 5a71a0259a7e597e5629712d81b764213063de5c | |
parent | f79b7cb2e5e7f2970ac7e462a08cd9d220130769 (diff) |
Enable collaboration only when a file is loaded
Right now, ImageViewer activity can start without a file loaded,
showing the empty panel and a button to open the object chooser.
If the user try sharing the session before a book is opened,
the collaboration is broken, because no file is available to share.
This patch disable collaboration until a file is opened.
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Signed-off-by: Agustin Zubiaga <aguz@sugarlabs.org>
-rw-r--r-- | ImageViewerActivity.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ImageViewerActivity.py b/ImageViewerActivity.py index 53f8d84..685d988 100644 --- a/ImageViewerActivity.py +++ b/ImageViewerActivity.py @@ -116,6 +116,8 @@ class ImageViewerActivity(activity.Activity): self.scrolled_window = Gtk.ScrolledWindow() self.scrolled_window.set_policy(Gtk.PolicyType.ALWAYS, Gtk.PolicyType.ALWAYS) + # disable sharing until a file is opened + self.max_participants = 1 # Don't use the default kinetic scrolling, let the view do the # drag-by-touch and pinch-to-zoom logic. @@ -239,9 +241,9 @@ class ImageViewerActivity(activity.Activity): def _add_toolbar_buttons(self, toolbar_box): self._seps = [] - activity_button = ActivityToolbarButton(self) - toolbar_box.toolbar.insert(activity_button, 0) - activity_button.show() + self.activity_button = ActivityToolbarButton(self) + toolbar_box.toolbar.insert(self.activity_button, 0) + self.activity_button.show() self._zoom_out_button = ToolButton('zoom-out') self._zoom_out_button.set_tooltip(_('Zoom out')) @@ -368,6 +370,8 @@ class ImageViewerActivity(activity.Activity): return self._want_document = False + # enable collaboration + self.activity_button.page.share.props.sensitive = True tempfile = os.path.join(self.get_activity_root(), 'instance', 'tmp%i' % time.time()) |