Mercurial > audlegacy
comparison src/audacious/mime.c @ 3009:9976e065e2f5 trunk
Mimetype system.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Mon, 09 Jul 2007 03:18:00 -0500 |
parents | |
children | 02a62ac3d9c2 |
comparison
equal
deleted
inserted
replaced
3008:7cea5ada1956 | 3009:9976e065e2f5 |
---|---|
1 /* | |
2 * Audacious | |
3 * Copyright (c) 2007 William Pitcock | |
4 * | |
5 * This program is free software; you can redistribute it and/or modify | |
6 * it under the terms of the GNU General Public License as published by | |
7 * the Free Software Foundation; under version 2 of the License. | |
8 * | |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with this program; if not, write to the Free Software | |
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 */ | |
18 | |
19 #include "mime.h" | |
20 | |
21 mowgli_dictionary_t *mime_type_dict = NULL; | |
22 | |
23 void mime_set_plugin(const gchar *mimetype, InputPlugin *ip) | |
24 { | |
25 g_return_if_fail(mimetype != NULL); | |
26 g_return_if_fail(ip != NULL); | |
27 | |
28 if (mime_type_dict == NULL) | |
29 mime_type_dict = mowgli_dictionary_create(strcasecmp); | |
30 | |
31 mowgli_dictionary_add(mime_type_dict, mimetype, ip); | |
32 } | |
33 | |
34 InputPlugin *mime_get_plugin(const gchar *mimetype) | |
35 { | |
36 if (mime_type_dict == NULL) | |
37 return NULL; | |
38 | |
39 return mowgli_dictionary_retrieve(mime_type_dict, mimetype); | |
40 } |