[evince] Allow changing the page of a presentation
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] Allow changing the page of a presentation
- Date: Thu, 28 Feb 2013 18:48:16 +0000 (UTC)
commit 53d6a3f6c2ee80618f8383bdc6757d81397ebb60
Author: William Jon McCann <jmccann redhat com>
Date: Wed Feb 13 17:53:17 2013 -0500
Allow changing the page of a presentation
https://bugzilla.gnome.org/show_bug.cgi?id=693749
libview/ev-view-presentation.c | 29 +++++++++++++++++++++++++----
1 files changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c
index 28f8da6..7c227f6 100644
--- a/libview/ev-view-presentation.c
+++ b/libview/ev-view-presentation.c
@@ -488,7 +488,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);
@@ -504,6 +507,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)
{
@@ -1346,7 +1364,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));
@@ -1368,6 +1386,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;
@@ -1439,8 +1460,8 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
"Current Page",
"The current page",
0, G_MAXUINT, 0,
- G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_ROTATION,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]