+2006-01-06 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
+
+ * shell/ev-view.c: (ev_view_scroll), (ev_view_previous_page),
+ (ev_view_can_previous_page), (ev_view_can_next_page):
+ * shell/ev-view.h:
+ * shell/ev-window.c: (update_action_sensitivity):
+
+ Two page scrolling with Space and PageUp in dual mode. Second fix
+ for the bug #316608.
+
2006-01-05 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
* shell/ev-view.c: (scroll_to_current_page):
/* At the top of a page, assign the upper bound limit of previous page */
} else if (value == (adjustment->lower)) {
value = adjustment->upper - adjustment->page_size;
- ev_page_cache_set_current_page (view->page_cache, view->current_page - 1);
+ ev_view_previous_page (view);
/* Jump to the top */
} else {
value = MAX (value - increment, adjustment->lower);
/* At the bottom of a page, assign the lower bound limit of next page */
} else if (value == (adjustment->upper - adjustment->page_size)) {
value = 0;
- ev_page_cache_set_current_page (view->page_cache, view->current_page + 1);
+ ev_view_next_page (view);
/* Jump to the bottom */
} else {
value = MIN (value + increment, adjustment->upper - adjustment->page_size);
}
}
+gboolean
+ev_view_can_previous_page (EvView *view)
+{
+ int page;
+
+ g_return_val_if_fail (EV_IS_VIEW (view), FALSE);
+
+ page = ev_page_cache_get_current_page (view->page_cache);
+ page = ev_view_get_dual_page (view) ? page - 2 : page - 1;
+
+ return (page >=0);
+}
+
+gboolean ev_view_can_next_page (EvView *view)
+{
+ int page;
+
+ g_return_val_if_fail (EV_IS_VIEW (view), FALSE);
+
+ page = ev_page_cache_get_current_page (view->page_cache);
+ page = ev_view_get_dual_page (view) ? page + 2 : page + 1;
+
+ return (page < ev_page_cache_get_n_pages (view->page_cache));
+}
+
/*** Enum description for usage in signal ***/
GType
EvLink *link);
gboolean ev_view_next_page (EvView *view);
gboolean ev_view_previous_page (EvView *view);
+gboolean ev_view_can_next_page (EvView *view);
+gboolean ev_view_can_previous_page (EvView *view);
G_END_DECLS
/* Go menu */
if (document) {
- set_action_sensitive (ev_window, "GoPreviousPage", page > 0);
- set_action_sensitive (ev_window, "GoNextPage", page < n_pages - 1);
+ set_action_sensitive (ev_window, "GoPreviousPage", ev_view_can_previous_page (view));
+ set_action_sensitive (ev_window, "GoNextPage", ev_view_can_next_page (view));
set_action_sensitive (ev_window, "GoFirstPage", page > 0);
set_action_sensitive (ev_window, "GoLastPage", page < n_pages - 1);
} else {