Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/evinceadapter.py
diff options
context:
space:
mode:
Diffstat (limited to 'evinceadapter.py')
-rw-r--r--evinceadapter.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/evinceadapter.py b/evinceadapter.py
index 2aaa216..b09e755 100644
--- a/evinceadapter.py
+++ b/evinceadapter.py
@@ -5,6 +5,7 @@ import time
from gi.repository import GObject
from gi.repository import Gtk
+from gi.repository import Gdk
from gi.repository import EvinceDocument
from gi.repository import EvinceView
@@ -37,6 +38,10 @@ class EvinceViewer():
activity._scrolled.add(self._view)
self._view.show()
+ self._view.set_events(self._view.get_events() |
+ Gdk.EventMask.TOUCH_MASK)
+ self._view.connect('event', self.__view_touch_event_cb)
+
activity._hbox.pack_start(activity._scrolled, True, True, 0)
activity._scrolled.show()
@@ -66,6 +71,15 @@ class EvinceViewer():
self._model.set_max_scale(max_scale * self.dpi / 72.0)
"""
+ def __view_touch_event_cb(self, widget, event):
+ if event.type == Gdk.EventType.TOUCH_BEGIN:
+ x = event.touch.x
+ view_width = widget.get_allocation().width
+ if x > view_width * 3 / 4:
+ self._view.scroll(Gtk.ScrollType.PAGE_FORWARD, False)
+ elif x < view_width * 1 / 4:
+ self._view.scroll(Gtk.ScrollType.PAGE_BACKWARD, False)
+
def __handle_link_cb(self, widget, url_object):
url = url_object.get_uri()
logging.debug('Create journal entry for URL: %s', url)