X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=libview%2Fev-view-presentation.c;h=bbbfd4f9435737518b17078540e6e8cf4bf6e035;hb=f3731bd3bdbcdc18c53e0f74bdaac93311046352;hp=8694e5e304ef6d4a48d9d872f4fd5372b752cb02;hpb=8c059088d4be57cc02791bbcc251ee080fe69e5f;p=evince.git diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c index 8694e5e3..bbbfd4f9 100644 --- a/libview/ev-view-presentation.c +++ b/libview/ev-view-presentation.c @@ -30,6 +30,7 @@ #include "ev-transition-animation.h" #include "ev-view-cursor.h" #include "ev-page-cache.h" +#include "ev-view-marshal.h" enum { PROP_0, @@ -40,6 +41,7 @@ enum { }; enum { + PAGE_CHANGED, CHANGE_PAGE, FINISHED, SIGNAL_EXTERNAL_LINK, @@ -97,6 +99,9 @@ struct _EvViewPresentationClass GtkWidgetClass base_class; /* signals */ + void (* page_changed) (EvViewPresentation *pview, + gint old_page, + gint new_page); void (* change_page) (EvViewPresentation *pview, GtkScrollType scroll); void (* finished) (EvViewPresentation *pview); @@ -488,6 +493,8 @@ ev_view_presentation_update_current_page (EvViewPresentation *pview, } } + g_signal_emit (pview, signals[PAGE_CHANGED], 0, pview->current_page); + pview->current_page = page; if (pview->page_cache) @@ -504,6 +511,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) { @@ -1382,8 +1402,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; @@ -1470,6 +1490,15 @@ 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),