From 30f24a8427c79983e66ff936510b4da9ef7be4ac Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Wed, 04 Sep 2013 19:02:15 +0000 Subject: 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 Signed-off-by: Agustin Zubiaga --- 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()) -- cgit v0.9.1