summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <[email protected]>2013-07-28 10:50:11 +0200
committerraveit65 <[email protected]>2017-09-06 21:19:51 +0200
commitf43ac3c209f1c617b6b65ccac1e7a69bab7a7401 (patch)
treef1ee399d07a17a1789d52b11360cf3649b2fa1e3
parente64064d40b451011dba2f891be454f65439df18d (diff)
downloadatril-f43ac3c209f1c617b6b65ccac1e7a69bab7a7401.tar.bz2
atril-f43ac3c209f1c617b6b65ccac1e7a69bab7a7401.tar.xz
libview: Add ev_view_set_caret_cursor_position
origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=b2597d
-rw-r--r--libview/ev-view.c18
-rw-r--r--libview/ev-view.h3
2 files changed, 21 insertions, 0 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c
index c76e5541..e04d7298 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3497,6 +3497,24 @@ ev_view_is_caret_navigation_enabled (EvView *view)
return view->caret_enabled;
}
+void
+ev_view_set_caret_cursor_position (EvView *view,
+ guint page,
+ guint offset)
+{
+ g_return_if_fail (EV_IS_VIEW (view));
+ g_return_if_fail (EV_IS_DOCUMENT (view->document));
+ g_return_if_fail (page < ev_document_get_n_pages (view->document));
+
+ if (view->cursor_page != page || view->cursor_offset != offset) {
+ view->cursor_page = page;
+ view->cursor_offset = offset;
+
+ if (view->caret_enabled && cursor_is_in_visible_page (view))
+ gtk_widget_queue_draw (GTK_WIDGET (view));
+ }
+}
+
/*** GtkWidget implementation ***/
static void
diff --git a/libview/ev-view.h b/libview/ev-view.h
index 6a4a6d4f..fdf6c0ea 100644
--- a/libview/ev-view.h
+++ b/libview/ev-view.h
@@ -119,6 +119,9 @@ gboolean ev_view_supports_caret_navigation (EvView *view);
gboolean ev_view_is_caret_navigation_enabled (EvView *view);
void ev_view_set_caret_navigation_enabled (EvView *view,
gboolean enabled);
+void ev_view_set_caret_cursor_position (EvView *view,
+ guint page,
+ guint offset);
G_END_DECLS
#endif /* __EV_VIEW_H__ */