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 //Removed from gnome-vfs: typedef GList* ListHandleComps;
00047 typedef Glib::ListHandle<Glib::ustring> ListHandleStrings;
00048 
00049 /*
00050  * Accessor functions
00051  */
00052 
00053 //TODO: The result is either APPLICATION or COMPONENT. These don't sound like actions,
00054 //      so my explanation seems necessary. Murray.
00059 MimeActionType get_default_action_type(const Glib::ustring& mime_type);
00060 
00065 MimeApplication get_default_application(const Glib::ustring& mime_type);
00066 
00071 GnomeVFSMimeAction* get_default_action(const Glib::ustring& mime_type);
00072 
00073 // TODO: Figure out how the heck to wrap this Bonobo_ServerInfo thingy...
00074 //Removed from gnome-vfs: Bonobo_ServerInfo* get_default_component(const Glib::ustring& mime_type);
00075 
00076 //TODO: What determines whether an application is in the short list or the all list? Murray.
00077 //TODO: This is a list of pointers. Who deletes them? Murray
00082 ListHandleApps get_short_list_applications(const Glib::ustring& mime_type);
00083 
00084 //TODO: This is a list of pointers. Who deletes them? Murray.
00089 ListHandleApps get_all_applications(const Glib::ustring& mime_type);
00090 
00091 
00092 //Removed from gnome-vfs: ListHandleComps get_short_list_components(const Glib::ustring& mime_type);
00093 
00094 
00095 //Removed from gnome-vfs: ListHandleComps get_all_components(const Glib::ustring& mime_type);
00096 
00097 //TODO: If this is just a convenience function, then we should say so. Murray.
00103 bool id_in_application_list(const Glib::ustring& id, const ListHandleApps& applications);
00104 
00105 //TODO: If this is just a convenience function, then we should say so. Murray.
00110 ListHandleStrings id_list_from_application_list(const ListHandleApps& applications);
00111 
00112 
00113 //Removed from gnome-vfs: bool id_in_component_list(const Glib::ustring& iid, ListHandleComps components);
00114 //Removed from gnome-vfs: ListHandleStrings id_list_from_component_list(ListHandleComps components);
00115 
00124 Glib::ustring get_icon(const Glib::ustring& mime_type);
00125 
00130 Glib::ustring get_description(const Glib::ustring& mime_type);
00131 
00137 bool can_be_executable(const Glib::ustring& mime_type);
00138 
00143 bool type_is_known(const Glib::ustring& mime_type);
00144 
00149 ListHandleStrings get_extensions_list(const Glib::ustring& mime_type);
00150 
00156 Glib::ustring get_extensions_string(const Glib::ustring& mime_type, bool pretty = false);
00157 
00161 ListHandleStrings get_registered_types();
00162 
00163 //TODO: What happens if the key is invalid? Murray.
00164 //TODO: What is a key? Murray.
00165 //TODO: What is a GnomeMimeContext? Murray.
00166 //TODO: What data does this return? Murray.
00172 Glib::ustring get_value(Glib::ustring& mime_type, Glib::ustring& key);
00173 
00178 ListHandleStrings get_key_list(Glib::ustring& mime_type);
00179 
00180 /*
00181  * Mutator functions
00182  * TODO: "Mutator" means nothing to me in this context. Murray.
00183  */
00184 
00189 void set_default_action_type(const Glib::ustring& mime_type, MimeActionType action_type) throw(exception);
00190 
00195 void set_default_application(const Glib::ustring& mime_type, const Glib::ustring& application_id) throw(exception);
00196 
00201 void set_default_component(const Glib::ustring& mime_type, const Glib::ustring& iid) throw(exception);
00202 
00210 void set_icon(const Glib::ustring& mime_type, const Glib::ustring& filename) throw(exception);
00211 
00217 void set_description(const Glib::ustring& mime_type, const Glib::ustring& description) throw(exception);
00218 
00223 void set_can_be_executable(const Glib::ustring& mime_type, bool new_value) throw(exception);
00224 
00230 void set_short_list_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception);
00231 
00237 void set_short_list_components(const Glib::ustring& mime_type, ListHandleStrings& component_iids) throw(exception);
00238 
00244 void add_application_to_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id) throw(exception);
00245 
00251 void remove_application_from_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id) throw(exception);
00252 
00258 void add_component_to_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid) throw(exception);
00259 
00265 void remove_component_from_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid) throw(exception);
00266 
00271 void add_extension(const Glib::ustring& mime_type, Glib::ustring& extension) throw(exception);
00272 
00277 void remove_extension(const Glib::ustring& mime_type, Glib::ustring& extension) throw(exception);
00278 
00284 void set_extensions_list(const Glib::ustring& mime_type, const Glib::ustring& extensions_list) throw(exception);
00285 
00290 void extend_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception);
00291 
00296 void remove_from_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception);
00297 
00302 void registered_mime_type_delete(const Glib::ustring& mime_type);
00303 
00309 void set_registered_type_key(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& data) throw(exception);
00310 
00317 void set_value(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& value) throw(exception);
00318 
00319 /*
00320  * Mime Control
00321  */
00322 
00327 void freeze();
00328 
00331 void thaw();
00332 
00336 void info_reload();
00337 
00340 void reset();
00341 
00342 } // namespace Mime
00343 } // namespace Vfs
00344 } // namespace Gnome
00345 
00346 #endif /* _LIBGNOMEVFSMM_MIME_HANDLERS_H */

Generated on Tue Aug 22 09:07:07 2006 for libgnomevfsmm by  doxygen 1.4.7