libgnomevfsmm 2.26.0
|
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 Lesser General Public 00005 * License as published by the Free Software Foundation; either 00006 * version 2.1 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 * Lesser General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser 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 /* 00030 * If the underlying GConf implementation does not use Orbit, then 00031 * stub out the return of functions which are Bonobo-specific 00032 */ 00033 #include <libgnomevfs/gnome-vfs-mime-handlers.h> 00034 #ifdef DISABLE_ORBIT 00035 typedef void Bonobo_ServerInfo; 00036 #endif 00037 00038 namespace Gnome 00039 { 00040 00041 namespace Vfs 00042 { 00043 00044 //TODO: Explain when/how someone might use this stuff. 00045 //TODO: Consider renaming this to MimeDatabase or something similar. Murray. 00046 //e.g. Direct people to 00047 //- get_registered_types() to discover all MIME types. 00048 //- get_description() to get a human-readable description of a MIME type. 00049 //- get_all_applications() to get a list of applications that can handle the MIME type. 00050 //TODO: Tell them how to get the MIME type for a file. 00051 namespace Mime 00052 { 00053 00054 typedef Glib::ListHandle<Gnome::Vfs::MimeApplication*> ListHandleApps; 00055 //Removed from gnome-vfs: typedef GList* ListHandleComps; 00056 typedef Glib::ListHandle<Glib::ustring> ListHandleStrings; 00057 00058 /* 00059 * Accessor functions 00060 */ 00061 00062 //TODO: The result is either APPLICATION or COMPONENT. These don't sound like actions, 00063 // so my explanation seems necessary. Murray. 00068 MimeActionType get_default_action_type(const Glib::ustring& mime_type); 00069 00074 MimeApplication get_default_application(const Glib::ustring& mime_type); 00075 00080 GnomeVFSMimeAction* get_default_action(const Glib::ustring& mime_type); 00081 00082 // TODO: Figure out how the heck to wrap this Bonobo_ServerInfo thingy... 00083 //Removed from gnome-vfs: Bonobo_ServerInfo* get_default_component(const Glib::ustring& mime_type); 00084 00085 //TODO: What determines whether an application is in the short list or the all list? Murray. 00086 //TODO: This is a list of pointers. Who deletes them? Murray 00091 ListHandleApps get_short_list_applications(const Glib::ustring& mime_type); 00092 00093 //TODO: This is a list of pointers. Who deletes them? Murray. 00098 ListHandleApps get_all_applications(const Glib::ustring& mime_type); 00099 00100 00101 //Removed from gnome-vfs: ListHandleComps get_short_list_components(const Glib::ustring& mime_type); 00102 00103 00104 //Removed from gnome-vfs: ListHandleComps get_all_components(const Glib::ustring& mime_type); 00105 00106 //TODO: If this is just a convenience function, then we should say so. Murray. 00112 bool id_in_application_list(const Glib::ustring& id, const ListHandleApps& applications); 00113 00114 //TODO: If this is just a convenience function, then we should say so. Murray. 00119 ListHandleStrings id_list_from_application_list(const ListHandleApps& applications); 00120 00121 00122 //Removed from gnome-vfs: bool id_in_component_list(const Glib::ustring& iid, ListHandleComps components); 00123 //Removed from gnome-vfs: ListHandleStrings id_list_from_component_list(ListHandleComps components); 00124 00133 Glib::ustring get_icon(const Glib::ustring& mime_type); 00134 00139 Glib::ustring get_description(const Glib::ustring& mime_type); 00140 00146 bool can_be_executable(const Glib::ustring& mime_type); 00147 00152 bool type_is_known(const Glib::ustring& mime_type); 00153 00158 ListHandleStrings get_extensions_list(const Glib::ustring& mime_type); 00159 00165 Glib::ustring get_extensions_string(const Glib::ustring& mime_type, bool pretty = false); 00166 00170 ListHandleStrings get_registered_types(); 00171 00172 //TODO: What happens if the key is invalid? Murray. 00173 //TODO: What is a key? Murray. 00174 //TODO: What is a GnomeMimeContext? Murray. 00175 //TODO: What data does this return? Murray. 00181 Glib::ustring get_value(Glib::ustring& mime_type, Glib::ustring& key); 00182 00187 ListHandleStrings get_key_list(Glib::ustring& mime_type); 00188 00189 /* 00190 * Mutator functions 00191 * TODO: "Mutator" means nothing to me in this context. Murray. 00192 */ 00193 00198 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00199 void set_default_action_type(const Glib::ustring& mime_type, MimeActionType action_type) throw(exception); 00200 #else 00201 void set_default_action_type(const Glib::ustring& mime_type, MimeActionType action_type, std::auto_ptr<Gnome::Vfs::exception>& error); 00202 #endif //GLIBMM_EXCEPTIONS_ENABLED 00203 00208 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00209 void set_default_application(const Glib::ustring& mime_type, const Glib::ustring& application_id) throw(exception); 00210 #else 00211 void set_default_application(const Glib::ustring& mime_type, const Glib::ustring& application_id, std::auto_ptr<Gnome::Vfs::exception>& error); 00212 #endif //GLIBMM_EXCEPTIONS_ENABLED 00213 00218 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00219 void set_default_component(const Glib::ustring& mime_type, const Glib::ustring& iid) throw(exception); 00220 #else 00221 void set_default_component(const Glib::ustring& mime_type, const Glib::ustring& iid, std::auto_ptr<Gnome::Vfs::exception>& error); 00222 #endif //GLIBMM_EXCEPTIONS_ENABLED 00223 00231 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00232 void set_icon(const Glib::ustring& mime_type, const Glib::ustring& filename) throw(exception); 00233 #else 00234 void set_icon(const Glib::ustring& mime_type, const Glib::ustring& filename, std::auto_ptr<Gnome::Vfs::exception>& error); 00235 #endif //GLIBMM_EXCEPTIONS_ENABLED 00236 00242 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00243 void set_description(const Glib::ustring& mime_type, const Glib::ustring& description) throw(exception); 00244 #else 00245 void set_description(const Glib::ustring& mime_type, const Glib::ustring& description, std::auto_ptr<Gnome::Vfs::exception>& error); 00246 #endif //GLIBMM_EXCEPTIONS_ENABLED 00247 00252 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00253 void set_can_be_executable(const Glib::ustring& mime_type, bool new_value) throw(exception); 00254 #else 00255 void set_can_be_executable(const Glib::ustring& mime_type, bool new_value, std::auto_ptr<Gnome::Vfs::exception>& error); 00256 #endif //GLIBMM_EXCEPTIONS_ENABLED 00257 00263 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00264 void set_short_list_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception); 00265 #else 00266 void set_short_list_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids, std::auto_ptr<Gnome::Vfs::exception>& error); 00267 #endif //GLIBMM_EXCEPTIONS_ENABLED 00268 00274 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00275 void set_short_list_components(const Glib::ustring& mime_type, ListHandleStrings& component_iids) throw(exception); 00276 #else 00277 void set_short_list_components(const Glib::ustring& mime_type, ListHandleStrings& component_iids, std::auto_ptr<Gnome::Vfs::exception>& error); 00278 #endif //GLIBMM_EXCEPTIONS_ENABLED 00279 00285 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00286 void add_application_to_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id) throw(exception); 00287 #else 00288 void add_application_to_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id, std::auto_ptr<Gnome::Vfs::exception>& error); 00289 #endif //GLIBMM_EXCEPTIONS_ENABLED 00290 00296 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00297 void remove_application_from_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id) throw(exception); 00298 #else 00299 void remove_application_from_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id, std::auto_ptr<Gnome::Vfs::exception>& error); 00300 #endif //GLIBMM_EXCEPTIONS_ENABLED 00301 00307 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00308 void add_component_to_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid) throw(exception); 00309 #else 00310 void add_component_to_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid, std::auto_ptr<Gnome::Vfs::exception>& error); 00311 #endif //GLIBMM_EXCEPTIONS_ENABLED 00312 00318 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00319 void remove_component_from_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid) throw(exception); 00320 #else 00321 void remove_component_from_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid, std::auto_ptr<Gnome::Vfs::exception>& error); 00322 #endif //GLIBMM_EXCEPTIONS_ENABLED 00323 00328 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00329 void add_extension(const Glib::ustring& mime_type, Glib::ustring& extension) throw(exception); 00330 #else 00331 void add_extension(const Glib::ustring& mime_type, Glib::ustring& extension, std::auto_ptr<Gnome::Vfs::exception>& error); 00332 #endif //GLIBMM_EXCEPTIONS_ENABLED 00333 00338 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00339 void remove_extension(const Glib::ustring& mime_type, Glib::ustring& extension) throw(exception); 00340 #else 00341 void remove_extension(const Glib::ustring& mime_type, Glib::ustring& extension, std::auto_ptr<Gnome::Vfs::exception>& error); 00342 #endif //GLIBMM_EXCEPTIONS_ENABLED 00343 00349 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00350 void set_extensions_list(const Glib::ustring& mime_type, const Glib::ustring& extensions_list) throw(exception); 00351 #else 00352 void set_extensions_list(const Glib::ustring& mime_type, const Glib::ustring& extensions_list, std::auto_ptr<Gnome::Vfs::exception>& error); 00353 #endif //GLIBMM_EXCEPTIONS_ENABLED 00354 00359 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00360 void extend_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception); 00361 #else 00362 void extend_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids, std::auto_ptr<Gnome::Vfs::exception>& error); 00363 #endif //GLIBMM_EXCEPTIONS_ENABLED 00364 00369 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00370 void remove_from_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception); 00371 #else 00372 void remove_from_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids, std::auto_ptr<Gnome::Vfs::exception>& error); 00373 #endif //GLIBMM_EXCEPTIONS_ENABLED 00374 00379 void registered_mime_type_delete(const Glib::ustring& mime_type); 00380 00386 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00387 void set_registered_type_key(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& data) throw(exception); 00388 #else 00389 void set_registered_type_key(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& data, std::auto_ptr<Gnome::Vfs::exception>& error); 00390 #endif //GLIBMM_EXCEPTIONS_ENABLED 00391 00398 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00399 void set_value(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& value) throw(exception); 00400 #else 00401 void set_value(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& value, std::auto_ptr<Gnome::Vfs::exception>& error); 00402 #endif //GLIBMM_EXCEPTIONS_ENABLED 00403 00404 /* 00405 * Mime Control 00406 */ 00407 00412 void freeze(); 00413 00416 void thaw(); 00417 00421 void info_reload(); 00422 00425 void reset(); 00426 00427 } // namespace Mime 00428 } // namespace Vfs 00429 } // namespace Gnome 00430 00431 #endif /* _LIBGNOMEVFSMM_MIME_HANDLERS_H */