From ca9b57ce1332a9b4636d5f9ad1b475fc99ce9d86 Mon Sep 17 00:00:00 2001
From: Gonzalo Odiard <godiard@gmail.com>
Date: Wed, 4 Sep 2013 16:02:15 -0300
Subject: [PATCH 1/4] 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>
---
ImageViewerActivity.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/ImageViewerActivity.py b/ImageViewerActivity.py
index 53f8d84..685d988 100644
a
|
b
|
class ImageViewerActivity(activity.Activity): |
116 | 116 | self.scrolled_window = Gtk.ScrolledWindow() |
117 | 117 | self.scrolled_window.set_policy(Gtk.PolicyType.ALWAYS, |
118 | 118 | Gtk.PolicyType.ALWAYS) |
| 119 | # disable sharing until a file is opened |
| 120 | self.max_participants = 1 |
119 | 121 | |
120 | 122 | # Don't use the default kinetic scrolling, let the view do the |
121 | 123 | # drag-by-touch and pinch-to-zoom logic. |
… |
… |
class ImageViewerActivity(activity.Activity): |
239 | 241 | def _add_toolbar_buttons(self, toolbar_box): |
240 | 242 | self._seps = [] |
241 | 243 | |
242 | | activity_button = ActivityToolbarButton(self) |
243 | | toolbar_box.toolbar.insert(activity_button, 0) |
244 | | activity_button.show() |
| 244 | self.activity_button = ActivityToolbarButton(self) |
| 245 | toolbar_box.toolbar.insert(self.activity_button, 0) |
| 246 | self.activity_button.show() |
245 | 247 | |
246 | 248 | self._zoom_out_button = ToolButton('zoom-out') |
247 | 249 | self._zoom_out_button.set_tooltip(_('Zoom out')) |
… |
… |
class ImageViewerActivity(activity.Activity): |
368 | 370 | return |
369 | 371 | |
370 | 372 | self._want_document = False |
| 373 | # enable collaboration |
| 374 | self.activity_button.page.share.props.sensitive = True |
371 | 375 | |
372 | 376 | tempfile = os.path.join(self.get_activity_root(), 'instance', |
373 | 377 | 'tmp%i' % time.time()) |