Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-view.c
diff options
context:
space:
mode:
authorDave Malcolm <dmalcolm@redhat.com>2005-01-14 05:26:54 (GMT)
committer David Malcolm <dave_malcolm@src.gnome.org>2005-01-14 05:26:54 (GMT)
commit3e3ca2bb5e6206bdb5af6b097cd9b92252e7a6c2 (patch)
treecea73ecdc00fe2fe7603bc7bd01e2677cc0bea1d /shell/ev-view.c
parente7088d0b30431821a31a2a7c64b1d8e921362f0d (diff)
new functions to help with implementation of sensitivity code Fix
2005-01-14 Dave Malcolm <dmalcolm@redhat.com> * shell/ev-view.h: * shell/ev-view.c (ev_view_can_go_back), (ev_view_can_go_forward): new functions to help with implementation of sensitivity code * shell/ev-window.c (update_action_sensitivity): Fix sensitivity of all actions that might require it. Fixes a crash when you click on the Zoom actions in a window lacking a document.
Diffstat (limited to 'shell/ev-view.c')
-rw-r--r--shell/ev-view.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/shell/ev-view.c b/shell/ev-view.c
index 41bf94b..8e18ec4 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -1123,6 +1123,23 @@ go_to_index (EvView *view, int index)
go_to_link (view, link);
}
+gboolean
+ev_view_can_go_back (EvView *view)
+{
+ int index, n;
+
+ g_return_val_if_fail (EV_IS_HISTORY (view->history), FALSE);
+
+ index = ev_history_get_current_index (view->history);
+ n = ev_history_get_n_links (view->history);
+
+ if (n > 0) {
+ return index != MAX (0, index - 1);
+ } else {
+ return FALSE;
+ }
+}
+
void
ev_view_go_back (EvView *view)
{
@@ -1139,6 +1156,23 @@ ev_view_go_back (EvView *view)
}
}
+gboolean
+ev_view_can_go_forward (EvView *view)
+{
+ int index, n;
+
+ g_return_val_if_fail (EV_IS_HISTORY (view->history), FALSE);
+
+ index = ev_history_get_current_index (view->history);
+ n = ev_history_get_n_links (view->history);
+
+ if (n > 0) {
+ return index != MIN (n - 1, index + 1);
+ } else {
+ return FALSE;
+ }
+}
+
void
ev_view_go_forward (EvView *view)
{