~ubuntu-branches/ubuntu/vivid/gnome-desktop3/vivid-proposed

« back to all changes in this revision

Viewing changes to libgnome-desktop/gnome-desktop-thumbnail.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2011-12-07 05:58:38 UTC
  • mfrom: (21.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20111207055838-m0dbp8e44eyhx9dx
Tags: 3.2.1-3
* Upload to unstable.
* debian/control.in:
  - Tighten dependency on gnome-desktop3-data again.
  - Change section of gir1.2-gnomedesktop-3.0 to introspection.

Show diffs side-by-side

added added

removed removed

Lines of Context:
927
927
mimetype_supported_by_gdk_pixbuf (const char *mime_type)
928
928
{
929
929
        guint i;
930
 
        static GHashTable *formats_hash = NULL;
 
930
        static gsize formats_hash = 0;
931
931
        gchar *key;
932
932
        gboolean result;
933
933
 
934
 
        if (!formats_hash) {
 
934
        if (g_once_init_enter (&formats_hash)) {
935
935
                GSList *formats, *list;
 
936
                GHashTable *hash;
936
937
 
937
 
                formats_hash = g_hash_table_new_full (g_str_hash,
938
 
                                                      (GEqualFunc) g_content_type_equals,
939
 
                                                      g_free, NULL);
 
938
                hash = g_hash_table_new_full (g_str_hash,
 
939
                                              (GEqualFunc) g_content_type_equals,
 
940
                                              g_free, NULL);
940
941
 
941
942
                formats = gdk_pixbuf_get_formats ();
942
943
                list = formats;
948
949
                        mime_types = gdk_pixbuf_format_get_mime_types (format);
949
950
 
950
951
                        for (i = 0; mime_types[i] != NULL; i++)
951
 
                                g_hash_table_insert (formats_hash,
 
952
                                g_hash_table_insert (hash,
952
953
                                                     (gpointer) g_content_type_from_mime_type (mime_types[i]),
953
954
                                                     GUINT_TO_POINTER (1));     
954
955
 
956
957
                        list = list->next;
957
958
                }
958
959
                g_slist_free (formats);
 
960
 
 
961
                g_once_init_leave (&formats_hash, (gsize) hash);
959
962
        }
960
963
 
961
964
        key = g_content_type_from_mime_type (mime_type);
962
 
        if (g_hash_table_lookup (formats_hash, key))
 
965
        if (g_hash_table_lookup ((void*)formats_hash, key))
963
966
                result = TRUE;
964
967
        else
965
968
                result = FALSE;