X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-window.c;h=19a0c52b5d3995054b916e05ff782f5bc547b1cf;hb=809ca307a8b35886451648e3ae7d794a2a20c63e;hp=b23a1a6e8bb714d3fdd7f35139c76f4e308aa9d1;hpb=8e30e595ac2d7f976bfab060dbc03595358431fb;p=evince.git diff --git a/shell/ev-window.c b/shell/ev-window.c index b23a1a6e..19a0c52b 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -36,6 +36,7 @@ #include "eggfindbar.h" #include "pdf-document.h" +#include "pixbuf-document.h" #include "gtkgs.h" #include @@ -205,6 +206,44 @@ unable_to_load (EvWindow *ev_window, gtk_widget_destroy (dialog); } +/* Would be nice to have this in gdk-pixbuf */ +static gboolean +mime_type_supported_by_gdk_pixbuf (const gchar *mime_type) +{ + GSList *formats, *list; + gboolean retval = FALSE; + + formats = gdk_pixbuf_get_formats (); + + list = formats; + while (list) { + GdkPixbufFormat *format = list->data; + int i; + 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++) { + if (strcmp (mime_types[i], mime_type) == 0) { + retval = TRUE; + break; + } + } + + if (retval) + break; + + list = list->next; + } + + g_slist_free (formats); + + return retval; +} + void ev_window_open (EvWindow *ev_window, const char *uri) { @@ -217,7 +256,9 @@ ev_window_open (EvWindow *ev_window, const char *uri) document = g_object_new (PDF_TYPE_DOCUMENT, NULL); else if (!strcmp (mime_type, "application/postscript")) document = g_object_new (GTK_GS_TYPE, NULL); - + else if (mime_type_supported_by_gdk_pixbuf (mime_type)) + document = g_object_new (PIXBUF_TYPE_DOCUMENT, NULL); + if (document) { GError *error = NULL;