1 /* $Id$ */ 2 /* Copyright (c) 2011-2012 Pierre Pronchery <khorben@defora.org> */ 3 /* This file is part of DeforaOS Desktop libDesktop */ 4 /* All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: 9 * 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 18 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 28 29 30 31 #ifndef LIBDESKTOP_DESKTOP_MIME_H 32 # define LIBDESKTOP_DESKTOP_MIME_H 33 34 # include <gtk/gtk.h> 35 36 37 /* Mime */ 38 /* types */ 39 typedef struct _Mime Mime; 40 41 typedef void (*MimeForeachCallback)(void * data, char const * name, 42 GdkPixbuf * icon_24, GdkPixbuf * icon_48, GdkPixbuf * icon_96); 43 44 45 /* functions */ 46 Mime * mime_new(GtkIconTheme * theme); 47 void mime_delete(Mime * mime); 48 49 /* accessors */ 50 char const * mime_get_handler(Mime * mime, char const * type, 51 char const * action); 52 int mime_set_handler(Mime * mime, char const * type, char const * action, 53 char const * handler); 54 void mime_set_theme(Mime * mime, GtkIconTheme * theme); 55 56 /* useful */ 57 char const * mime_type(Mime * mime, char const * path); 58 /* FIXME return an enum with error codes? */ 59 int mime_action(Mime * mime, char const * action, char const * path); 60 int mime_action_type(Mime * mime, char const * action, char const * path, 61 char const * type); 62 63 void mime_foreach(Mime * mime, MimeForeachCallback callback, void * data); 64 65 void mime_icons(Mime * mime, char const * type, ...); 66 67 int mime_save(Mime * mime); 68 69 #endif /* !LIBDESKTOP_DESKTOP_MIME_H */ 70