diff options
author | Matthias Clasen <mclasen@redhat.com> | 2006-07-20 04:14:59 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2006-07-20 04:14:59 +0000 |
commit | 81c0660f19d89c7bff8d13b1d86a1803ded6056b (patch) | |
tree | fc8dd21aa4b31727fba89e34822c97f2cd912834 /gtk/xdgmime/xdgmime.c | |
parent | ed1f9073fffd397f9bd46403d43dca46f3b3ddc9 (diff) | |
download | gdk-pixbuf-81c0660f19d89c7bff8d13b1d86a1803ded6056b.tar.gz |
Add xdg_init-free versions of some functions and use them internally, so
2006-07-20 Matthias Clasen <mclasen@redhat.com>
* xdgmimemagic.c:
* xdgmime.c:
* xdgmime.h: Add xdg_init-free versions of some
functions and use them internally, so that we don't
reload caches and clobber data structures in the
middle of an operation. Patch by Joe Shaw,
bugs.freedesktop.org #6824
Diffstat (limited to 'gtk/xdgmime/xdgmime.c')
-rw-r--r-- | gtk/xdgmime/xdgmime.c | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/gtk/xdgmime/xdgmime.c b/gtk/xdgmime/xdgmime.c index 2cc1e68d2..16026cf1f 100644 --- a/gtk/xdgmime/xdgmime.c +++ b/gtk/xdgmime/xdgmime.c @@ -602,12 +602,10 @@ xdg_mime_get_max_buffer_extents (void) } const char * -xdg_mime_unalias_mime_type (const char *mime_type) +_xdg_mime_unalias_mime_type (const char *mime_type) { const char *lookup; - xdg_mime_init (); - if (_caches) return _xdg_mime_cache_unalias_mime_type (mime_type); @@ -617,16 +615,22 @@ xdg_mime_unalias_mime_type (const char *mime_type) return mime_type; } +const char * +xdg_mime_unalias_mime_type (const char *mime_type) +{ + xdg_mime_init (); + + return _xdg_mime_unalias_mime_type (mime_type); +} + int -xdg_mime_mime_type_equal (const char *mime_a, - const char *mime_b) +_xdg_mime_mime_type_equal (const char *mime_a, + const char *mime_b) { const char *unalias_a, *unalias_b; - xdg_mime_init (); - - unalias_a = xdg_mime_unalias_mime_type (mime_a); - unalias_b = xdg_mime_unalias_mime_type (mime_b); + unalias_a = _xdg_mime_unalias_mime_type (mime_a); + unalias_b = _xdg_mime_unalias_mime_type (mime_b); if (strcmp (unalias_a, unalias_b) == 0) return 1; @@ -635,6 +639,15 @@ xdg_mime_mime_type_equal (const char *mime_a, } int +xdg_mime_mime_type_equal (const char *mime_a, + const char *mime_b) +{ + xdg_mime_init (); + + return _xdg_mime_mime_type_equal (mime_a, mime_b); +} + +int xdg_mime_media_type_equal (const char *mime_a, const char *mime_b) { @@ -668,19 +681,17 @@ xdg_mime_is_super_type (const char *mime) #endif int -xdg_mime_mime_type_subclass (const char *mime, - const char *base) +_xdg_mime_mime_type_subclass (const char *mime, + const char *base) { const char *umime, *ubase; const char **parents; - xdg_mime_init (); - if (_caches) return _xdg_mime_cache_mime_type_subclass (mime, base); - umime = xdg_mime_unalias_mime_type (mime); - ubase = xdg_mime_unalias_mime_type (base); + umime = _xdg_mime_unalias_mime_type (mime); + ubase = _xdg_mime_unalias_mime_type (base); if (strcmp (umime, ubase) == 0) return 1; @@ -703,13 +714,22 @@ xdg_mime_mime_type_subclass (const char *mime, parents = _xdg_mime_parent_list_lookup (parent_list, umime); for (; parents && *parents; parents++) { - if (xdg_mime_mime_type_subclass (*parents, ubase)) + if (_xdg_mime_mime_type_subclass (*parents, ubase)) return 1; } return 0; } +int +xdg_mime_mime_type_subclass (const char *mime, + const char *base) +{ + xdg_mime_init (); + + return _xdg_mime_mime_type_subclass (mime, base); +} + char ** xdg_mime_list_mime_parents (const char *mime) { @@ -741,7 +761,7 @@ xdg_mime_get_mime_parents (const char *mime) xdg_mime_init (); - umime = xdg_mime_unalias_mime_type (mime); + umime = _xdg_mime_unalias_mime_type (mime); return _xdg_mime_parent_list_lookup (parent_list, umime); } |