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
201 | 201 | |
202 | 202 | self.is_received_document = False |
203 | 203 | |
204 | if self.shared_activity and handle.object_id is None: | |
204 | if self.shared_activity: | |
205 | 205 | # We're joining, and we don't already have the document. |
206 | 206 | if self.get_shared(): |
207 | 207 | # Already joined for some reason, just get the document |
348 | 348 | del chooser |
349 | 349 | |
350 | 350 | 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 | ||
351 | 356 | self._want_document = False |
352 | 357 | |
353 | 358 | tempfile = os.path.join(self.get_activity_root(), 'instance', |
398 | 403 | |
399 | 404 | self.progressdialog.destroy() |
400 | 405 | |
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 | |
403 | 422 | |
404 | 423 | def _download_progress_cb(self, getter, bytes_downloaded, tube_id): |
405 | 424 | if self._download_content_length > 0: |
489 | 508 | self.progressdialog = ProgressDialog.ProgressDialog(self) |
490 | 509 | self.progressdialog.show_all() |
491 | 510 | |
492 | GObject.idle_add(self._get_document) | |
493 | ||
494 | 511 | def _share_document(self): |
495 | 512 | """Share the document.""" |
496 | 513 | # FIXME: should ideally have the fileserver listen on a Unix socket |