[evince] "<Ctrl>Home/End" scroll to the start/end of the document
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] "<Ctrl>Home/End" scroll to the start/end of the document
- Date: Thu, 24 Jul 2014 15:18:26 +0000 (UTC)
commit 61d3a03e48fc0aa69b35d424298eee1d314bb074
Author: Antia Puentes <apuentes igalia com>
Date: Thu Jul 24 11:23:59 2014 +0200
"<Ctrl>Home/End" scroll to the start/end of the document
Before they scroll to the first/last page. This is now managed
by the view, instead of the window.
https://bugzilla.gnome.org/show_bug.cgi?id=724273
libview/ev-view.c | 35 +++++++++++++++++++++++++++++++++++
shell/ev-application.c | 2 --
2 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 26700d5..62f6a09 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -925,6 +925,27 @@ compute_scroll_increment (EvView *view,
}
+static void
+ev_view_first_page (EvView *view)
+{
+ ev_document_model_set_page (view->model, 0);
+}
+
+static void
+ev_view_last_page (EvView *view)
+{
+ gint n_pages;
+
+ if (!view->document)
+ return;
+
+ n_pages = ev_document_get_n_pages (view->document);
+ if (n_pages <= 1)
+ return;
+
+ ev_document_model_set_page (view->model, n_pages - 1);
+}
+
/**
* ev_view_scroll:
* @view: a #EvView
@@ -1022,6 +1043,18 @@ ev_view_scroll (EvView *view,
case GTK_SCROLL_STEP_UP:
value += step_increment / 10;
break;
+ case GTK_SCROLL_START:
+ value = lower;
+ if (!first_page)
+ ev_view_first_page (view);
+ break;
+ case GTK_SCROLL_END:
+ value = upper - page_size;
+ if (!last_page)
+ ev_view_last_page (view);
+ /* Changing pages causes the top to be shown. Here we want the bottom shown. */
+ view->pending_point.y = value;
+ break;
default:
break;
}
@@ -6832,6 +6865,8 @@ ev_view_class_init (EvViewClass *class)
add_scroll_binding_keypad (binding_set, GDK_KEY_Down, GDK_MOD1_MASK, GTK_SCROLL_STEP_UP,
GTK_ORIENTATION_VERTICAL);
add_scroll_binding_keypad (binding_set, GDK_KEY_Page_Up, 0, GTK_SCROLL_PAGE_BACKWARD,
GTK_ORIENTATION_VERTICAL);
add_scroll_binding_keypad (binding_set, GDK_KEY_Page_Down, 0, GTK_SCROLL_PAGE_FORWARD,
GTK_ORIENTATION_VERTICAL);
+ add_scroll_binding_keypad (binding_set, GDK_KEY_Home, GDK_CONTROL_MASK, GTK_SCROLL_START,
GTK_ORIENTATION_VERTICAL);
+ add_scroll_binding_keypad (binding_set, GDK_KEY_End, GDK_CONTROL_MASK, GTK_SCROLL_END,
GTK_ORIENTATION_VERTICAL);
/* We can't use the bindings defined in GtkWindow for Space and Return,
* because we also have those bindings for scrolling.
diff --git a/shell/ev-application.c b/shell/ev-application.c
index d1aa053..b7fa935 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -1021,8 +1021,6 @@ ev_application_startup (GApplication *gapplication)
"win.copy", "<Ctrl>C", "<Ctrl>Insert", NULL,
"win.select-all", "<Ctrl>A", NULL,
"win.save-settings", "<Ctrl>T", NULL,
- "win.go-first-page", "<Ctrl>Home", NULL,
- "win.go-last-page", "<Ctrl>End", NULL,
"win.add-bookmark", "<Ctrl>D", NULL,
"win.close", "<Ctrl>W", NULL,
"win.escape", "Escape", NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]