~ubuntu-branches/ubuntu/oneiric/evince/oneiric-updates

« back to all changes in this revision

Viewing changes to libdocument/ev-document-factory.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Moya, Josselin Mouette, Rodrigo Moya
  • Date: 2011-05-19 12:12:42 UTC
  • mfrom: (1.1.65 upstream) (1.3.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20110519121242-967hbn2nh2hunp4y
Tags: 3.0.0-4ubuntu1
[ Josselin Mouette ]
* bug-presubj: please document where to report rendering bugs.
* evince.mime: dropped. We have desktop files to handle MIME 
  associations, no need to maintain an alternate system by hand.
  Closes: #619564, #627027, #551734, #581441.

[ Rodrigo Moya ]
* Rebase from Debian and GNOME3 PPA (thanks to Rico Tzschichholz).
  Remaining Ubuntu changes:
* debian/apparmor-profile:
* debian/apparmor-profile.abstraction:
* debian/evince.apport:
* debian/evince-common.dirs:
* debian/evince-common.postinst:
* debian/evince-common.postrm:
  - Add apparmor profile
* debian/control:
  - Build-Depend on debhelper (>= 7.4.20ubuntu5), gnome-common,
    hardening-includes and liblaunchpad-integration-3.0-dev
  - Standards-Version is 3.9.1
  - Depend on apparmor
* debian/rules:
  - Include hardening.make
  - Add rule to install apparmor files
* debian/watch:
  - Watch unstable series
* debian/patches/01_lpi.patch:
  - Launchpad integration patch
* debian/patches/04_gold.patch:
  - Link against libz
* debian/patches/05_library-path.patch:
  - Fix library path for g-ir-scanner

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "ev-document-factory.h"
34
34
#include "ev-file-helpers.h"
35
35
 
36
 
#ifdef ENABLE_PIXBUF
37
 
static GList*
38
 
gdk_pixbuf_mime_type_list ()
39
 
{
40
 
        GSList *formats, *list;
41
 
        GList *result = NULL;
42
 
 
43
 
        formats = gdk_pixbuf_get_formats ();
44
 
        for (list = formats; list != NULL; list = list->next) {
45
 
                GdkPixbufFormat *format = list->data;
46
 
                gchar          **mime_types;
47
 
 
48
 
                if (gdk_pixbuf_format_is_disabled (format))
49
 
                        continue;
50
 
 
51
 
                mime_types = gdk_pixbuf_format_get_mime_types (format);
52
 
                result = g_list_prepend (result, mime_types); 
53
 
        }
54
 
        g_slist_free (formats);
55
 
 
56
 
        return result;
57
 
}
58
 
 
59
 
/* Would be nice to have this in gdk-pixbuf */
60
 
static gboolean
61
 
mime_type_supported_by_gdk_pixbuf (const gchar *mime_type)
62
 
{
63
 
        GList *mime_types;
64
 
        GList *list;
65
 
        gboolean retval = FALSE;
66
 
 
67
 
        mime_types = gdk_pixbuf_mime_type_list ();
68
 
        for (list = mime_types; list; list = list->next) {
69
 
                gchar      **mtypes = (gchar **)list->data;
70
 
                const gchar *mtype;
71
 
                gint         i = 0;
72
 
 
73
 
                while ((mtype = mtypes[i++])) {
74
 
                        if (strcmp (mtype, mime_type) == 0) {
75
 
                                retval = TRUE;
76
 
                                break;
77
 
                        }
78
 
                }
79
 
        }
80
 
 
81
 
        g_list_foreach (mime_types, (GFunc)g_strfreev, NULL);
82
 
        g_list_free (mime_types);
83
 
 
84
 
        return retval;
85
 
}
86
 
#endif /* ENABLE_PIXBUF */
87
 
 
88
36
static EvCompressionType
89
37
get_compression_from_mime_type (const gchar *mime_type)
90
38
{
99
47
                        return EV_COMPRESSION_GZIP;
100
48
                else if (g_ascii_strcasecmp (type, "bz") == 0)
101
49
                        return EV_COMPRESSION_BZIP2;
 
50
                else if (g_ascii_strcasecmp (type, "xz") == 0)
 
51
                        return EV_COMPRESSION_LZMA;
102
52
        }
103
53
 
104
54
        return EV_COMPRESSION_NONE;
149
99
        }
150
100
 
151
101
        document = ev_backends_manager_get_document (mime_type);
152
 
        
153
 
#ifdef ENABLE_PIXBUF
154
 
        if (!document && mime_type_supported_by_gdk_pixbuf (mime_type))
155
 
                document = ev_backends_manager_get_document ("image/*");
156
 
#endif /* ENABLE_PIXBUF */
157
 
 
158
102
        if (document == NULL) {
159
103
                gchar *content_type, *mime_desc = NULL;
160
104
 
304
248
        const gchar *mime_type;
305
249
        gint         i = 0;
306
250
 
307
 
#ifdef ENABLE_PIXBUF
308
 
        if (g_ascii_strcasecmp (info->mime_types[0], "image/*") == 0) {
309
 
                GList *pixbuf_types, *l;
310
 
 
311
 
                pixbuf_types = gdk_pixbuf_mime_type_list ();
312
 
                for (l = pixbuf_types; l; l = g_list_next (l)) {
313
 
                        gchar **mime_types = (gchar **)l->data;
314
 
                        gint    j = 0;
315
 
                        
316
 
                        while ((mime_type = mime_types[j++]))
317
 
                                gtk_file_filter_add_mime_type (filter, mime_type);
318
 
                        
319
 
                        g_strfreev (mime_types);
320
 
                }
321
 
                g_list_free (pixbuf_types);
322
 
 
323
 
                return;
324
 
        }
325
 
#endif /* ENABLE_PIXBUF */
326
 
        
327
251
        while ((mime_type = info->mime_types[i++]))
328
252
                gtk_file_filter_add_mime_type (filter, mime_type);
329
253
}