ftp://ftp.redhat.com/pub/redhat/linux/rawhide/SRPMS/SRPMS/gnome-vfs2-2.3.8-1.src.rpm
[gnome-vfs-httpcaptive.git] / libgnomevfs / gnome-vfs-mime-handlers.h
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-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>
32
33 G_BEGIN_DECLS
34
35 typedef enum {
36         GNOME_VFS_MIME_ACTION_TYPE_NONE,
37         GNOME_VFS_MIME_ACTION_TYPE_APPLICATION,
38         GNOME_VFS_MIME_ACTION_TYPE_COMPONENT
39 } GnomeVFSMimeActionType;
40
41 typedef enum {
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;
46
47 typedef struct {
48         char *id;
49         char *name;
50         char *command;
51         gboolean can_open_multiple_files;
52         GnomeVFSMimeApplicationArgumentType expects_uris;
53         GList *supported_uri_schemes;
54         gboolean requires_terminal;
55
56         /* Padded to avoid future breaks in ABI compatibility */
57         void *reserved1;
58         void *reserved2;
59
60 } GnomeVFSMimeApplication;
61
62 /**
63  * GnomeVFSMimeAction:
64  *
65  * This data structure describes an action that can be done 
66  * on a file.
67  **/
68
69 typedef struct {
70         GnomeVFSMimeActionType action_type;
71         union {
72                 Bonobo_ServerInfo *component;
73                 void *dummy_component;
74                 GnomeVFSMimeApplication *application;
75         } action;
76
77         /* Padded to avoid future breaks in ABI compatibility */
78         void *reserved1;
79 } GnomeVFSMimeAction;
80
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);
96
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);
103
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,
106                                                                             gboolean                 new_value);
107
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,
118                                                                             const char              *iid);
119 GnomeVFSResult           gnome_vfs_mime_remove_component_from_short_list   (const char              *mime_type,
120                                                                             const char              *iid);
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);
125
126
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);
136
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,
143                                                                             GList                   *components);
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,
148                                                                             const char              *iid,
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);
152
153
154 /* For launching mime actions & application */
155 GnomeVFSResult           gnome_vfs_mime_action_launch                      (GnomeVFSMimeAction      *action,
156                                                                             GList                   *uris);
157 GnomeVFSResult           gnome_vfs_mime_action_launch_with_env             (GnomeVFSMimeAction      *action,
158                                                                             GList                   *uris,
159                                                                             char                   **envp);
160 GnomeVFSResult           gnome_vfs_mime_application_launch                 (GnomeVFSMimeApplication *app,
161                                                                             GList                   *uris);
162 GnomeVFSResult           gnome_vfs_mime_application_launch_with_env        (GnomeVFSMimeApplication *app,
163                                                                             GList                   *uris,
164                                                                             char                   **envp);
165
166 G_END_DECLS
167
168 #endif /* GNOME_VFS_MIME_HANDLERS_H */