]> www.fi.muni.cz Git - evince.git/blobdiff - thumbnailer/evince-thumbnailer.c
Rework document types managing to avoid code duplication and actually
[evince.git] / thumbnailer / evince-thumbnailer.c
index 37242a1fb1e472b95b14b3b62efc7f98b60a03f5..9c672463bd6106a8e007493b340f1b7dd462d2fb 100644 (file)
@@ -33,21 +33,14 @@ static gboolean
 evince_thumbnail_pngenc_get (const char *uri, const char *thumbnail, int size)
 {
        EvDocument *document = NULL;
-       char *mime_type;
        GError *error = NULL;
        GdkPixbuf *pixbuf;
-       GType document_type;
+       char *mime_type = NULL;
 
-       mime_type = gnome_vfs_get_mime_type (uri);
-       if (mime_type == NULL)
+       document = ev_document_types_get_document (uri, &mime_type, &error);
+       if (document == NULL)
                return FALSE;
 
-       document_type = ev_document_type_lookup (mime_type);
-       if (document_type==G_TYPE_INVALID)
-               return FALSE;
-
-       document = g_object_new (document_type, NULL);
-
        if (!ev_document_load (document, uri, &error)) {
                if (error->domain == EV_DOCUMENT_ERROR &&
                    error->code == EV_DOCUMENT_ERROR_ENCRYPTED) {
@@ -67,7 +60,7 @@ evince_thumbnail_pngenc_get (const char *uri, const char *thumbnail, int size)
        if (pixbuf != NULL) {
                const char *overlaid_icon_name = NULL;
 
-               if (strcmp(mime_type,"application/pdf")==0) {
+               if (strcmp (mime_type, "application/pdf") == 0) {
                        overlaid_icon_name = "pdf-icon.png";
                }