]> www.fi.muni.cz Git - evince.git/commitdiff
Add support for "Find Previous" as dictated by the GNOME HIG. A menu item
authorWouter Bolsterlee <uws+gnome@xs4all.nl>
Thu, 20 Apr 2006 15:35:24 +0000 (15:35 +0000)
committerWouter Bolsterlee <wbolster@src.gnome.org>
Thu, 20 Apr 2006 15:35:24 +0000 (15:35 +0000)
2006-04-20  Wouter Bolsterlee  <uws+gnome@xs4all.nl>

* data/evince-ui.xml:
* shell/ev-view.c: (ev_view_can_find_previous):
* shell/ev-view.h:
* shell/ev-window.c: (ev_window_update_actions),
(ev_window_cmd_edit_find_previous):

Add support for "Find Previous" as dictated by the GNOME HIG. A
menu item is added and some glue code to make it all work is added
to various files.

ChangeLog
data/evince-ui.xml
shell/ev-view.c
shell/ev-view.h
shell/ev-window.c

index 8ad2d0125045deea5b8f741fca3db65c4326fdde..74be37a86c88818703310c19d300e9b8b4fcfe74 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2006-04-20  Wouter Bolsterlee  <uws+gnome@xs4all.nl>
+
+       * data/evince-ui.xml:
+       * shell/ev-view.c: (ev_view_can_find_previous):
+       * shell/ev-view.h:
+       * shell/ev-window.c: (ev_window_update_actions),
+       (ev_window_cmd_edit_find_previous):
+
+       Add support for "Find Previous" as dictated by the GNOME HIG. A
+       menu item is added and some glue code to make it all work is added
+       to various files.
+
 2006-04-09  Wouter Bolsterlee  <uws+gnome@xs4all.nl>
 
        * configure.ac: Award myself the "useless use of cat" award.
index bfd42121137ad543cc5fd5c2c23e75fcf14e9dba..213a276cf5d8b93ba67a5b363c398c168109d3bb 100644 (file)
@@ -19,6 +19,7 @@
       <separator/>
       <menuitem name="EditFindMenu" action="EditFind"/>
       <menuitem name="EditFindNextMenu" action="EditFindNext"/>
+      <menuitem name="EditFindPreviousMenu" action="EditFindPrevious"/>
       <separator/>
       <menuitem name="EditRotateLeftMenu" action="EditRotateLeft"/>
       <menuitem name="EditRotateRigtMenu" action="EditRotateRight"/>
index f903e20a2e1d99e3d8119628c1fda21ee5635f1c..eb8f3292455d8e56dfa2552c918481c0d26bbaa2 100644 (file)
@@ -3430,6 +3430,23 @@ ev_view_find_next (EvView *view)
        }
 }
 
+gboolean
+ev_view_can_find_previous (EvView *view)
+{
+       if (EV_IS_DOCUMENT_FIND (view->document)) {
+               EvDocumentFind *find = EV_DOCUMENT_FIND (view->document);
+               int i, n_pages;
+
+               n_pages = ev_page_cache_get_n_pages (view->page_cache);
+               for (i = n_pages - 1; i >= 0; i--) {
+                       if (ev_document_find_get_n_results (find, i) > 0) {
+                               return TRUE;
+                       }
+               }
+       }
+
+       return FALSE;
+}
 void
 ev_view_find_previous (EvView *view)
 {
index dc00ff3659f37b18b0afd75a8310aabebf91d544..3ad401669cbe5411f6098b352925de13fa82a1c7 100644 (file)
@@ -119,8 +119,9 @@ void            ev_view_set_rotation      (EvView         *view,
 int             ev_view_get_rotation      (EvView         *view);
 
 /* Find */
-gboolean       ev_view_can_find_next     (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);
 
index 905fd51b16ef823df449527432134b753cd9522f..cce9d76504ff83d0b3d4c21e57182f9d1d7a07b3 100644 (file)
@@ -335,6 +335,8 @@ ev_window_update_actions (EvWindow *ev_window)
        ev_window_set_action_sensitive (ev_window, "EditCopy", has_pages && ev_view_get_has_selection (view));
        ev_window_set_action_sensitive (ev_window, "EditFindNext",
                              ev_view_can_find_next (view));
+       ev_window_set_action_sensitive (ev_window, "EditFindPrevious",
+                             ev_view_can_find_previous (view));
 
        ev_window_set_action_sensitive (ev_window, "ViewZoomIn",
                              has_pages && ev_view_can_zoom_in (view));
@@ -1446,6 +1448,14 @@ ev_window_cmd_edit_find_next (GtkAction *action, EvWindow *ev_window)
        ev_view_find_next (EV_VIEW (ev_window->priv->view));
 }
 
+static void
+ev_window_cmd_edit_find_previous (GtkAction *action, EvWindow *ev_window)
+{
+        g_return_if_fail (EV_IS_WINDOW (ev_window));
+
+       ev_view_find_previous (EV_VIEW (ev_window->priv->view));
+}
+
 static void
 ev_window_cmd_edit_copy (GtkAction *action, EvWindow *ev_window)
 {
@@ -2848,6 +2858,8 @@ static const GtkActionEntry entries[] = {
           G_CALLBACK (ev_window_cmd_edit_find) },
        { "EditFindNext", NULL, N_("Find Ne_xt"), "<control>G", NULL,
          G_CALLBACK (ev_window_cmd_edit_find_next) },
+       { "EditFindPrevious", NULL, N_("Find Pre_vious"), "<shift><control>G", NULL,
+         G_CALLBACK (ev_window_cmd_edit_find_previous) },
         { "EditToolbar", NULL, N_("T_oolbar"), NULL, NULL,
           G_CALLBACK (ev_window_cmd_edit_toolbar) },
        { "EditRotateLeft", NULL, N_("Rotate _Left"), NULL, NULL,