#include "ev-document.h"
-#include "ev-backend-marshalers.h"
-
static void ev_document_class_init (gpointer g_class);
GMutex *ev_doc_mutex = NULL;
GMutex *ev_fc_mutex = NULL;
-#define LOG(x)
GType
ev_document_get_type (void)
{
type = g_type_register_static (G_TYPE_INTERFACE,
"EvDocument",
&our_info, (GTypeFlags)0);
+
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
}
return type;
g_mutex_unlock (ev_document_get_doc_mutex ());
}
+gboolean
+ev_document_doc_mutex_trylock (void)
+{
+ return g_mutex_trylock (ev_document_get_doc_mutex ());
+}
+
GMutex *
ev_document_get_fc_mutex (void)
{
g_mutex_unlock (ev_document_get_fc_mutex ());
}
+gboolean
+ev_document_fc_mutex_trylock (void)
+{
+ return g_mutex_trylock (ev_document_get_fc_mutex ());
+}
+
gboolean
ev_document_load (EvDocument *document,
const char *uri,
{
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
gboolean retval;
- LOG ("ev_document_load");
+
retval = iface->load (document, uri, error);
return retval;
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
gboolean retval;
- LOG ("ev_document_save");
retval = iface->save (document, uri, error);
return retval;
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
gint retval;
- LOG ("ev_document_get_n_pages");
retval = iface->get_n_pages (document);
return retval;
}
+EvPage *
+ev_document_get_page (EvDocument *document,
+ gint index)
+{
+ EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
+ EvPage *retval;
+
+ if (iface->get_page)
+ retval = iface->get_page (document, index);
+ else
+ retval = ev_page_new (index);
+
+ return retval;
+}
+
void
-ev_document_get_page_size (EvDocument *document,
- int page,
- double *width,
- double *height)
+ev_document_get_page_size (EvDocument *document,
+ EvPage *page,
+ double *width,
+ double *height)
{
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
- LOG ("ev_document_get_page_size");
iface->get_page_size (document, page, width, height);
}
char *
-ev_document_get_page_label(EvDocument *document,
- int page)
+ev_document_get_page_label (EvDocument *document,
+ EvPage *page)
{
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
- LOG ("ev_document_get_page_label");
if (iface->get_page_label == NULL)
return NULL;
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
GList *retval;
- LOG ("ev_document_get_attachments");
if (iface->get_attachments == NULL)
return NULL;
retval = iface->get_attachments (document);
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
cairo_surface_t *retval;
- LOG ("ev_document_render_pixbuf");
g_assert (iface->render);
retval = iface->render (document, rc);
return retval;
}
+/* EvDocumentInfo */
+GType
+ev_document_info_get_type (void)
+{
+ static GType type = 0;
+ if (type == 0)
+ type = g_boxed_type_register_static ("EvDocumentInfo",
+ (GBoxedCopyFunc)ev_document_info_copy,
+ (GBoxedFreeFunc)ev_document_info_free);
+ return type;
+}
+
+EvDocumentInfo *
+ev_document_info_copy (EvDocumentInfo *info)
+{
+ EvDocumentInfo *copy;
+
+ g_return_val_if_fail (info != NULL, NULL);
+
+ copy = g_new0 (EvDocumentInfo, 1);
+ copy->title = info->title ? g_strdup (info->title) : NULL;
+ copy->format = info->format ? g_strdup (info->format) : NULL;
+ copy->author = info->author ? g_strdup (info->author) : NULL;
+ copy->subject = info->subject ? g_strdup (info->subject) : NULL;
+ copy->keywords = info->keywords ? g_strdup (info->keywords) : NULL;
+ copy->security = info->security ? g_strdup (info->security) : NULL;
+ copy->creator = info->creator ? g_strdup (info->creator) : NULL;
+ copy->producer = info->producer ? g_strdup (info->producer) : NULL;
+ copy->linearized = info->linearized ? g_strdup (info->linearized) : NULL;
+
+ copy->creation_date = info->creation_date;
+ copy->modified_date = info->modified_date;
+ copy->layout = info->layout;
+ copy->mode = info->mode;
+ copy->ui_hints = info->ui_hints;
+ copy->permissions = info->permissions;
+ copy->n_pages = info->n_pages;
+ copy->fields_mask = info->fields_mask;
+
+ return copy;
+}
+
void
ev_document_info_free (EvDocumentInfo *info)
{
g_free (info->linearized);
g_free (info->security);
-
g_free (info);
}