From 0e54ba33b487090b5befeb55ea6a6526bf207e35 Mon Sep 17 00:00:00 2001 From: infirit Date: Wed, 10 Dec 2014 02:18:04 +0100 Subject: libview: Save contents of FormTextFields when they loss focus. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Taken from evince commit: c8104d3426a7bd7ce6570a87363e4edeea472fce From: José Aliste Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=624921 --- libview/ev-view.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'libview/ev-view.c') diff --git a/libview/ev-view.c b/libview/ev-view.c index ceb7494d..d35dcb6d 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -2184,6 +2184,16 @@ ev_view_form_field_text_changed (GtkWidget *widget, } } +static gboolean +ev_view_form_field_text_focus_out (GtkWidget *widget, + GdkEventFocus *event, + EvView *view) +{ + ev_view_form_field_text_save (view, widget); + + return FALSE; +} + static GtkWidget * ev_view_form_field_text_create_widget (EvView *view, EvFormField *field) @@ -2209,6 +2219,9 @@ ev_view_form_field_text_create_widget (EvView *view, g_free (txt); } + g_signal_connect (text, "focus-out-event", + G_CALLBACK (ev_view_form_field_text_focus_out), + view); g_signal_connect (text, "changed", G_CALLBACK (ev_view_form_field_text_changed), field); @@ -2226,7 +2239,10 @@ ev_view_form_field_text_create_widget (EvView *view, gtk_text_buffer_set_text (buffer, txt, -1); g_free (txt); } - + + g_signal_connect( buffer, "focus-out-event", + G_CALLBACK (ev_view_form_field_text_focus_out), + view); g_signal_connect (buffer, "changed", G_CALLBACK (ev_view_form_field_text_changed), field); -- cgit v1.2.1