From a49bdffa1a43a0ac43b0d14fed139632c5a4c4c1 Mon Sep 17 00:00:00 2001 From: Antia Puentes Date: Wed, 26 Jun 2013 20:01:04 +0200 Subject: 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 --- libview/ev-view.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libview') 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); -- cgit v1.2.1