summaryrefslogtreecommitdiff
path: root/libview/ev-view.c
diff options
context:
space:
mode:
authorAntia Puentes <[email protected]>2013-06-26 20:01:04 +0200
committerraveit65 <[email protected]>2017-09-06 18:25:34 +0200
commita49bdffa1a43a0ac43b0d14fed139632c5a4c4c1 (patch)
treec55d4c8911e123d2bf20a0d731e68e4469873780 /libview/ev-view.c
parent8d9c9e059772d7c8cea633d219c0158424f1e2dc (diff)
downloadatril-a49bdffa1a43a0ac43b0d14fed139632c5a4c4c1.tar.bz2
atril-a49bdffa1a43a0ac43b0d14fed139632c5a4c4c1.tar.xz
libview: Added 'cursor-moved' signal to notify when the caret cursor
has been moved. https://bugzilla.gnome.org/show_bug.cgi?id=702078 origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=4eecb33
Diffstat (limited to 'libview/ev-view.c')
-rw-r--r--libview/ev-view.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 89458b95..2cd2a864 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -60,6 +60,7 @@ enum {
SIGNAL_ANNOT_REMOVED,
SIGNAL_LAYERS_CHANGED,
SIGNAL_MOVE_CURSOR,
+ SIGNAL_CURSOR_MOVED,
N_SIGNALS
};
@@ -4316,6 +4317,8 @@ position_caret_cursor_for_event (EvView *view,
view->cursor_line_offset = area.x;
+ g_signal_emit (view, signals[SIGNAL_CURSOR_MOVED], 0, view->cursor_page, view->cursor_offset);
+
return TRUE;
}
@@ -5333,6 +5336,8 @@ ev_view_move_cursor (EvView *view,
ev_document_model_set_page (view->model, view->cursor_page);
ensure_rectangle_is_visible (view, &rect);
+ g_signal_emit (view, signals[SIGNAL_CURSOR_MOVED], 0, view->cursor_page, view->cursor_offset);
+
/* Select text */
if (extend_selection && EV_IS_SELECTION (view->document)) {
GdkRectangle prev_rect;
@@ -6223,6 +6228,15 @@ ev_view_class_init (EvViewClass *class)
GTK_TYPE_MOVEMENT_STEP,
G_TYPE_INT,
G_TYPE_BOOLEAN);
+ signals[SIGNAL_CURSOR_MOVED] = g_signal_new ("cursor-moved",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ ev_view_marshal_VOID__INT_INT,
+ G_TYPE_NONE, 2,
+ G_TYPE_INT,
+ G_TYPE_INT);
binding_set = gtk_binding_set_by_class (class);