]> www.fi.muni.cz Git - evince.git/commitdiff
Support all mime types
authorMarco Pesenti Gritti <mpg@redhat.com>
Tue, 5 Jul 2005 16:03:47 +0000 (16:03 +0000)
committerMarco Pesenti Gritti <marco@src.gnome.org>
Tue, 5 Jul 2005 16:03:47 +0000 (16:03 +0000)
2005-07-05  Marco Pesenti Gritti  <mpg@redhat.com>

        * Makefile.am:
        * properties/Makefile.am:
        * properties/ev-properties-main.c: (ev_properties_get_pages):

        Support all mime types

        * shell/Makefile.am:
        * thumbnailer/Makefile.am:
        * thumbnailer/evince-thumbnailer.c: (get_document_from_uri),
        (evince_thumbnail_pngenc_get):

        Use the document factory

ChangeLog
Makefile.am
properties/Makefile.am
properties/ev-properties-main.c
shell/Makefile.am
thumbnailer/Makefile.am
thumbnailer/evince-thumbnailer.c

index b954d0dcf51c75953da7262f91157de39a27fa25..a3f20490ff7bdf50dd8182ca92a3f9ccea32a0fd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2005-07-05  Marco Pesenti Gritti  <mpg@redhat.com>
+
+       * Makefile.am:
+       * properties/Makefile.am:
+       * properties/ev-properties-main.c: (ev_properties_get_pages):
+
+       Support all mime types
+
+       * shell/Makefile.am:
+       * thumbnailer/Makefile.am:
+       * thumbnailer/evince-thumbnailer.c: (get_document_from_uri),
+       (evince_thumbnail_pngenc_get):
+
+       Use the document factory
+
 2005-07-05  Marco Pesenti Gritti  <mpg@redhat.com>
 
        * backend/Makefile.am:
index 229a03bfaff78d0877e9b3bccb753087599572a9..7c4883ae784d712146e4eef6e46c2ef825ca180a 100644 (file)
@@ -18,7 +18,7 @@ endif
 
 # Applications 
 
-SUBDIRS += properties shell thumbnailer
+SUBDIRS += shell thumbnailer properties
 
 intltool_extra = intltool-extract.in intltool-merge.in intltool-update.in
 
index 597fb5a8bf4613cc2ba71764e10d75f5a187ca40..e00edd80f59a7250e5c84110043caf00a146c3cc 100644 (file)
@@ -4,7 +4,6 @@ INCLUDES=                                       \
        -DDATADIR=\"$(pkgdatadir)\"             \
        -DGNOMELOCALEDIR=\"$(datadir)/locale\"  \
        -I$(top_srcdir)/backend                 \
-       -I$(top_srcdir)/pdf                     \
        $(PROPERTIES_CFLAGS)                    \
        $(NAUTILUS_CFLAGS)                      \
        $(EVINCE_DISABLE_DEPRECATED)            \
@@ -33,6 +32,6 @@ libevince_properties_page_la_SOURCES =        \
 libevince_properties_page_la_LIBADD =                  \
        $(PROPERTIES_LIBS)                              \
        libevproperties.la                              \
-       $(top_builddir)/pdf/libpdfdocument.la           \
-       $(top_builddir)/backend/libevbackend.la         \
-       $(top_builddir)/lib/libev.la
+       $(top_builddir)/shell/libevbackendfactory.la    \
+       $(top_builddir)/lib/libev.la                    \
+       -ltiff -lz
index 87f4a59012927a8b2965bf6c443e138ba06b81fb..64f5707bf6fc22ca09044a2c271427e05c08dce6 100644 (file)
@@ -28,7 +28,7 @@
  */
 
 #include "ev-properties-view.h"
-#include "pdf-document.h"
+#include "ev-document-factory.h"
 
 #include <config.h>
 #include <string.h>
