Added missing release notes to Changes file.
[rox-filer.git] / ROX-Filer / src / xdgmime.h
blob52d1524af42ba630c8e7368446ab601c7d5ffe00
1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* xdgmime.h: XDG Mime Spec mime resolver. Based on version 0.11 of the spec.
4 * More info can be found at http://www.freedesktop.org/standards/
5 *
6 * Copyright (C) 2003 Red Hat, Inc.
7 * Copyright (C) 2003 Jonathan Blandford <jrb@alum.mit.edu>
9 * Licensed under the Academic Free License version 2.0
10 * Or under the following terms:
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the
24 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 * Boston, MA 02111-1307, USA.
29 #ifndef __XDG_MIME_H__
30 #define __XDG_MIME_H__
32 #include <stdlib.h>
33 #include <sys/stat.h>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif /* __cplusplus */
39 #ifdef XDG_PREFIX
40 #define XDG_ENTRY(func) _XDG_ENTRY2(XDG_PREFIX,func)
41 #define _XDG_ENTRY2(prefix,func) _XDG_ENTRY3(prefix,func)
42 #define _XDG_ENTRY3(prefix,func) prefix##_##func
44 #define XDG_RESERVED_ENTRY(func) _XDG_RESERVED_ENTRY2(XDG_PREFIX,func)
45 #define _XDG_RESERVED_ENTRY2(prefix,func) _XDG_RESERVED_ENTRY3(prefix,func)
46 #define _XDG_RESERVED_ENTRY3(prefix,func) _##prefix##_##func
47 #endif
49 typedef void (*XdgMimeCallback) (void *user_data);
50 typedef void (*XdgMimeDestroy) (void *user_data);
53 #ifdef XDG_PREFIX
54 #define xdg_mime_get_mime_type_for_data XDG_ENTRY(mime_get_mime_type_for_data)
55 #define xdg_mime_get_mime_type_for_file XDG_ENTRY(mime_get_mime_type_for_file)
56 #define xdg_mime_get_mime_type_from_file_name XDG_ENTRY(mime_get_mime_type_from_file_name)
57 #define xdg_mime_is_valid_mime_type XDG_ENTRY(mime_is_valid_mime_type)
58 #define xdg_mime_mime_type_equal XDG_ENTRY(mime_mime_type_equal)
59 #define xdg_mime_media_type_equal XDG_ENTRY(mime_media_type_equal)
60 #define xdg_mime_mime_type_subclass XDG_ENTRY(mime_mime_type_subclass)
61 #define xdg_mime_get_mime_parents XDG_ENTRY(mime_get_mime_parents)
62 #define xdg_mime_list_mime_parents XDG_ENTRY(mime_list_mime_parents)
63 #define xdg_mime_unalias_mime_type XDG_ENTRY(mime_unalias_mime_type)
64 #define xdg_mime_get_max_buffer_extents XDG_ENTRY(mime_get_max_buffer_extents)
65 #define xdg_mime_shutdown XDG_ENTRY(mime_shutdown)
66 #define xdg_mime_dump XDG_ENTRY(mime_dump)
67 #define xdg_mime_register_reload_callback XDG_ENTRY(mime_register_reload_callback)
68 #define xdg_mime_remove_callback XDG_ENTRY(mime_remove_callback)
69 #define xdg_mime_type_unknown XDG_ENTRY(mime_type_unknown)
71 #define _xdg_mime_mime_type_equal XDG_RESERVED_ENTRY(mime_mime_type_equal)
72 #define _xdg_mime_media_type_equal XDG_RESERVED_ENTRY(mime_media_type_equal)
73 #define _xdg_mime_mime_type_subclass XDG_RESERVED_ENTRY(mime_mime_type_subclass)
74 #endif
76 extern const char xdg_mime_type_unknown[];
77 #define XDG_MIME_TYPE_UNKNOWN xdg_mime_type_unknown
79 /* ROX: */
80 extern const char xdg_mime_type_unknown_text[];
81 #define XDG_MIME_TYPE_UNKNOWN_TEXT xdg_mime_type_unknown_text
83 const char *xdg_mime_get_mime_type_for_data (const void *data,
84 size_t len);
85 const char *xdg_mime_get_mime_type_for_file (const char *file_name,
86 struct stat *statbuf);
87 const char *xdg_mime_get_mime_type_from_file_name (const char *file_name);
88 int xdg_mime_is_valid_mime_type (const char *mime_type);
89 int xdg_mime_mime_type_equal (const char *mime_a,
90 const char *mime_b);
91 int xdg_mime_media_type_equal (const char *mime_a,
92 const char *mime_b);
93 int xdg_mime_mime_type_subclass (const char *mime_a,
94 const char *mime_b);
95 /* xdg_mime_get_mime_parents() is deprecated since it does
96 * not work correctly with caches. Use xdg_mime_list_parents()
97 * instead, but notice that that function expects you to free
98 * the array it returns.
100 const char **xdg_mime_get_mime_parents (const char *mime);
101 char ** xdg_mime_list_mime_parents (const char *mime);
102 const char *xdg_mime_unalias_mime_type (const char *mime);
103 int xdg_mime_get_max_buffer_extents (void);
104 void xdg_mime_shutdown (void);
105 void xdg_mime_dump (void);
106 int xdg_mime_register_reload_callback (XdgMimeCallback callback,
107 void *data,
108 XdgMimeDestroy destroy);
109 void xdg_mime_remove_callback (int callback_id);
111 /* Private versions of functions that don't call xdg_mime_init () */
112 int _xdg_mime_mime_type_equal (const char *mime_a,
113 const char *mime_b);
114 int _xdg_mime_media_type_equal (const char *mime_a,
115 const char *mime_b);
116 int _xdg_mime_mime_type_subclass (const char *mime,
117 const char *base);
119 #ifdef __cplusplus
121 #endif /* __cplusplus */
123 #endif /* __XDG_MIME_H__ */