[evince/gnome-3-8] Make sure find bar is visible when --find command line option is used



commit efc13ec2048b369921f997a0c976a90c84279053
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Tue May 7 18:48:01 2013 +0200

    Make sure find bar is visible when --find command line option is used
    
    Move the code to start the initial search to ev_window_setup_document()
    so that it will be called also when the view is reloaded and do not grab
    the focus on the view when there's an initial search to keep the find
    bar open.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=604327

 shell/ev-window.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index a539f58..e7cdeef 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -1450,11 +1450,19 @@ ev_window_setup_document (EvWindow *ev_window)
                                                    options & EV_FIND_CASE_SENSITIVE);
                egg_find_bar_enable_whole_words_only (EGG_FIND_BAR (ev_window->priv->find_bar),
                                                      options & EV_FIND_WHOLE_WORDS_ONLY);
+
+               if (ev_window->priv->search_string &&
+                   !EV_WINDOW_IS_PRESENTATION (ev_window)) {
+                       ev_window_show_find_bar (ev_window);
+                       egg_find_bar_set_search_string (EGG_FIND_BAR (ev_window->priv->find_bar), 
ev_window->priv->search_string);
+               }
+
+               g_clear_pointer (&ev_window->priv->search_string, g_free);
        }
 
        if (EV_WINDOW_IS_PRESENTATION (ev_window))
                gtk_widget_grab_focus (ev_window->priv->presentation_view);
-       else
+       else if (!gtk_widget_get_visible (ev_window->priv->find_bar))
                gtk_widget_grab_focus (ev_window->priv->view);
 
        return FALSE;
@@ -1631,16 +1639,6 @@ ev_window_load_job_cb (EvJob *job,
                                break;
                }
 
-               if (ev_window->priv->search_string && EV_IS_DOCUMENT_FIND (document) &&
-                   ev_window->priv->window_mode != EV_WINDOW_MODE_PRESENTATION) {
-                       ev_window_show_find_bar (ev_window);
-                       egg_find_bar_set_search_string (EGG_FIND_BAR (ev_window->priv->find_bar),
-                                                       ev_window->priv->search_string);
-               }
-
-               g_free (ev_window->priv->search_string);
-               ev_window->priv->search_string = NULL;
-
                /* Create a monitor for the document */
                ev_window->priv->monitor = ev_file_monitor_new (ev_window->priv->uri);
                g_signal_connect_swapped (ev_window->priv->monitor, "changed",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]