]> www.fi.muni.cz Git - evince.git/commitdiff
Add Edit->Find Next
authorMarco Pesenti Gritti <mpg@redhat.com>
Fri, 8 Apr 2005 10:31:28 +0000 (10:31 +0000)
committerMarco Pesenti Gritti <marco@src.gnome.org>
Fri, 8 Apr 2005 10:31:28 +0000 (10:31 +0000)
2005-04-08  Marco Pesenti Gritti <mpg@redhat.com>

        * data/evince-ui.xml:
        * shell/ev-view.c: (ev_view_can_find_next):
        * shell/ev-view.h:
        * shell/ev-window.c: (update_action_sensitivity),
        (find_changed_cb), (ev_window_setup_document),
        (ev_window_cmd_edit_find_next):

        Add Edit->Find Next

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

index 693f80bbe7b1bd77baf492665fe77b9e27c7e35c..de542fb82a3506ef8dd694349c7f85c5bda29466 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-04-08  Marco Pesenti Gritti <mpg@redhat.com>
+
+       * data/evince-ui.xml:
+       * shell/ev-view.c: (ev_view_can_find_next):
+       * shell/ev-view.h:
+       * shell/ev-window.c: (update_action_sensitivity),
+       (find_changed_cb), (ev_window_setup_document),
+       (ev_window_cmd_edit_find_next):
+
+       Add Edit->Find Next
+
 2005-04-08  Marco Pesenti Gritti <mpg@redhat.com>
 
        * pdf/ev-poppler.cc:
index a84697cb4411354175e24abbd01cbbbb831eafde..274075c021e5d6e8ed245ce0c45fe65e80e8fa95 100644 (file)
@@ -16,6 +16,7 @@
       <menuitem name="EditSelectAllMenu" action="EditSelectAll"/>
       <separator/>
       <menuitem name="EditFindMenu" action="EditFind"/>
+      <menuitem name="EditFindNextMenu" action="EditFindNext"/>
     </menu>
 
     <menu name="ViewMenu" action="View">
index 2db13179d9180929f9903b22fea21ce2366d56cd..b94a317fca6b25e3baaa23d3ffdb680b4f196f06 100644 (file)
@@ -1590,6 +1590,22 @@ ev_view_get_find_status (EvView *view)
        return view->find_status;
 }
 
+gboolean
+ev_view_can_find_next (EvView *view)
+{
+       int n_results = 0;
+
+       if (view->document) {   
+               EvDocumentFind *find = EV_DOCUMENT_FIND (view->document);
+
+               g_mutex_lock (EV_DOC_MUTEX);
+               n_results = ev_document_find_get_n_results (find, view->current_page);
+               g_mutex_unlock (EV_DOC_MUTEX);
+       }
+
+       return n_results > 0;
+}
+
 void
 ev_view_find_next (EvView *view)
 {
index 8ba79f1e41598f813c185889c4e8103ba5f781bc..6cde705df1e3d3adad5b57872bb4acfe67135a28 100644 (file)
@@ -56,6 +56,7 @@ void          ev_view_set_size        (EvView     *view,
                                         int         height);
 
 /* Find */
+gboolean       ev_view_can_find_next   (EvView     *view);
 void            ev_view_find_next       (EvView     *view);
 void            ev_view_find_previous   (EvView     *view);
 
index eb50e1c9392588ad79fc6c98053d897897d37ff8..3185e66e39dc17f943dadfd428cf54d46eb7769c 100644 (file)
@@ -203,6 +203,9 @@ update_action_sensitivity (EvWindow *ev_window)
        else
                set_action_sensitive (ev_window, "EditFind", FALSE);
 
+       set_action_sensitive (ev_window, "EditFindNext",
+                             ev_view_can_find_next (EV_VIEW (ev_window->priv->view)));
+
         /* View menu */
        set_action_sensitive (ev_window, "ViewZoomIn", document!=NULL);
        set_action_sensitive (ev_window, "ViewZoomOut", document!=NULL);
@@ -518,6 +521,12 @@ hide_sidebar_and_actions (EvWindow *ev_window)
 
 }
 
+static void
+find_changed_cb (EvDocument *document, int page, EvWindow *ev_window)
+{
+       update_action_sensitivity (ev_window);
+}
+
 static void
 page_changed_cb (EvPageCache *page_cache,
                 gint         page,
@@ -526,7 +535,6 @@ page_changed_cb (EvPageCache *page_cache,
        update_action_sensitivity (ev_window);
 }
 
-
 static void
 ev_window_setup_document (EvWindow *ev_window)
 {
@@ -543,6 +551,10 @@ ev_window_setup_document (EvWindow *ev_window)
                                 "notify::title",
                                 G_CALLBACK (update_window_title),
                                 ev_window, 0);
+       g_signal_connect_object (G_OBJECT (document),
+                                "find_changed",
+                                G_CALLBACK (find_changed_cb),  
+                                ev_window, 0);
 
        ev_window_set_page_mode (ev_window, PAGE_MODE_SINGLE_PAGE);
 
@@ -1146,6 +1158,14 @@ ev_window_cmd_edit_find (GtkAction *action, EvWindow *ev_window)
        }
 }
 
+static void
+ev_window_cmd_edit_find_next (GtkAction *action, EvWindow *ev_window)
+{
+        g_return_if_fail (EV_IS_WINDOW (ev_window));
+
+       ev_view_find_next (EV_VIEW (ev_window->priv->view));
+}
+
 static void
 ev_window_cmd_edit_copy (GtkAction *action, EvWindow *ev_window)
 {
@@ -2091,6 +2111,9 @@ static GtkActionEntry entries[] = {
         { "EditFind", GTK_STOCK_FIND, NULL, "<control>F",
           N_("Find a word or phrase in the document"),
           G_CALLBACK (ev_window_cmd_edit_find) },
+       { "EditFindNext", NULL, N_("Find Ne_xt"), "<control>G",
+         N_("Find next occurrence of the word or phrase"),
+         G_CALLBACK (ev_window_cmd_edit_find_next) },
 
         /* View menu */
         { "ViewZoomIn", GTK_STOCK_ZOOM_IN, NULL, "<control>plus",