libgnomevfsmm 2.26.0
mime-handlers.h
Go to the documentation of this file.
1/* Copyright 2003 gnome-vfsmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free
15 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18
19#ifndef _LIBGNOMEVFSMM_MIME_HANDLERS_H
20#define _LIBGNOMEVFSMM_MIME_HANDLERS_H
21
22#include <glibmm.h>
23
24#include <libgnomevfsmm/enums.h>
28
29/*
30 * If the underlying GConf implementation does not use Orbit, then
31 * stub out the return of functions which are Bonobo-specific
32 */
33#include <libgnomevfs/gnome-vfs-mime-handlers.h>
34#ifdef DISABLE_ORBIT
35typedef void Bonobo_ServerInfo;
36#endif
37
38namespace Gnome
39{
40
41namespace Vfs
42{
43
44//TODO: Explain when/how someone might use this stuff.
45//TODO: Consider renaming this to MimeDatabase or something similar. Murray.
46//e.g. Direct people to
47//- get_registered_types() to discover all MIME types.
48//- get_description() to get a human-readable description of a MIME type.
49//- get_all_applications() to get a list of applications that can handle the MIME type.
50//TODO: Tell them how to get the MIME type for a file.
51namespace Mime
52{
53
54typedef Glib::ListHandle<Gnome::Vfs::MimeApplication*> ListHandleApps;
55//Removed from gnome-vfs: typedef GList* ListHandleComps;
56typedef Glib::ListHandle<Glib::ustring> ListHandleStrings;
57
58/*
59 * Accessor functions
60 */
61
62//TODO: The result is either APPLICATION or COMPONENT. These don't sound like actions,
63// so my explanation seems necessary. Murray.
68MimeActionType get_default_action_type(const Glib::ustring& mime_type);
69
74MimeApplication get_default_application(const Glib::ustring& mime_type);
75
80GnomeVFSMimeAction* get_default_action(const Glib::ustring& mime_type);
81
82// TODO: Figure out how the heck to wrap this Bonobo_ServerInfo thingy...
83//Removed from gnome-vfs: Bonobo_ServerInfo* get_default_component(const Glib::ustring& mime_type);
84
85//TODO: What determines whether an application is in the short list or the all list? Murray.
86//TODO: This is a list of pointers. Who deletes them? Murray
91ListHandleApps get_short_list_applications(const Glib::ustring& mime_type);
92
93//TODO: This is a list of pointers. Who deletes them? Murray.
98ListHandleApps get_all_applications(const Glib::ustring& mime_type);
99
100
101//Removed from gnome-vfs: ListHandleComps get_short_list_components(const Glib::ustring& mime_type);
102
103
104//Removed from gnome-vfs: ListHandleComps get_all_components(const Glib::ustring& mime_type);
105
106//TODO: If this is just a convenience function, then we should say so. Murray.
112bool id_in_application_list(const Glib::ustring& id, const ListHandleApps& applications);
113
114//TODO: If this is just a convenience function, then we should say so. Murray.
120
121
122//Removed from gnome-vfs: bool id_in_component_list(const Glib::ustring& iid, ListHandleComps components);
123//Removed from gnome-vfs: ListHandleStrings id_list_from_component_list(ListHandleComps components);
124
133Glib::ustring get_icon(const Glib::ustring& mime_type);
134
139Glib::ustring get_description(const Glib::ustring& mime_type);
140
146bool can_be_executable(const Glib::ustring& mime_type);
147
152bool type_is_known(const Glib::ustring& mime_type);
153
158ListHandleStrings get_extensions_list(const Glib::ustring& mime_type);
159
165Glib::ustring get_extensions_string(const Glib::ustring& mime_type, bool pretty = false);
166
171
172//TODO: What happens if the key is invalid? Murray.
173//TODO: What is a key? Murray.
174//TODO: What is a GnomeMimeContext? Murray.
175//TODO: What data does this return? Murray.
181Glib::ustring get_value(Glib::ustring& mime_type, Glib::ustring& key);
182
187ListHandleStrings get_key_list(Glib::ustring& mime_type);
188
189/*
190 * Mutator functions
191 * TODO: "Mutator" means nothing to me in this context. Murray.
192 */
193
198#ifdef GLIBMM_EXCEPTIONS_ENABLED
199void set_default_action_type(const Glib::ustring& mime_type, MimeActionType action_type) throw(exception);
200#else
201void set_default_action_type(const Glib::ustring& mime_type, MimeActionType action_type, std::auto_ptr<Gnome::Vfs::exception>& error);
202#endif //GLIBMM_EXCEPTIONS_ENABLED
203
208#ifdef GLIBMM_EXCEPTIONS_ENABLED
209void set_default_application(const Glib::ustring& mime_type, const Glib::ustring& application_id) throw(exception);
210#else
211void set_default_application(const Glib::ustring& mime_type, const Glib::ustring& application_id, std::auto_ptr<Gnome::Vfs::exception>& error);
212#endif //GLIBMM_EXCEPTIONS_ENABLED
213
218#ifdef GLIBMM_EXCEPTIONS_ENABLED
219void set_default_component(const Glib::ustring& mime_type, const Glib::ustring& iid) throw(exception);
220#else
221void set_default_component(const Glib::ustring& mime_type, const Glib::ustring& iid, std::auto_ptr<Gnome::Vfs::exception>& error);
222#endif //GLIBMM_EXCEPTIONS_ENABLED
223
231#ifdef GLIBMM_EXCEPTIONS_ENABLED
232void set_icon(const Glib::ustring& mime_type, const Glib::ustring& filename) throw(exception);
233#else
234void set_icon(const Glib::ustring& mime_type, const Glib::ustring& filename, std::auto_ptr<Gnome::Vfs::exception>& error);
235#endif //GLIBMM_EXCEPTIONS_ENABLED
236
242#ifdef GLIBMM_EXCEPTIONS_ENABLED
243void set_description(const Glib::ustring& mime_type, const Glib::ustring& description) throw(exception);
244#else
245void set_description(const Glib::ustring& mime_type, const Glib::ustring& description, std::auto_ptr<Gnome::Vfs::exception>& error);
246#endif //GLIBMM_EXCEPTIONS_ENABLED
247
252#ifdef GLIBMM_EXCEPTIONS_ENABLED
253void set_can_be_executable(const Glib::ustring& mime_type, bool new_value) throw(exception);
254#else
255void set_can_be_executable(const Glib::ustring& mime_type, bool new_value, std::auto_ptr<Gnome::Vfs::exception>& error);
256#endif //GLIBMM_EXCEPTIONS_ENABLED
257
263#ifdef GLIBMM_EXCEPTIONS_ENABLED
264void set_short_list_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception);
265#else
266void set_short_list_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids, std::auto_ptr<Gnome::Vfs::exception>& error);
267#endif //GLIBMM_EXCEPTIONS_ENABLED
268
274#ifdef GLIBMM_EXCEPTIONS_ENABLED
275void set_short_list_components(const Glib::ustring& mime_type, ListHandleStrings& component_iids) throw(exception);
276#else
277void set_short_list_components(const Glib::ustring& mime_type, ListHandleStrings& component_iids, std::auto_ptr<Gnome::Vfs::exception>& error);
278#endif //GLIBMM_EXCEPTIONS_ENABLED
279
285#ifdef GLIBMM_EXCEPTIONS_ENABLED
286void add_application_to_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id) throw(exception);
287#else
288void add_application_to_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id, std::auto_ptr<Gnome::Vfs::exception>& error);
289#endif //GLIBMM_EXCEPTIONS_ENABLED
290
296#ifdef GLIBMM_EXCEPTIONS_ENABLED
297void remove_application_from_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id) throw(exception);
298#else
299void remove_application_from_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id, std::auto_ptr<Gnome::Vfs::exception>& error);
300#endif //GLIBMM_EXCEPTIONS_ENABLED
301
307#ifdef GLIBMM_EXCEPTIONS_ENABLED
308void add_component_to_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid) throw(exception);
309#else
310void add_component_to_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid, std::auto_ptr<Gnome::Vfs::exception>& error);
311#endif //GLIBMM_EXCEPTIONS_ENABLED
312
318#ifdef GLIBMM_EXCEPTIONS_ENABLED
319void remove_component_from_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid) throw(exception);
320#else
321void remove_component_from_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid, std::auto_ptr<Gnome::Vfs::exception>& error);
322#endif //GLIBMM_EXCEPTIONS_ENABLED
323
328#ifdef GLIBMM_EXCEPTIONS_ENABLED
329void add_extension(const Glib::ustring& mime_type, Glib::ustring& extension) throw(exception);
330#else
331void add_extension(const Glib::ustring& mime_type, Glib::ustring& extension, std::auto_ptr<Gnome::Vfs::exception>& error);
332#endif //GLIBMM_EXCEPTIONS_ENABLED
333
338#ifdef GLIBMM_EXCEPTIONS_ENABLED
339void remove_extension(const Glib::ustring& mime_type, Glib::ustring& extension) throw(exception);
340#else
341void remove_extension(const Glib::ustring& mime_type, Glib::ustring& extension, std::auto_ptr<Gnome::Vfs::exception>& error);
342#endif //GLIBMM_EXCEPTIONS_ENABLED
343
349#ifdef GLIBMM_EXCEPTIONS_ENABLED
350void set_extensions_list(const Glib::ustring& mime_type, const Glib::ustring& extensions_list) throw(exception);
351#else
352void set_extensions_list(const Glib::ustring& mime_type, const Glib::ustring& extensions_list, std::auto_ptr<Gnome::Vfs::exception>& error);
353#endif //GLIBMM_EXCEPTIONS_ENABLED
354
359#ifdef GLIBMM_EXCEPTIONS_ENABLED
360void extend_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception);
361#else
362void extend_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids, std::auto_ptr<Gnome::Vfs::exception>& error);
363#endif //GLIBMM_EXCEPTIONS_ENABLED
364
369#ifdef GLIBMM_EXCEPTIONS_ENABLED
370void remove_from_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception);
371#else
372void remove_from_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids, std::auto_ptr<Gnome::Vfs::exception>& error);
373#endif //GLIBMM_EXCEPTIONS_ENABLED
374
379void registered_mime_type_delete(const Glib::ustring& mime_type);
380
386#ifdef GLIBMM_EXCEPTIONS_ENABLED
387void set_registered_type_key(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& data) throw(exception);
388#else
389void set_registered_type_key(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& data, std::auto_ptr<Gnome::Vfs::exception>& error);
390#endif //GLIBMM_EXCEPTIONS_ENABLED
391
398#ifdef GLIBMM_EXCEPTIONS_ENABLED
399void set_value(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& value) throw(exception);
400#else
401void set_value(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& value, std::auto_ptr<Gnome::Vfs::exception>& error);
402#endif //GLIBMM_EXCEPTIONS_ENABLED
403
404/*
405 * Mime Control
406 */
407
412void freeze();
413
416void thaw();
417
422
425void reset();
426
427} // namespace Mime
428} // namespace Vfs
429} // namespace Gnome
430
431#endif /* _LIBGNOMEVFSMM_MIME_HANDLERS_H */
Definition: mime-application.h:43
Definition: exception.h:34
MimeActionType
Definition: enums.h:580
void set_registered_type_key(const Glib::ustring &mime_type, const Glib::ustring &key, const Glib::ustring &data)
Set the key data for the registered MIME type's hash table.
void set_short_list_components(const Glib::ustring &mime_type, ListHandleStrings &component_iids)
Set the short list of components for the specified MIME type.
MimeActionType get_default_action_type(const Glib::ustring &mime_type)
Get a default action type for specified mime_type.
Glib::ustring get_value(Glib::ustring &mime_type, Glib::ustring &key)
Retrieve the value associated with key in the given GnomeMimeContext.
void set_extensions_list(const Glib::ustring &mime_type, const Glib::ustring &extensions_list)
Sets the extensions for a given mime type.
Glib::ustring get_icon(const Glib::ustring &mime_type)
Query the MIME database for an icon representing the specified MIME type.
void set_default_action_type(const Glib::ustring &mime_type, MimeActionType action_type)
Sets the default action type to be performed on files of the specified MIME type.
void freeze()
Freeze the MIME data so that you can do multiple updates to the data in one batch without needing to ...
GnomeVFSMimeAction * get_default_action(const Glib::ustring &mime_type)
Get the default action for specified mime_type.
void set_icon(const Glib::ustring &mime_type, const Glib::ustring &filename)
Set the icon entry for a particular MIME type in the MIME database.
ListHandleApps get_short_list_applications(const Glib::ustring &mime_type)
Get a short list of applications for specified mime_type.
void set_default_component(const Glib::ustring &mime_type, const Glib::ustring &iid)
Sets the default component to use with files of the specified MIME type.
ListHandleStrings get_extensions_list(const Glib::ustring &mime_type)
Get the file extensions associated with an MIME type.
Glib::ListHandle< Gnome::Vfs::MimeApplication * > ListHandleApps
Definition: mime-handlers.h:54
void reset()
Reset the user's MIME database to the system defaults.
Glib::ustring get_description(const Glib::ustring &mime_type)
Query the MIME database for a description of the specified MIME type.
ListHandleStrings get_key_list(Glib::ustring &mime_type)
Retrieve a list of all keys associated with mime_type.
ListHandleStrings get_registered_types()
Get a list of registered MIME types from the MIME database.
void remove_component_from_short_list(const Glib::ustring &mime_type, Glib::ustring &component_iid)
Remove a component from the short list for the specified MIME type.
void set_description(const Glib::ustring &mime_type, const Glib::ustring &description)
Set the description of this MIME type in the MIME database.
void extend_all_applications(const Glib::ustring &mime_type, ListHandleStrings &application_ids)
Register mime_type as being handled by all applications listed in application_ids.
void set_short_list_applications(const Glib::ustring &mime_type, ListHandleStrings &application_ids)
Set the short list of applications for the specified MIME type.
MimeApplication get_default_application(const Glib::ustring &mime_type)
Get the default application for specified mime_type.
void info_reload()
Reload the MIME database from disk.
void set_value(const Glib::ustring &mime_type, const Glib::ustring &key, const Glib::ustring &value)
Set the value associated with the key.
ListHandleStrings id_list_from_application_list(const ListHandleApps &applications)
Get a list of IDs corresponding to the applications in a list.
void thaw()
UnFreeze the MIME data after a freeze.
void set_can_be_executable(const Glib::ustring &mime_type, bool new_value)
Set whether files of this MIME type might conceivably be executable.
bool type_is_known(const Glib::ustring &mime_type)
Test to see if mime_type is in the MIME database at all.
void add_extension(const Glib::ustring &mime_type, Glib::ustring &extension)
Add a file extension to the specified MIME type in the database.
void remove_application_from_short_list(const Glib::ustring &mime_type, Glib::ustring &application_id)
Remove an application from the short list for the specified MIME type.
void remove_extension(const Glib::ustring &mime_type, Glib::ustring &extension)
Removes a file extension from the specified MIME type in the database.
void add_component_to_short_list(const Glib::ustring &mime_type, Glib::ustring &component_iid)
Add a component to the short list for the specified MIME type.
Glib::ustring get_extensions_string(const Glib::ustring &mime_type, bool pretty=false)
Retrieves the extensions associated with mime_type.
void registered_mime_type_delete(const Glib::ustring &mime_type)
Delete an MIME type for the user who runs this command.
bool id_in_application_list(const Glib::ustring &id, const ListHandleApps &applications)
Test if an application ID is in a list of applications.
void set_default_application(const Glib::ustring &mime_type, const Glib::ustring &application_id)
Sets the default application to run on files of the specified MIME type.
Glib::ListHandle< Glib::ustring > ListHandleStrings
Definition: mime-handlers.h:56
void remove_from_all_applications(const Glib::ustring &mime_type, ListHandleStrings &application_ids)
Remove mime_type as a handled type from every application in application_ids.
bool can_be_executable(const Glib::ustring &mime_type)
Test whether files of this MIME type might conceivably be executable.
void add_application_to_short_list(const Glib::ustring &mime_type, Glib::ustring &application_id)
Add an application to the short list for the specified MIME type.
ListHandleApps get_all_applications(const Glib::ustring &mime_type)
Get the entire list of applications for specified mime_type.
Definition: address.h:37