Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members

mime-handlers.h

Go to the documentation of this file.
00001 /* Copyright 2003 gnome-vfsmm Development Team
00002  *
00003  * This library is free software; you can redistribute it and/or
00004  * modify it under the terms of the GNU Library General Public
00005  * License as published by the Free Software Foundation; either
00006  * version 2 of the License, or (at your option) any later version.
00007  *
00008  * This library is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * Library General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU Library General Public
00014  * License along with this library; if not, write to the Free
00015  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00016  */
00017 
00018 
00019 #ifndef _LIBGNOMEVFSMM_MIME_HANDLERS_H
00020 #define _LIBGNOMEVFSMM_MIME_HANDLERS_H
00021 
00022 #include <glibmm.h>
00023 
00024 #include <libgnomevfsmm/enums.h>
00025 #include <libgnomevfsmm/exception.h>
00026 #include <libgnomevfsmm/mime-application.h>
00027 #include <libgnomevfsmm/mime-action.h>
00028 
00029 namespace Gnome
00030 {
00031 
00032 namespace Vfs
00033 {
00034 
00035 //TODO: Explain when/how someone might use this stuff.
00036 //TODO: Consider renaming this to MimeDatabase or something similar. Murray.
00037 //e.g. Direct people to
00038 //- get_registered_types() to discover all MIME types.
00039 //- get_description() to get a human-readable description of a MIME type.
00040 //- get_all_applications() to get a list of applications that can handle the MIME type.
00041 //TODO: Tell them how to get the MIME type for a file.
00042 namespace Mime
00043 {
00044 
00045 typedef Glib::ListHandle<Gnome::Vfs::MimeApplication*> ListHandleApps;
00046 // TODO: once Bonobo_ServerInfo is wrapped, I can change this to the C++ equivalent...
00047 typedef GList* ListHandleComps;
00048 typedef Glib::ListHandle<Glib::ustring> ListHandleStrings;
00049 
00050 /*
00051  * Accessor functions
00052  */
00053 
00054 //TODO: The result is either APPLICATION or COMPONENT. These don't sound like actions,
00055 //      so my explanation seems necessary. Murray.
00060 MimeActionType get_default_action_type(const Glib::ustring& mime_type);
00061 
00066 MimeApplication get_default_application(const Glib::ustring& mime_type);
00067 
00072 GnomeVFSMimeAction* get_default_action(const Glib::ustring& mime_type);
00073 
00074 // TODO: Figure out how the heck to wrap this Bonobo_ServerInfo thingy...
00075 Bonobo_ServerInfo* get_default_component(const Glib::ustring& mime_type);
00076 
00077 //TODO: What determines whether an application is in the short list or the all list? Murray.
00078 //TODO: This is a list of pointers. Who deletes them? Murray
00083 ListHandleApps get_short_list_applications(const Glib::ustring& mime_type);
00084 
00085 //TODO: This is a list of pointers. Who deletes them? Murray.
00090 ListHandleApps get_all_applications(const Glib::ustring& mime_type);
00091 
00096 ListHandleComps get_short_list_components(const Glib::ustring& mime_type);
00097 
00102 ListHandleComps get_all_components(const Glib::ustring& mime_type);
00103 
00104 //TODO: If this is just a convenience function, then we should say so. Murray.
00110 bool id_in_application_list(const Glib::ustring& id, const ListHandleApps& applications);
00111 
00112 //TODO: If this is just a convenience function, then we should say so. Murray.
00117 ListHandleStrings id_list_from_application_list(const ListHandleApps& applications);
00118 
00119 //TODO: If this is just a convenience function, then we should say so. Murray.
00125 bool id_in_component_list(const Glib::ustring& iid, ListHandleComps components);
00126 
00127 //TODO: If this is just a convenience function, then we should say so. Murray.
00132 ListHandleStrings id_list_from_component_list(ListHandleComps components);
00133 
00142 Glib::ustring get_icon(const Glib::ustring& mime_type);
00143 
00148 Glib::ustring get_description(const Glib::ustring& mime_type);
00149 
00155 bool can_be_executable(const Glib::ustring& mime_type);
00156 
00161 bool type_is_known(const Glib::ustring& mime_type);
00162 
00167 ListHandleStrings get_extensions_list(const Glib::ustring& mime_type);
00168 
00174 Glib::ustring get_extensions_string(const Glib::ustring& mime_type, bool pretty = false);
00175 
00179 ListHandleStrings get_registered_types();
00180 
00181 //TODO: What happens if the key is invalid? Murray.
00182 //TODO: What is a key? Murray.
00183 //TODO: What is a GnomeMimeContext? Murray.
00184 //TODO: What data does this return? Murray.
00190 Glib::ustring get_value(Glib::ustring& mime_type, Glib::ustring& key);
00191 
00196 ListHandleStrings get_key_list(Glib::ustring& mime_type);
00197 
00198 /*
00199  * Mutator functions
00200  * TODO: "Mutator" means nothing to me in this context. Murray.
00201  */
00202 
00207 void set_default_action_type(const Glib::ustring& mime_type, MimeActionType action_type) throw(exception);
00208 
00213 void set_default_application(const Glib::ustring& mime_type, const Glib::ustring& application_id) throw(exception);
00214 
00219 void set_default_component(const Glib::ustring& mime_type, const Glib::ustring& iid) throw(exception);
00220 
00228 void set_icon(const Glib::ustring& mime_type, const Glib::ustring& filename) throw(exception);
00229 
00235 void set_description(const Glib::ustring& mime_type, const Glib::ustring& description) throw(exception);
00236 
00241 void set_can_be_executable(const Glib::ustring& mime_type, bool new_value) throw(exception);
00242 
00248 void set_short_list_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception);
00249 
00255 void set_short_list_components(const Glib::ustring& mime_type, ListHandleStrings& component_iids) throw(exception);
00256 
00262 void add_application_to_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id) throw(exception);
00263 
00269 void remove_application_from_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id) throw(exception);
00270 
00276 void add_component_to_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid) throw(exception);
00277 
00283 void remove_component_from_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid) throw(exception);
00284 
00289 void add_extension(const Glib::ustring& mime_type, Glib::ustring& extension) throw(exception);
00290 
00295 void remove_extension(const Glib::ustring& mime_type, Glib::ustring& extension) throw(exception);
00296 
00302 void set_extensions_list(const Glib::ustring& mime_type, const Glib::ustring& extensions_list) throw(exception);
00303 
00308 void extend_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception);
00309 
00314 void remove_from_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception);
00315 
00320 void registered_mime_type_delete(const Glib::ustring& mime_type);
00321 
00327 void set_registered_type_key(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& data) throw(exception);
00328 
00335 void set_value(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& value) throw(exception);
00336 
00337 /*
00338  * Mime Control
00339  */
00340 
00345 void freeze();
00346 
00349 void thaw();
00350 
00354 void info_reload();
00355 
00358 void reset();
00359 
00360 } // namespace Mime
00361 } // namespace Vfs
00362 } // namespace Gnome
00363 
00364 #endif /* _LIBGNOMEVFSMM_MIME_HANDLERS_H */

Generated on Mon Apr 5 17:43:41 2004 for libgnomevfsmm by doxygen 1.3.6-20040222