From f81841c35b37550bad81c3df8bafd69854f424b7 Mon Sep 17 00:00:00 2001
From: Gonzalo Odiard <godiard@gmail.com>
Date: Fri, 31 Aug 2012 17:56:43 -0300
Subject: [sugar-toolkit-gtk3] Take list of supported image formats mime types
from GdkPixbuf - SL #3845
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
---
src/sugar3/mime.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/sugar3/mime.py b/src/sugar3/mime.py
index 07d085e..d0b12dc 100644
a
|
b
|
import os |
25 | 25 | import logging |
26 | 26 | import gettext |
27 | 27 | |
| 28 | from gi.repository import GdkPixbuf |
| 29 | |
28 | 30 | from sugar3 import _sugarbaseext |
29 | 31 | |
30 | 32 | _ = lambda msg: gettext.dgettext('sugar-base', msg) |
… |
… |
GENERIC_TYPE_AUDIO = 'Audio' |
35 | 37 | GENERIC_TYPE_VIDEO = 'Video' |
36 | 38 | GENERIC_TYPE_LINK = 'Link' |
37 | 39 | |
| 40 | |
| 41 | def get_supported_image_mime_types(): |
| 42 | mime_types = [] |
| 43 | for image_format in GdkPixbuf.Pixbuf.get_formats(): |
| 44 | mime_types.extend(image_format.get_mime_types()) |
| 45 | return mime_types |
| 46 | |
| 47 | |
38 | 48 | _extensions = {} |
39 | 49 | _globs_timestamps = [] |
40 | 50 | _generic_types = [ |
… |
… |
_generic_types = [ |
51 | 61 | 'id': GENERIC_TYPE_IMAGE, |
52 | 62 | 'name': _('Image'), |
53 | 63 | 'icon': 'image-x-generic', |
54 | | 'types': ['image/png', 'image/gif', 'image/jpeg'], |
| 64 | 'types': get_supported_image_mime_types(), |
55 | 65 | }, |
56 | 66 | { |
57 | 67 | 'id': GENERIC_TYPE_AUDIO, |