+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.
}
}
+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)
{
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);
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));
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)
{
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,