Ticket #4549: 0001-Enable-collaboration-only-when-a-file-is-loaded.patch

File 0001-Enable-collaboration-only-when-a-file-is-loaded.patch, 2.1 KB (added by godiard, 9 years ago)
  • ImageViewerActivity.py

    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): 
    116116        self.scrolled_window = Gtk.ScrolledWindow()
    117117        self.scrolled_window.set_policy(Gtk.PolicyType.ALWAYS,
    118118                                        Gtk.PolicyType.ALWAYS)
     119        # disable sharing until a file is opened
     120        self.max_participants = 1
    119121
    120122        # Don't use the default kinetic scrolling, let the view do the
    121123        # drag-by-touch and pinch-to-zoom logic.
    class ImageViewerActivity(activity.Activity): 
    239241    def _add_toolbar_buttons(self, toolbar_box):
    240242        self._seps = []
    241243
    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()
    245247
    246248        self._zoom_out_button = ToolButton('zoom-out')
    247249        self._zoom_out_button.set_tooltip(_('Zoom out'))
    class ImageViewerActivity(activity.Activity): 
    368370            return
    369371
    370372        self._want_document = False
     373        # enable collaboration
     374        self.activity_button.page.share.props.sensitive = True
    371375
    372376        tempfile = os.path.join(self.get_activity_root(), 'instance',
    373377            'tmp%i' % time.time())