Ticket #3845: 0001-Get-the-list-of-supported-image-formats-from-Gtk.patch

File 0001-Get-the-list-of-supported-image-formats-from-Gtk.patch, 1.3 KB (added by godiard, 12 years ago)
  • src/sugar/mime.py

    From 75efa9e92adfa602e03c372bb60caa8fa2947584 Mon Sep 17 00:00:00 2001
    From: Gonzalo Odiard <godiard@gmail.com>
    Date: Fri, 31 Aug 2012 18:21:44 -0300
    Subject: [sugar-base] Get the list of supported image formats from Gtk
    
    Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
    ---
     src/sugar/mime.py | 12 +++++++++++-
     1 file changed, 11 insertions(+), 1 deletion(-)
    
    diff --git a/src/sugar/mime.py b/src/sugar/mime.py
    index c90a762..33cd15b 100644
    a b import os 
    2525import logging
    2626import gettext
    2727
     28import gtk
     29
    2830from sugar import _sugarbaseext
    2931
    3032_ = lambda msg: gettext.dgettext('sugar-base', msg)
    GENERIC_TYPE_AUDIO = 'Audio' 
    3537GENERIC_TYPE_VIDEO = 'Video'
    3638GENERIC_TYPE_LINK = 'Link'
    3739
     40
     41def get_supported_image_mime_types():
     42    mime_types = []
     43    for image_format in  gtk.gdk.pixbuf_get_formats():
     44        mime_types.extend(image_format['mime_types'])
     45    return mime_types
     46
     47
    3848_extensions = {}
    3949_globs_timestamps = []
    4050_generic_types = [
    _generic_types = [ 
    5161    'id': GENERIC_TYPE_IMAGE,
    5262    'name': _('Image'),
    5363    'icon': 'image-x-generic',
    54     'types': ['image/png', 'image/gif', 'image/jpeg'],
     64    'types': get_supported_image_mime_types(),
    5565},
    5666{
    5767    'id': GENERIC_TYPE_AUDIO,