]> www.fi.muni.cz Git - evince.git/commitdiff
Plugin system for backends. Fixes bug #351348.
authorCarlos Garcia Campos <carlosgc@gnome.org>
Fri, 28 Dec 2007 18:13:32 +0000 (18:13 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Fri, 28 Dec 2007 18:13:32 +0000 (18:13 +0000)
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.

svn path=/trunk/; revision=2786

51 files changed:
ChangeLog
Makefile.am
backend/comics/Makefile.am
backend/comics/comics-document.c
backend/comics/comics-document.h
backend/comics/comicsdocument.evince-backend.in [new file with mode: 0644]
backend/djvu/Makefile.am
backend/djvu/djvu-document.c
backend/djvu/djvu-document.h
backend/djvu/djvudocument.evince-backend.in [new file with mode: 0644]
backend/dvi/Makefile.am
backend/dvi/dvi-document.c
backend/dvi/dvi-document.h
backend/dvi/dvidocument.evince-backend.in [new file with mode: 0644]
backend/impress/Makefile.am
backend/impress/impress-document.c
backend/impress/impress-document.h
backend/impress/impressdocument.evince-backend.in [new file with mode: 0644]
backend/pdf/Makefile.am
backend/pdf/ev-poppler.cc
backend/pdf/ev-poppler.h
backend/pdf/pdfdocument.evince-backend.in [new file with mode: 0644]
backend/pixbuf/Makefile.am
backend/pixbuf/pixbuf-document.c
backend/pixbuf/pixbuf-document.h
backend/pixbuf/pixbufdocument.evince-backend.in [new file with mode: 0644]
backend/ps/Makefile.am
backend/ps/ev-spectre.c
backend/ps/ev-spectre.h
backend/ps/ps-document.c
backend/ps/ps-document.h
backend/ps/psdocument.evince-backend.in [new file with mode: 0644]
backend/tiff/Makefile.am
backend/tiff/tiff-document.c
backend/tiff/tiff-document.h
backend/tiff/tiffdocument.evince-backend.in [new file with mode: 0644]
configure.ac
libdocument/Makefile.am
libdocument/ev-backends-manager.c [new file with mode: 0644]
libdocument/ev-backends-manager.h [new file with mode: 0644]
libdocument/ev-document-factory.c
libdocument/ev-document-factory.h
libdocument/ev-document.h
libdocument/ev-module.c [new file with mode: 0644]
libdocument/ev-module.h [new file with mode: 0644]
po/POTFILES.in
shell/Makefile.am
shell/ev-window-title.c
shell/main.c
thumbnailer/Makefile.am
thumbnailer/evince-thumbnailer.c

index cb0830ab655eda9beee17880a30dc1fb3abc3ae4..4f40ea2b24bf05a78b8cc6a92d9da9ca9a5d163d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
+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:
index 14f3b1ede279f77d76f7dc89bf4c924e19a25458..38d8b96279e9461987dc9146275dea349ed25b48 100644 (file)
@@ -1,8 +1,8 @@
 SUBDIRS = \
        cut-n-paste \
        data \
-       backend \
        libdocument \
+       backend \
        properties \
        shell \
        po \
index 47332cd277f73517600c2f1d9a0d596475562925..5f2fb89eb9a4e3420d189d47117c185c6dc887d9 100644 (file)
@@ -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)
+
+
index b72eef69694290da995598a4802fe71866e8f280..8c3b00c38a0345af2b761715a7e7565152718d3d 100644 (file)
@@ -17,6 +17,8 @@
  * 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>
@@ -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);
        } );
