struct _ComicsDocumentClass
{
- GObjectClass parent_class;
+ EvDocumentClass parent_class;
};
-
-typedef enum
+
+typedef enum
{
RARLABS,
GNAUNRAR,
struct _ComicsDocument
{
- GObject parent_instance;
+ EvDocument parent_instance;
+
gchar *archive, *dir;
GSList *page_names;
gint n_pages;
typedef struct _ComicsDocumentClass ComicsDocumentClass;
-static void comics_document_document_iface_init (EvDocumentIface *iface);
static void comics_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface);
static GSList* get_supported_image_extensions (void);
G_OBJECT_CLASS (comics_document_parent_class)->finalize (object);
}
-static void
-comics_document_class_init (ComicsDocumentClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->finalize = comics_document_finalize;
-}
-
static EvDocumentInfo *
comics_document_get_info (EvDocument *document)
{
}
static void
-comics_document_document_iface_init (EvDocumentIface *iface)
+comics_document_class_init (ComicsDocumentClass *klass)
{
- iface->load = comics_document_load;
- iface->save = comics_document_save;
- iface->get_n_pages = comics_document_get_n_pages;
- iface->get_page_size = comics_document_get_page_size;
- iface->render = comics_document_render;
- iface->get_info = comics_document_get_info;
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ EvDocumentClass *ev_document_class = EV_DOCUMENT_CLASS (klass);
+
+ gobject_class->finalize = comics_document_finalize;
+
+ ev_document_class->load = comics_document_load;
+ ev_document_class->save = comics_document_save;
+ ev_document_class->get_n_pages = comics_document_get_n_pages;
+ ev_document_class->get_page_size = comics_document_get_page_size;
+ ev_document_class->render = comics_document_render;
+ ev_document_class->get_info = comics_document_get_info;
}
static void
#include <libdjvu/ddjvuapi.h>
struct _DjvuDocument {
- GObject parent_instance;
+ EvDocument parent_instance;
ddjvu_context_t *d_context;
ddjvu_document_t *d_document;
struct _DjvuDocumentClass
{
- GObjectClass parent_class;
+ EvDocumentClass parent_class;
};
typedef struct _DjvuDocumentClass DjvuDocumentClass;
-static void djvu_document_document_iface_init (EvDocumentIface *iface);
static void djvu_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface);
static void djvu_document_file_exporter_iface_init (EvFileExporterIface *iface);
static void djvu_document_find_iface_init (EvDocumentFindIface *iface);
return surface;
}
+static EvDocumentInfo *
+djvu_document_get_info (EvDocument *document)
+{
+ EvDocumentInfo *info;
+
+ info = g_new0 (EvDocumentInfo, 1);
+
+ return info;
+}
+
static void
djvu_document_finalize (GObject *object)
{
static void
djvu_document_class_init (DjvuDocumentClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ EvDocumentClass *ev_document_class = EV_DOCUMENT_CLASS (klass);
gobject_class->finalize = djvu_document_finalize;
-}
-static EvDocumentInfo *
-djvu_document_get_info (EvDocument *document)
-{
- EvDocumentInfo *info;
-
- info = g_new0 (EvDocumentInfo, 1);
-
- return info;
-}
-
-static void
-djvu_document_document_iface_init (EvDocumentIface *iface)
-{
- iface->load = djvu_document_load;
- iface->save = djvu_document_save;
- iface->get_n_pages = djvu_document_get_n_pages;
- iface->get_page_size = djvu_document_get_page_size;
- iface->render = djvu_document_render;
- iface->get_info = djvu_document_get_info;
+ ev_document_class->load = djvu_document_load;
+ ev_document_class->save = djvu_document_save;
+ ev_document_class->get_n_pages = djvu_document_get_n_pages;
+ ev_document_class->get_page_size = djvu_document_get_page_size;
+ ev_document_class->render = djvu_document_render;
+ ev_document_class->get_info = djvu_document_get_info;
}
static gchar *
struct _DviDocumentClass
{
- GObjectClass parent_class;
+ EvDocumentClass parent_class;
};
struct _DviDocument
{
- GObject parent_instance;
+ EvDocument parent_instance;
DviContext *context;
DviPageSpec *spec;
typedef struct _DviDocumentClass DviDocumentClass;
-static void dvi_document_document_iface_init (EvDocumentIface *iface);
static void dvi_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface);
static void dvi_document_file_exporter_iface_init (EvFileExporterIface *iface);
static void dvi_document_do_color_special (DviContext *dvi,
G_OBJECT_CLASS (dvi_document_parent_class)->finalize (object);
}
+static EvDocumentInfo *
+dvi_document_get_info (EvDocument *document)
+{
+ EvDocumentInfo *info;
+
+ info = g_new0 (EvDocumentInfo, 1);
+
+ return info;
+}
static void
dvi_document_class_init (DviDocumentClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ EvDocumentClass *ev_document_class = EV_DOCUMENT_CLASS (klass);
gobject_class->finalize = dvi_document_finalize;
mdvi_register_fonts ();
dvi_context_mutex = g_mutex_new ();
-}
-
-static EvDocumentInfo *
-dvi_document_get_info (EvDocument *document)
-{
- EvDocumentInfo *info;
-
- info = g_new0 (EvDocumentInfo, 1);
- return info;
-}
-
-static void
-dvi_document_document_iface_init (EvDocumentIface *iface)
-{
- iface->load = dvi_document_load;
- iface->save = dvi_document_save;
- iface->get_n_pages = dvi_document_get_n_pages;
- iface->get_page_size = dvi_document_get_page_size;
- iface->render = dvi_document_render;
- iface->get_info = dvi_document_get_info;
+ ev_document_class->load = dvi_document_load;
+ ev_document_class->save = dvi_document_save;
+ ev_document_class->get_n_pages = dvi_document_get_n_pages;
+ ev_document_class->get_page_size = dvi_document_get_page_size;
+ ev_document_class->render = dvi_document_render;
+ ev_document_class->get_info = dvi_document_get_info;
}
static void
struct _ImpressDocumentClass
{
- GObjectClass parent_class;
+ EvDocumentClass parent_class;
};
struct _ImpressDocument
{
- GObject parent_instance;
+ EvDocument parent_instance;
ImpDoc *imp;
ImpRenderCtx *ctx;
typedef struct _ImpressDocumentClass ImpressDocumentClass;
-static void impress_document_document_iface_init (EvDocumentIface *iface);
static void impress_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface);
EV_BACKEND_REGISTER_WITH_CODE (ImpressDocument, impress_document,
return scaled_surface;
}
+static EvDocumentInfo *
+impress_document_get_info (EvDocument *document)
+{
+ EvDocumentInfo *info;
+
+ info = g_new0 (EvDocumentInfo, 1);
+ info->fields_mask = 0;
+
+ return info;
+}
+
static void
impress_document_finalize (GObject *object)
{
static void
impress_document_class_init (ImpressDocumentClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ EvDocumentClass *ev_document_class = EV_DOCUMENT_CLASS (klass);
gobject_class->finalize = impress_document_finalize;
-}
-static EvDocumentInfo *
-impress_document_get_info (EvDocument *document)
-{
- EvDocumentInfo *info;
-
- info = g_new0 (EvDocumentInfo, 1);
- info->fields_mask = 0;
-
- return info;
-}
-
-static void
-impress_document_document_iface_init (EvDocumentIface *iface)
-{
- iface->load = impress_document_load;
- iface->save = impress_document_save;
- iface->get_n_pages = impress_document_get_n_pages;
- iface->get_page_size = impress_document_get_page_size;
- iface->render = impress_document_render;
- iface->get_info = impress_document_get_info;
+ ev_document_class->load = impress_document_load;
+ ev_document_class->save = impress_document_save;
+ ev_document_class->get_n_pages = impress_document_get_n_pages;
+ ev_document_class->get_page_size = impress_document_get_page_size;
+ ev_document_class->render = impress_document_render;
+ ev_document_class->get_info = impress_document_get_info;
}
static GdkPixbuf *
struct _PdfDocumentClass
{
- GObjectClass parent_class;
+ EvDocumentClass parent_class;
};
struct _PdfDocument
{
- GObject parent_instance;
+ EvDocument parent_instance;
PopplerDocument *document;
gchar *password;
GList *layers;
};
-static void pdf_document_document_iface_init (EvDocumentIface *iface);
static void pdf_document_security_iface_init (EvDocumentSecurityIface *iface);
static void pdf_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface);
static void pdf_document_document_links_iface_init (EvDocumentLinksIface *iface);
G_OBJECT_CLASS (pdf_document_parent_class)->dispose (object);
}
-static void
-pdf_document_class_init (PdfDocumentClass *klass)
-{
- GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
-
- g_object_class->dispose = pdf_document_dispose;
-}
-
static void
pdf_document_init (PdfDocument *pdf_document)
{
width, height, rc);
}
-/* EvDocumentSecurity */
-
-static gboolean
-pdf_document_has_document_security (EvDocumentSecurity *document_security)
-{
- /* FIXME: do we really need to have this? */
- return FALSE;
-}
-
-static void
-pdf_document_set_password (EvDocumentSecurity *document_security,
- const char *password)
-{
- PdfDocument *document = PDF_DOCUMENT (document_security);
-
- if (document->password)
- g_free (document->password);
-
- document->password = g_strdup (password);
-}
-
-
/* reference:
http://www.pdfa.org/lib/exe/fetch.php?id=pdfa%3Aen%3Atechdoc&cache=cache&media=pdfa:techdoc:tn0001_pdfa-1_and_namespaces_2008-03-18.pdf */
static char *
}
static void
-pdf_document_document_iface_init (EvDocumentIface *iface)
-{
- iface->save = pdf_document_save;
- iface->load = pdf_document_load;
- iface->get_n_pages = pdf_document_get_n_pages;
- iface->get_page = pdf_document_get_page;
- iface->get_page_size = pdf_document_get_page_size;
- iface->get_page_label = pdf_document_get_page_label;
- iface->render = pdf_document_render;
- iface->get_info = pdf_document_get_info;
-};
+pdf_document_class_init (PdfDocumentClass *klass)
+{
+ GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
+ EvDocumentClass *ev_document_class = EV_DOCUMENT_CLASS (klass);
+
+ g_object_class->dispose = pdf_document_dispose;
+
+ ev_document_class->save = pdf_document_save;
+ ev_document_class->load = pdf_document_load;
+ ev_document_class->get_n_pages = pdf_document_get_n_pages;
+ ev_document_class->get_page = pdf_document_get_page;
+ ev_document_class->get_page_size = pdf_document_get_page_size;
+ ev_document_class->get_page_label = pdf_document_get_page_label;
+ ev_document_class->render = pdf_document_render;
+ ev_document_class->get_info = pdf_document_get_info;
+}
+
+/* EvDocumentSecurity */
+static gboolean
+pdf_document_has_document_security (EvDocumentSecurity *document_security)
+{
+ /* FIXME: do we really need to have this? */
+ return FALSE;
+}
+
+static void
+pdf_document_set_password (EvDocumentSecurity *document_security,
+ const char *password)
+{
+ PdfDocument *document = PDF_DOCUMENT (document_security);
+
+ if (document->password)
+ g_free (document->password);
+
+ document->password = g_strdup (password);
+}
static void
pdf_document_security_iface_init (EvDocumentSecurityIface *iface)
struct _PixbufDocumentClass
{
- GObjectClass parent_class;
+ EvDocumentClass parent_class;
};
struct _PixbufDocument
{
- GObject parent_instance;
+ EvDocument parent_instance;
GdkPixbuf *pixbuf;
typedef struct _PixbufDocumentClass PixbufDocumentClass;
-static void pixbuf_document_document_iface_init (EvDocumentIface *iface);
static void pixbuf_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface);
EV_BACKEND_REGISTER_WITH_CODE (PixbufDocument, pixbuf_document,
G_OBJECT_CLASS (pixbuf_document_parent_class)->finalize (object);
}
-static void
-pixbuf_document_class_init (PixbufDocumentClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->finalize = pixbuf_document_finalize;
-}
-
static EvDocumentInfo *
pixbuf_document_get_info (EvDocument *document)
{
}
static void
-pixbuf_document_document_iface_init (EvDocumentIface *iface)
+pixbuf_document_class_init (PixbufDocumentClass *klass)
{
- iface->load = pixbuf_document_load;
- iface->save = pixbuf_document_save;
- iface->get_n_pages = pixbuf_document_get_n_pages;
- iface->get_page_size = pixbuf_document_get_page_size;
- iface->render = pixbuf_document_render;
- iface->get_info = pixbuf_document_get_info;
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ EvDocumentClass *ev_document_class = EV_DOCUMENT_CLASS (klass);
+
+ gobject_class->finalize = pixbuf_document_finalize;
+
+ ev_document_class->load = pixbuf_document_load;
+ ev_document_class->save = pixbuf_document_save;
+ ev_document_class->get_n_pages = pixbuf_document_get_n_pages;
+ ev_document_class->get_page_size = pixbuf_document_get_page_size;
+ ev_document_class->render = pixbuf_document_render;
+ ev_document_class->get_info = pixbuf_document_get_info;
}
static GdkPixbuf *
#include "ev-document-misc.h"
struct _PSDocument {
- GObject object;
+ EvDocument object;
SpectreDocument *doc;
SpectreExporter *exporter;
};
struct _PSDocumentClass {
- GObjectClass parent_class;
+ EvDocumentClass parent_class;
};
-static void ps_document_document_iface_init (EvDocumentIface *iface);
static void ps_document_file_exporter_iface_init (EvFileExporterIface *iface);
static void ps_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface);
G_OBJECT_CLASS (ps_document_parent_class)->dispose (object);
}
-static void
-ps_document_class_init (PSDocumentClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
-
- object_class->dispose = ps_document_dispose;
-}
-
/* EvDocumentIface */
static gboolean
ps_document_load (EvDocument *document,
}
static void
-ps_document_document_iface_init (EvDocumentIface *iface)
+ps_document_class_init (PSDocumentClass *klass)
{
- iface->load = ps_document_load;
- iface->save = ps_document_save;
- iface->get_n_pages = ps_document_get_n_pages;
- iface->get_page = ps_document_get_page;
- iface->get_page_size = ps_document_get_page_size;
- iface->get_page_label = ps_document_get_page_label;
- iface->get_info = ps_document_get_info;
- iface->render = ps_document_render;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ EvDocumentClass *ev_document_class = EV_DOCUMENT_CLASS (klass);
+
+ object_class->dispose = ps_document_dispose;
+
+ ev_document_class->load = ps_document_load;
+ ev_document_class->save = ps_document_save;
+ ev_document_class->get_n_pages = ps_document_get_n_pages;
+ ev_document_class->get_page = ps_document_get_page;
+ ev_document_class->get_page_size = ps_document_get_page_size;
+ ev_document_class->get_page_label = ps_document_get_page_label;
+ ev_document_class->get_info = ps_document_get_info;
+ ev_document_class->render = ps_document_render;
}
/* EvDocumentThumbnailsIface */
struct _TiffDocumentClass
{
- GObjectClass parent_class;
+ EvDocumentClass parent_class;
};
struct _TiffDocument
{
- GObject parent_instance;
+ EvDocument parent_instance;
TIFF *tiff;
gint n_pages;
typedef struct _TiffDocumentClass TiffDocumentClass;
-static void tiff_document_document_iface_init (EvDocumentIface *iface);
static void tiff_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface);
static void tiff_document_document_file_exporter_iface_init (EvFileExporterIface *iface);
return rotated_pixbuf;
}
-static void
-tiff_document_finalize (GObject *object)
-{
- TiffDocument *tiff_document = TIFF_DOCUMENT (object);
-
- if (tiff_document->tiff)
- TIFFClose (tiff_document->tiff);
- if (tiff_document->uri)
- g_free (tiff_document->uri);
-
- G_OBJECT_CLASS (tiff_document_parent_class)->finalize (object);
-}
-
-static void
-tiff_document_class_init (TiffDocumentClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->finalize = tiff_document_finalize;
-}
-
static gchar *
tiff_document_get_page_label (EvDocument *document,
EvPage *page)
{
TiffDocument *tiff_document = TIFF_DOCUMENT (document);
static gchar *label;
-
+
if (TIFFGetField (tiff_document->tiff, TIFFTAG_PAGENAME, &label) &&
g_utf8_validate (label, -1, NULL)) {
return g_strdup (label);
}
-
+
return NULL;
}
}
static void
-tiff_document_document_iface_init (EvDocumentIface *iface)
+tiff_document_finalize (GObject *object)
+{
+ TiffDocument *tiff_document = TIFF_DOCUMENT (object);
+
+ if (tiff_document->tiff)
+ TIFFClose (tiff_document->tiff);
+ if (tiff_document->uri)
+ g_free (tiff_document->uri);
+
+ G_OBJECT_CLASS (tiff_document_parent_class)->finalize (object);
+}
+
+static void
+tiff_document_class_init (TiffDocumentClass *klass)
{
- iface->load = tiff_document_load;
- iface->save = tiff_document_save;
- iface->get_n_pages = tiff_document_get_n_pages;
- iface->get_page_size = tiff_document_get_page_size;
- iface->render = tiff_document_render;
- iface->get_page_label = tiff_document_get_page_label;
- iface->get_info = tiff_document_get_info;
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ EvDocumentClass *ev_document_class = EV_DOCUMENT_CLASS (klass);
+
+ gobject_class->finalize = tiff_document_finalize;
+
+ ev_document_class->load = tiff_document_load;
+ ev_document_class->save = tiff_document_save;
+ ev_document_class->get_n_pages = tiff_document_get_n_pages;
+ ev_document_class->get_page_size = tiff_document_get_page_size;
+ ev_document_class->render = tiff_document_render;
+ ev_document_class->get_page_label = tiff_document_get_page_label;
+ ev_document_class->get_info = tiff_document_get_info;
}
static GdkPixbuf *
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
/*
+ * Copyright (C) 2009 Carlos Garcia Campos
* Copyright (C) 2004 Marco Pesenti Gritti
*
* This program is free software; you can redistribute it and/or modify
GMutex *ev_doc_mutex = NULL;
GMutex *ev_fc_mutex = NULL;
-EV_DEFINE_INTERFACE (EvDocument, ev_document, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE (EvDocument, ev_document, G_TYPE_OBJECT)
GQuark
ev_document_error_quark (void)
return q;
}
+static EvPage *
+ev_document_impl_get_page (EvDocument *document,
+ gint index)
+{
+ return ev_page_new (index);
+}
+
static void
-ev_document_class_init (EvDocumentIface *klass)
+ev_document_init (EvDocument *document)
{
}
+static void
+ev_document_class_init (EvDocumentClass *klass)
+{
+ klass->get_page = ev_document_impl_get_page;
+}
+
GMutex *
ev_document_get_doc_mutex (void)
{
const char *uri,
GError **error)
{
- EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
+ EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
gboolean retval;
GError *err = NULL;
- retval = iface->load (document, uri, &err);
+ retval = klass->load (document, uri, &err);
if (!retval) {
if (err) {
g_propagate_error (error, err);
} else {
- g_warning ("%s::EvDocumentIface::load returned FALSE but did not fill in @error; fix the backend!\n",
+ g_warning ("%s::EvDocument::load returned FALSE but did not fill in @error; fix the backend!\n",
G_OBJECT_TYPE_NAME (document));
/* So upper layers don't crash */
const char *uri,
GError **error)
{
- EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
- gboolean retval;
-
- retval = iface->save (document, uri, error);
+ EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
- return retval;
+ return klass->save (document, uri, error);
}
int
ev_document_get_n_pages (EvDocument *document)
{
- EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
- gint retval;
-
- retval = iface->get_n_pages (document);
+ EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
- return retval;
+ return klass->get_n_pages (document);
}
EvPage *
ev_document_get_page (EvDocument *document,
gint index)
{
- EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
- EvPage *retval;
+ EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
- if (iface->get_page)
- retval = iface->get_page (document, index);
- else
- retval = ev_page_new (index);
-
- return retval;
+ return klass->get_page (document, index);
}
void
double *width,
double *height)
{
- EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
+ EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
- iface->get_page_size (document, page, width, height);
+ klass->get_page_size (document, page, width, height);
}
-char *
+gchar *
ev_document_get_page_label (EvDocument *document,
EvPage *page)
{
- EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
+ EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
- if (iface->get_page_label == NULL)
- return NULL;
-
- return iface->get_page_label (document, page);
+ return klass->get_page_label ?
+ klass->get_page_label (document, page) : NULL;
}
EvDocumentInfo *
ev_document_get_info (EvDocument *document)
{
- EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
+ EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
- return iface->get_info (document);
+ return klass->get_info (document);
}
cairo_surface_t *
ev_document_render (EvDocument *document,
EvRenderContext *rc)
{
- EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
- cairo_surface_t *retval;
-
- g_assert (iface->render);
+ EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
- retval = iface->render (document, rc);
-
- return retval;
+ return klass->render (document, rc);
}
/* EvDocumentInfo */
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
/*
+ * Copyright (C) 2009 Carlos Garcia Campos
* Copyright (C) 2000-2003 Marco Pesenti Gritti
*
* This program is free software; you can redistribute it and/or modify
#define EV_TYPE_DOCUMENT (ev_document_get_type ())
#define EV_DOCUMENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT, EvDocument))
-#define EV_DOCUMENT_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT, EvDocumentIface))
+#define EV_DOCUMENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT, EvDocumentClass))
#define EV_IS_DOCUMENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_DOCUMENT))
-#define EV_IS_DOCUMENT_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT))
-#define EV_DOCUMENT_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_DOCUMENT, EvDocumentIface))
+#define EV_IS_DOCUMENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT))
+#define EV_DOCUMENT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), EV_TYPE_DOCUMENT, EvDocumentClass))
typedef struct _EvDocument EvDocument;
-typedef struct _EvDocumentIface EvDocumentIface;
+typedef struct _EvDocumentClass EvDocumentClass;
typedef struct _EvPageCache EvPageCache;
typedef struct _EvPageCacheClass EvPageCacheClass;
typedef struct _EvRectangle EvRectangle;
-struct _EvDocumentIface
+struct _EvDocument
{
- GTypeInterface base_iface;
+ GObject base;
+};
+
+struct _EvDocumentClass
+{
+ GObjectClass base_class;
- /* Methods */
+ /* Virtual Methods */
gboolean (* load) (EvDocument *document,
const char *uri,
GError **error);
gboolean (* save) (EvDocument *document,
const char *uri,
GError **error);
- int (* get_n_pages) (EvDocument *document);
+ gint (* get_n_pages) (EvDocument *document);
EvPage * (* get_page) (EvDocument *document,
gint index);
void (* get_page_size) (EvDocument *document,
EvPage *page,
double *width,
double *height);
- char * (* get_page_label) (EvDocument *document,
+ gchar * (* get_page_label) (EvDocument *document,
EvPage *page);
cairo_surface_t * (* render) (EvDocument *document,
EvRenderContext *rc);
- EvDocumentInfo * (* get_info) (EvDocument *document);
+ EvDocumentInfo * (* get_info) (EvDocument *document);
};
GType ev_document_get_type (void) G_GNUC_CONST;
gboolean ev_document_save (EvDocument *document,
const char *uri,
GError **error);
-int ev_document_get_n_pages (EvDocument *document);
+gint ev_document_get_n_pages (EvDocument *document);
EvPage *ev_document_get_page (EvDocument *document,
gint index);
void ev_document_get_page_size (EvDocument *document,
EvPage *page,
double *width,
double *height);
-char *ev_document_get_page_label (EvDocument *document,
+gchar *ev_document_get_page_label (EvDocument *document,
EvPage *page);
cairo_surface_t *ev_document_render (EvDocument *document,
EvRenderContext *rc);
G_MODULE_EXPORT GType \
register_evince_backend (GTypeModule *module) \
{ \
- const GTypeInfo our_info = { \
+ const GTypeInfo our_info = { \
sizeof (BackendName##Class), \
NULL, /* base_init */ \
NULL, /* base_finalize */ \
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); \
\
g_define_type_id = g_type_module_register_type (module, \
- G_TYPE_OBJECT, \
- #BackendName, \
- &our_info, \
- (GTypeFlags)0); \
+ EV_TYPE_DOCUMENT, \
+ #BackendName, \
+ &our_info, \
+ (GTypeFlags)0); \
\
- EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, \
- backend_name##_document_iface_init); \
- \
CODE \
\
return g_define_type_id; \