]> www.fi.muni.cz Git - evince.git/commitdiff
Don't jump to find result when the findbar is shown with search text
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 30 Apr 2011 11:08:20 +0000 (13:08 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 30 Apr 2011 11:08:20 +0000 (13:08 +0200)
Fixes bug #647378.

shell/ev-window.c

index 9ef85aab2d7051d56b362c5ebb27c0b5808597ad..6d19c95d5733dd8436bbd9b6c2f93bc31bd5a152 100644 (file)
@@ -5187,30 +5187,23 @@ find_bar_close_cb (EggFindBar *find_bar,
 }
 
 static void
-find_bar_search_changed_cb (EggFindBar *find_bar,
-                           GParamSpec *param,
-                           EvWindow   *ev_window)
+ev_window_search_start (EvWindow *ev_window)
 {
-       gboolean case_sensitive;
+       EggFindBar *find_bar = EGG_FIND_BAR (ev_window->priv->find_bar);
        const char *search_string;
 
        if (!ev_window->priv->document || !EV_IS_DOCUMENT_FIND (ev_window->priv->document))
                return;
-       
-       /* Either the string or case sensitivity could have changed. */
-       case_sensitive = egg_find_bar_get_case_sensitive (find_bar);
-       search_string = egg_find_bar_get_search_string (find_bar);
 
-       ev_view_find_search_changed (EV_VIEW (ev_window->priv->view));
+       search_string = egg_find_bar_get_search_string (find_bar);
 
        ev_window_clear_find_job (ev_window);
-
        if (search_string && search_string[0]) {
                ev_window->priv->find_job = ev_job_find_new (ev_window->priv->document,
                                                             ev_document_model_get_page (ev_window->priv->model),
                                                             ev_document_get_n_pages (ev_window->priv->document),
                                                             search_string,
-                                                            case_sensitive);
+                                                            egg_find_bar_get_case_sensitive (find_bar));
                g_signal_connect (ev_window->priv->find_job, "finished",
                                  G_CALLBACK (ev_window_find_job_finished_cb),
                                  ev_window);
@@ -5220,12 +5213,21 @@ find_bar_search_changed_cb (EggFindBar *find_bar,
                ev_job_scheduler_push_job (ev_window->priv->find_job, EV_JOB_PRIORITY_NONE);
        } else {
                ev_window_update_actions (ev_window);
-               egg_find_bar_set_status_text (EGG_FIND_BAR (ev_window->priv->find_bar),
-                                             NULL);
+               egg_find_bar_set_status_text (find_bar, NULL);
                gtk_widget_queue_draw (GTK_WIDGET (ev_window->priv->view));
        }
 }
 
+static void
+find_bar_search_changed_cb (EggFindBar *find_bar,
+                           GParamSpec *param,
+                           EvWindow   *ev_window)
+{
+       /* Either the string or case sensitivity could have changed. */
+       ev_view_find_search_changed (EV_VIEW (ev_window->priv->view));
+       ev_window_search_start (ev_window);
+}
+
 static void
 find_bar_visibility_changed_cb (EggFindBar *find_bar,
                                GParamSpec *param,
@@ -5238,11 +5240,10 @@ find_bar_visibility_changed_cb (EggFindBar *find_bar,
        if (ev_window->priv->document &&
            EV_IS_DOCUMENT_FIND (ev_window->priv->document)) {
                ev_view_find_set_highlight_search (EV_VIEW (ev_window->priv->view), visible);
-               ev_view_find_search_changed (EV_VIEW (ev_window->priv->view));
                ev_window_update_actions (ev_window);
 
                if (visible)
-                       find_bar_search_changed_cb (find_bar, NULL, ev_window);
+                       ev_window_search_start (ev_window);
                else
                        egg_find_bar_set_status_text (EGG_FIND_BAR (ev_window->priv->find_bar), NULL);
        }