summaryrefslogtreecommitdiff
path: root/libview/ev-view-presentation.c
diff options
context:
space:
mode:
authorWilliam Jon McCann <[email protected]>2013-02-13 17:53:17 -0500
committerraveit65 <[email protected]>2018-03-26 15:36:49 +0200
commit50bdf3f446991631713f2fba76de1b54ce7eb5b9 (patch)
treeea1bf9a34c0e5c0d4994192ac4252913e36aedfb /libview/ev-view-presentation.c
parent454ca8b142f2f6c8b3715a73de3f3c6770666ee3 (diff)
downloadatril-50bdf3f446991631713f2fba76de1b54ce7eb5b9.tar.bz2
atril-50bdf3f446991631713f2fba76de1b54ce7eb5b9.tar.xz
Allow changing the page of a presentation
https://bugzilla.gnome.org/show_bug.cgi?id=693749 origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-8&id=53d6a3
Diffstat (limited to 'libview/ev-view-presentation.c')
-rw-r--r--libview/ev-view-presentation.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c
index 204aff02..5d5e56ad 100644
--- a/libview/ev-view-presentation.c
+++ b/libview/ev-view-presentation.c
@@ -507,7 +507,10 @@ ev_view_presentation_update_current_page (EvViewPresentation *pview,
}
}
- pview->current_page = page;
+ if (pview->current_page != page) {
+ pview->current_page = page;
+ g_object_notify (G_OBJECT (pview), "current-page");
+ }
if (pview->page_cache)
ev_page_cache_set_page_range (pview->page_cache, page, page);
@@ -523,6 +526,21 @@ ev_view_presentation_update_current_page (EvViewPresentation *pview,
gtk_widget_queue_draw (GTK_WIDGET (pview));
}
+static void
+ev_view_presentation_set_current_page (EvViewPresentation *pview,
+ guint page)
+{
+ if (pview->current_page == page)
+ return;
+
+ if (!gtk_widget_get_realized (GTK_WIDGET (pview))) {
+ pview->current_page = page;
+ g_object_notify (G_OBJECT (pview), "current-page");
+ } else {
+ ev_view_presentation_update_current_page (pview, page);
+ }
+}
+
void
ev_view_presentation_next_page (EvViewPresentation *pview)
{
@@ -1373,7 +1391,7 @@ ev_view_presentation_set_property (GObject *object,
pview->enable_animations = EV_IS_DOCUMENT_TRANSITION (pview->document);
break;
case PROP_CURRENT_PAGE:
- pview->current_page = g_value_get_uint (value);
+ ev_view_presentation_set_current_page (pview, g_value_get_uint (value));
break;
case PROP_ROTATION:
ev_view_presentation_set_rotation (pview, g_value_get_uint (value));
@@ -1395,6 +1413,9 @@ ev_view_presentation_get_property (GObject *object,
EvViewPresentation *pview = EV_VIEW_PRESENTATION (object);
switch (prop_id) {
+ case PROP_CURRENT_PAGE:
+ g_value_set_uint (value, pview->current_page);
+ break;
case PROP_ROTATION:
g_value_set_uint (value, ev_view_presentation_get_rotation (pview));
break;
@@ -1478,7 +1499,7 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
"The current page",
0, G_MAXUINT, 0,
G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY));
+ G_PARAM_CONSTRUCT));
g_object_class_install_property (gobject_class,
PROP_ROTATION,
g_param_spec_uint ("rotation",