[evince] previewer: Enable/disable page navigation based on current page
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] previewer: Enable/disable page navigation based on current page
- Date: Mon, 16 Mar 2015 18:54:58 +0000 (UTC)
commit a671eb08a98dd8e4637567949af281ce4b7c5496
Author: Robert Roth <robert roth off gmail com>
Date: Sun Mar 15 20:39:25 2015 +0200
previewer: Enable/disable page navigation based on current page
https://bugzilla.gnome.org/show_bug.cgi?id=745840
previewer/ev-previewer-window.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/previewer/ev-previewer-window.c b/previewer/ev-previewer-window.c
index dd34f25..ff2c42c 100644
--- a/previewer/ev-previewer-window.c
+++ b/previewer/ev-previewer-window.c
@@ -334,6 +334,22 @@ view_focus_changed (GtkWidget *widget,
}
static void
+model_page_changed (EvDocumentModel* model,
+ gint old_page,
+ gint new_page,
+ EvPreviewerWindow *window)
+{
+ GtkAction *action;
+ gint n_pages = ev_document_get_n_pages (ev_document_model_get_document (window->model));
+
+ action = gtk_action_group_get_action (window->action_group, "GoPreviousPage");
+ gtk_action_set_sensitive (GTK_ACTION (action), new_page > 0 );
+
+ action = gtk_action_group_get_action (window->action_group, "GoNextPage");
+ gtk_action_set_sensitive (GTK_ACTION (action), new_page < n_pages - 1);
+}
+
+static void
view_sizing_mode_changed (EvDocumentModel *model,
GParamSpec *pspec,
EvPreviewerWindow *window)
@@ -599,6 +615,10 @@ ev_previewer_window_constructor (GType type,
ev_view_set_model (window->view, window->model);
ev_document_model_set_continuous (window->model, FALSE);
+ g_signal_connect_object (window->model, "page-changed",
+ G_CALLBACK (model_page_changed),
+ window, 0);
+
gtk_container_add (GTK_CONTAINER (window->swindow), GTK_WIDGET (window->view));
gtk_widget_show (GTK_WIDGET (window->view));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]