From 9a29009b83a1453fc57082bdf1651a3d972a5279 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 18 May 2005 18:15:23 +0000 Subject: [PATCH] Make PgUp/Down behave like Space 2005-05-18 Marco Pesenti Gritti * data/evince-ui.xml: * shell/ev-view.c: (ev_view_scroll_view), (ev_view_class_init): * shell/ev-window.c: (set_view_actions_sensitivity): Make PgUp/Down behave like Space --- ChangeLog | 8 ++++++++ data/evince-ui.xml | 2 ++ shell/ev-view.c | 51 +++++++++++++++++++--------------------------- shell/ev-window.c | 12 +++++++++-- 4 files changed, 41 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6df464b6..6c597088 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-05-18 Marco Pesenti Gritti + + * data/evince-ui.xml: + * shell/ev-view.c: (ev_view_scroll_view), (ev_view_class_init): + * shell/ev-window.c: (set_view_actions_sensitivity): + + Make PgUp/Down behave like Space + 2005-05-18 Marco Pesenti Gritti * backend/ev-ps-exporter.c: (ev_ps_exporter_begin): diff --git a/data/evince-ui.xml b/data/evince-ui.xml index c049cc08..b3723fff 100644 --- a/data/evince-ui.xml +++ b/data/evince-ui.xml @@ -62,6 +62,8 @@ + + diff --git a/shell/ev-view.c b/shell/ev-view.c index 3e28b0c5..552b771c 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -667,38 +667,32 @@ ev_view_scroll_view (EvView *view, GtkScrollType scroll, gboolean horizontal) { - if (scroll == GTK_SCROLL_PAGE_BACKWARD) { - ev_page_cache_prev_page (view->page_cache); - } else if (scroll == GTK_SCROLL_PAGE_FORWARD) { - ev_page_cache_next_page (view->page_cache); - } else { - GtkAdjustment *adjustment; - double value; + GtkAdjustment *adjustment; + double value; - if (horizontal) { - adjustment = view->hadjustment; - } else { - adjustment = view->vadjustment; - } + if (horizontal) { + adjustment = view->hadjustment; + } else { + adjustment = view->vadjustment; + } - value = adjustment->value; + value = adjustment->value; - switch (scroll) { - case GTK_SCROLL_STEP_BACKWARD: - value -= adjustment->step_increment; - break; - case GTK_SCROLL_STEP_FORWARD: - value += adjustment->step_increment; - break; - default: - break; - } + switch (scroll) { + case GTK_SCROLL_STEP_BACKWARD: + value -= adjustment->step_increment; + break; + case GTK_SCROLL_STEP_FORWARD: + value += adjustment->step_increment; + break; + default: + break; + } - value = CLAMP (value, adjustment->lower, - adjustment->upper - adjustment->page_size); + value = CLAMP (value, adjustment->lower, + adjustment->upper - adjustment->page_size); - gtk_adjustment_set_value (adjustment, value); - } + gtk_adjustment_set_value (adjustment, value); } #define MARGIN 5 @@ -1824,9 +1818,6 @@ ev_view_class_init (EvViewClass *class) add_scroll_binding_keypad (binding_set, GDK_Right, GTK_SCROLL_STEP_FORWARD, TRUE); add_scroll_binding_keypad (binding_set, GDK_Up, GTK_SCROLL_STEP_BACKWARD, FALSE); add_scroll_binding_keypad (binding_set, GDK_Down, GTK_SCROLL_STEP_FORWARD, FALSE); - - add_scroll_binding_keypad (binding_set, GDK_Page_Up, GTK_SCROLL_PAGE_BACKWARD, FALSE); - add_scroll_binding_keypad (binding_set, GDK_Page_Down, GTK_SCROLL_PAGE_FORWARD, FALSE); } static void diff --git a/shell/ev-window.c b/shell/ev-window.c index 102e56c3..6549d3fd 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -2325,10 +2325,10 @@ static const GtkActionEntry entries[] = { G_CALLBACK (ev_window_cmd_view_reload) }, /* Go menu */ - { "GoPreviousPage", GTK_STOCK_GO_BACK, N_("_Previous Page"), "Page_Up", + { "GoPreviousPage", GTK_STOCK_GO_BACK, N_("_Previous Page"), "Page_Up", N_("Go to the previous page"), G_CALLBACK (ev_window_cmd_go_previous_page) }, - { "GoNextPage", GTK_STOCK_GO_FORWARD, N_("_Next Page"), "Page_Down", + { "GoNextPage", GTK_STOCK_GO_FORWARD, N_("_Next Page"), "Page_Down", N_("Go to the next page"), G_CALLBACK (ev_window_cmd_go_next_page) }, { "GoFirstPage", GTK_STOCK_GOTO_FIRST, N_("_First Page"), "Home", @@ -2358,6 +2358,12 @@ static const GtkActionEntry entries[] = { { "Slash", GTK_STOCK_FIND, NULL, "slash", N_("Find a word or phrase in the document"), G_CALLBACK (ev_window_cmd_edit_find) }, + { "PageDown", NULL, "", "Page_Down", + N_("Scroll one page forward"), + G_CALLBACK (ev_window_cmd_scroll_forward) }, + { "PageUp", NULL, "", "Page_Up", + N_("Scroll one page backward"), + G_CALLBACK (ev_window_cmd_scroll_backward) }, { "Space", NULL, "", "space", N_("Scroll one page forward"), G_CALLBACK (ev_window_cmd_scroll_forward) }, @@ -2605,6 +2611,8 @@ static void set_view_actions_sensitivity (EvWindow *window, gboolean sensitive) { if (window->priv->action_group) { + set_action_sensitive (window, "PageDown", sensitive); + set_action_sensitive (window, "PageUp", sensitive); set_action_sensitive (window, "Space", sensitive); set_action_sensitive (window, "ShiftSpace", sensitive); set_action_sensitive (window, "BackSpace", sensitive); -- 2.43.5