1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ |
---|
2 | |
---|
3 | /* gnome-vfs-mime-handlers.h - Mime type handlers for the GNOME Virtual |
---|
4 | File System. |
---|
5 | |
---|
6 | Copyright (C) 2000 Eazel, Inc. |
---|
7 | |
---|
8 | The Gnome Library is free software; you can redistribute it and/or |
---|
9 | modify it under the terms of the GNU Library General Public License as |
---|
10 | published by the Free Software Foundation; either version 2 of the |
---|
11 | License, or (at your option) any later version. |
---|
12 | |
---|
13 | The Gnome Library is distributed in the hope that it will be useful, |
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 | Library General Public License for more details. |
---|
17 | |
---|
18 | You should have received a copy of the GNU Library General Public |
---|
19 | License along with the Gnome Library; see the file COPYING.LIB. If not, |
---|
20 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
21 | Boston, MA 02111-1307, USA. |
---|
22 | |
---|
23 | Author: Maciej Stachowiak <mjs@eazel.com> */ |
---|
24 | |
---|
25 | #ifndef GNOME_VFS_MIME_HANDLERS_H |
---|
26 | #define GNOME_VFS_MIME_HANDLERS_H |
---|
27 | |
---|
28 | #include <glib.h> |
---|
29 | #include <liboaf/liboaf.h> |
---|
30 | #include <libgnomevfs/gnome-vfs-types.h> /* for GnomeVFSResult */ |
---|
31 | |
---|
32 | typedef enum { |
---|
33 | GNOME_VFS_MIME_ACTION_TYPE_NONE, |
---|
34 | GNOME_VFS_MIME_ACTION_TYPE_APPLICATION, |
---|
35 | GNOME_VFS_MIME_ACTION_TYPE_COMPONENT |
---|
36 | } GnomeVFSMimeActionType; |
---|
37 | |
---|
38 | typedef struct { |
---|
39 | char *id; |
---|
40 | char *name; |
---|
41 | char *command; |
---|
42 | gboolean can_open_multiple_files; |
---|
43 | gboolean can_open_uris; |
---|
44 | gboolean requires_terminal; |
---|
45 | } GnomeVFSMimeApplication; |
---|
46 | |
---|
47 | typedef struct { |
---|
48 | GnomeVFSMimeActionType action_type; |
---|
49 | union { |
---|
50 | OAF_ServerInfo *component; |
---|
51 | void *dummy_component; |
---|
52 | GnomeVFSMimeApplication *application; |
---|
53 | } action; |
---|
54 | } GnomeVFSMimeAction; |
---|
55 | |
---|
56 | GnomeVFSMimeApplication *gnome_vfs_mime_application_copy (GnomeVFSMimeApplication *application); |
---|
57 | GnomeVFSMimeActionType gnome_vfs_mime_get_default_action_type (const char *mime_type); |
---|
58 | GnomeVFSMimeAction * gnome_vfs_mime_get_default_action (const char *mime_type); |
---|
59 | GnomeVFSMimeAction * gnome_vfs_mime_get_default_action_without_fallback(const char *mime_type); |
---|
60 | GnomeVFSMimeApplication *gnome_vfs_mime_get_default_application (const char *mime_type); |
---|
61 | OAF_ServerInfo * gnome_vfs_mime_get_default_component (const char *mime_type); |
---|
62 | GList * gnome_vfs_mime_get_short_list_applications (const char *mime_type); |
---|
63 | GList * gnome_vfs_mime_get_short_list_components (const char *mime_type); |
---|
64 | GList * gnome_vfs_mime_get_all_applications (const char *mime_type); |
---|
65 | GList * gnome_vfs_mime_get_all_components (const char *mime_type); |
---|
66 | GnomeVFSResult gnome_vfs_mime_set_default_action_type (const char *mime_type, |
---|
67 | GnomeVFSMimeActionType action_type); |
---|
68 | GnomeVFSResult gnome_vfs_mime_set_default_application (const char *mime_type, |
---|
69 | const char *application_id); |
---|
70 | GnomeVFSResult gnome_vfs_mime_set_default_component (const char *mime_type, |
---|
71 | const char *component_iid); |
---|
72 | const char *gnome_vfs_mime_get_icon (const char *mime_type); |
---|
73 | GnomeVFSResult gnome_vfs_mime_set_icon (const char *mime_type, |
---|
74 | const char *filename); |
---|
75 | const char *gnome_vfs_mime_get_description (const char *mime_type); |
---|
76 | |
---|
77 | /* Stored as delta to current user level - API function computes delta and stores in prefs */ |
---|
78 | GnomeVFSResult gnome_vfs_mime_set_short_list_applications (const char *mime_type, |
---|
79 | GList *application_ids); |
---|
80 | GnomeVFSResult gnome_vfs_mime_set_short_list_components (const char *mime_type, |
---|
81 | GList *component_ids); |
---|
82 | GnomeVFSResult gnome_vfs_mime_add_application_to_short_list (const char *uri, |
---|
83 | const char *application_id); |
---|
84 | GnomeVFSResult gnome_vfs_mime_remove_application_from_short_list (const char *uri, |
---|
85 | const char *application_id); |
---|
86 | GnomeVFSResult gnome_vfs_mime_add_component_to_short_list (const char *uri, |
---|
87 | const char *iid); |
---|
88 | GnomeVFSResult gnome_vfs_mime_remove_component_from_short_list (const char *uri, |
---|
89 | const char *iid); |
---|
90 | GnomeVFSResult gnome_vfs_mime_add_extension (const char *mime_type, |
---|
91 | const char *extension); |
---|
92 | GnomeVFSResult gnome_vfs_mime_remove_extension (const char *mime_type, |
---|
93 | const char *extension); |
---|
94 | |
---|
95 | |
---|
96 | /* No way to override system list; can only add. */ |
---|
97 | GnomeVFSResult gnome_vfs_mime_extend_all_applications (const char *mime_type, |
---|
98 | GList *application_ids); |
---|
99 | /* Only "user" entries may be removed. */ |
---|
100 | GnomeVFSResult gnome_vfs_mime_remove_from_all_applications (const char *mime_type, |
---|
101 | GList *application_ids); |
---|
102 | GnomeVFSMimeApplication *gnome_vfs_mime_application_new_from_id (const char *id); |
---|
103 | void gnome_vfs_mime_application_free (GnomeVFSMimeApplication *application); |
---|
104 | void gnome_vfs_mime_action_free (GnomeVFSMimeAction *action); |
---|
105 | |
---|
106 | /* List manipulation helper functions */ |
---|
107 | void gnome_vfs_mime_application_list_free (GList *list); |
---|
108 | void gnome_vfs_mime_component_list_free (GList *list); |
---|
109 | gboolean gnome_vfs_mime_id_in_application_list (const char *id, |
---|
110 | GList *applications); |
---|
111 | gboolean gnome_vfs_mime_id_in_component_list (const char *iid, |
---|
112 | GList *components); |
---|
113 | GList * gnome_vfs_mime_remove_application_from_list (GList *applications, |
---|
114 | const char *application_id, |
---|
115 | gboolean *did_remove); |
---|
116 | GList * gnome_vfs_mime_remove_component_from_list (GList *components, |
---|
117 | const char *iid, |
---|
118 | gboolean *did_remove); |
---|
119 | GList * gnome_vfs_mime_id_list_from_component_list (GList *components); |
---|
120 | GList * gnome_vfs_mime_id_list_from_application_list (GList *applications); |
---|
121 | |
---|
122 | #endif /* GNOME_VFS_MIME_HANDLERS_H */ |
---|