diff options
author | William Jon McCann <[email protected]> | 2013-02-13 17:53:17 -0500 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-03-26 13:53:55 +0200 |
commit | dc77310536e87cce1588fab6132256ad2bd88af4 (patch) | |
tree | d15a3ac3d053795515014f111035aeb15945cee0 /libview | |
parent | b0ea2c7e7170f8bc201339d4b7dc4d1baae775b2 (diff) | |
download | atril-dc77310536e87cce1588fab6132256ad2bd88af4.tar.bz2 atril-dc77310536e87cce1588fab6132256ad2bd88af4.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')
-rw-r--r-- | libview/ev-view-presentation.c | 27 |
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", |