]> www.fi.muni.cz Git - evince.git/blobdiff - libview/ev-view.c
[dualscreen] fix crash on ctrl+w and fix control window closing
[evince.git] / libview / ev-view.c
index 301c8ca57876f095c3e9f3feb0d6f107107944d3..cbc6b4ac1286bace33bdc6d7218833bffe5ae680 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);
@@ -5218,6 +5234,7 @@ ev_view_document_changed_cb (EvDocumentModel *model,
        if (document != view->document) {
                gint current_page;
 
+               ev_view_remove_all (view);
                clear_caches (view);
 
                if (view->document) {