X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=backend%2Fev-document.c;h=6f6a687eef0686f4345e88b9661b079f9e70423c;hb=7a0789bc8bbe25d3b0674176d2096ad126fc75a5;hp=44910032276b36b3dd9facebb7c2b5440226d037;hpb=7acd15e0881622f4423f01212c1694af4d2b3f07;p=evince.git diff --git a/backend/ev-document.c b/backend/ev-document.c index 44910032..6f6a687e 100644 --- a/backend/ev-document.c +++ b/backend/ev-document.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */ /* * Copyright (C) 2004 Marco Pesenti Gritti * @@ -20,8 +21,17 @@ #include "config.h" #include "ev-document.h" +#include "ev-backend-marshalers.h" -static void ev_document_base_init (gpointer g_class); +static void ev_document_class_init (gpointer g_class); + +enum +{ + CHANGED, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0 }; GType ev_document_get_type (void) @@ -33,8 +43,9 @@ ev_document_get_type (void) static const GTypeInfo our_info = { sizeof (EvDocumentIface), - ev_document_base_init, NULL, + NULL, + (GClassInitFunc)ev_document_class_init }; type = g_type_register_static (G_TYPE_INTERFACE, @@ -45,18 +56,63 @@ ev_document_get_type (void) return type; } +GQuark +ev_document_error_quark (void) +{ + static GQuark q = 0; + if (q == 0) + q = g_quark_from_static_string ("ev-document-error-quark"); + + return q; +} + static void -ev_document_base_init (gpointer g_class) +ev_document_class_init (gpointer g_class) { + signals[CHANGED] = + g_signal_new ("changed", + EV_TYPE_DOCUMENT, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EvDocumentIface, changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + g_object_interface_install_property (g_class, + g_param_spec_string ("title", + "Document Title", + "The title of the document", + NULL, + G_PARAM_READABLE)); } -void +gboolean ev_document_load (EvDocument *document, const char *uri, - GError *error) + GError **error) { EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); - iface->load (document, uri, error); + return iface->load (document, uri, error); +} + +gboolean +ev_document_save (EvDocument *document, + const char *uri, + GError **error) +{ + EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); + return iface->save (document, uri, error); +} + +char * +ev_document_get_title (EvDocument *document) +{ + char *title; + + g_object_get (document, "title", &title, NULL); + + return title; } int @@ -74,6 +130,13 @@ ev_document_set_page (EvDocument *document, iface->set_page (document, page); } +int +ev_document_get_page (EvDocument *document) +{ + EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); + return iface->get_page (document); +} + void ev_document_set_target (EvDocument *document, GdkDrawable *target) @@ -83,14 +146,46 @@ ev_document_set_target (EvDocument *document, } void -ev_document_set_page_rect (EvDocument *document, - int x, - int y, - int width, - int height) +ev_document_set_scale (EvDocument *document, + double scale) +{ + EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); + iface->set_scale (document, scale); +} + +void +ev_document_set_page_offset (EvDocument *document, + int x, + int y) { EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); - iface->set_page_rect (document, x, y, width, height); + iface->set_page_offset (document, x, y); +} + +void +ev_document_get_page_size (EvDocument *document, + int *width, + int *height) +{ + EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); + iface->get_page_size (document, width, height); +} + +char * +ev_document_get_text (EvDocument *document, + GdkRectangle *rect) +{ + EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); + return iface->get_text (document, rect); +} + +EvLink * +ev_document_get_link (EvDocument *document, + int x, + int y) +{ + EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); + return iface->get_link (document, x, y); } void @@ -103,3 +198,9 @@ ev_document_render (EvDocument *document, EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); iface->render (document, clip_x, clip_y, clip_width, clip_height); } + +void +ev_document_changed (EvDocument *document) +{ + g_signal_emit (G_OBJECT (document), signals[CHANGED], 0); +}