Index: shell/ev-view.c
===================================================================
RCS file: /cvs/gnome/evince/shell/ev-view.c,v
retrieving revision 1.138
diff -u -r1.138 ev-view.c
--- shell/ev-view.c	30 Jul 2005 23:11:25 -0000	1.138
+++ shell/ev-view.c	3 Aug 2005 16:52:01 -0000
@@ -41,6 +41,9 @@
 #define EV_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_VIEW))
 #define EV_VIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_VIEW, EvViewClass))
 
+#define FIND_NEXT 0
+#define FIND_PREV 1
+
 enum {
 	PROP_0,
 	PROP_STATUS,
@@ -350,7 +353,7 @@
 							      const char         *message);
 /*** Find ***/
 static void       jump_to_find_result                        (EvView             *view);
-static void       jump_to_find_page                          (EvView             *view);
+static void       jump_to_find_page                          (EvView             *view, int direction);
 
 /*** Selection ***/
 static void       compute_selections                         (EvView             *view,
@@ -1986,7 +1989,7 @@
 static void
 find_changed_cb (EvDocument *document, int page, EvView *view)
 {
-	jump_to_find_page (view);
+	jump_to_find_page (view, FIND_NEXT);
 	jump_to_find_result (view);
 	update_find_status_message (view);
 
@@ -2699,7 +2702,7 @@
 }
 
 static void
-jump_to_find_page (EvView *view)
+jump_to_find_page (EvView *view, int direction)
 {
 	int n_pages, i;
 
@@ -2708,12 +2711,20 @@
 	for (i = 0; i < n_pages; i++) {
 		int has_results;
 		int page;
+		
+		if (direction == FIND_NEXT)
+			page = view->find_page + i;
+		else
+			page = view->find_page - i;
+
 
-		page = i + view->find_page;
 		if (page >= n_pages) {
 			page = page - n_pages;
 		}
 
+		if (page < 0) 
+			page = page + n_pages;
+		
 		has_results = ev_document_find_page_has_results
 				(EV_DOCUMENT_FIND (view->document), page);
 		if (has_results == -1) {
@@ -2721,7 +2732,6 @@
 			break;
 		} else if (has_results == 1) {
 			ev_page_cache_set_current_page (view->page_cache, page);
-			jump_to_find_result (view);
 			break;
 		}
 	}
@@ -2763,7 +2773,8 @@
 			view->find_page = 0;
 		}
 
-		jump_to_find_page (view);
+		jump_to_find_page (view, FIND_NEXT);
+		jump_to_find_result (view);
 	} else {
 		jump_to_find_result (view);
 		gtk_widget_queue_draw (GTK_WIDGET (view));
@@ -2786,14 +2797,15 @@
 	view->find_result--;
 
 	if (view->find_result < 0) {
-		view->find_result = 0;
 		view->find_page--;
 
 		if (view->find_page < 0) {
 			view->find_page = n_pages - 1;
 		}
 
-		jump_to_find_page (view);
+		jump_to_find_page (view, FIND_PREV);
+		view->find_result = ev_document_find_get_n_results (find, view->current_page) - 1;
+		jump_to_find_result (view);
 	} else {
 		jump_to_find_result (view);
 		gtk_widget_queue_draw (GTK_WIDGET (view));
