+2007-12-28 Carlos Garcia Campos <carlosgc@gnome.org>
+
+ * 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.
+
2007-12-25 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
* shell/ev-view-private.h:
SUBDIRS = \
cut-n-paste \
data \
- backend \
libdocument \
+ backend \
properties \
shell \
po \
-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)
+
+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include "config.h"
+
#include <unistd.h>
#include <string.h>
#include <glib/gi18n.h>
#include "comics-document.h"
#include "ev-document-misc.h"
#include "ev-document-thumbnails.h"
+#include "ev-file-helpers.h"
struct _ComicsDocumentClass
{
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);
} );
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
--- /dev/null
+[Evince Backend]
+Module=comicsdocument
+_TypeDescription=Comic Books
+MimeType=application/x-cbr;application/x-cbz;
+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)
+
+
* 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"
#include "ev-document-find.h"
#include "ev-document-links.h"
#include "ev-selection.h"
+#include "ev-file-helpers.h"
#include <gdk-pixbuf/gdk-pixbuf-core.h>
#include <glib/gi18n.h>
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);
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,
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
--- /dev/null
+[Evince Backend]
+Module=djvudocument
+_TypeDescription=Djvu Documents
+MimeType=image/vnd.djvu
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)
* 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"
#include "fonts.h"
#include "cairo-device.h"
-#include <gtk/gtk.h>
#include <glib/gi18n.h>
GMutex *dvi_context_mutex = NULL;
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);
});
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
--- /dev/null
+[Evince Backend]
+Module=dvidocument
+_TypeDescription=DVI Documents
+MimeType=application/x-dvi
-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) \
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)
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include "config.h"
+
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <string.h>
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);
});
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
--- /dev/null
+[Evince Backend]
+Module=impressdocument
+_TypeDescription=Impress Slides
+MimeType=application/vnd.sun.xml.impress;application/vnd.oasis.opendocument.presentation;
+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
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,
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,
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
--- /dev/null
+[Evince Backend]
+Module=pdfdocument
+_TypeDescription=PDF Documents
+MimeType=application/pdf;application/x-bzpdf;application/x-gzpdf
+
-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)
* 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"
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,
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
--- /dev/null
+[Evince Backend]
+Module=pixbufdocument
+_TypeDescription=Images
+MimeType=image/*;
-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 = \
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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
+#include <config.h>
+
#include <glib/gi18n.h>
#include <stdlib.h>
#include <libspectre/spectre.h>
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,
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
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,
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
--- /dev/null
+[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
-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)
/* FIXME: Should probably buffer calls to libtiff with TIFFSetWarningHandler
*/
+#include "config.h"
+
#include <stdio.h>
#include <glib.h>
+#include <glib/gi18n.h>
#include "tiffio.h"
#include "tiff2ps.h"
#include "ev-document-misc.h"
#include "ev-document-thumbnails.h"
#include "ev-file-exporter.h"
+#include "ev-file-helpers.h"
struct _TiffDocumentClass
{
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,
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
--- /dev/null
+[Evince Backend]
+Module=tiffdocument
+_TypeDescription=Tiff Documents
+MimeType=image/tiff
AC_INIT([Evince],[2.21.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=evince],[evince])
AM_INIT_AUTOMAKE([1.9 dist-bzip2 no-dist-gzip])
+EV_API_VERSION=2.20
+AC_SUBST(EV_API_VERSION)
+
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
dnl Check dependencies
-# LIB_CFLAGS for helpers and generic widgets. (lib, cut-and-paste)
+# LIB_CFLAGS for helpers and generic widgets. (libdocument, cut-and-paste)
# BACKEND_CFLAGS for backend implementations.
# FRONTEND_CFLAGS for frontend implementations. (properties, thumbnailer)
# FRONTEND_LIBS
GTK_PRINT_REQUIRED=2.10.0
-PKG_CHECK_MODULES(LIB, gtk+-2.0 >= $GTK_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED)
-PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED gnome-vfs-2.0)
+PKG_CHECK_MODULES(LIB, gtk+-2.0 >= $GTK_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED gnome-vfs-2.0)
+PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED)
PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 gnome-vfs-2.0)
PKG_CHECK_MODULES(SHELL_CORE, libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gnome-vfs-2.0 libglade-2.0 gconf-2.0 gnome-keyring-1 >= $KEYRING_REQUIRED)
+BACKEND_LIBTOOL_FLAGS="-module -avoid-version"
+AC_SUBST(BACKEND_LIBTOOL_FLAGS)
+
AC_ARG_WITH(libgnome,
AC_HELP_STRING([--without-libgnome],[disable the use of libgnome]),
[case "${withval}" in
AC_SUBST(LIB_CFLAGS)
AC_SUBST(LIB_LIBS)
-BACKEND_CFLAGS="$BACKEND_CFLAGS $GNOME_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
-BACKEND_LIBS="$BACKEND_LIBS $GNOME_LIBS"
+BACKEND_CFLAGS="$BACKEND_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
AC_SUBST(BACKEND_CFLAGS)
AC_SUBST(BACKEND_LIBS)
if test "x$enable_pdf" = "xyes"; then
AC_DEFINE([ENABLE_PDF], [1], [Enable pdf support.])
- FRONTEND_LIBS="$FRONTEND_LIBS $POPPLER_LIBS"
SHELL_LIBS="$SHELL_LIBS $POPPLER_LIBS"
SHELL_CFLAGS="$SHELL_CFLAGS $POPPLER_CFLAGS"
evince_save_LIBS=$LIBS
- LIBS="$LIBS $FRONTEND_LIBS"
+ LIBS="$LIBS $POPPLER_LIBS"
AC_CHECK_FUNCS(poppler_page_render)
AC_CHECK_FUNCS(poppler_page_render_for_printing)
LIBS=$evince_save_LIBS
AC_DEFINE([ENABLE_PS], [1], [Enable support for PostScript files.])
if test "x$have_spectre" = "xyes"; then
- FRONTEND_LIBS="$FRONTEND_LIBS $SPECTRE_LIBS"
- SHELL_LIBS="$SHELL_LIBS $SPECTRE_LIBS"
- SHELL_CFLAGS="$SHELL_CFLAGS $SPECTRE_CFLAGS"
ps_backend="(libspectre)"
else
dnl check for GS version
fi
if test "x$enable_tiff" = "xyes"; then
AC_DEFINE([ENABLE_TIFF], [1], [Enable multipage tiff support.])
- FRONTEND_LIBS="$FRONTEND_LIBS -ltiff"
- SHELL_LIBS="$SHELL_LIBS -ltiff"
else
AC_MSG_WARN("Tiff support is disabled since tiff library version 3.6 or newer not found")
fi
-INCLUDES= \
- -DEVINCE_UIDIR=\"$(pkgdatadir)\" \
- -DGNOMELOCALEDIR=\"$(datadir)/locale\" \
- -I$(top_srcdir)/backend/pdf \
- -I$(top_srcdir)/backend/pixbuf \
- -I$(top_srcdir)/backend/tiff \
- -I$(top_srcdir)/backend/ps \
- -I$(top_srcdir)/backend/djvu \
- -I$(top_srcdir)/backend/dvi \
- -I$(top_srcdir)/backend/impress \
- -I$(top_srcdir)/backend/comics \
- $(BACKEND_CFLAGS) \
- $(WARN_CFLAGS) \
+INCLUDES= \
+ -DEVINCE_UIDIR=\"$(pkgdatadir)\" \
+ -DGNOMELOCALEDIR=\"$(datadir)/locale\" \
+ -DEV_BACKENDSDIR=\"$(libdir)/evince/backends\" \
+ $(LIB_CFLAGS) \
+ $(WARN_CFLAGS) \
$(DISABLE_DEPRECATED)
-noinst_LTLIBRARIES = libevbackend.la
+lib_LTLIBRARIES = libevbackend.la
+
+libevbackend_la_LDFLAGS = -export-dynamic
+libevbackend_la_LIBADD = $(LIB_LIBS)
+
+NOINST_H_FILES = \
+ ev-backend-marshalers.h \
+ ev-backends-manager.h \
+ ev-document-factory.h \
+ ev-module.h
+
+INST_H_FILES = \
+ ev-async-renderer.h \
+ ev-attachment.h \
+ ev-document-find.h \
+ ev-document-fonts.h \
+ ev-document-forms.h \
+ ev-document.h \
+ ev-document-images.h \
+ ev-document-info.h \
+ ev-document-links.h \
+ ev-document-misc.h \
+ ev-document-security.h \
+ ev-document-thumbnails.h \
+ ev-document-transition.h \
+ ev-file-exporter.h \
+ ev-file-helpers.h \
+ ev-form-field.h \
+ ev-image.h \
+ ev-link-action.h \
+ ev-link-dest.h \
+ ev-link.h \
+ ev-render-context.h \
+ ev-selection.h
+
+headerdir = $(prefix)/include/evince-@EV_API_VERSION@/evince
+header_DATA = $(INST_H_FILES)
libevbackend_la_SOURCES= \
ev-async-renderer.c \
- ev-async-renderer.h \
ev-attachment.c \
- ev-attachment.h \
+ ev-backends-manager.c \
ev-backend-marshal.c \
ev-link.c \
- ev-link.h \
ev-link-action.c \
- ev-link-action.h \
ev-link-dest.c \
- ev-link-dest.h \
ev-image.c \
- ev-image.h \
ev-document.c \
- ev-document.h \
ev-document-factory.c \
- ev-document-factory.h \
ev-document-thumbnails.c \
- ev-document-thumbnails.h \
ev-document-fonts.c \
- ev-document-fonts.h \
ev-document-links.c \
- ev-document-links.h \
ev-document-images.c \
- ev-document-images.h \
ev-document-security.c \
- ev-document-security.h \
ev-document-find.c \
- ev-document-find.h \
- ev-document-info.h \
- ev-document-transition.h \
ev-document-transition.c \
- ev-document-forms.h \
ev-document-forms.c \
- ev-form-field.h \
ev-form-field.c \
ev-file-exporter.c \
- ev-file-exporter.h \
ev-file-helpers.c \
- ev-file-helpers.h \
- ev-render-context.h \
+ ev-module.c \
ev-render-context.c \
- ev-selection.h \
ev-selection.c \
- ev-document-misc.h \
- ev-document-misc.c
-
-libevbackend_la_LIBADD =
-
-if ENABLE_PDF
-libevbackend_la_LIBADD += \
- $(top_builddir)/backend/pdf/libpdfdocument.la
-endif
-
-if ENABLE_PS
-libevbackend_la_LIBADD += \
- $(top_builddir)/backend/ps/libpsdocument.la
-endif
-
-if ENABLE_PIXBUF
-libevbackend_la_LIBADD += \
- $(top_builddir)/backend/pixbuf/libpixbufdocument.la
-endif
-
-if ENABLE_DJVU
-libevbackend_la_LIBADD += \
- $(top_builddir)/backend/djvu/libgtkdjvu.la
-endif
-
-if ENABLE_TIFF
-libevbackend_la_LIBADD += \
- $(top_builddir)/backend/tiff/libtiffdocument.la
-endif
-
-if ENABLE_DVI
-libevbackend_la_LIBADD += \
- $(top_builddir)/backend/dvi/libgtkdvi.la
-endif
-
-if ENABLE_COMICS
-libevbackend_la_LIBADD += \
- $(top_builddir)/backend/comics/libcomicsdocument.la
-endif
-
-if ENABLE_IMPRESS
-libevbackend_la_LIBADD += \
- $(top_builddir)/backend/impress/libimpressdocument.la
-endif
+ ev-document-misc.c \
+ $(NOINST_H_FILES) \
+ $(INST_H_FILES)
BUILT_SOURCES= \
ev-backend-marshalers.h \
ev-backend-marshal.c: ev-backend-marshalers.h ev-backend-marshalers.c
-noinst_HEADERS = \
- ev-backend-marshalers.h
-
EXTRA_DIST= \
ev-backend-marshalers.list
--- /dev/null
+/* this file is part of evince, a gnome document viewer
+ *
+ * Copyright (C) 2007 Carlos Garcia Campos <carlosgc@gnome.org>
+ *
+ * Evince is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Evince is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include <glib/gstdio.h>
+
+#include "ev-module.h"
+#include "ev-backends-manager.h"
+
+static GList *ev_backends_list = NULL;
+
+typedef struct _EvBackendInfo EvBackendInfo;
+struct _EvBackendInfo {
+ gchar *module_name;
+ GTypeModule *module;
+
+ GType type_id;
+
+ gchar *type_desc;
+ gchar **mime_types;
+};
+
+#define EV_BACKENDS_GROUP "Evince Backend"
+#define EV_BACKENDS_EXTENSION ".evince-backend"
+
+static void
+ev_backend_info_free (EvBackendInfo *info)
+{
+ g_free (info->module_name);
+ g_free (info->type_desc);
+ g_strfreev (info->mime_types);
+ g_free (info);
+}
+
+static EvBackendInfo *
+ev_backends_manager_load_backend (const gchar *file)
+{
+ EvBackendInfo *info;
+ GKeyFile *backend_file = NULL;
+ GError *error = NULL;
+
+ backend_file = g_key_file_new ();
+ if (!g_key_file_load_from_file (backend_file, file, G_KEY_FILE_NONE, &error)) {
+ g_warning ("Error opening backend file %s: %s",
+ file, error->message);
+ g_error_free (error);
+ g_key_file_free (backend_file);
+
+ return NULL;
+ }
+
+ info = g_new0 (EvBackendInfo, 1);
+ info->module_name = g_key_file_get_string (backend_file, EV_BACKENDS_GROUP,
+ "Module", NULL);
+ if (!info->module_name) {
+ g_warning ("Bad evince backend file %s: Could not find 'Module'",
+ file);
+ ev_backend_info_free (info);
+ g_key_file_free (backend_file);
+
+ return NULL;
+ }
+
+ info->type_desc = g_key_file_get_locale_string (backend_file, EV_BACKENDS_GROUP,
+ "TypeDescription", NULL, NULL);
+ if (!info->type_desc) {
+ g_warning ("Bad evince backend file %s: Could not find 'TypeDescription'",
+ file);
+ ev_backend_info_free (info);
+ g_key_file_free (backend_file);
+
+ return NULL;
+ }
+
+ info->mime_types = g_key_file_get_string_list (backend_file, EV_BACKENDS_GROUP,
+ "MimeType", NULL, NULL);
+ if (!info->mime_types) {
+ g_warning ("Bad evince backend file %s: Could not find 'MimeType'",
+ file);
+ ev_backend_info_free (info);
+ g_key_file_free (backend_file);
+
+ return NULL;
+ }
+
+ g_key_file_free (backend_file);
+
+ return info;
+}
+
+static gboolean
+ev_backends_manager_load (void)
+{
+ GDir *dir;
+ const gchar *dirent;
+ GError *error = NULL;
+
+ dir = g_dir_open (EV_BACKENDSDIR, 0, &error);
+ if (!dir) {
+ g_warning (error->message);
+ g_error_free (error);
+
+ return FALSE;
+ }
+
+ while ((dirent = g_dir_read_name (dir))) {
+ EvBackendInfo *info;
+ gchar *file;
+
+ if (!g_str_has_suffix (dirent, EV_BACKENDS_EXTENSION))
+ continue;
+
+ file = g_build_filename (EV_BACKENDSDIR, dirent, NULL);
+ info = ev_backends_manager_load_backend (file);
+ g_free (file);
+
+ if (!info)
+ continue;
+
+ ev_backends_list = g_list_prepend (ev_backends_list, info);
+ }
+
+ return TRUE;
+}
+
+gboolean
+ev_backends_manager_init (void)
+{
+ if (ev_backends_list)
+ return FALSE;
+
+ return ev_backends_manager_load ();
+}
+
+void
+ev_backends_manager_shutdown (void)
+{
+ g_list_foreach (ev_backends_list, (GFunc)ev_backend_info_free, NULL);
+ g_list_free (ev_backends_list);
+ ev_backends_list = NULL;
+}
+
+static EvBackendInfo *
+ev_backends_manager_get_backend_info (const gchar *mime_type)
+{
+ GList *l;
+
+ for (l = ev_backends_list; l; l = g_list_next (l)) {
+ EvBackendInfo *info;
+ gint i = 0;
+ const char *mime;
+
+ info = (EvBackendInfo *)l->data;
+
+ while ((mime = info->mime_types[i++])) {
+ if (g_ascii_strcasecmp (mime, mime_type) == 0)
+ return info;
+ }
+ }
+
+ return NULL;
+}
+
+EvDocument *
+ev_backends_manager_get_document (const gchar *mime_type)
+{
+ EvDocument *document;
+ EvBackendInfo *info;
+
+ info = ev_backends_manager_get_backend_info (mime_type);
+ if (!info)
+ return NULL;
+
+ if (!info->module) {
+ gchar *path;
+
+ path = g_module_build_path (EV_BACKENDSDIR, info->module_name);
+ info->module = G_TYPE_MODULE (ev_module_new (path));
+ g_free (path);
+ }
+
+ if (!g_type_module_use (info->module)) {
+ g_warning ("Cannot load backend '%s' since file '%s' cannot be read.",
+ info->module_name,
+ ev_module_get_path (EV_MODULE (info->module)));
+ g_object_unref (G_OBJECT (info->module));
+ info->module = NULL;
+
+ return NULL;
+ }
+
+ document = EV_DOCUMENT (ev_module_new_object (EV_MODULE (info->module)));
+ g_type_module_unuse (info->module);
+
+ return document;
+}
+
+static EvBackendInfo *
+get_document_backend_info (EvDocument *document)
+{
+ GList *l;
+
+ for (l = ev_backends_list; l; l = g_list_next (l)) {
+ EvBackendInfo *info;
+ GType type_id;
+
+ info = (EvBackendInfo *)l->data;
+
+ if (!info->module)
+ continue;
+
+ type_id = ev_module_get_object_type (EV_MODULE (info->module));
+
+ if (G_TYPE_CHECK_INSTANCE_TYPE (document, type_id)) {
+ return info;
+ }
+ }
+
+ return NULL;
+}
+
+const gchar *
+ev_backends_manager_get_document_module_name (EvDocument *document)
+{
+ EvBackendInfo *info;
+
+ info = get_document_backend_info (document);
+ return info ? info->module_name : NULL;
+}
+
+static EvTypeInfo *
+ev_type_info_new (const gchar *desc, const gchar **mime_types)
+{
+ EvTypeInfo *info;
+
+ info = g_new (EvTypeInfo, 1);
+
+ info->desc = desc;
+ info->mime_types = mime_types;
+
+ return info;
+}
+
+EvTypeInfo *
+ev_backends_manager_get_document_type_info (EvDocument *document)
+{
+ EvBackendInfo *info;
+
+ info = get_document_backend_info (document);
+ return info ?
+ ev_type_info_new (info->type_desc,
+ (const gchar **)info->mime_types)
+ : NULL;
+}
+
+GList *
+ev_backends_manager_get_all_types_info (void)
+{
+ GList *l;
+ GList *retval = NULL;
+
+ for (l = ev_backends_list; l; l = g_list_next (l)) {
+ EvBackendInfo *info;
+ EvTypeInfo *type_info;
+
+ info = (EvBackendInfo *)l->data;
+
+ type_info = ev_type_info_new (info->type_desc,
+ (const gchar **)info->mime_types);
+ retval = g_list_prepend (retval, type_info);
+ }
+
+ return retval;
+}
--- /dev/null
+/* this file is part of evince, a gnome document viewer
+ *
+ * Copyright (C) 2007 Carlos Garcia Campos <carlosgc@gnome.org>
+ *
+ * Evince is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Evince is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EV_BACKENDS_MANAGER
+#define EV_BACKENDS_MANAGER
+
+#include <glib.h>
+
+#include "ev-document.h"
+
+G_BEGIN_DECLS
+
+typedef struct _EvTypeInfo {
+ const gchar *desc;
+ const gchar **mime_types;
+} EvTypeInfo;
+
+gboolean ev_backends_manager_init (void);
+void ev_backends_manager_shutdown (void);
+
+EvDocument *ev_backends_manager_get_document (const gchar *mime_type);
+const gchar *ev_backends_manager_get_document_module_name (EvDocument *document);
+EvTypeInfo *ev_backends_manager_get_document_type_info (EvDocument *document);
+GList *ev_backends_manager_get_all_types_info (void);
+
+G_END_DECLS
+
+#endif /* EV_BACKENDS_MANAGER */
#include "config.h"
#endif
-#include "ev-document-factory.h"
-
-/* The various document type backends: */
-#ifdef ENABLE_PDF
-#include "ev-poppler.h"
-#endif
-#ifdef ENABLE_PS
-#include "ps-document.h"
-#endif
-#ifdef ENABLE_TIFF
-#include "tiff-document.h"
-#endif
-#ifdef ENABLE_DVI
-#include "dvi-document.h"
-#endif
-#ifdef ENABLE_PIXBUF
-#include "pixbuf-document.h"
-#endif
-#ifdef ENABLE_DJVU
-#include "djvu-document.h"
-#endif
-#ifdef ENABLE_COMICS
-#include "comics-document.h"
-#endif
-#ifdef ENABLE_IMPRESS
-#include "impress-document.h"
-#endif
-
#include <string.h>
#include <glib/gstdio.h>
#include <glib/gi18n.h>
#include <libgnomevfs/gnome-vfs-ops.h>
#include <gtk/gtkfilechooserdialog.h>
+#include "ev-backends-manager.h"
+#include "ev-document-factory.h"
#include "ev-file-helpers.h"
-typedef struct _EvDocumentType EvDocumentType;
-struct _EvDocumentType {
- const char *mime_type;
- EvCompressionType compression;
- EvBackend backend;
- GType (*document_type_factory_callback)();
-};
-
-const EvDocumentType document_types[] = {
-#ifdef ENABLE_PDF
- /* PDF: */
- {"application/pdf", EV_COMPRESSION_NONE, EV_BACKEND_PDF, pdf_document_get_type},
- {"application/x-bzpdf", EV_COMPRESSION_BZIP2, EV_BACKEND_PDF, pdf_document_get_type},
- {"application/x-gzpdf", EV_COMPRESSION_GZIP, EV_BACKEND_PDF, pdf_document_get_type},
-#endif
-
-#ifdef ENABLE_PS
- /* Postscript: */
- {"application/postscript", EV_COMPRESSION_NONE, EV_BACKEND_PS, ps_document_get_type},
- {"application/x-bzpostscript", EV_COMPRESSION_BZIP2, EV_BACKEND_PS, ps_document_get_type},
- {"application/x-gzpostscript", EV_COMPRESSION_GZIP, EV_BACKEND_PS, ps_document_get_type},
- {"image/x-eps", EV_COMPRESSION_NONE, EV_BACKEND_PS, ps_document_get_type},
- {"image/x-bzeps", EV_COMPRESSION_BZIP2, EV_BACKEND_PS, ps_document_get_type},
- {"image/x-gzeps", EV_COMPRESSION_GZIP, EV_BACKEND_PS, ps_document_get_type},
-#endif
-
-#ifdef ENABLE_TIFF
- /* Tiff: */
- {"image/tiff", EV_COMPRESSION_NONE, EV_BACKEND_TIFF, tiff_document_get_type},
-#endif
-
-#ifdef ENABLE_DJVU
- /* djvu: */
- {"image/vnd.djvu", EV_COMPRESSION_NONE, EV_BACKEND_DJVU, djvu_document_get_type},
-#endif
-
-#ifdef ENABLE_DVI
- /* dvi: */
- {"application/x-dvi", EV_COMPRESSION_NONE, EV_BACKEND_DVI, dvi_document_get_type},
-#endif
-
-#ifdef ENABLE_COMICS
- /* cbr/cbz: */
- {"application/x-cbr", EV_COMPRESSION_NONE, EV_BACKEND_COMICS, comics_document_get_type},
- {"application/x-cbz", EV_COMPRESSION_NONE, EV_BACKEND_COMICS, comics_document_get_type},
-#endif
-
-#ifdef ENABLE_IMPRESS
- /* Impress slides: */
- {"application/vnd.sun.xml.impress", EV_COMPRESSION_NONE, EV_BACKEND_IMPRESS, impress_document_get_type},
- {"application/vnd.oasis.opendocument.presentation", EV_COMPRESSION_NONE, EV_BACKEND_IMPRESS, impress_document_get_type},
-#endif
-
-};
-
#ifdef ENABLE_PIXBUF
-
static GList*
gdk_pixbuf_mime_type_list ()
{
GSList *formats, *list;
- GList *result;
+ GList *result = NULL;
formats = gdk_pixbuf_get_formats ();
- result = NULL;
-
for (list = formats; list != NULL; list = list->next) {
GdkPixbufFormat *format = list->data;
- int i;
- gchar **mime_types;
+ gchar **mime_types;
if (gdk_pixbuf_format_is_disabled (format))
continue;
mime_types = gdk_pixbuf_format_get_mime_types (format);
-
- for (i = 0; mime_types[i] != NULL; i++) {
- result = g_list_append (result, mime_types[i]);
- }
+ result = g_list_prepend (result, mime_types);
}
g_slist_free (formats);
GList *mime_types;
GList *list;
gboolean retval = FALSE;
-
+
mime_types = gdk_pixbuf_mime_type_list ();
for (list = mime_types; list; list = list->next) {
- if (strcmp ((char *)list->data, mime_type) == 0) {
- retval = TRUE;
- break;
+ gchar **mtypes = (gchar **)list->data;
+ const gchar *mtype;
+ gint i = 0;
+
+ while ((mtype = mtypes[i++])) {
+ if (strcmp (mtype, mime_type) == 0) {
+ retval = TRUE;
+ break;
+ }
}
}
-
- g_list_foreach (mime_types, (GFunc)g_free, NULL);
+
+ g_list_foreach (mime_types, (GFunc)g_strfreev, NULL);
g_list_free (mime_types);
return retval;
}
-#endif
+#endif /* ENABLE_PIXBUF */
-static EvDocument *
-ev_document_factory_get_from_mime (const gchar *mime_type,
- EvCompressionType *compression)
+static EvCompressionType
+get_compression_from_mime_type (const gchar *mime_type)
{
- int i;
- GType type = G_TYPE_INVALID;
- EvDocument *document = NULL;
+ gchar type[3];
+ gchar *p;
- *compression = EV_COMPRESSION_NONE;
-
- for (i = 0; i < G_N_ELEMENTS (document_types); i++) {
- if (strcmp (mime_type, document_types[i].mime_type) == 0) {
- g_assert (document_types[i].document_type_factory_callback != NULL);
- type = document_types[i].document_type_factory_callback ();
- *compression = document_types[i].compression;
- break;
- }
- }
-#ifdef ENABLE_PIXBUF
- if (type == G_TYPE_INVALID && mime_type_supported_by_gdk_pixbuf (mime_type)) {
- type = pixbuf_document_get_type ();
- }
-#endif
-
- if (type != G_TYPE_INVALID) {
- document = g_object_new (type, NULL);
- }
-
- return document;
-}
-
-EvBackend
-ev_document_factory_get_backend (EvDocument *document)
-{
- int i;
+ if (!(p = g_strrstr (mime_type, "/")))
+ return EV_COMPRESSION_NONE;
- for (i = 0; i < G_N_ELEMENTS (document_types); i++) {
- GType type = document_types[i].document_type_factory_callback ();
- if (type == G_TYPE_FROM_INSTANCE (document)) {
- return document_types[i].backend;
- }
+ if (sscanf (++p, "x-%2s%*s", type) == 1) {
+ if (g_ascii_strcasecmp (type, "gz") == 0)
+ return EV_COMPRESSION_GZIP;
+ else if (g_ascii_strcasecmp (type, "bz") == 0)
+ return EV_COMPRESSION_BZIP2;
}
-#ifdef ENABLE_PIXBUF
- if (G_TYPE_FROM_INSTANCE (document) == pixbuf_document_get_type ())
- return EV_BACKEND_PIXBUF;
-#endif
- g_assert_not_reached ();
-
- return 0;
-}
-
-static GList *
-ev_document_factory_get_mime_types (EvBackend backend)
-{
- GList *types = NULL;
- int i;
-
-#ifdef ENABLE_PIXBUF
- if (backend == EV_BACKEND_PIXBUF) {
- return gdk_pixbuf_mime_type_list ();
- }
-#endif
-
- for (i = 0; i < G_N_ELEMENTS (document_types); i++) {
- if (document_types[i].backend == backend) {
- types = g_list_append (types, g_strdup (document_types[i].mime_type));
- }
- }
-
- return types;
-}
-
-static GList *
-ev_document_factory_get_all_mime_types (void)
-{
- GList *types = NULL;
- int i;
-
- for (i = 0; i < G_N_ELEMENTS (document_types); i++) {
- types = g_list_append (types, g_strdup (document_types[i].mime_type));
- }
-
-#ifdef ENABLE_PIXBUF
- types = g_list_concat (types, gdk_pixbuf_mime_type_list ());
-#endif
-
- return types;
+ return EV_COMPRESSION_NONE;
}
static EvDocument *
return NULL;
}
- document = ev_document_factory_get_from_mime (info->mime_type, compression);
-
+#ifdef ENABLE_PIXBUF
+ if (mime_type_supported_by_gdk_pixbuf (info->mime_type)) {
+ document = ev_backends_manager_get_document ("image/*");
+ } else
+ document = ev_backends_manager_get_document (info->mime_type);
+#else
+ document = ev_backends_manager_get_document (info->mime_type);
+#endif /* ENABLE_PIXBUF */
+
if (document == NULL) {
g_set_error (error,
EV_DOCUMENT_ERROR,
return NULL;
}
+ *compression = get_compression_from_mime_type (info->mime_type);
+
gnome_vfs_file_info_unref (info);
return document;
}
static void
-file_filter_add_mime_list_and_free (GtkFileFilter *filter, GList *mime_types)
+file_filter_add_mime_types (EvTypeInfo *info, GtkFileFilter *filter)
{
- GList *l;
+ const gchar *mime_type;
+ gint i = 0;
- for (l = mime_types; l != NULL; l = l->next) {
- gtk_file_filter_add_mime_type (filter, l->data);
- }
+#ifdef ENABLE_PIXBUF
+ if (g_ascii_strcasecmp (info->mime_types[0], "image/*") == 0) {
+ GList *pixbuf_types, *l;
+
+ pixbuf_types = gdk_pixbuf_mime_type_list ();
+ for (l = pixbuf_types; l; l = g_list_next (l)) {
+ gchar **mime_types = (gchar **)l->data;
+ gint j = 0;
+
+ while ((mime_type = mime_types[j++]))
+ gtk_file_filter_add_mime_type (filter, mime_type);
+
+ g_strfreev (mime_types);
+ }
+ g_list_free (pixbuf_types);
- g_list_foreach (mime_types, (GFunc)g_free, NULL);
- g_list_free (mime_types);
+ return;
+ }
+#endif /* ENABLE_PIXBUF */
+
+ while ((mime_type = info->mime_types[i++]))
+ gtk_file_filter_add_mime_type (filter, mime_type);
}
void
ev_document_factory_add_filters (GtkWidget *chooser, EvDocument *document)
{
- EvBackend backend = 0;
- GList *mime_types;
+ GList *all_types;
GtkFileFilter *filter;
GtkFileFilter *default_filter;
GtkFileFilter *document_filter;
- if (document != NULL) {
- backend = ev_document_factory_get_backend (document);
- }
-
+ all_types = ev_backends_manager_get_all_types_info ();
+
default_filter = document_filter = filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("All Documents"));
- mime_types = ev_document_factory_get_all_mime_types ();
- file_filter_add_mime_list_and_free (filter, mime_types);
+ g_list_foreach (all_types, (GFunc)file_filter_add_mime_types, filter);
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
-#ifdef ENABLE_PS
- if (document == NULL || backend == EV_BACKEND_PS) {
- default_filter = filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (filter, _("PostScript Documents"));
- mime_types = ev_document_factory_get_mime_types (EV_BACKEND_PS);
- file_filter_add_mime_list_and_free (filter, mime_types);
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
- }
-#endif
-
-#ifdef ENABLE_PDF
- if (document == NULL || backend == EV_BACKEND_PDF) {
- default_filter = filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (filter, _("PDF Documents"));
- mime_types = ev_document_factory_get_mime_types (EV_BACKEND_PDF);
- file_filter_add_mime_list_and_free (filter, mime_types);
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
- }
-#endif
+ if (document) {
+ EvTypeInfo *info;
-#ifdef ENABLE_PIXBUF
- if (document == NULL || backend == EV_BACKEND_PIXBUF) {
+ info = ev_backends_manager_get_document_type_info (document);
default_filter = filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (filter, _("Images"));
- mime_types = ev_document_factory_get_mime_types (EV_BACKEND_PIXBUF);
- file_filter_add_mime_list_and_free (filter, mime_types);
+ gtk_file_filter_set_name (filter, info->desc);
+ file_filter_add_mime_types (info, filter);
+ g_free (info);
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
- }
-#endif
+ } else {
+ GList *l;
-#ifdef ENABLE_DVI
- if (document == NULL || backend == EV_BACKEND_DVI) {
- default_filter = filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (filter, _("DVI Documents"));
- mime_types = ev_document_factory_get_mime_types (EV_BACKEND_DVI);
- file_filter_add_mime_list_and_free (filter, mime_types);
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
- }
-#endif
+ for (l = all_types; l; l = g_list_next (l)){
+ EvTypeInfo *info;
-#ifdef ENABLE_DJVU
- if (document == NULL || backend == EV_BACKEND_DJVU) {
- default_filter = filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (filter, _("Djvu Documents"));
- mime_types = ev_document_factory_get_mime_types (EV_BACKEND_DJVU);
- file_filter_add_mime_list_and_free (filter, mime_types);
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
- }
-#endif
+ info = (EvTypeInfo *)l->data;
-#ifdef ENABLE_COMICS
- if (document == NULL || backend == EV_BACKEND_COMICS) {
- default_filter = filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (filter, _("Comic Books"));
- mime_types = ev_document_factory_get_mime_types (EV_BACKEND_COMICS);
- file_filter_add_mime_list_and_free (filter, mime_types);
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
+ default_filter = filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, info->desc);
+ file_filter_add_mime_types (info, filter);
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
+ }
}
-#endif
-#ifdef ENABLE_IMPRESS
- if (document == NULL || backend == EV_BACKEND_IMPRESS) {
- default_filter = filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (filter, _("Impress Slides"));
- mime_types = ev_document_factory_get_mime_types (EV_BACKEND_IMPRESS);
- file_filter_add_mime_list_and_free (filter, mime_types);
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
- }
-#endif
+ g_list_foreach (all_types, (GFunc)g_free, NULL);
+ g_list_free (all_types);
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("All Files"));
G_BEGIN_DECLS
-typedef enum {
- EV_BACKEND_PDF,
- EV_BACKEND_PS,
- EV_BACKEND_TIFF,
- EV_BACKEND_PIXBUF,
- EV_BACKEND_DJVU,
- EV_BACKEND_DVI,
- EV_BACKEND_COMICS,
- EV_BACKEND_IMPRESS
-} EvBackend;
-
EvDocument* ev_document_factory_get_document (const char *uri, GError **error);
-EvBackend ev_document_factory_get_backend (EvDocument *document);
void ev_document_factory_add_filters (GtkWidget *chooser, EvDocument *document);
G_END_DECLS
cairo_surface_t *ev_document_render (EvDocument *document,
EvRenderContext *rc);
-gint ev_rect_cmp (EvRectangle *a,
- EvRectangle *b);
+gint ev_rect_cmp (EvRectangle *a,
+ EvRectangle *b);
+
+/*
+ * Utility macro used to register backends
+ *
+ * use: EV_BACKEND_REGISTER_WITH_CODE(BackendName, backend_name, CODE)
+ */
+#define EV_BACKEND_REGISTER_WITH_CODE(BackendName, backend_name, CODE) \
+ \
+static GType g_define_type_id = 0; \
+ \
+GType \
+backend_name##_get_type (void) \
+{ \
+ return g_define_type_id; \
+} \
+ \
+static void backend_name##_init (BackendName *self); \
+static void backend_name##_class_init (BackendName##Class *klass); \
+static gpointer backend_name##_parent_class = NULL; \
+static void backend_name##_class_intern_init (gpointer klass) \
+{ \
+ backend_name##_parent_class = g_type_class_peek_parent (klass); \
+ backend_name##_class_init ((BackendName##Class *) klass); \
+} \
+ \
+G_MODULE_EXPORT GType \
+register_evince_backend (GTypeModule *module) \
+{ \
+ static const GTypeInfo our_info = { \
+ sizeof (BackendName##Class), \
+ NULL, /* base_init */ \
+ NULL, /* base_finalize */ \
+ (GClassInitFunc) backend_name##_class_intern_init, \
+ NULL, \
+ NULL, /* class_data */ \
+ sizeof (BackendName), \
+ 0, /* n_preallocs */ \
+ (GInstanceInitFunc) backend_name##_init \
+ }; \
+ \
+ /* Initialise the i18n stuff */ \
+ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); \
+ 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); \
+ \
+ G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, \
+ backend_name##_document_iface_init); \
+ \
+ CODE \
+ \
+ return g_define_type_id; \
+}
+
+/*
+ * Utility macro used to register backend
+ *
+ * use: EV_BACKEND_REGISTER(BackendName, backend_name)
+ */
+#define EV_BACKEND_REGISTER(BackendName, backend_name) \
+ EV_BACKEND_REGISTER_WITH_CODE(BackendName, backend_name, ;)
+
G_END_DECLS
#endif /* EV_DOCUMENT_H */
--- /dev/null
+/*
+ * ev-module.c
+ * This file is part of Evince
+ *
+ * Copyright (C) 2005 - Paolo Maggi
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* This is a modified version of ephy-module.c from Epiphany source code.
+ * Here the original copyright assignment:
+ *
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ * Copyright (C) 2003, 2004 Christian Persch
+ *
+ */
+
+/*
+ * Modified by the gedit Team, 2005. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id: gedit-module.c 5367 2006-12-17 14:29:49Z pborelli $
+ */
+
+/* Modified by evince team */
+
+#include "config.h"
+
+#include "ev-module.h"
+
+#include <gmodule.h>
+
+typedef struct _EvModuleClass EvModuleClass;
+
+struct _EvModuleClass {
+ GTypeModuleClass parent_class;
+};
+
+struct _EvModule {
+ GTypeModule parent_instance;
+
+ GModule *library;
+
+ gchar *path;
+ GType type;
+};
+
+typedef GType (*EvModuleRegisterFunc) (GTypeModule *);
+
+static void ev_module_init (EvModule *action);
+static void ev_module_class_init (EvModuleClass *class);
+
+G_DEFINE_TYPE (EvModule, ev_module, G_TYPE_TYPE_MODULE)
+
+static gboolean
+ev_module_load (GTypeModule *gmodule)
+{
+ EvModule *module = EV_MODULE (gmodule);
+ EvModuleRegisterFunc register_func;
+
+ module->library = g_module_open (module->path, 0);
+
+ if (!module->library) {
+ g_warning (g_module_error ());
+
+ return FALSE;
+ }
+
+ /* extract symbols from the lib */
+ if (!g_module_symbol (module->library, "register_evince_backend",
+ (void *) ®ister_func)) {
+ g_warning (g_module_error ());
+ g_module_close (module->library);
+
+ return FALSE;
+ }
+
+ /* symbol can still be NULL even though g_module_symbol
+ * returned TRUE */
+ if (!register_func) {
+ g_warning ("Symbol 'register_evince_backend' should not be NULL");
+ g_module_close (module->library);
+
+ return FALSE;
+ }
+
+ module->type = register_func (gmodule);
+
+ if (module->type == 0) {
+ g_warning ("Invalid evince backend contained by module %s", module->path);
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+ev_module_unload (GTypeModule *gmodule)
+{
+ EvModule *module = EV_MODULE (gmodule);
+
+ g_module_close (module->library);
+
+ module->library = NULL;
+ module->type = 0;
+}
+
+const gchar *
+ev_module_get_path (EvModule *module)
+{
+ g_return_val_if_fail (EV_IS_MODULE (module), NULL);
+
+ return module->path;
+}
+
+GObject *
+ev_module_new_object (EvModule *module)
+{
+ g_return_val_if_fail (EV_IS_MODULE (module), NULL);
+
+ if (module->type == 0)
+ return NULL;
+
+ return g_object_new (module->type, NULL);
+}
+
+GType
+ev_module_get_object_type (EvModule *module)
+{
+ g_return_val_if_fail (EV_IS_MODULE (module), 0);
+
+ return module->type;
+}
+
+static void
+ev_module_init (EvModule *module)
+{
+}
+
+static void
+ev_module_finalize (GObject *object)
+{
+ EvModule *module = EV_MODULE (object);
+
+ g_free (module->path);
+
+ G_OBJECT_CLASS (ev_module_parent_class)->finalize (object);
+}
+
+static void
+ev_module_class_init (EvModuleClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class);
+
+ object_class->finalize = ev_module_finalize;
+
+ module_class->load = ev_module_load;
+ module_class->unload = ev_module_unload;
+}
+
+EvModule *
+ev_module_new (const gchar *path)
+{
+ EvModule *result;
+
+ g_return_val_if_fail (path != NULL && path[0] != '\0', NULL);
+
+ result = g_object_new (EV_TYPE_MODULE, NULL);
+
+ g_type_module_set_name (G_TYPE_MODULE (result), path);
+ result->path = g_strdup (path);
+
+ return result;
+}
--- /dev/null
+/*
+ * ev-module.h
+ * This file is part of Evince
+ *
+ * Copyright (C) 2005 - Paolo Maggi
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* This is a modified version of gedit-module.h from Epiphany source code.
+ * Here the original copyright assignment:
+ *
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ * Copyright (C) 2003, 2004 Christian Persch
+ *
+ */
+
+/*
+ * Modified by the gedit Team, 2005. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id: gedit-module.h 5263 2006-10-08 14:26:02Z pborelli $
+ */
+
+/* Modified by Evince Team */
+
+#ifndef EV_MODULE_H
+#define EV_MODULE_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define EV_TYPE_MODULE (ev_module_get_type ())
+#define EV_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EV_TYPE_MODULE, EvModule))
+#define EV_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_MODULE, EvModuleClass))
+#define EV_IS_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EV_TYPE_MODULE))
+#define EV_IS_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EV_TYPE_MODULE))
+#define EV_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EV_TYPE_MODULE, EvModuleClass))
+
+typedef struct _EvModule EvModule;
+
+GType ev_module_get_type (void) G_GNUC_CONST;
+
+EvModule *ev_module_new (const gchar *path);
+
+const gchar *ev_module_get_path (EvModule *module);
+
+GObject *ev_module_new_object (EvModule *module);
+
+GType ev_module_get_object_type (EvModule *module);
+
+G_END_DECLS
+
+#endif /* EV_MODULE_H */
# Please keep this file sorted alphabetically.
[encoding: UTF-8]
backend/comics/comics-document.c
+backend/comics/comicsdocument.evince-backend.in
backend/djvu/djvu-document.c
+backend/djvu/djvudocument.evince-backend.in
backend/dvi/dvi-document.c
+backend/dvi/dvidocument.evince-backend.in
backend/pdf/ev-poppler.cc
+backend/pdf/pdfdocument.evince-backend.in
+backend/impress/impress-document.c
+backend/impress/impressdocument.evince-backend.in
backend/impress/zip.c
backend/ps/gsdefaults.c
backend/ps/ps-document.c
backend/ps/ps-interpreter.c
-backend/impress/impress-document.c
+backend/ps/psdocument.evince-backend.in
libdocument/ev-attachment.c
libdocument/ev-document-factory.c
cut-n-paste/toolbar-editor/egg-editable-toolbar.c
$(SHELL_LIBS) \
$(GNOME_PRINT_LIBS)
-if ENABLE_DJVU
-evince_LDADD += $(DJVU_LIBS)
-endif
-
-if ENABLE_DVI
-evince_LDADD += -lkpathsea
-endif
-
-if WITH_TYPE1_FONTS
-evince_LDADD += -lt1
-endif
-
BUILT_SOURCES = ev-marshal.h ev-marshal.c
if ENABLE_DBUS
*/
#include "ev-window-title.h"
-#include "ev-document-factory.h"
+#include "ev-backends-manager.h"
#include <glib/gi18n.h>
#include <libgnomevfs/gnome-vfs-utils.h>
+/* Known backends (for bad extensions fix) */
+#define EV_BACKEND_PS "psdocument"
+#define EV_BACKEND_PDF "pdfdocument"
+
typedef struct
{
- EvBackend backend;
- const char *ext;
+ const gchar *backend;
+ const gchar *ext;
} BadExtensionEntry;
struct _EvWindowTitle
Let's show the filename in this case */
static void
ev_window_title_sanitize_extension (EvWindowTitle *window_title, char **title) {
- EvBackend backend;
+ const gchar *backend;
int i;
- backend = ev_document_factory_get_backend (window_title->document);
+ backend = ev_backends_manager_get_document_module_name (window_title->document);
+
for (i = 0; i < G_N_ELEMENTS (bad_extensions); i++) {
- if (bad_extensions[i].backend == backend &&
+ if (g_ascii_strcasecmp (bad_extensions[i].backend, backend) == 0 &&
g_str_has_suffix (*title, bad_extensions[i].ext)) {
char *new_title;
char *filename = get_filename_from_uri (window_title->uri);
#include "ev-stock-icons.h"
#include "ev-job-queue.h"
#include "ev-file-helpers.h"
+#include "ev-backends-manager.h"
static gchar *ev_page_label;
static gchar *ev_find_string;
gnome_authentication_manager_init ();
#endif
+ ev_backends_manager_init ();
+
if (enable_metadata) {
ev_metadata_manager_init ();
}
ev_metadata_manager_shutdown ();
}
+ ev_backends_manager_shutdown ();
+
#if WITH_GNOME
g_object_unref (program);
#endif
$(FRONTEND_LIBS) \
$(DJVU_LIBS)
-if ENABLE_DJVU
-evince_thumbnailer_LDADD += $(DJVU_LIBS)
-endif
-
-if ENABLE_DVI
-evince_thumbnailer_LDADD += -lkpathsea
-endif
-
-if WITH_TYPE1_FONTS
-evince_thumbnailer_LDADD += -lt1
-endif
-
schema_files = \
evince-thumbnailer-dvi.schemas.in \
evince-thumbnailer-djvu.schemas.in \
#include <ev-document-thumbnails.h>
#include <ev-async-renderer.h>
#include <ev-document-factory.h>
+#include <ev-backends-manager.h>
#include <stdlib.h>
#include <string.h>
gnome_vfs_init ();
+ ev_backends_manager_init ();
+
uri = gnome_vfs_make_uri_from_shell_arg (input);
document = evince_thumbnailer_get_document (uri);
g_free (uri);
- if (!document)
+ if (!document) {
+ ev_backends_manager_shutdown ();
return -2;
+ }
if (!EV_IS_DOCUMENT_THUMBNAILS (document)) {
g_object_unref (document);
- return FALSE;
+ ev_backends_manager_shutdown ();
+ return -2;
}
if (EV_IS_ASYNC_RENDERER (document)) {
gtk_main ();
g_object_unref (document);
+ ev_backends_manager_shutdown ();
return data.success ? 0 : -2;
}
if (!evince_thumbnail_pngenc_get (document, output, size)) {
g_object_unref (document);
+ ev_backends_manager_shutdown ();
return -2;
}
g_object_unref (document);
+ ev_backends_manager_shutdown ();
return 0;
}