[evince] ev-window: do not remove find job when find bar closes
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] ev-window: do not remove find job when find bar closes
- Date: Sat, 18 May 2013 08:28:04 +0000 (UTC)
commit fdfc89d9fd4f4fe1d6f2ec1638ada4f379cff118
Author: Jonas Danielsson <jonas threetimestwo org>
Date: Wed May 15 13:20:41 2013 +0200
ev-window: do not remove find job when find bar closes
In order to have the find next and previous keyboard shortcuts function even
when the find bar is closed we should not clear and cancel the find job in
ev_window_close_find_bar. The job still gets cleared and canceled on a new
search which happens every time the search string changes.
And for that reason do not call ev_window_search_start when the find bar goes
visible, as that will clear and cancel present find job hindering the
next and previous operations.
We also need to run the ev_find_{next|previous} functions as idles in order
to make sure that the view has time to update when the window was hidden.
https://bugzilla.gnome.org/show_bug.cgi?id=625225
shell/ev-window.c | 41 ++++++++++++++++++++++++++++++++++-------
1 files changed, 34 insertions(+), 7 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 235848f..35596a1 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -3862,24 +3862,55 @@ ev_window_cmd_edit_find (GtkAction *action, EvWindow *ev_window)
ev_window_show_find_bar (ev_window);
}
+
+static gboolean
+find_next_idle_cb (EvView *view)
+{
+ ev_view_find_next (view);
+ return FALSE;
+}
+
static void
ev_window_cmd_edit_find_next (GtkAction *action, EvWindow *ev_window)
{
+ gboolean find_bar_hidden;
+
if (EV_WINDOW_IS_PRESENTATION (ev_window))
return;
+ find_bar_hidden = !gtk_widget_get_visible (ev_window->priv->find_bar);
ev_window_show_find_bar (ev_window);
- ev_view_find_next (EV_VIEW (ev_window->priv->view));
+
+ /* Use idle to make sure view allocation happens before find */
+ if (find_bar_hidden)
+ g_idle_add ((GSourceFunc)find_next_idle_cb, ev_window->priv->view);
+ else
+ ev_view_find_next (EV_VIEW (ev_window->priv->view));
+}
+
+static gboolean
+find_previous_idle_cb (EvView *view)
+{
+ ev_view_find_previous (view);
+ return FALSE;
}
static void
ev_window_cmd_edit_find_previous (GtkAction *action, EvWindow *ev_window)
{
+ gboolean find_bar_hidden;
+
if (EV_WINDOW_IS_PRESENTATION (ev_window))
return;
+ find_bar_hidden = !gtk_widget_get_visible (ev_window->priv->find_bar);
ev_window_show_find_bar (ev_window);
- ev_view_find_previous (EV_VIEW (ev_window->priv->view));
+
+ /* Use idle to make sure view allocation happens before find */
+ if (find_bar_hidden)
+ g_idle_add ((GSourceFunc)find_previous_idle_cb, ev_window->priv->view);
+ else
+ ev_view_find_previous (EV_VIEW (ev_window->priv->view));
}
static void
@@ -5364,9 +5395,7 @@ find_bar_visibility_changed_cb (EggFindBar *find_bar,
ev_view_find_set_highlight_search (EV_VIEW (ev_window->priv->view), visible);
ev_window_update_actions_sensitivity (ev_window);
- if (visible)
- ev_window_search_start (ev_window);
- else
+ if (!visible)
egg_find_bar_set_status_text (EGG_FIND_BAR (ev_window->priv->find_bar), NULL);
}
}
@@ -5422,8 +5451,6 @@ ev_window_close_find_bar (EvWindow *ev_window)
if (!gtk_widget_get_visible (ev_window->priv->find_bar))
return;
- ev_view_find_cancel (EV_VIEW (ev_window->priv->view));
- ev_window_clear_find_job (ev_window);
update_chrome_flag (ev_window, EV_CHROME_FINDBAR, FALSE);
update_chrome_visibility (ev_window);
gtk_widget_grab_focus (ev_window->priv->view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]