2003-07-16 21:07:38 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu" -*- */
|
|
|
|
/* xdgmime.h: XDG Mime Spec mime resolver. Based on version 0.11 of the spec.
|
|
|
|
*
|
|
|
|
* More info can be found at http://www.freedesktop.org/standards/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003 Red Hat, Inc.
|
|
|
|
* Copyright (C) 2003 Jonathan Blandford <jrb@alum.mit.edu>
|
|
|
|
*
|
2003-10-24 20:03:37 +00:00
|
|
|
* Licensed under the Academic Free License version 2.0
|
|
|
|
* Or under the following terms:
|
2003-07-16 21:07:38 +00:00
|
|
|
*
|
2003-10-24 20:03:37 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
2003-07-16 21:07:38 +00:00
|
|
|
*
|
2003-10-24 20:03:37 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2003-07-16 21:07:38 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2003-10-24 20:03:37 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2003-07-16 21:07:38 +00:00
|
|
|
*
|
2003-10-24 20:03:37 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
2003-07-16 21:07:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __XDG_MIME_H__
|
|
|
|
#define __XDG_MIME_H__
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
2005-09-01 14:42:02 +00:00
|
|
|
#include <sys/stat.h>
|
2003-07-16 21:07:38 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#ifdef XDG_PREFIX
|
|
|
|
#define XDG_ENTRY(func) _XDG_ENTRY2(XDG_PREFIX,func)
|
|
|
|
#define _XDG_ENTRY2(prefix,func) _XDG_ENTRY3(prefix,func)
|
|
|
|
#define _XDG_ENTRY3(prefix,func) prefix##_##func
|
2004-01-20 18:07:07 +00:00
|
|
|
#endif
|
2003-07-16 21:07:38 +00:00
|
|
|
|
2004-11-08 19:36:12 +00:00
|
|
|
typedef void (*XdgMimeCallback) (void *user_data);
|
|
|
|
typedef void (*XdgMimeDestroy) (void *user_data);
|
|
|
|
|
2004-01-20 18:07:07 +00:00
|
|
|
|
|
|
|
#ifdef XDG_PREFIX
|
2003-07-16 21:07:38 +00:00
|
|
|
#define xdg_mime_get_mime_type_for_data XDG_ENTRY(get_mime_type_for_data)
|
|
|
|
#define xdg_mime_get_mime_type_for_file XDG_ENTRY(get_mime_type_for_file)
|
|
|
|
#define xdg_mime_get_mime_type_from_file_name XDG_ENTRY(get_mime_type_from_file_name)
|
2008-04-16 22:18:27 +00:00
|
|
|
#define xdg_mime_get_mime_types_from_file_name XDG_ENTRY(get_mime_types_from_file_name)
|
2003-07-16 21:07:38 +00:00
|
|
|
#define xdg_mime_is_valid_mime_type XDG_ENTRY(is_valid_mime_type)
|
2004-11-08 19:36:12 +00:00
|
|
|
#define xdg_mime_mime_type_equal XDG_ENTRY(mime_type_equal)
|
2008-04-16 22:18:27 +00:00
|
|
|
#define _xdg_mime_mime_type_equal XDG_ENTRY(mime_type_equal_p)
|
2004-12-10 21:59:19 +00:00
|
|
|
#define xdg_mime_media_type_equal XDG_ENTRY(media_type_equal)
|
2004-11-08 19:36:12 +00:00
|
|
|
#define xdg_mime_mime_type_subclass XDG_ENTRY(mime_type_subclass)
|
2008-04-16 22:18:27 +00:00
|
|
|
#define _xdg_mime_mime_type_subclass XDG_ENTRY(mime_type_subclass_p)
|
2004-12-10 21:59:19 +00:00
|
|
|
#define xdg_mime_get_mime_parents XDG_ENTRY(get_mime_parents)
|
2005-04-29 18:24:38 +00:00
|
|
|
#define xdg_mime_list_mime_parents XDG_ENTRY(list_mime_parents)
|
2004-12-10 21:59:19 +00:00
|
|
|
#define xdg_mime_unalias_mime_type XDG_ENTRY(unalias_mime_type)
|
2008-04-16 22:18:27 +00:00
|
|
|
#define _xdg_mime_unalias_mime_type XDG_ENTRY(unalias_mime_type_p)
|
2004-03-11 03:48:26 +00:00
|
|
|
#define xdg_mime_get_max_buffer_extents XDG_ENTRY(get_max_buffer_extents)
|
2004-08-12 00:46:43 +00:00
|
|
|
#define xdg_mime_shutdown XDG_ENTRY(shutdown)
|
2006-02-27 16:48:34 +00:00
|
|
|
#define xdg_mime_dump XDG_ENTRY(dump)
|
2004-11-08 19:36:12 +00:00
|
|
|
#define xdg_mime_register_reload_callback XDG_ENTRY(register_reload_callback)
|
|
|
|
#define xdg_mime_remove_callback XDG_ENTRY(remove_callback)
|
|
|
|
#define xdg_mime_type_unknown XDG_ENTRY(type_unknown)
|
2003-07-16 21:07:38 +00:00
|
|
|
#endif
|
|
|
|
|
2006-04-04 03:49:32 +00:00
|
|
|
extern const char xdg_mime_type_unknown[];
|
2004-03-11 03:48:26 +00:00
|
|
|
#define XDG_MIME_TYPE_UNKNOWN xdg_mime_type_unknown
|
|
|
|
|
2004-12-09 17:26:52 +00:00
|
|
|
const char *xdg_mime_get_mime_type_for_data (const void *data,
|
2008-04-16 22:18:27 +00:00
|
|
|
size_t len,
|
|
|
|
int *result_prio);
|
2005-09-01 14:42:02 +00:00
|
|
|
const char *xdg_mime_get_mime_type_for_file (const char *file_name,
|
|
|
|
struct stat *statbuf);
|
2004-12-09 17:26:52 +00:00
|
|
|
const char *xdg_mime_get_mime_type_from_file_name (const char *file_name);
|
2008-04-16 22:18:27 +00:00
|
|
|
int xdg_mime_get_mime_types_from_file_name(const char *file_name,
|
|
|
|
const char *mime_types[],
|
|
|
|
int n_mime_types);
|
2004-12-09 17:26:52 +00:00
|
|
|
int xdg_mime_is_valid_mime_type (const char *mime_type);
|
|
|
|
int xdg_mime_mime_type_equal (const char *mime_a,
|
|
|
|
const char *mime_b);
|
|
|
|
int xdg_mime_media_type_equal (const char *mime_a,
|
|
|
|
const char *mime_b);
|
|
|
|
int xdg_mime_mime_type_subclass (const char *mime_a,
|
|
|
|
const char *mime_b);
|
2005-04-29 18:24:38 +00:00
|
|
|
/* xdg_mime_get_mime_parents() is deprecated since it does
|
|
|
|
* not work correctly with caches. Use xdg_mime_list_parents()
|
|
|
|
* instead, but notice that that function expects you to free
|
|
|
|
* the array it returns.
|
|
|
|
*/
|
2004-12-09 17:26:52 +00:00
|
|
|
const char **xdg_mime_get_mime_parents (const char *mime);
|
2005-04-29 18:24:38 +00:00
|
|
|
char ** xdg_mime_list_mime_parents (const char *mime);
|
2004-12-09 17:26:52 +00:00
|
|
|
const char *xdg_mime_unalias_mime_type (const char *mime);
|
|
|
|
int xdg_mime_get_max_buffer_extents (void);
|
|
|
|
void xdg_mime_shutdown (void);
|
|
|
|
void xdg_mime_dump (void);
|
|
|
|
int xdg_mime_register_reload_callback (XdgMimeCallback callback,
|
|
|
|
void *data,
|
|
|
|
XdgMimeDestroy destroy);
|
|
|
|
void xdg_mime_remove_callback (int callback_id);
|
2004-03-11 03:48:26 +00:00
|
|
|
|
2006-07-20 04:14:59 +00:00
|
|
|
/* Private versions of functions that don't call xdg_mime_init () */
|
|
|
|
int _xdg_mime_mime_type_equal (const char *mime_a,
|
|
|
|
const char *mime_b);
|
|
|
|
int _xdg_mime_mime_type_subclass (const char *mime,
|
|
|
|
const char *base);
|
2008-04-16 22:18:27 +00:00
|
|
|
const char *_xdg_mime_unalias_mime_type (const char *mime);
|
2006-07-20 04:14:59 +00:00
|
|
|
|
|
|
|
|
2003-07-16 21:07:38 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* __XDG_MIME_H__ */
|