29 | 29 |
import emptypanel
|
30 | 30 |
|
31 | 31 |
import dbus
|
|
32 |
from gi.repository import GLib
|
32 | 33 |
from gi.repository import GObject
|
33 | 34 |
from gi.repository import Gtk
|
34 | 35 |
from gi.repository import Gdk
|
|
684 | 685 |
if self.props.active:
|
685 | 686 |
# Now active, start initial suspend timeout
|
686 | 687 |
if self._idle_timer > 0:
|
687 | |
GObject.source_remove(self._idle_timer)
|
688 | |
self._idle_timer = GObject.timeout_add_seconds(15,
|
689 | |
self._suspend_cb)
|
|
688 |
GLib.source_remove(self._idle_timer)
|
|
689 |
self._idle_timer = GLib.timeout_add_seconds(15,
|
|
690 |
self._suspend_cb)
|
690 | 691 |
self._sleep_inhibit = False
|
691 | 692 |
else:
|
692 | 693 |
# Now inactive
|
|
704 | 705 |
def _user_action_cb(self, widget):
|
705 | 706 |
"""Set a timer for going back to ebook mode idle sleep."""
|
706 | 707 |
if self._idle_timer > 0:
|
707 | |
GObject.source_remove(self._idle_timer)
|
708 | |
self._idle_timer = GObject.timeout_add_seconds(5, self._suspend_cb)
|
|
708 |
GLib.source_remove(self._idle_timer)
|
|
709 |
self._idle_timer = GLib.timeout_add_seconds(5, self._suspend_cb)
|
709 | 710 |
|
710 | 711 |
def _suspend_cb(self):
|
711 | 712 |
"""Go into ebook mode idle sleep."""
|
|
730 | 731 |
self._load_document('file://' + tempfile)
|
731 | 732 |
|
732 | 733 |
# FIXME: This should obviously be fixed properly
|
733 | |
GObject.timeout_add_seconds(
|
|
734 |
GLib.timeout_add_seconds(
|
734 | 735 |
1, self.__view_toolbar_needs_update_size_cb, None)
|
735 | 736 |
|
736 | 737 |
def write_file(self, file_path):
|
|
840 | 841 |
self._progress_alert = None
|
841 | 842 |
|
842 | 843 |
# download the metadata
|
843 | |
GObject.idle_add(self._download_metadata, tube_id, tube_ip, tube_port)
|
|
844 |
GLib.idle_add(self._download_metadata, tube_id, tube_ip, tube_port)
|
844 | 845 |
|
845 | 846 |
def _download_metadata_result_cb(self, getter, tempfile, suggested_name,
|
846 | 847 |
tube_id):
|
|
850 | 851 |
os.remove(tempfile)
|
851 | 852 |
|
852 | 853 |
# load the object from the datastore to update the file path
|
853 | |
GObject.idle_add(self._open_downloaded_file, shared_metadata)
|
|
854 |
GLib.idle_add(self._open_downloaded_file, shared_metadata)
|
854 | 855 |
|
855 | 856 |
def _open_downloaded_file(self, shared_metadata):
|
856 | 857 |
self._jobject = datastore.get(self._jobject.object_id)
|
|
881 | 882 |
if self._progress_alert is not None:
|
882 | 883 |
self.remove_alert(self._progress_alert)
|
883 | 884 |
self._progress_alert = None
|
884 | |
GObject.idle_add(self._get_document)
|
|
885 |
GLib.idle_add(self._get_document)
|
885 | 886 |
|
886 | 887 |
def _get_connection_params(self, tube_id):
|
887 | 888 |
# return ip and port to download a file
|
|
939 | 940 |
|
940 | 941 |
# Avoid trying to download the document multiple times at once
|
941 | 942 |
self._want_document = False
|
942 | |
GObject.idle_add(self._download_document, tube_id)
|
|
943 |
GLib.idle_add(self._download_document, tube_id)
|
943 | 944 |
return False
|
944 | 945 |
|
945 | 946 |
def _joined_cb(self, also_self):
|
|
951 | 952 |
if self._progress_alert is not None:
|
952 | 953 |
self._progress_alert.props.msg = _('Receiving book...')
|
953 | 954 |
|
954 | |
GObject.idle_add(self._get_document)
|
|
955 |
GLib.idle_add(self._get_document)
|
955 | 956 |
|
956 | 957 |
def _load_document(self, filepath):
|
957 | 958 |
"""Load the specified document and set up the UI.
|
|
1123 | 1124 |
self.unused_download_tubes.add(tube_id)
|
1124 | 1125 |
# if no download is in progress, let's fetch the document
|
1125 | 1126 |
if self._want_document:
|
1126 | |
GObject.idle_add(self._get_document)
|
|
1127 |
GLib.idle_add(self._get_document)
|
1127 | 1128 |
|
1128 | 1129 |
def _list_tubes_reply_cb(self, tubes):
|
1129 | 1130 |
"""Callback when new tubes are available."""
|
|
1254 | 1255 |
# but we don't have a event yet, Evince model have a event
|
1255 | 1256 |
# we need check the differnt backends and implement
|
1256 | 1257 |
# in all the backends.
|
1257 | |
GObject.timeout_add_seconds(2, self._update_preview, button, page)
|
|
1258 |
GLib.timeout_add_seconds(2, self._update_preview, button, page)
|
1258 | 1259 |
|
1259 | 1260 |
def _update_preview(self, button, page):
|
1260 | 1261 |
thumb = self._get_screenshot()
|