[evince] libview: Add ev_view_set_caret_cursor_position



commit b2597d9be5a95b37f2133bf97627d9a36f023bcb
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sun Jul 28 10:50:11 2013 +0200

    libview: Add ev_view_set_caret_cursor_position

 libview/ev-view.c |   18 ++++++++++++++++++
 libview/ev-view.h |    3 +++
 2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 4e75da3..b07db15 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3379,6 +3379,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 1639aea..6793e3a 100644
--- a/libview/ev-view.h
+++ b/libview/ev-view.h
@@ -120,6 +120,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__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]