]> www.fi.muni.cz Git - evince.git/commitdiff
libview: Save contents of FormTextFields when they loss focus.
authorJosé Aliste <jaliste@src.gnome.org>
Tue, 22 Feb 2011 16:02:04 +0000 (13:02 -0300)
committerJosé Aliste <jaliste@src.gnome.org>
Sun, 20 Mar 2011 17:42:13 +0000 (13:42 -0400)
Fixes bug #624921.

libview/ev-view.c

index 1b404dce571ab75c2e8139982817a0d47a1b9653..c2e888d958998ef70c390f58dcc614c3791d0e50 100644 (file)
@@ -2151,6 +2151,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)
@@ -2176,6 +2186,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);
@@ -2193,7 +2206,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);