@@ -83,6 +83,7 @@ ev_properties_get_pages (NautilusPropertyPageProvider *provider,
                         GList *files)
 {
        GError *error;
+       char *mime;
        EvDocument *document;
        GList *pages = NULL;
        NautilusFileInfo *file;
@@ -95,12 +96,12 @@ ev_properties_get_pages (NautilusPropertyPageProvider *provider,
                goto end;
        file = files->data;
 
-       if (!nautilus_file_info_is_mime_type (file, "application/pdf")) {
-               goto end;
-        }
 
        /* okay, make the page */
-       document = EV_DOCUMENT (pdf_document_new ());
+       mime = nautilus_file_info_get_mime_type (file);
+       document = ev_document_factory_get_document (mime);
+       g_free (mime);
+
        uri = nautilus_file_info_get_uri (file);
        if (!ev_document_load (document, uri, &error)) {
                g_error_free (error);
index 7dc939ff98e603a0fcac1b64f15c51b2fa88881c..2b88796752165f9765a9cc21b88b32b7399034e2 100644 (file)
@@ -22,9 +22,7 @@ endif
 bin_PROGRAMS=evince
 noinst_LTLIBRARIES = libevbackendfactory.la
 
-libevbackendfactory_la_SOURCES=                        \
-       ev-document-types.c                             \
-       ev-document-types.h
+libevbackendfactory_la_SOURCES =
 
 libevbackendfactory_la_LIBADD =                        \
        $(top_builddir)/pdf/libpdfdocument.la           \
@@ -57,6 +55,8 @@ evince_SOURCES=                               \
        eggfindbar.h                    \
        ev-application.c                \
        ev-application.h                \
+       ev-document-types.c             \
+       ev-document-types.h             \
        ev-job-queue.h                  \
        ev-job-queue.c                  \
        ev-jobs.h                       \
index 8a4e9334af21da576b506026fe0cf675e9c0145e..a2f7909eb904061e76c37c10a6f512a5f13203f2 100644 (file)
@@ -5,9 +5,7 @@ NULL=
 INCLUDES=                                      \
        -DDATADIR=\"$(pkgdatadir)\"             \
        -I$(top_srcdir)/lib                     \
-       -I$(top_srcdir)/pdf                     \
        -I$(top_srcdir)/backend                 \
-       -I$(top_srcdir)/shell                   \
        -DGNOMELOCALEDIR=\"$(datadir)/locale\"  \
        -DGNOMEICONDIR=\""$(datadir)/pixmaps"\" \
        $(THUMBNAILER_CFLAGS)                   \
index 9c672463bd6106a8e007493b340f1b7dd462d2fb..4e9f3000db9283241503a035e883aa3cb286d898 100644 (file)
 #include <libgnomevfs/gnome-vfs-uri.h>
 #include <libgnomevfs/gnome-vfs-utils.h>
 #include <libgnomevfs/gnome-vfs-init.h>
+#include <libgnomevfs/gnome-vfs-ops.h>
 
 #include <ev-document.h>
-#include <ev-document-types.h>
 #include <ev-document-thumbnails.h>
+#include <ev-document-factory.h>
 
 #include <string.h>
 
 #define THUMBNAIL_SIZE 128
 
+static EvDocument *
+get_document_from_uri (const char *uri, gboolean slow, gchar **mime_type)
+{
+       EvDocument *document = NULL;
+        GnomeVFSFileInfo *info;
+        GnomeVFSResult result;
+
+        info = gnome_vfs_file_info_new ();
+        result = gnome_vfs_get_file_info (uri, info,
+                                         GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
+                                         GNOME_VFS_FILE_INFO_FOLLOW_LINKS | 
+                                         (slow ? GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE : 0));
+        if (result != GNOME_VFS_OK || info->mime_type == NULL) {
+               goto end;
+        } 
+       
+       document = ev_document_factory_get_document (info->mime_type);
+       if (mime_type != NULL) {
+               *mime_type = info->mime_type ? g_strdup (info->mime_type) : NULL;
+       }
+
+end:
+        gnome_vfs_file_info_unref (info);      
+        return document;
+}
+
 static gboolean
 evince_thumbnail_pngenc_get (const char *uri, const char *thumbnail, int size)
 {
@@ -37,9 +64,13 @@ evince_thumbnail_pngenc_get (const char *uri, const char *thumbnail, int size)
        GdkPixbuf *pixbuf;
        char *mime_type = NULL;
 
-       document = ev_document_types_get_document (uri, &mime_type, &error);
-       if (document == NULL)
+       document = get_document_from_uri (uri, FALSE, &mime_type);
+       if (document == NULL) {
+               document = get_document_from_uri (uri, TRUE, &mime_type);
+       }
+       if (document == NULL) {
                return FALSE;
+       }
 
        if (!ev_document_load (document, uri, &error)) {
                if (error->domain == EV_DOCUMENT_ERROR &&