]> www.fi.muni.cz Git - evince.git/blobdiff - libview/ev-view-presentation.c
[dualscreen] [presentation] make presentation control dscwindow, presentation ->...
[evince.git] / libview / ev-view-presentation.c
index 8694e5e304ef6d4a48d9d872f4fd5372b752cb02..3612904ae025cd539d3d5edb2b094cb3a414b739 100644 (file)
 #include "ev-view-cursor.h"
 #include "ev-page-cache.h"
 
+
+
 enum {
        PROP_0,
        PROP_DOCUMENT,
        PROP_CURRENT_PAGE,
+       PROP_PAGE,
        PROP_ROTATION,
        PROP_INVERTED_COLORS
 };
@@ -489,6 +492,7 @@ ev_view_presentation_update_current_page (EvViewPresentation *pview,
        }
 
        pview->current_page = page;
+       g_object_notify (G_OBJECT(pview), "page");
 
        if (pview->page_cache)
                ev_page_cache_set_page_range (pview->page_cache, page, page);
@@ -504,6 +508,19 @@ ev_view_presentation_update_current_page (EvViewPresentation *pview,
                gtk_widget_queue_draw (GTK_WIDGET (pview));
 }
 
+void
+ev_view_presentation_set_page (EvViewPresentation *pview, gint new_page)
+{
+               guint n_pages;
+
+       n_pages = ev_document_get_n_pages (pview->document);
+
+       if (new_page >= n_pages)
+               ev_view_presentation_set_end (pview);
+       else
+               ev_view_presentation_update_current_page (pview, new_page);
+}
+
 void
 ev_view_presentation_next_page (EvViewPresentation *pview)
 {
@@ -1352,6 +1369,9 @@ ev_view_presentation_set_property (GObject      *object,
        case PROP_CURRENT_PAGE:
                pview->current_page = g_value_get_uint (value);
                break;
+       case PROP_PAGE:
+               pview->current_page = g_value_get_uint (value);
+               break;
        case PROP_ROTATION:
                 ev_view_presentation_set_rotation (pview, g_value_get_uint (value));
                break;
@@ -1372,6 +1392,9 @@ ev_view_presentation_get_property (GObject    *object,
         EvViewPresentation *pview = EV_VIEW_PRESENTATION (object);
 
         switch (prop_id) {
+               case PROP_PAGE:
+                               g_value_set_uint (value, ev_view_presentation_get_current_page (pview));
+                               break;
         case PROP_ROTATION:
                 g_value_set_uint (value, ev_view_presentation_get_rotation (pview));
                 break;
@@ -1382,8 +1405,8 @@ ev_view_presentation_get_property (GObject    *object,
 
 static GObject *
 ev_view_presentation_constructor (GType                  type,
-                                 guint                  n_construct_properties,
-                                 GObjectConstructParam *construct_params)
+                                                                 guint                  n_construct_properties,
+                                                                 GObjectConstructParam *construct_params)
 {
        GObject            *object;
        EvViewPresentation *pview;
@@ -1436,13 +1459,20 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
                                                              EV_TYPE_DOCUMENT,
                                                              G_PARAM_WRITABLE |
                                                              G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (gobject_class,
+                                        PROP_PAGE,
+                                        g_param_spec_uint ("page",
+                                                           "Current Page",
+                                                           "The current page",
+                                                           0, G_MAXUINT, 0,
+                                                               G_PARAM_READWRITE));
        g_object_class_install_property (gobject_class,
                                         PROP_CURRENT_PAGE,
                                         g_param_spec_uint ("current_page",
                                                            "Current Page",
                                                            "The current page",
                                                            0, G_MAXUINT, 0,
-                                                           G_PARAM_WRITABLE |
+                                                               G_PARAM_WRITABLE |
                                                            G_PARAM_CONSTRUCT_ONLY));
        g_object_class_install_property (gobject_class,
                                         PROP_ROTATION,
@@ -1470,6 +1500,7 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
                              g_cclosure_marshal_VOID__ENUM,
                              G_TYPE_NONE, 1,
                              GTK_TYPE_SCROLL_TYPE);
+
        signals[FINISHED] =
                g_signal_new ("finished",
                              G_OBJECT_CLASS_TYPE (gobject_class),