1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
3 /* gnome-vfs-mime-handlers.h - Mime type handlers for the GNOME Virtual
6 Copyright (C) 2000 Eazel, Inc.
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.
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.
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.
23 Author: Maciej Stachowiak <mjs@eazel.com> */
25 #ifndef GNOME_VFS_MIME_HANDLERS_H
26 #define GNOME_VFS_MIME_HANDLERS_H
28 #include <libgnomevfs/gnome-vfs-mime-utils.h>
29 #include <libgnomevfs/gnome-vfs-result.h>
30 #include <libgnomevfs/gnome-vfs-uri.h>
31 #include <bonobo-activation/bonobo-activation-server-info.h>
36 GNOME_VFS_MIME_ACTION_TYPE_NONE,
37 GNOME_VFS_MIME_ACTION_TYPE_APPLICATION,
38 GNOME_VFS_MIME_ACTION_TYPE_COMPONENT
39 } GnomeVFSMimeActionType;
42 GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS,
43 GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_PATHS,
44 GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS_FOR_NON_FILES
45 } GnomeVFSMimeApplicationArgumentType;
51 gboolean can_open_multiple_files;
52 GnomeVFSMimeApplicationArgumentType expects_uris;
53 GList *supported_uri_schemes;
54 gboolean requires_terminal;
56 /* Padded to avoid future breaks in ABI compatibility */
60 } GnomeVFSMimeApplication;
65 * This data structure describes an action that can be done
70 GnomeVFSMimeActionType action_type;
72 Bonobo_ServerInfo *component;
73 void *dummy_component;
74 GnomeVFSMimeApplication *application;
77 /* Padded to avoid future breaks in ABI compatibility */
81 GnomeVFSMimeApplication *gnome_vfs_mime_application_copy (GnomeVFSMimeApplication *application);
82 GnomeVFSMimeActionType gnome_vfs_mime_get_default_action_type (const char *mime_type);
83 GnomeVFSMimeAction * gnome_vfs_mime_get_default_action (const char *mime_type);
84 GnomeVFSMimeApplication *gnome_vfs_mime_get_default_application (const char *mime_type);
85 Bonobo_ServerInfo * gnome_vfs_mime_get_default_component (const char *mime_type);
86 GList * gnome_vfs_mime_get_short_list_applications (const char *mime_type);
87 GList * gnome_vfs_mime_get_short_list_components (const char *mime_type);
88 GList * gnome_vfs_mime_get_all_applications (const char *mime_type);
89 GList * gnome_vfs_mime_get_all_components (const char *mime_type);
90 GnomeVFSResult gnome_vfs_mime_set_default_action_type (const char *mime_type,
91 GnomeVFSMimeActionType action_type);
92 GnomeVFSResult gnome_vfs_mime_set_default_application (const char *mime_type,
93 const char *application_id);
94 GnomeVFSResult gnome_vfs_mime_set_default_component (const char *mime_type,
95 const char *component_iid);
97 const char *gnome_vfs_mime_get_icon (const char *mime_type);
98 GnomeVFSResult gnome_vfs_mime_set_icon (const char *mime_type,
99 const char *filename);
100 const char *gnome_vfs_mime_get_description (const char *mime_type);
101 GnomeVFSResult gnome_vfs_mime_set_description (const char *mime_type,
102 const char *description);
104 gboolean gnome_vfs_mime_can_be_executable (const char *mime_type);
105 GnomeVFSResult gnome_vfs_mime_set_can_be_executable (const char *mime_type,
108 /* Stored as delta to current user level - API function computes delta and stores in prefs */
109 GnomeVFSResult gnome_vfs_mime_set_short_list_applications (const char *mime_type,
110 GList *application_ids);
111 GnomeVFSResult gnome_vfs_mime_set_short_list_components (const char *mime_type,
112 GList *component_iids);
113 GnomeVFSResult gnome_vfs_mime_add_application_to_short_list (const char *mime_type,
114 const char *application_id);
115 GnomeVFSResult gnome_vfs_mime_remove_application_from_short_list (const char *mime_type,
116 const char *application_id);
117 GnomeVFSResult gnome_vfs_mime_add_component_to_short_list (const char *mime_type,
119 GnomeVFSResult gnome_vfs_mime_remove_component_from_short_list (const char *mime_type,
121 GnomeVFSResult gnome_vfs_mime_add_extension (const char *mime_type,
122 const char *extension);
123 GnomeVFSResult gnome_vfs_mime_remove_extension (const char *mime_type,
124 const char *extension);
127 /* No way to override system list; can only add. */
128 GnomeVFSResult gnome_vfs_mime_extend_all_applications (const char *mime_type,
129 GList *application_ids);
130 /* Only "user" entries may be removed. */
131 GnomeVFSResult gnome_vfs_mime_remove_from_all_applications (const char *mime_type,
132 GList *application_ids);
133 GnomeVFSMimeApplication *gnome_vfs_mime_application_new_from_id (const char *id);
134 void gnome_vfs_mime_application_free (GnomeVFSMimeApplication *application);
135 void gnome_vfs_mime_action_free (GnomeVFSMimeAction *action);
137 /* List manipulation helper functions */
138 void gnome_vfs_mime_application_list_free (GList *list);
139 void gnome_vfs_mime_component_list_free (GList *list);
140 gboolean gnome_vfs_mime_id_in_application_list (const char *id,
141 GList *applications);
142 gboolean gnome_vfs_mime_id_in_component_list (const char *iid,
144 GList * gnome_vfs_mime_remove_application_from_list (GList *applications,
145 const char *application_id,
146 gboolean *did_remove);
147 GList * gnome_vfs_mime_remove_component_from_list (GList *components,
149 gboolean *did_remove);
150 GList * gnome_vfs_mime_id_list_from_component_list (GList *components);
151 GList * gnome_vfs_mime_id_list_from_application_list (GList *applications);
154 /* For launching mime actions & application */
155 GnomeVFSResult gnome_vfs_mime_action_launch (GnomeVFSMimeAction *action,
157 GnomeVFSResult gnome_vfs_mime_action_launch_with_env (GnomeVFSMimeAction *action,
160 GnomeVFSResult gnome_vfs_mime_application_launch (GnomeVFSMimeApplication *app,
162 GnomeVFSResult gnome_vfs_mime_application_launch_with_env (GnomeVFSMimeApplication *app,
168 #endif /* GNOME_VFS_MIME_HANDLERS_H */