From 39c51b63804387f5f7c0f3fce193da9eb9998774 Mon Sep 17 00:00:00 2001 From: Justin Blanchard Date: Mon, 27 Aug 2007 21:36:20 +0000 Subject: [PATCH] Enables 'find next' when bindbar is hidden. Fixes bug #323817. 2007-08-28 Justin Blanchard * shell/ev-view-private.h: * shell/ev-view.c: (ev_view_expose_event), (ev_view_init), (ev_view_set_highlight_search): * shell/ev-view.h: * shell/ev-window.c: (ev_window_cmd_edit_find_next), (ev_window_cmd_edit_find_previous), (find_bar_search_changed_cb), (find_bar_visibility_changed_cb): Enables 'find next' when bindbar is hidden. Fixes bug #323817. svn path=/trunk/; revision=2645 --- ChangeLog | 26 +++++++++++++++++++------- shell/ev-view-private.h | 1 + shell/ev-view.c | 9 ++++++++- shell/ev-view.h | 13 +++++++------ shell/ev-window.c | 36 +++++++++++++++++++++++++++--------- 5 files changed, 62 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index da4744d9..3cc05375 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-08-28 Justin Blanchard + + * shell/ev-view-private.h: + * shell/ev-view.c: (ev_view_expose_event), (ev_view_init), + (ev_view_set_highlight_search): + * shell/ev-view.h: + * shell/ev-window.c: (ev_window_cmd_edit_find_next), + (ev_window_cmd_edit_find_previous), (find_bar_search_changed_cb), + (find_bar_visibility_changed_cb): + + Enables 'find next' when bindbar is hidden. Fixes bug #323817. + 2007-08-27 Carlos Garcia Campos * backend/pdf/ev-poppler.cc: (pdf_print_context_free), @@ -8,7 +20,7 @@ Create always a portrait cairo surface and rotate when needed for landscape. It fixes printing problems in real printers. - + 2007-08-25 Carlos Garcia Campos * backend/pdf/ev-poppler.cc: (pdf_document_file_exporter_begin): @@ -19,14 +31,14 @@ Adjust number of pages per row according to page orientation when printing 2 or 6 pages per sheet. - + 2007-08-25 Carlos Garcia Campos * shell/ev-window.c: (ev_window_print_send): Reset also cups setting to 1 when printing multiple pages per sheet. Fixes bug #468853. - + 2007-08-24 Carlos Garcia Campos * libdocument/ev-document-misc.c: @@ -34,7 +46,7 @@ Use directly cairo_surface_get_content() when creating a similar surface as suggested by Jeff Muizelaar. Thanks again. - + 2007-08-24 Carlos Garcia Campos * backend/djvu/djvu-document.c: (djvu_document_render): @@ -47,7 +59,7 @@ Use CAIRO_FORMAT_RGB24 instead of CAIRO_FORMAT_ARGB32 when creating page surfaces. Fixes bug #453123. Thank you very much to Jeff Muizelaar . - + 2007-08-17 Carlos Garcia Campos * shell/ev-page-cache.c: (ev_page_cache_new), @@ -58,7 +70,7 @@ Also store in page-cache the dimensions of the thumbnails so that they can be used to create the correct loading icon in the side pane. Fixes bug #466857. - + 2007-08-17 Carlos Garcia Campos * backend/pdf/ev-poppler.cc: @@ -66,7 +78,7 @@ Fix thumbnails rotation in pdf documents that include embedded thumbnails. - + 2007-08-15 Jens Granseuer * backend/pdf/ev-poppler.cc: diff --git a/shell/ev-view-private.h b/shell/ev-view-private.h index feed78a9..d1edfa66 100644 --- a/shell/ev-view-private.h +++ b/shell/ev-view-private.h @@ -81,6 +81,7 @@ struct _EvView { char *find_status; int find_result; gboolean jump_to_find_result; + gboolean highlight_find_results; EvPageCache *page_cache; EvPixbufCache *pixbuf_cache; diff --git a/shell/ev-view.c b/shell/ev-view.c index 4fda98c1..b3bd531f 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -2494,7 +2494,7 @@ ev_view_expose_event (GtkWidget *widget, draw_one_page (view, i, cr, &page_area, &border, &(event->area), &page_ready); - if (page_ready && EV_IS_DOCUMENT_FIND (view->document)) + if (page_ready && EV_IS_DOCUMENT_FIND (view->document) && view->highlight_find_results) highlight_find_results (view, i); } @@ -3996,6 +3996,7 @@ ev_view_init (EvView *view) view->sizing_mode = EV_SIZING_FIT_WIDTH; view->pending_scroll = SCROLL_TO_KEEP_POSITION; view->jump_to_find_result = TRUE; + view->highlight_find_results = FALSE; gtk_layout_set_hadjustment (GTK_LAYOUT (view), NULL); gtk_layout_set_vadjustment (GTK_LAYOUT (view), NULL); @@ -4997,6 +4998,12 @@ void ev_view_search_changed (EvView *view) view->jump_to_find_result = TRUE; } +void ev_view_set_highlight_search (EvView *view, gboolean value) +{ + view->highlight_find_results = value; + gtk_widget_queue_draw (GTK_WIDGET (view)); +} + /*** Selections ***/ /* compute_new_selection_rect/text calculates the area currently selected by diff --git a/shell/ev-view.h b/shell/ev-view.h index 698b7b2d..667b2ee6 100644 --- a/shell/ev-view.h +++ b/shell/ev-view.h @@ -118,12 +118,13 @@ void ev_view_set_rotation (EvView *view, int ev_view_get_rotation (EvView *view); /* Find */ -gboolean ev_view_can_find_next (EvView *view); -void ev_view_find_next (EvView *view); -gboolean ev_view_can_find_previous (EvView *view); -void ev_view_find_previous (EvView *view); -void ev_view_search_changed (EvView *view); - +gboolean ev_view_can_find_next (EvView *view); +void ev_view_find_next (EvView *view); +gboolean ev_view_can_find_previous (EvView *view); +void ev_view_find_previous (EvView *view); +void ev_view_search_changed (EvView *view); +void ev_view_set_highlight_search (EvView *view, + gboolean value); /* Status */ const char *ev_view_get_status (EvView *view); const char *ev_view_get_find_status (EvView *view); diff --git a/shell/ev-window.c b/shell/ev-window.c index 32d52fda..9081b855 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -2789,6 +2789,8 @@ ev_window_cmd_edit_find_next (GtkAction *action, EvWindow *ev_window) { g_return_if_fail (EV_IS_WINDOW (ev_window)); + update_chrome_flag (ev_window, EV_CHROME_FINDBAR, TRUE); + gtk_widget_grab_focus (ev_window->priv->find_bar); ev_view_find_next (EV_VIEW (ev_window->priv->view)); } @@ -2797,6 +2799,8 @@ ev_window_cmd_edit_find_previous (GtkAction *action, EvWindow *ev_window) { g_return_if_fail (EV_IS_WINDOW (ev_window)); + update_chrome_flag (ev_window, EV_CHROME_FINDBAR, TRUE); + gtk_widget_grab_focus (ev_window->priv->find_bar); ev_view_find_previous (EV_VIEW (ev_window->priv->view)); } @@ -4019,24 +4023,18 @@ find_bar_search_changed_cb (EggFindBar *find_bar, EvWindow *ev_window) { gboolean case_sensitive; - gboolean visible; const char *search_string; - /* Either the string or case sensitivity could have changed, - * we connect this callback to both. We also connect it - * to ::visible so when the find bar is hidden, we should - * pretend the search string is NULL/"" - */ + /* Either the string or case sensitivity could have changed. */ case_sensitive = egg_find_bar_get_case_sensitive (find_bar); - visible = GTK_WIDGET_VISIBLE (find_bar); search_string = egg_find_bar_get_search_string (find_bar); ev_view_search_changed (EV_VIEW(ev_window->priv->view)); if (ev_window->priv->document && EV_IS_DOCUMENT_FIND (ev_window->priv->document)) { - if (visible && search_string && search_string[0]) { + if (search_string && search_string[0]) { ev_document_doc_mutex_lock (); ev_document_find_begin (EV_DOCUMENT_FIND (ev_window->priv->document), ev_page_cache_get_current_page (ev_window->priv->page_cache), @@ -4056,6 +4054,26 @@ find_bar_search_changed_cb (EggFindBar *find_bar, } } +static void +find_bar_visibility_changed_cb (EggFindBar *find_bar, + GParamSpec *param, + EvWindow *ev_window) +{ + gboolean visible; + + visible = GTK_WIDGET_VISIBLE (find_bar); + + if (ev_window->priv->document && + EV_IS_DOCUMENT_FIND (ev_window->priv->document)) { + ev_view_set_highlight_search (EV_VIEW(ev_window->priv->view), visible); + ev_view_search_changed (EV_VIEW(ev_window->priv->view)); + ev_window_update_actions (ev_window); + + if (!visible) + egg_find_bar_set_status_text (EGG_FIND_BAR (ev_window->priv->find_bar), NULL); + } +} + static void find_bar_scroll(EggFindBar *find_bar, GtkScrollType scroll, EvWindow* ev_window) { @@ -5419,7 +5437,7 @@ ev_window_init (EvWindow *ev_window) ev_window); g_signal_connect (ev_window->priv->find_bar, "notify::visible", - G_CALLBACK (find_bar_search_changed_cb), + G_CALLBACK (find_bar_visibility_changed_cb), ev_window); g_signal_connect (ev_window->priv->find_bar, "scroll", -- 2.43.5