index cd5b17b5abe4299c2700c498260caa7a05922a93..fdc815cd00e4da2298483ec6db7fe75a4e8f15c7 100644 (file)
@@ -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 (file)
index 0000000..df1a97e
--- /dev/null
@@ -0,0 +1,4 @@
+[Evince Backend]
+Module=comicsdocument
+_TypeDescription=Comic Books
+MimeType=application/x-cbr;application/x-cbz;
index fa44bbb734337d0e87eaab5314d7259fe05a1de5..ea5f904379acdb359036163d0d005aa04d33fa2f 100644 (file)
@@ -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)
+
+
 
 
index 2b9dee72e78028fc79533216b2368e544d0f4371..e16ec6ab78f1694ecbb5ecd20f84b28bf1ace48d 100644 (file)
@@ -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 <gdk-pixbuf/gdk-pixbuf-core.h>
 #include <glib/gi18n.h>
@@ -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,
index 402f476ef88a6e63f0ea3df1f0a6cb095457c0d5..3a5cd6fca63d2157c84ed07a50d68a54e303e655 100644 (file)
@@ -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 (file)
index 0000000..716dabf
--- /dev/null
@@ -0,0 +1,4 @@
+[Evince Backend]
+Module=djvudocument
+_TypeDescription=Djvu Documents
+MimeType=image/vnd.djvu
index 10325e069a653e5770c5ea51d63a37cb6799d54c..c65b5e8ec9c3c746abe807e008075ece891c56e9 100644 (file)
@@ -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)
 
 
 
index 73b148b389b491ea82775af91a455389e7667562..56a0d9231d3f214f1c40cc2c9dfc13a5044458bd 100644 (file)
@@ -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 <gtk/gtk.h>
 #include <glib/gi18n.h>
 
 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);
      });
index d92d474c4c3fc0a203de6e85e1952002d42580b1..1f8c260bee03f0bc8b2cae422b7df9462ee43410 100644 (file)
@@ -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 (file)
index 0000000..b43e8df
--- /dev/null
@@ -0,0 +1,4 @@
+[Evince Backend]
+Module=dvidocument
+_TypeDescription=DVI Documents
+MimeType=application/x-dvi
index 526839be734db582ec8e80fb0a2a123f3717057c..dec003d207251ed5aef54ba4153442a87d2d1570 100644 (file)
@@ -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)
index 74d335a6614fc67c99f35cc3e881311d3562457b..687972be294c01770c2b6c299ce138b35ebd8a95 100644 (file)
@@ -18,6 +18,8 @@
  * 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>
@@ -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);
                         });
