]> www.fi.muni.cz Git - evince.git/commitdiff
[shell] [presentation] notify changes
authorLukas Bezdicka <255993@mail.muni.cz>
Sun, 10 Apr 2011 19:11:01 +0000 (21:11 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 1 Jun 2011 11:09:21 +0000 (13:09 +0200)
libview/ev-view-presentation.c
shell/ev-dualscreen.c

index 6ee168beff4fd6679e24ccf7e65e5eb00fea8926..49c9c976185da139b051849b87e18399dd6511c5 100644 (file)
@@ -31,6 +31,8 @@
 #include "ev-view-cursor.h"
 #include "ev-page-cache.h"
 
+
+
 enum {
        PROP_0,
        PROP_DOCUMENT,
@@ -40,7 +42,6 @@ enum {
 };
 
 enum {
-       PAGE_CHANGED,
        CHANGE_PAGE,
        FINISHED,
         SIGNAL_EXTERNAL_LINK,
@@ -98,8 +99,6 @@ struct _EvViewPresentationClass
        GtkWidgetClass base_class;
 
        /* signals */
-       void (* page_changed)  (EvViewPresentation *pview,
-                               gint                page);
        void (* change_page)   (EvViewPresentation *pview,
                                 GtkScrollType       scroll);
        void (* finished)      (EvViewPresentation *pview);
@@ -491,9 +490,8 @@ ev_view_presentation_update_current_page (EvViewPresentation *pview,
                }
        }
 
-       g_signal_emit (pview, signals[PAGE_CHANGED], 0, page);
-       g_printf("pages: %d %d\n",page,pview->current_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);
@@ -512,7 +510,7 @@ ev_view_presentation_update_current_page (EvViewPresentation *pview,
 void
 ev_view_presentation_set_page (EvViewPresentation *pview, gint new_page)
 {
-       guint n_pages;
+               guint n_pages;
 
        n_pages = ev_document_get_n_pages (pview->document);
 
@@ -1390,6 +1388,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, ev_view_presentation_get_current_page (pview));
+                               break;
         case PROP_ROTATION:
                 g_value_set_uint (value, ev_view_presentation_get_rotation (pview));
                 break;
@@ -1460,8 +1461,7 @@ 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_object_class_install_property (gobject_class,
                                         PROP_ROTATION,
                                         g_param_spec_uint ("rotation",
@@ -1488,15 +1488,7 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
                              g_cclosure_marshal_VOID__ENUM,
                              G_TYPE_NONE, 1,
                              GTK_TYPE_SCROLL_TYPE);
-       signals [PAGE_CHANGED] =
-               g_signal_new ("page-changed",
-                             EV_TYPE_VIEW_PRESENTATION,
-                             G_SIGNAL_RUN_LAST,
-                             G_STRUCT_OFFSET (EvViewPresentationClass, page_changed),
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__INT,
-                             G_TYPE_NONE, 2,
-                             G_TYPE_INT, G_TYPE_INT);
+
        signals[FINISHED] =
                g_signal_new ("finished",
                              G_OBJECT_CLASS_TYPE (gobject_class),
index bb3c89e7d9f2aca01f06faa1a1e43b341d1b0eef..66b08e167accff92b09463895d501070aab827ff 100644 (file)
@@ -197,16 +197,17 @@ ev_dscwindow_page_changed_cb (EvDocumentModel *model,
                           EvDSCWindow     *ev_dscwindow)
 {
        gint page = ev_document_model_get_page (model);
-       g_printf("page:%d\n",page);
-
-       ev_view_presentation_set_page (EV_VIEW_PRESENTATION(ev_dscwindow->priv->presentation_view), page);
+       g_printf("m_page:%d\n",page);
+       if(page != ev_view_presentation_get_current_page (ev_dscwindow->priv->presentation_view))
+               ev_view_presentation_set_page (EV_VIEW_PRESENTATION(ev_dscwindow->priv->presentation_view), page);
 }
 static void
-ev_dscwindow_presentation_page_changed_cb (EvDocumentModel *model,
+ev_dscwindow_presentation_page_changed_cb (EvViewPresentation *pview,
                           GParamSpec      *pspec,
                           EvDSCWindow     *ev_dscwindow)
 {
-       gint page = ev_view_presentation_get_current_page (ev_dscwindow->priv->presentation_view);
+       gint page = ev_view_presentation_get_current_page (pview);
+       g_printf("p_page:%d\n",page);
        ev_document_model_set_page (ev_dscwindow->priv->model, page);
 }
 
@@ -224,12 +225,12 @@ ev_dscwindow_set_presentation (EvDSCWindow *ev_dscwindow,
        ev_dscwindow->priv->presentation_window = GTK_WIDGET(presentation_window);
        ev_dscwindow->priv->presentation_document = document;
        ev_dscwindow->priv->presentation_view = EV_VIEW_PRESENTATION(pview);
+       ev_document_model_set_document(ev_dscwindow->priv->model,
+               document);
        g_signal_connect (ev_dscwindow->priv->presentation_view,
-                         "notify::page",
+                         "notify::current_page",
                          G_CALLBACK (ev_dscwindow_presentation_page_changed_cb),
                          ev_dscwindow);
-       ev_document_model_set_document(ev_dscwindow->priv->model,
-               document);
        ev_dscwindow_window_placement (ev_dscwindow);
 }