Ticket #4520: 0001-Fix-collaboration-SL-4520.patch

File 0001-Fix-collaboration-SL-4520.patch, 3.0 KB (added by godiard, 11 years ago)

Proposed patch

  • ImageViewerActivity.py

    From e6f86f2a92c566f622fa1089d893b6dd6681a560 Mon Sep 17 00:00:00 2001
    From: Gonzalo Odiard <godiard@gmail.com>
    Date: Mon, 3 Jun 2013 12:02:22 -0300
    Subject: [PATCH] Fix collaboration - SL #4520
    
    Collaboration was broken partially by the remove of __set_file_idle_cb
    in 17acb8ec0e72ead145c3d2648707af87b8ff5cf5 and posterior changes.
    Now restored the method, but use as a parameter the object_id instead
    of the tempfile path, because this change after the file is saved in the
    journal.
    We also needed add a control in read_file due to the use of the
    emptypanel.
    
    Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
    ---
     ImageViewerActivity.py | 27 ++++++++++++++++++++++-----
     1 file changed, 22 insertions(+), 5 deletions(-)
    
    diff --git a/ImageViewerActivity.py b/ImageViewerActivity.py
    index e611dff..45e6ba2 100644
    a b class ImageViewerActivity(activity.Activity): 
    202202
    203203        self.is_received_document = False
    204204
    205         if self.shared_activity and handle.object_id is None:
     205        if self.shared_activity:
    206206            # We're joining, and we don't already have the document.
    207207            if self.get_shared():
    208208                # Already joined for some reason, just get the document
    class ImageViewerActivity(activity.Activity): 
    349349            del chooser
    350350
    351351    def read_file(self, file_path):
     352        if self._object_id is None or self.shared_activity:
     353            # read_file is call because the canvas is visible
     354            # but we need check if is not the case of empty file
     355            return
     356
    352357        self._want_document = False
    353358
    354359        tempfile = os.path.join(self.get_activity_root(), 'instance',
    class ImageViewerActivity(activity.Activity): 
    399404
    400405        self.progressdialog.destroy()
    401406
    402         GObject.idle_add(self.__set_file_idle_cb, tempfile)
    403         self.save()
     407        GObject.idle_add(self.__set_file_idle_cb, self._jobject.object_id)
     408
     409    def __set_file_idle_cb(self, object_id):
     410        dsobj = datastore.get(object_id)
     411        self._tempfile = dsobj.file_path
     412        """ This method is used when join a collaboration session """
     413        self.view.set_file_location(self._tempfile)
     414        try:
     415            zoom = int(self.metadata.get('zoom', '0'))
     416            if zoom > 0:
     417                self.view.set_zoom(zoom)
     418        except Exception:
     419            pass
     420        self.set_canvas(self.scrolled_window)
     421        self.scrolled_window.show_all()
     422        return False
    404423
    405424    def _download_progress_cb(self, getter, bytes_downloaded, tube_id):
    406425        if self._download_content_length > 0:
    class ImageViewerActivity(activity.Activity): 
    490509        self.progressdialog = ProgressDialog.ProgressDialog(self)
    491510        self.progressdialog.show_all()
    492511
    493         GObject.idle_add(self._get_document)
    494 
    495512    def _share_document(self):
    496513        """Share the document."""
    497514        # FIXME: should ideally have the fileserver listen on a Unix socket