index 7698e98cbed7eb52dc32eb0da0837b8061133e22..9f8449858b27ce620edf9d7410862f0a14d5361a 100644 (file)
@@ -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 (file)
index 0000000..61de77a
--- /dev/null
@@ -0,0 +1,4 @@
+[Evince Backend]
+Module=impressdocument
+_TypeDescription=Impress Slides
+MimeType=application/vnd.sun.xml.impress;application/vnd.oasis.opendocument.presentation;
index 38d08319bbd633dbe667828443a197315c79ef07..4d2e549de8de8270c719682a63e0b9d0d6f678f0 100644 (file)
@@ -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
index 690c90810412c7ba592c242c53c448d2e3447c3d..5b0398047c458ec8e84f286739270951c9b20a58 100644 (file)
@@ -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, 
index 8cc65d12f56e0a50a84620317e0c30a113d7a463..8f9dcb685f6fbd1f17bf051695573e6e319ec444 100644 (file)
@@ -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 (file)
index 0000000..476afe3
--- /dev/null
@@ -0,0 +1,5 @@
+[Evince Backend]
+Module=pdfdocument
+_TypeDescription=PDF Documents
+MimeType=application/pdf;application/x-bzpdf;application/x-gzpdf
+
index b81e1c839e4ff779ca1e73fde9fb36b244bcac8d..acc23a5bc4ea63eb987a1a883883f64edcf24616 100644 (file)
@@ -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)
index 5f61587e60b868f0fb9ce28a70d65492b128e0f0..c5810d1d3071cbc3221d1b30dc683543f7e5ff58 100644 (file)
@@ -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,
index bddf94a8fb747f24b4424fb43fcecc0d1f190858..d8a4d4389d57d69aef7800e5ff1cfc9cdf3476ec 100644 (file)
@@ -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 (file)
index 0000000..9beb526
--- /dev/null
@@ -0,0 +1,4 @@
+[Evince Backend]
+Module=pixbufdocument
+_TypeDescription=Images
+MimeType=image/*;
index 921e3977b3bb34cd5783b0f67ec52f99173d9778..3e4680191251ada82e68d731ae5e0117b7b9a6dd 100644 (file)
@@ -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
index a16c0a063c4daebf9d58ffafc3ed63c68c6c5a86..82e3ca61ba6969d7b9d4e3da39f9f8f8b86b121d 100644 (file)
@@ -17,6 +17,8 @@
  * 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>
@@ -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,
index fb00f9fb2c96101b14bf09fda28481d9943105d5..f79f6b86ab05e3b0bd6c1a3644c72da2a0eabbbb 100644 (file)
@@ -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
 
index 61f07ab789011c6e42a74fb85e9f639ba4a46da1..abe819250c42dc13fa8a0b8b26140e9202aa10c4 100644 (file)
@@ -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,
index fb00f9fb2c96101b14bf09fda28481d9943105d5..f79f6b86ab05e3b0bd6c1a3644c72da2a0eabbbb 100644 (file)
@@ -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 (file)
index 0000000..616c66b
--- /dev/null
@@ -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
index f89e9d9b82d1852d9bec0fc2f8d0379ef60215ef..aa7ce7212f62a45edf6cd41d434aaaf571186f39 100644 (file)
@@ -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)
index 34275c13d3886ba92b0000f27a360734362fa243..d1473a17bbd3d94908305a030f91d7a4eba8e361 100644 (file)
 /* 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"
@@ -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,
index bdf0e29db5603a42a2a5551ee2f12eca83f9d842..4170cca612f2f22b2a51eb0129b120cbfc0dc5d6 100644 (file)
@@ -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 (file)
index 0000000..daaa7fd
--- /dev/null
@@ -0,0 +1,4 @@
+[Evince Backend]
+Module=tiffdocument
+_TypeDescription=Tiff Documents
+MimeType=image/tiff
index bf9d378f2438ed73d413f3b6402a95184a4eacb9..906c2d1e4b5299071f6d9373e1da7f4dd2e1f544 100644 (file)
@@ -4,6 +4,9 @@ AC_PREREQ(2.57)
 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
@@ -35,7 +38,7 @@ AM_GLIB_GNU_GETTEXT
 
 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
@@ -54,11 +57,14 @@ LIBXML_REQUIRED=2.5.0
 
 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
@@ -152,8 +158,7 @@ LIB_LIBS="$LIB_LIBS $GNOME_LIBS"
 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)
 
@@ -231,12 +236,11 @@ if test "x$enable_pdf" = "xyes"; then
 
     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
@@ -274,9 +278,6 @@ if test x$enable_ps = xyes; then
    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
@@ -312,8 +313,6 @@ if test "x$enable_tiff" = "xyes"; then
     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 
index f96d0197aeb19976b628b181c83efa92ebd9fcc9..d6e0c5661ab34dc26f5e75d495821610749102c4 100644 (file)
-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         \
@@ -119,8 +87,5 @@ ev-backend-marshalers.c: ev-backend-marshalers.list
 
 ev-backend-marshal.c: ev-backend-marshalers.h ev-backend-marshalers.c
 
-noinst_HEADERS = \
-       ev-backend-marshalers.h
-
 EXTRA_DIST= \
        ev-backend-marshalers.list
diff --git a/libdocument/ev-backends-manager.c b/libdocument/ev-backends-manager.c
new file mode 100644 (file)
index 0000000..0f501a1
--- /dev/null
@@ -0,0 +1,291 @@
+/* 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;
+}
diff --git a/libdocument/ev-backends-manager.h b/libdocument/ev-backends-manager.h
new file mode 100644 (file)
index 0000000..a78d6f8
--- /dev/null
@@ -0,0 +1,44 @@
+/* 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 */
index b500fdfb6dbe365a5803b5b4ad84db7260ea1b31..21e0b4a9a8f29401d6fbc655c1ea87eac44f4a4e 100644 (file)
 #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);
 
