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 <libgnomevfs/gnome-vfs-result.h> |
---|
29 | #include <liboaf/liboaf.h> |
---|
30 | |
---|
31 | typedef enum { |
---|
32 | GNOME_VFS_MIME_ACTION_TYPE_NONE, |
---|
33 | GNOME_VFS_MIME_ACTION_TYPE_APPLICATION, |
---|
34 | GNOME_VFS_MIME_ACTION_TYPE_COMPONENT |
---|
35 | } GnomeVFSMimeActionType; |
---|
36 | |
---|
37 | typedef enum { |
---|
38 | GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS, |
---|
39 | GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_PATHS, |
---|
40 | GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS_FOR_NON_FILES |
---|
41 | } GnomeVFSMimeApplicationArgumentType; |
---|
42 | |
---|
43 | typedef struct { |
---|
44 | char *id; |
---|
45 | char *name; |
---|
46 | char *command; |
---|
47 | gboolean can_open_multiple_files; |
---|
48 | GnomeVFSMimeApplicationArgumentType expects_uris; |
---|
49 | GList *supported_uri_schemes; |
---|
50 | gboolean requires_terminal; |
---|
51 | } GnomeVFSMimeApplication; |
---|
52 | |
---|
53 | typedef struct { |
---|
54 | GnomeVFSMimeActionType action_type; |
---|
55 | union { |
---|
56 | OAF_ServerInfo *component; |
---|
57 | void *dummy_component; |
---|
58 | GnomeVFSMimeApplication *application; |
---|
59 | } action; |
---|
60 | } GnomeVFSMimeAction; |
---|
61 | |
---|
62 | GnomeVFSMimeApplication *gnome_vfs_mime_application_copy (GnomeVFSMimeApplication *application); |
---|
63 | GnomeVFSMimeActionType gnome_vfs_mime_get_default_action_type (const char *mime_type); |
---|
64 | GnomeVFSMimeAction * gnome_vfs_mime_get_default_action (const char *mime_type); |
---|
65 | GnomeVFSMimeApplication *gnome_vfs_mime_get_default_application (const char *mime_type); |
---|
66 | OAF_ServerInfo * gnome_vfs_mime_get_default_component (const char *mime_type); |
---|
67 | GList * gnome_vfs_mime_get_short_list_applications (const char *mime_type); |
---|
68 | GList * gnome_vfs_mime_get_short_list_components (const char *mime_type); |
---|
69 | GList * gnome_vfs_mime_get_all_applications (const char *mime_type); |
---|
70 | GList * gnome_vfs_mime_get_all_components (const char *mime_type); |
---|
71 | GnomeVFSResult gnome_vfs_mime_set_default_action_type (const char *mime_type, |
---|
72 | GnomeVFSMimeActionType action_type); |
---|
73 | GnomeVFSResult gnome_vfs_mime_set_default_application (const char *mime_type, |
---|
74 | const char *application_id); |
---|
75 | GnomeVFSResult gnome_vfs_mime_set_default_component (const char *mime_type, |
---|
76 | const char *component_iid); |
---|
77 | |
---|
78 | const char *gnome_vfs_mime_get_icon (const char *mime_type); |
---|
79 | GnomeVFSResult gnome_vfs_mime_set_icon (const char *mime_type, |
---|
80 | const char *filename); |
---|
81 | const char *gnome_vfs_mime_get_description (const char *mime_type); |
---|
82 | GnomeVFSResult gnome_vfs_mime_set_description (const char *mime_type, |
---|
83 | const char *description); |
---|
84 | |
---|
85 | gboolean gnome_vfs_mime_can_be_executable (const char *mime_type); |
---|
86 | GnomeVFSResult gnome_vfs_mime_set_can_be_executable (const char *mime_type, |
---|
87 | gboolean new_value); |
---|
88 | |
---|
89 | /* Stored as delta to current user level - API function computes delta and stores in prefs */ |
---|
90 | GnomeVFSResult gnome_vfs_mime_set_short_list_applications (const char *mime_type, |
---|
91 | GList *application_ids); |
---|
92 | GnomeVFSResult gnome_vfs_mime_set_short_list_components (const char *mime_type, |
---|
93 | GList *component_iids); |
---|
94 | GnomeVFSResult gnome_vfs_mime_add_application_to_short_list (const char *mime_type, |
---|
95 | const char *application_id); |
---|
96 | GnomeVFSResult gnome_vfs_mime_remove_application_from_short_list (const char *mime_type, |
---|
97 | const char *application_id); |
---|
98 | GnomeVFSResult gnome_vfs_mime_add_component_to_short_list (const char *mime_type, |
---|
99 | const char *iid); |
---|
100 | GnomeVFSResult gnome_vfs_mime_remove_component_from_short_list (const char *mime_type, |
---|
101 | const char *iid); |
---|
102 | GnomeVFSResult gnome_vfs_mime_add_extension (const char *mime_type, |
---|
103 | const char *extension); |
---|
104 | GnomeVFSResult gnome_vfs_mime_remove_extension (const char *mime_type, |
---|
105 | const char *extension); |
---|
106 | |
---|
107 | |
---|
108 | /* No way to override system list; can only add. */ |
---|
109 | GnomeVFSResult gnome_vfs_mime_extend_all_applications (const char *mime_type, |
---|
110 | GList *application_ids); |
---|
111 | /* Only "user" entries may be removed. */ |
---|
112 | GnomeVFSResult gnome_vfs_mime_remove_from_all_applications (const char *mime_type, |
---|
113 | GList *application_ids); |
---|
114 | GnomeVFSMimeApplication *gnome_vfs_mime_application_new_from_id (const char *id); |
---|
115 | void gnome_vfs_mime_application_free (GnomeVFSMimeApplication *application); |
---|
116 | void gnome_vfs_mime_action_free (GnomeVFSMimeAction *action); |
---|
117 | |
---|
118 | /* List manipulation helper functions */ |
---|
119 | void gnome_vfs_mime_application_list_free (GList *list); |
---|
120 | void gnome_vfs_mime_component_list_free (GList *list); |
---|
121 | gboolean gnome_vfs_mime_id_in_application_list (const char *id, |
---|
122 | GList *applications); |
---|
123 | gboolean gnome_vfs_mime_id_in_component_list (const char *iid, |
---|
124 | GList *components); |
---|
125 | GList * gnome_vfs_mime_remove_application_from_list (GList *applications, |
---|
126 | const char *application_id, |
---|
127 | gboolean *did_remove); |
---|
128 | GList * gnome_vfs_mime_remove_component_from_list (GList *components, |
---|
129 | const char *iid, |
---|
130 | gboolean *did_remove); |
---|
131 | GList * gnome_vfs_mime_id_list_from_component_list (GList *components); |
---|
132 | GList * gnome_vfs_mime_id_list_from_application_list (GList *applications); |
---|
133 | |
---|
134 | #endif /* GNOME_VFS_MIME_HANDLERS_H */ |
---|