[evince] Check if find bar is visible when ESC is pressed to hide it



commit 0109afa3719a2b06ccbb49f32fd17bdcbd279bd0
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Fri Jun 28 10:43:14 2013 +0200

    Check if find bar is visible when ESC is pressed to hide it
    
    We were checking if the focused widget was a children of the find bar.
    Now that there's a find sidebar and findbar is not closed when it loses
    the focus, other widgets might have the focus while a search is active.
    So, simply check if the findbar is visible instead.

 shell/ev-window.c |   30 ++++++++----------------------
 1 files changed, 8 insertions(+), 22 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index f9533af..172a30e 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -4691,30 +4691,16 @@ ev_window_cmd_start_presentation (GtkAction *action, EvWindow *window)
 static void
 ev_window_cmd_escape (GtkAction *action, EvWindow *window)
 {
-       GtkWidget *widget;
-
        ev_view_autoscroll_stop (EV_VIEW (window->priv->view));
-       
-       widget = gtk_window_get_focus (GTK_WINDOW (window));
-       if (widget && gtk_widget_get_ancestor (widget, EGG_TYPE_FIND_BAR)) {
-               ev_window_close_find_bar (window);
-       } else {
-               gboolean fullscreen;
-
-               fullscreen = ev_document_model_get_fullscreen (window->priv->model);
 
-               if (fullscreen) {
-                       ev_window_stop_fullscreen (window, TRUE);
-               } else if (EV_WINDOW_IS_PRESENTATION (window)) {
-                       ev_window_stop_presentation (window, TRUE);
-                       gtk_widget_grab_focus (window->priv->view);
-               } else {
-                       gtk_widget_grab_focus (window->priv->view);
-               }
-
-               if (fullscreen && EV_WINDOW_IS_PRESENTATION (window))
-                       g_warning ("Both fullscreen and presentation set somehow");
-       }
+       if (gtk_widget_get_visible (window->priv->find_bar))
+               ev_window_close_find_bar (window);
+       else if (ev_document_model_get_fullscreen (window->priv->model))
+               ev_window_stop_fullscreen (window, TRUE);
+       else if (EV_WINDOW_IS_PRESENTATION (window))
+               ev_window_stop_presentation (window, TRUE);
+       else
+               gtk_widget_grab_focus (window->priv->view);
 }
 
 static void


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