#include "ev-view-cursor.h"
#include "ev-page-cache.h"
+
+
enum {
PROP_0,
PROP_DOCUMENT,
};
enum {
- PAGE_CHANGED,
CHANGE_PAGE,
FINISHED,
SIGNAL_EXTERNAL_LINK,
GtkWidgetClass base_class;
/* signals */
- void (* page_changed) (EvViewPresentation *pview,
- gint page);
void (* change_page) (EvViewPresentation *pview,
GtkScrollType scroll);
void (* finished) (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);
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);
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;
"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",
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),
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);
}
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);
}