From 31e16bd8f386dc292e60489d4a17227804bdc2e6 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Fri, 28 Dec 2007 18:13:32 +0000 Subject: Plugin system for backends. Fixes bug #351348. 2007-12-28 Carlos Garcia Campos * configure.ac: * Makefile.am: * po/POTFILES.in: * backend/comics/Makefile.am: * backend/comics/comics-document.[ch]: * backend/comics/comicsdocument.evince-backend.in: * backend/djvu/Makefile.am: * backend/djvu/djvu-document.[ch]: * backend/djvu/djvudocument.evince-backend.in: * backend/dvi/Makefile.am: * backend/dvi/dvi-document.[c]: * backend/dvi/dvidocument.evince-backend.in: * backend/impress/Makefile.am: * backend/impress/impress-document.[ch]: * backend/impress/impressdocument.evince-backend.in: * backend/pdf/Makefile.am: * backend/pdf/ev-poppler.cc: * backend/pdf/ev-poppler.h: * backend/pdf/pdfdocument.evince-backend.in: * backend/pixbuf/Makefile.am: * backend/pixbuf/pixbuf-document.[ch]: * backend/pixbuf/pixbufdocument.evince-backend.in: * backend/ps/Makefile.am: * backend/ps/ev-spectre.[ch]: * backend/ps/ps-document.[ch]: * backend/ps/psdocument.evince-backend.in: * backend/tiff/Makefile.am: * backend/tiff/tiff-document.[ch]: * backend/tiff/tiffdocument.evince-backend.in: * libdocument/Makefile.am: * libdocument/ev-backends-manager.[ch]: * libdocument/ev-module.[ch]: * libdocument/ev-document.h: * libdocument/ev-document-factory.[ch]: (gdk_pixbuf_mime_type_list), (mime_type_supported_by_gdk_pixbuf), (get_compression_from_mime_type), (get_document_from_uri), (ev_document_factory_get_document), (file_filter_add_mime_types), (ev_document_factory_add_filters): * shell/Makefile.am: * shell/ev-window-title.c: (get_filename_from_uri): * shell/main.c: (main): * thumbnailer/Makefile.am: * thumbnailer/evince-thumbnailer.c: (main): Plugin system for backends. Fixes bug #351348. svn path=/trunk/; revision=2786 --- (limited to 'backend') diff --git a/backend/comics/Makefile.am b/backend/comics/Makefile.am index 47332cd..5f2fb89 100644 --- a/backend/comics/Makefile.am +++ b/backend/comics/Makefile.am @@ -1,11 +1,34 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libdocument \ - $(BACKEND_CFLAGS) +backenddir = $(libdir)/evince/backends -noinst_LTLIBRARIES = libcomicsdocument.la +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/libdocument \ + -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ + $(BACKEND_CFLAGS) \ + $(LIB_CFLAGS) \ + $(WARN_CFLAGS) \ + $(DISABLE_DEPRECATED) + +backend_LTLIBRARIES = libcomicsdocument.la libcomicsdocument_la_SOURCES = \ comics-document.c \ comics-document.h +libcomicsdocument_la_LDFLAGS = $(BACKEND_LIBTOOL_FLAGS) +libcomicsdocument_la_LIBADD = \ + $(top_builddir)/libdocument/libevbackend.la \ + $(BACKEND_LIBS) \ + $(LIB_LIBS) + +backend_in_files = comicsdocument.evince-backend.in + +%.evince-backend: %.evince-backend.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache + +backend_DATA = $(backend_in_files:.evince-backend.in=.evince-backend) + +EXTRA_DIST = $(backend_DATA) + +CLEANFILES = $(backend_DATA) + + diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c index b72eef6..8c3b00c 100644 --- a/backend/comics/comics-document.c +++ b/backend/comics/comics-document.c @@ -17,6 +17,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include #include @@ -25,6 +27,7 @@ #include "comics-document.h" #include "ev-document-misc.h" #include "ev-document-thumbnails.h" +#include "ev-file-helpers.h" struct _ComicsDocumentClass { @@ -58,11 +61,8 @@ static char** extract_argv (EvDocument *document, gint page); -G_DEFINE_TYPE_WITH_CODE ( - ComicsDocument, comics_document, G_TYPE_OBJECT, +EV_BACKEND_REGISTER_WITH_CODE (ComicsDocument, comics_document, { - G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, - comics_document_document_iface_init); G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, comics_document_document_thumbnails_iface_init); } ); diff --git a/backend/comics/comics-document.h b/backend/comics/comics-document.h index cd5b17b..fdc815c 100644 --- a/backend/comics/comics-document.h +++ b/backend/comics/comics-document.h @@ -29,9 +29,9 @@ G_BEGIN_DECLS typedef struct _ComicsDocument ComicsDocument; -ComicsDocument *comics_document_new (void); +GType comics_document_get_type (void) G_GNUC_CONST; -GType comics_document_get_type (void) G_GNUC_CONST; +G_MODULE_EXPORT GType register_evince_backend (GTypeModule *module); G_END_DECLS diff --git a/backend/comics/comicsdocument.evince-backend.in b/backend/comics/comicsdocument.evince-backend.in new file mode 100644 index 0000000..df1a97e --- /dev/null +++ b/backend/comics/comicsdocument.evince-backend.in @@ -0,0 +1,4 @@ +[Evince Backend] +Module=comicsdocument +_TypeDescription=Comic Books +MimeType=application/x-cbr;application/x-cbz; diff --git a/backend/djvu/Makefile.am b/backend/djvu/Makefile.am index fa44bbb..ea5f904 100644 --- a/backend/djvu/Makefile.am +++ b/backend/djvu/Makefile.am @@ -1,22 +1,44 @@ +backenddir = $(libdir)/evince/backends + INCLUDES = \ -I$(top_srcdir) \ -I$(top_srcdir)/libdocument \ -DGNOMEICONDIR=\""${prefix}/${DATADIRNAME}/pixmaps"\" \ - $(LIB_CFLAGS) \ - $(DJVU_CFLAGS) + -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ + $(BACKEND_CFLAGS) \ + $(DJVU_CFLAGS) \ + $(WARN_CFLAGS) \ + $(DISABLE_DEPRECATED) -noinst_LTLIBRARIES = libgtkdjvu.la +backend_LTLIBRARIES = libdjvudocument.la -libgtkdjvu_la_SOURCES = \ - djvu-document.c \ - djvu-document.h \ +libdjvudocument_la_SOURCES = \ + djvu-document.c \ + djvu-document.h \ djvu-document-private.h \ - djvu-links.c \ - djvu-links.h \ - djvu-text.c \ - djvu-text.h \ - djvu-text-page.c \ + djvu-links.c \ + djvu-links.h \ + djvu-text.c \ + djvu-text.h \ + djvu-text-page.c \ djvu-text-page.h +libdjvudocument_la_LDFLAGS = $(BACKEND_LIBTOOL_FLAGS) +libdjvudocument_la_LIBADD = \ + $(top_builddir)/libdocument/libevbackend.la \ + $(BACKEND_LIBS) \ + $(DJVU_LIBS) + +backend_in_files = djvudocument.evince-backend.in + +%.evince-backend: %.evince-backend.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache + +backend_DATA = $(backend_in_files:.evince-backend.in=.evince-backend) + +EXTRA_DIST = $(backend_DATA) + +CLEANFILES = $(backend_DATA) + + diff --git a/backend/djvu/djvu-document.c b/backend/djvu/djvu-document.c index 2b9dee7..e16ec6a 100644 --- a/backend/djvu/djvu-document.c +++ b/backend/djvu/djvu-document.c @@ -17,6 +17,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include "djvu-document.h" #include "djvu-text.h" #include "djvu-links.h" @@ -27,6 +29,7 @@ #include "ev-document-find.h" #include "ev-document-links.h" #include "ev-selection.h" +#include "ev-file-helpers.h" #include #include @@ -54,10 +57,8 @@ static void djvu_document_find_iface_init (EvDocumentFindIface *iface); static void djvu_document_document_links_iface_init (EvDocumentLinksIface *iface); static void djvu_selection_iface_init (EvSelectionIface *iface); -G_DEFINE_TYPE_WITH_CODE - (DjvuDocument, djvu_document, G_TYPE_OBJECT, +EV_BACKEND_REGISTER_WITH_CODE (DjvuDocument, djvu_document, { - G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, djvu_document_document_iface_init); G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, djvu_document_document_thumbnails_iface_init); G_IMPLEMENT_INTERFACE (EV_TYPE_FILE_EXPORTER, djvu_document_file_exporter_iface_init); G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_FIND, djvu_document_find_iface_init); @@ -262,7 +263,7 @@ djvu_document_render (EvDocument *document, rowstride = page_width * 4; pixels = (gchar *) g_malloc (page_height * rowstride); - surface = cairo_image_surface_create_for_data (pixels, + surface = cairo_image_surface_create_for_data ((guchar *)pixels, CAIRO_FORMAT_RGB24, page_width, page_height, diff --git a/backend/djvu/djvu-document.h b/backend/djvu/djvu-document.h index 402f476..3a5cd6f 100644 --- a/backend/djvu/djvu-document.h +++ b/backend/djvu/djvu-document.h @@ -29,9 +29,9 @@ G_BEGIN_DECLS typedef struct _DjvuDocument DjvuDocument; -DjvuDocument *djvu_document_new (void); +GType djvu_document_get_type (void) G_GNUC_CONST; -GType djvu_document_get_type (void) G_GNUC_CONST; +G_MODULE_EXPORT GType register_evince_backend (GTypeModule *module); G_END_DECLS diff --git a/backend/djvu/djvudocument.evince-backend.in b/backend/djvu/djvudocument.evince-backend.in new file mode 100644 index 0000000..716dabf --- /dev/null +++ b/backend/djvu/djvudocument.evince-backend.in @@ -0,0 +1,4 @@ +[Evince Backend] +Module=djvudocument +_TypeDescription=Djvu Documents +MimeType=image/vnd.djvu diff --git a/backend/dvi/Makefile.am b/backend/dvi/Makefile.am index 10325e0..c65b5e8 100644 --- a/backend/dvi/Makefile.am +++ b/backend/dvi/Makefile.am @@ -1,23 +1,45 @@ SUBDIRS = mdvi-lib -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libdocument \ - -I$(srcdir)/mdvi-lib \ - $(LIB_CFLAGS) \ +backenddir = $(libdir)/evince/backends + +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/libdocument \ + -I$(srcdir)/mdvi-lib \ + -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ + $(BACKEND_CFLAGS) \ $(SPECTRE_CFLAGS) -noinst_LTLIBRARIES = libgtkdvi.la - -libgtkdvi_la_SOURCES = \ - dvi-document.c \ - dvi-document.h \ - cairo-device.c \ - cairo-device.h \ - fonts.c \ +backend_LTLIBRARIES = libdvidocument.la + +libdvidocument_la_SOURCES = \ + dvi-document.c \ + dvi-document.h \ + cairo-device.c \ + cairo-device.h \ + fonts.c \ fonts.h -libgtkdvi_la_LIBADD = mdvi-lib/libmdvi.la +libdvidocument_la_LIBADD = \ + mdvi-lib/libmdvi.la \ + -lkpathsea \ + $(top_builddir)/libdocument/libevbackend.la \ + $(BACKEND_LIBS) \ + $(SPECTRE_LIBS) + +if WITH_TYPE1_FONTS +libdvidocument_la_LIBADD += -lt1 +endif + +backend_in_files = dvidocument.evince-backend.in + +%.evince-backend: %.evince-backend.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache + +backend_DATA = $(backend_in_files:.evince-backend.in=.evince-backend) + +EXTRA_DIST = $(backend_DATA) + +CLEANFILES = $(backend_DATA) diff --git a/backend/dvi/dvi-document.c b/backend/dvi/dvi-document.c index 73b148b..56a0d92 100644 --- a/backend/dvi/dvi-document.c +++ b/backend/dvi/dvi-document.c @@ -17,6 +17,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include "dvi-document.h" #include "ev-document-thumbnails.h" #include "ev-document-misc.h" @@ -26,7 +28,6 @@ #include "fonts.h" #include "cairo-device.h" -#include #include GMutex *dvi_context_mutex = NULL; @@ -73,10 +74,8 @@ static void dvi_document_do_color_special (DviContext const char *prefix, const char *arg); -G_DEFINE_TYPE_WITH_CODE - (DviDocument, dvi_document, G_TYPE_OBJECT, - { - G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, dvi_document_document_iface_init); +EV_BACKEND_REGISTER_WITH_CODE (DviDocument, dvi_document, + { G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, dvi_document_document_thumbnails_iface_init); G_IMPLEMENT_INTERFACE (EV_TYPE_FILE_EXPORTER, dvi_document_file_exporter_iface_init); }); diff --git a/backend/dvi/dvi-document.h b/backend/dvi/dvi-document.h index d92d474..1f8c260 100644 --- a/backend/dvi/dvi-document.h +++ b/backend/dvi/dvi-document.h @@ -29,9 +29,9 @@ G_BEGIN_DECLS typedef struct _DviDocument DviDocument; -DviDocument *dvi_document_new (void); +GType dvi_document_get_type (void) G_GNUC_CONST; -GType dvi_document_get_type (void) G_GNUC_CONST; +G_MODULE_EXPORT GType register_evince_backend (GTypeModule *module); G_END_DECLS diff --git a/backend/dvi/dvidocument.evince-backend.in b/backend/dvi/dvidocument.evince-backend.in new file mode 100644 index 0000000..b43e8df --- /dev/null +++ b/backend/dvi/dvidocument.evince-backend.in @@ -0,0 +1,4 @@ +[Evince Backend] +Module=dvidocument +_TypeDescription=DVI Documents +MimeType=application/x-dvi diff --git a/backend/impress/Makefile.am b/backend/impress/Makefile.am index 526839b..dec003d 100644 --- a/backend/impress/Makefile.am +++ b/backend/impress/Makefile.am @@ -1,10 +1,15 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libdocument \ - $(SHELL_CFLAGS) \ - -DDATADIR=\""$(datadir)"\" +backenddir = $(libdir)/evince/backends -noinst_LTLIBRARIES = libimpressdocument.la +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/libdocument \ + -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ + -DDATADIR=\""$(datadir)"\" \ + $(BACKEND_CFLAGS) \ + $(WARN_CFLAGS) \ + $(DISABLE_DEPRECATED) + +backend_LTLIBRARIES = libimpressdocument.la libimpressdocument_la_SOURCES = \ $(IMPOSTER_SOURCE_FILES) \ @@ -36,3 +41,17 @@ IMPOSTER_RENDER_SOURCE_FILES = \ IMPOSTER_RENDER_INCLUDE_FILES = \ render.h +libimpressdocument_la_LDFLAGS = $(BACKEND_LIBTOOL_FLAGS) +libimpressdocument_la_LIBADD = \ + $(top_builddir)/libdocument/libevbackend.la \ + $(BACKEND_LIBS) + +backend_in_files = impressdocument.evince-backend.in + +%.evince-backend: %.evince-backend.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache + +backend_DATA = $(backend_in_files:.evince-backend.in=.evince-backend) + +EXTRA_DIST = $(backend_DATA) + +CLEANFILES = $(backend_DATA) diff --git a/backend/impress/impress-document.c b/backend/impress/impress-document.c index 74d335a..687972b 100644 --- a/backend/impress/impress-document.c +++ b/backend/impress/impress-document.c @@ -18,6 +18,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include #include @@ -58,9 +60,8 @@ typedef struct _ImpressDocumentClass ImpressDocumentClass; static void impress_document_document_iface_init (EvDocumentIface *iface); static void impress_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface); -G_DEFINE_TYPE_WITH_CODE (ImpressDocument, impress_document, G_TYPE_OBJECT, - { G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, - impress_document_document_iface_init); +EV_BACKEND_REGISTER_WITH_CODE (ImpressDocument, impress_document, + { G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, impress_document_document_thumbnails_iface_init); }); diff --git a/backend/impress/impress-document.h b/backend/impress/impress-document.h index 7698e98..9f84498 100644 --- a/backend/impress/impress-document.h +++ b/backend/impress/impress-document.h @@ -30,8 +30,9 @@ G_BEGIN_DECLS typedef struct _ImpressDocument ImpressDocument; -ImpressDocument *impress_document_new (void); -GType impress_document_get_type (void) G_GNUC_CONST; +GType impress_document_get_type (void) G_GNUC_CONST; + +G_MODULE_EXPORT GType register_evince_backend (GTypeModule *module); G_END_DECLS diff --git a/backend/impress/impressdocument.evince-backend.in b/backend/impress/impressdocument.evince-backend.in new file mode 100644 index 0000000..61de77a --- /dev/null +++ b/backend/impress/impressdocument.evince-backend.in @@ -0,0 +1,4 @@ +[Evince Backend] +Module=impressdocument +_TypeDescription=Impress Slides +MimeType=application/vnd.sun.xml.impress;application/vnd.oasis.opendocument.presentation; diff --git a/backend/pdf/Makefile.am b/backend/pdf/Makefile.am index 38d0831..4d2e549 100644 --- a/backend/pdf/Makefile.am +++ b/backend/pdf/Makefile.am @@ -1,13 +1,34 @@ +backenddir = $(libdir)/evince/backends + INCLUDES = \ -I$(top_srcdir) \ -I$(top_srcdir)/libdocument \ + -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ $(BACKEND_CFLAGS) \ $(POPPLER_CFLAGS) \ $(WARN_CXXFLAGS) \ $(DISABLE_DEPRECATED) -noinst_LTLIBRARIES = libpdfdocument.la +backend_LTLIBRARIES = libpdfdocument.la libpdfdocument_la_SOURCES = \ ev-poppler.cc \ ev-poppler.h + +libpdfdocument_la_LDFLAGS = $(BACKEND_LIBTOOL_FLAGS) +libpdfdocument_la_LIBADD = \ + $(top_builddir)/libdocument/libevbackend.la \ + $(BACKEND_LIBS) \ + $(POPPLER_LIBS) \ + $(CAIRO_PDF_LIBS) \ + $(CAIRO_PS_LIBS) + +backend_in_files = pdfdocument.evince-backend.in + +%.evince-backend: %.evince-backend.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache + +backend_DATA = $(backend_in_files:.evince-backend.in=.evince-backend) + +EXTRA_DIST = $(backend_DATA) + +CLEANFILES = $(backend_DATA) \ No newline at end of file diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc index 690c908..5b03980 100644 --- a/backend/pdf/ev-poppler.cc +++ b/backend/pdf/ev-poppler.cc @@ -123,10 +123,8 @@ static EvLink *ev_link_from_action (PdfDocument *pdf_document, static void pdf_document_search_free (PdfDocumentSearch *search); static void pdf_print_context_free (PdfPrintContext *ctx); -G_DEFINE_TYPE_WITH_CODE (PdfDocument, pdf_document, G_TYPE_OBJECT, - { - G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, - pdf_document_document_iface_init); +EV_BACKEND_REGISTER_WITH_CODE (PdfDocument, pdf_document, + { G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_SECURITY, pdf_document_security_iface_init); G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, @@ -1975,12 +1973,6 @@ pdf_document_page_transition_iface_init (EvDocumentTransitionIface *iface) iface->get_page_duration = pdf_document_get_page_duration; } -PdfDocument * -pdf_document_new (void) -{ - return PDF_DOCUMENT (g_object_new (PDF_TYPE_DOCUMENT, NULL)); -} - /* Forms */ static void pdf_document_get_crop_box (EvDocument *document, diff --git a/backend/pdf/ev-poppler.h b/backend/pdf/ev-poppler.h index 8cc65d1..8f9dcb6 100644 --- a/backend/pdf/ev-poppler.h +++ b/backend/pdf/ev-poppler.h @@ -30,8 +30,9 @@ G_BEGIN_DECLS typedef struct _PdfDocument PdfDocument; typedef struct _PdfDocumentClass PdfDocumentClass; -PdfDocument *pdf_document_new (void); -GType pdf_document_get_type (void) G_GNUC_CONST; +GType pdf_document_get_type (void) G_GNUC_CONST; + +G_MODULE_EXPORT GType register_evince_backend (GTypeModule *module); G_END_DECLS diff --git a/backend/pdf/pdfdocument.evince-backend.in b/backend/pdf/pdfdocument.evince-backend.in new file mode 100644 index 0000000..476afe3 --- /dev/null +++ b/backend/pdf/pdfdocument.evince-backend.in @@ -0,0 +1,5 @@ +[Evince Backend] +Module=pdfdocument +_TypeDescription=PDF Documents +MimeType=application/pdf;application/x-bzpdf;application/x-gzpdf + diff --git a/backend/pixbuf/Makefile.am b/backend/pixbuf/Makefile.am index b81e1c8..acc23a5 100644 --- a/backend/pixbuf/Makefile.am +++ b/backend/pixbuf/Makefile.am @@ -1,10 +1,30 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libdocument \ - $(BACKEND_CFLAGS) +backenddir = $(libdir)/evince/backends -noinst_LTLIBRARIES = libpixbufdocument.la +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/libdocument \ + -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ + $(BACKEND_CFLAGS) \ + $(WARN_CFLAGS) \ + $(DISABLE_DEPRECATED) + +backend_LTLIBRARIES = libpixbufdocument.la libpixbufdocument_la_SOURCES = \ pixbuf-document.c \ pixbuf-document.h + +libpixbufdocument_la_LDFLAGS = $(BACKEND_LIBTOOL_FLAGS) +libpixbufdocument_la_LIBADD = \ + $(top_builddir)/libdocument/libevbackend.la \ + $(BACKEND_LIBS) + +backend_in_files = pixbufdocument.evince-backend.in + +%.evince-backend: %.evince-backend.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache + +backend_DATA = $(backend_in_files:.evince-backend.in=.evince-backend) + +EXTRA_DIST = $(backend_DATA) + +CLEANFILES = $(backend_DATA) diff --git a/backend/pixbuf/pixbuf-document.c b/backend/pixbuf/pixbuf-document.c index 5f61587..c5810d1 100644 --- a/backend/pixbuf/pixbuf-document.c +++ b/backend/pixbuf/pixbuf-document.c @@ -17,6 +17,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include "pixbuf-document.h" #include "ev-document-thumbnails.h" #include "ev-document-misc.h" @@ -40,12 +42,11 @@ typedef struct _PixbufDocumentClass PixbufDocumentClass; static void pixbuf_document_document_iface_init (EvDocumentIface *iface); static void pixbuf_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface); -G_DEFINE_TYPE_WITH_CODE (PixbufDocument, pixbuf_document, G_TYPE_OBJECT, - { G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, - pixbuf_document_document_iface_init); +EV_BACKEND_REGISTER_WITH_CODE (PixbufDocument, pixbuf_document, + { G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, pixbuf_document_document_thumbnails_iface_init) - }); + }); static gboolean pixbuf_document_load (EvDocument *document, diff --git a/backend/pixbuf/pixbuf-document.h b/backend/pixbuf/pixbuf-document.h index bddf94a..d8a4d43 100644 --- a/backend/pixbuf/pixbuf-document.h +++ b/backend/pixbuf/pixbuf-document.h @@ -29,9 +29,9 @@ G_BEGIN_DECLS typedef struct _PixbufDocument PixbufDocument; -PixbufDocument *pixbuf_document_new (void); +GType pixbuf_document_get_type (void) G_GNUC_CONST; -GType pixbuf_document_get_type (void) G_GNUC_CONST; +G_MODULE_EXPORT GType register_evince_backend (GTypeModule *module); G_END_DECLS diff --git a/backend/pixbuf/pixbufdocument.evince-backend.in b/backend/pixbuf/pixbufdocument.evince-backend.in new file mode 100644 index 0000000..9beb526 --- /dev/null +++ b/backend/pixbuf/pixbufdocument.evince-backend.in @@ -0,0 +1,4 @@ +[Evince Backend] +Module=pixbufdocument +_TypeDescription=Images +MimeType=image/*; diff --git a/backend/ps/Makefile.am b/backend/ps/Makefile.am index 921e397..3e46801 100644 --- a/backend/ps/Makefile.am +++ b/backend/ps/Makefile.am @@ -1,15 +1,18 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libdocument \ - $(BACKEND_CFLAGS) \ - $(WARN_CFLAGS) \ +backenddir = $(libdir)/evince/backends + +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/libdocument \ + -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ + $(BACKEND_CFLAGS) \ + $(WARN_CFLAGS) \ $(DISABLE_DEPRECATED) if HAVE_SPECTRE INCLUDES += $(SPECTRE_CFLAGS) endif -noinst_LTLIBRARIES = libpsdocument.la +backend_LTLIBRARIES = libpsdocument.la if HAVE_SPECTRE libpsdocument_la_SOURCES = \ @@ -29,3 +32,22 @@ libpsdocument_la_SOURCES = \ gsdefaults.c \ gsdefaults.h endif + +libpsdocument_la_LDFLAGS = $(BACKEND_LIBTOOL_FLAGS) +libpsdocument_la_LIBADD = \ + $(top_builddir)/libdocument/libevbackend.la \ + $(BACKEND_LIBS) + +if HAVE_SPECTRE +libpsdocument_la_LIBADD += $(SPECTRE_LIBS) +endif + +backend_in_files = psdocument.evince-backend.in + +%.evince-backend: %.evince-backend.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache + +backend_DATA = $(backend_in_files:.evince-backend.in=.evince-backend) + +EXTRA_DIST = $(backend_DATA) + +CLEANFILES = $(backend_DATA) \ No newline at end of file diff --git a/backend/ps/ev-spectre.c b/backend/ps/ev-spectre.c index a16c0a0..82e3ca6 100644 --- a/backend/ps/ev-spectre.c +++ b/backend/ps/ev-spectre.c @@ -17,6 +17,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ +#include + #include #include #include @@ -42,10 +44,8 @@ static void ps_document_document_iface_init (EvDocumentIface static void ps_document_file_exporter_iface_init (EvFileExporterIface *iface); static void ps_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface); -G_DEFINE_TYPE_WITH_CODE (PSDocument, ps_document, G_TYPE_OBJECT, +EV_BACKEND_REGISTER_WITH_CODE (PSDocument, ps_document, { - G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, - ps_document_document_iface_init); G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, ps_document_document_thumbnails_iface_init); G_IMPLEMENT_INTERFACE (EV_TYPE_FILE_EXPORTER, diff --git a/backend/ps/ev-spectre.h b/backend/ps/ev-spectre.h index fb00f9f..f79f6b8 100644 --- a/backend/ps/ev-spectre.h +++ b/backend/ps/ev-spectre.h @@ -39,7 +39,9 @@ G_BEGIN_DECLS typedef struct _PSDocument PSDocument; typedef struct _PSDocumentClass PSDocumentClass; -GType ps_document_get_type (void) G_GNUC_CONST; +GType ps_document_get_type (void) G_GNUC_CONST; + +G_MODULE_EXPORT GType register_evince_backend (GTypeModule *module); G_END_DECLS diff --git a/backend/ps/ps-document.c b/backend/ps/ps-document.c index 61f07ab..abe8192 100644 --- a/backend/ps/ps-document.c +++ b/backend/ps/ps-document.c @@ -74,10 +74,8 @@ static void ps_interpreter_page_rendered (PSInterpreter GdkPixbuf *pixbuf, PSDocument *ps_document); -G_DEFINE_TYPE_WITH_CODE (PSDocument, ps_document, G_TYPE_OBJECT, +EV_BACKEND_REGISTER_WITH_CODE (PSDocument, ps_document, { - G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, - ps_document_document_iface_init); G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, ps_document_document_thumbnails_iface_init); G_IMPLEMENT_INTERFACE (EV_TYPE_FILE_EXPORTER, diff --git a/backend/ps/ps-document.h b/backend/ps/ps-document.h index fb00f9f..f79f6b8 100644 --- a/backend/ps/ps-document.h +++ b/backend/ps/ps-document.h @@ -39,7 +39,9 @@ G_BEGIN_DECLS typedef struct _PSDocument PSDocument; typedef struct _PSDocumentClass PSDocumentClass; -GType ps_document_get_type (void) G_GNUC_CONST; +GType ps_document_get_type (void) G_GNUC_CONST; + +G_MODULE_EXPORT GType register_evince_backend (GTypeModule *module); G_END_DECLS diff --git a/backend/ps/psdocument.evince-backend.in b/backend/ps/psdocument.evince-backend.in new file mode 100644 index 0000000..616c66b --- /dev/null +++ b/backend/ps/psdocument.evince-backend.in @@ -0,0 +1,4 @@ +[Evince Backend] +Module=psdocument +_TypeDescription=PostScript Documents +MimeType=application/postscript;application/x-bzpostscript;application/x-gzpostscript;image/x-eps;image/x-bzeps;image/x-gzeps diff --git a/backend/tiff/Makefile.am b/backend/tiff/Makefile.am index f89e9d9..aa7ce72 100644 --- a/backend/tiff/Makefile.am +++ b/backend/tiff/Makefile.am @@ -1,12 +1,32 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libdocument \ - $(BACKEND_CFLAGS) +backenddir = $(libdir)/evince/backends -noinst_LTLIBRARIES = libtiffdocument.la +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/libdocument \ + -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ + $(BACKEND_CFLAGS) \ + $(WARN_CFLAGS) \ + $(DISABLE_DEPRECATED) + +backend_LTLIBRARIES = libtiffdocument.la libtiffdocument_la_SOURCES = \ tiff-document.c \ tiff-document.h \ tiff2ps.c \ tiff2ps.h + +libtiffdocument_la_LDFLAGS = $(BACKEND_LIBTOOL_FLAGS) +libtiffdocument_la_LIBADD = \ + $(top_builddir)/libdocument/libevbackend.la \ + -ltiff + +backend_in_files = tiffdocument.evince-backend.in + +%.evince-backend: %.evince-backend.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache + +backend_DATA = $(backend_in_files:.evince-backend.in=.evince-backend) + +EXTRA_DIST = $(backend_DATA) + +CLEANFILES = $(backend_DATA) diff --git a/backend/tiff/tiff-document.c b/backend/tiff/tiff-document.c index 34275c1..d1473a1 100644 --- a/backend/tiff/tiff-document.c +++ b/backend/tiff/tiff-document.c @@ -20,8 +20,11 @@ /* FIXME: Should probably buffer calls to libtiff with TIFFSetWarningHandler */ +#include "config.h" + #include #include +#include #include "tiffio.h" #include "tiff2ps.h" @@ -29,6 +32,7 @@ #include "ev-document-misc.h" #include "ev-document-thumbnails.h" #include "ev-file-exporter.h" +#include "ev-file-helpers.h" struct _TiffDocumentClass { @@ -52,9 +56,8 @@ 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); -G_DEFINE_TYPE_WITH_CODE (TiffDocument, tiff_document, G_TYPE_OBJECT, - { G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, - tiff_document_document_iface_init); +EV_BACKEND_REGISTER_WITH_CODE (TiffDocument, tiff_document, + { G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, tiff_document_document_thumbnails_iface_init); G_IMPLEMENT_INTERFACE (EV_TYPE_FILE_EXPORTER, diff --git a/backend/tiff/tiff-document.h b/backend/tiff/tiff-document.h index bdf0e29..4170cca 100644 --- a/backend/tiff/tiff-document.h +++ b/backend/tiff/tiff-document.h @@ -30,8 +30,8 @@ G_BEGIN_DECLS typedef struct _TiffDocument TiffDocument; -TiffDocument *tiff_document_new (void); -GType tiff_document_get_type (void) G_GNUC_CONST; +GType tiff_document_get_type (void) G_GNUC_CONST; +G_MODULE_EXPORT GType register_evince_backend (GTypeModule *module); G_END_DECLS diff --git a/backend/tiff/tiffdocument.evince-backend.in b/backend/tiff/tiffdocument.evince-backend.in new file mode 100644 index 0000000..daaa7fd --- /dev/null +++ b/backend/tiff/tiffdocument.evince-backend.in @@ -0,0 +1,4 @@ +[Evince Backend] +Module=tiffdocument +_TypeDescription=Tiff Documents +MimeType=image/tiff -- cgit v0.9.1