Codebase list sugar-imageviewer-activity / 15c4c79
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> Gonzalo Odiard authored 10 years ago Agustin Zubiaga committed 10 years ago
1 changed file(s) with 22 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
201201
202202 self.is_received_document = False
203203
204 if self.shared_activity and handle.object_id is None:
204 if self.shared_activity:
205205 # We're joining, and we don't already have the document.
206206 if self.get_shared():
207207 # Already joined for some reason, just get the document
348348 del chooser
349349
350350 def read_file(self, file_path):
351 if self._object_id is None or self.shared_activity:
352 # read_file is call because the canvas is visible
353 # but we need check if is not the case of empty file
354 return
355
351356 self._want_document = False
352357
353358 tempfile = os.path.join(self.get_activity_root(), 'instance',
398403
399404 self.progressdialog.destroy()
400405
401 GObject.idle_add(self.__set_file_idle_cb, tempfile)
402 self.save()
406 GObject.idle_add(self.__set_file_idle_cb, self._jobject.object_id)
407
408 def __set_file_idle_cb(self, object_id):
409 dsobj = datastore.get(object_id)
410 self._tempfile = dsobj.file_path
411 """ This method is used when join a collaboration session """
412 self.view.set_file_location(self._tempfile)
413 try:
414 zoom = int(self.metadata.get('zoom', '0'))
415 if zoom > 0:
416 self.view.set_zoom(zoom)
417 except Exception:
418 pass
419 self.set_canvas(self.scrolled_window)
420 self.scrolled_window.show_all()
421 return False
403422
404423 def _download_progress_cb(self, getter, bytes_downloaded, tube_id):
405424 if self._download_content_length > 0:
489508 self.progressdialog = ProgressDialog.ProgressDialog(self)
490509 self.progressdialog.show_all()
491510
492 GObject.idle_add(self._get_document)
493
494511 def _share_document(self):
495512 """Share the document."""
496513 # FIXME: should ideally have the fileserver listen on a Unix socket