+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:
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)
{
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);
}
+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,
update_action_sensitivity (ev_window);
}
-
static void
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);
}
}
+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)
{
{ "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",