]> www.fi.muni.cz Git - evince.git/commitdiff
Enables 'find next' when bindbar is hidden. Fixes bug #323817.
authorJustin Blanchard <justinb04@aim.com>
Mon, 27 Aug 2007 21:36:20 +0000 (21:36 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Mon, 27 Aug 2007 21:36:20 +0000 (21:36 +0000)
2007-08-28  Justin Blanchard  <justinb04@aim.com>

* 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
shell/ev-view-private.h
shell/ev-view.c
shell/ev-view.h
shell/ev-window.c

index da4744d9ca0fc0751bd592379e79bc637a93bc1c..3cc053757e181425fc5bcd7b5155653e87b542b9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-08-28  Justin Blanchard  <justinb04@aim.com>
+
+       * 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  <carlosgc@gnome.org>
 
        * 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  <carlosgc@gnome.org>
 
        * backend/pdf/ev-poppler.cc: (pdf_document_file_exporter_begin):
 
        Adjust number of pages per row according to page orientation when
        printing 2 or 6 pages per sheet.
-       
+
 2007-08-25  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * 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  <carlosgc@gnome.org>
 
        * 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  <carlosgc@gnome.org>
 
        * 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 <jeff@infidigm.net>.
-       
+
 2007-08-17  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * 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  <carlosgc@gnome.org>
 
        * backend/pdf/ev-poppler.cc:
@@ -66,7 +78,7 @@
 
        Fix thumbnails rotation in pdf documents that include embedded 
        thumbnails.
-       
+
 2007-08-15  Jens Granseuer  <jensgr@gmx.net>
 
        * backend/pdf/ev-poppler.cc:
index feed78a919b49d0010986b73deea9ad289d10fef..d1edfa66f8e2eeadb33cb734ead6ed436b88cf1c 100644 (file)
@@ -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;
index 4fda98c155989e76c65369fa5d000bbcd973e5fc..b3bd531f888bc29c348a1ef0ae08c42f3b57c133 100644 (file)
@@ -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
index 698b7b2db3e3a0a7ebb451224a06c9897a65a8bd..667b2ee62325222e2a040d881d08ac6003b205f2 100644 (file)
@@ -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);
index 32d52fdaa67d73ceafe4ca06379b44ed8c54c211..9081b85593c7c789672c15f82552408945453b2c 100644 (file)
@@ -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",