@@ -152,110 +64,45 @@ mime_type_supported_by_gdk_pixbuf (const gchar *mime_type)
        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 *
@@ -293,8 +140,15 @@ get_document_from_uri (const char        *uri,
                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, 
@@ -304,6 +158,8 @@ get_document_from_uri (const char        *uri,
                return NULL;
        }
 
+       *compression = get_compression_from_mime_type (info->mime_type);
+
         gnome_vfs_file_info_unref (info);
        
         return document;
@@ -410,106 +266,76 @@ ev_document_factory_get_document (const char *uri, GError **error)
 }
 
 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"));
index 886be691b002567367e0773105a4582d29c360ab..55c59e4a85b6a0b7a93ef38aa6f324cc6c29683e 100644 (file)
 
 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
index 4f83553eca2ae772339d5b7fab924c0bff26a64f..6e7232bb0d7686036cec931f476364ee76ace5d2 100644 (file)
@@ -123,8 +123,74 @@ GList           *ev_document_get_attachments  (EvDocument      *document);
 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 */
diff --git a/libdocument/ev-module.c b/libdocument/ev-module.c
new file mode 100644 (file)
index 0000000..f2aebe7
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ * 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 *) &register_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;
+}
diff --git a/libdocument/ev-module.h b/libdocument/ev-module.h
new file mode 100644 (file)
index 0000000..4239cb1
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * 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 */
index 93e5efb0d9cf46e19a0c4a791bb2860c47140db1..e29511cf6a4e57069efe9ac78c22e3cc0ee96e9e 100644 (file)
@@ -2,14 +2,20 @@
 # 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
index 973882b79e957b666162d4e1b7852f5aa9e1e954..a4e8d1ef94a170e7c91e359e282b59e549c0a3f4 100644 (file)
@@ -102,18 +102,6 @@ evince_LDADD=                                                                      \
        $(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
index 3a7d908dafeb99fec468421fc2e310eaa6cf1f4d..ac1be65cd38a55cada141f6cb058f3164588feb7 100644 (file)
  */
 
 #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
@@ -74,12 +78,13 @@ get_filename_from_uri (const char *uri)
    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);
index b7362e06e0255363d3fdb226ca56923a53b56e79..e4c2d1b7e7f4a4ea9517a54f97fd658315962d67 100644 (file)
@@ -45,6 +45,7 @@
 #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;
@@ -379,6 +380,8 @@ main (int argc, char *argv[])
        gnome_authentication_manager_init ();
 #endif
 
+       ev_backends_manager_init ();
+       
        if (enable_metadata) {
                ev_metadata_manager_init ();
        }
@@ -408,6 +411,8 @@ main (int argc, char *argv[])
                ev_metadata_manager_shutdown ();
        }
 
+       ev_backends_manager_shutdown ();
+
 #if WITH_GNOME
        g_object_unref (program);
 #endif
index 25868e9c230dafd4c432a9b3960bae1841fc8223..0d341096cc9706ecb49e61519c4772fb1936e0bb 100644 (file)
@@ -19,18 +19,6 @@ evince_thumbnailer_LDADD=            \
        $(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 \
index f76b9c45aad1d2f9efaaa03ce6753fa9c7b47278..d55067427bb292e9ae50f12ac7da95c268e72136 100644 (file)
@@ -26,6 +26,7 @@
 #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>
@@ -163,16 +164,21 @@ main (int argc, char *argv[])
        
        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)) {
@@ -190,16 +196,19 @@ main (int argc, char *argv[])
                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;
 }