00001 /* $Id: application-registry.h,v 1.4 2003/07/16 05:34:55 murrayc Exp $ */ 00002 00003 /* Copyright 2003 gnome-vfsmm Development Team 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public 00016 * License along with this library; if not, write to the Free 00017 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 00021 #ifndef _LIBGNOMEVFSMM_APPLICATION_REGISTRY_H 00022 #define _LIBGNOMEVFSMM_APPLICATION_REGISTRY_H 00023 00024 #include <glibmm.h> 00025 00026 #include <libgnomevfsmm/enums.h> 00027 #include <libgnomevfsmm/exception.h> 00028 #include <libgnomevfsmm/mime-application.h> 00029 #include <libgnomevfs/gnome-vfs-application-registry.h> 00030 00031 00032 namespace Gnome 00033 { 00034 00035 namespace Vfs 00036 { 00037 00038 //TODO: Some explanation of how/when this might be used. 00039 //TODO: There seems to be some duplication of functinoality between here and the Mime namespace. 00040 //At first glance it seems like something that would be used by the GNOME file-types control panel, and nothing else. Murray. 00041 namespace ApplicationRegistry 00042 { 00043 00044 typedef Glib::ListHandle<Glib::ustring> ListHandleStrings; 00045 00046 00052 bool exists(const Glib::ustring& app_id); 00053 00054 //TODO: Explain what a key is? Why does each application have keys? Murray. 00055 00061 ListHandleStrings get_keys(const Glib::ustring& app_id); 00062 00069 Glib::ustring peek_value(const Glib::ustring& app_id, const Glib::ustring& key); 00070 00071 //TODO: "the structure pointed to by @a app_id" doesn't make much sense here. Is it an application or a structure? Murray. 00072 //TODO: This looks like a simple convenience method. If so, it should say so. 00073 //TODO: Why does this have the got_key() method, but peek_value() doesn't. 00074 //TODO: Should peek_value() be called get_value()? 00082 bool get_bool_value(const Glib::ustring& app_id, const Glib::ustring& key, bool& got_key); 00083 00089 void remove_application(const Glib::ustring& app_id); 00090 00098 void set_value(const Glib::ustring& app_id, const Glib::ustring& key, const Glib::ustring& value); 00099 00100 //TODO: Consider calling sync() automatically - we need to investigate possible performance problems of doing this. Murray. 00101 //TODO: The default argument here is only appropriate if a bool is more likely to be used than any other type, 00102 // and if so we should have bool get_value() and string get_string_value(). 00110 void set_value(const Glib::ustring& app_id, const Glib::ustring& key, bool value = true); 00111 00112 //TODO: Say what would happen when get_value() is then used. 00119 void unset_key(const Glib::ustring& app_id, const Glib::ustring& key); 00120 00121 /* 00122 * Query functions 00123 */ 00124 00130 ListHandleStrings get_applications(const Glib::ustring& mime_type); 00131 00137 ListHandleStrings get_mime_types(const Glib::ustring& app_id); 00138 00145 bool supports_mime_type(const Glib::ustring& app_id, const Glib::ustring& mime_type); 00146 00154 bool supports_uri_scheme(const Glib::ustring& app_id, const Glib::ustring& uri_scheme); 00155 00156 /* 00157 * Mime type functions 00158 * Note that mime_type can be a specific(image/png) or generic (image/<star>) type 00159 */ 00160 00166 void clear_mime_types(const Glib::ustring& app_id); 00167 00174 void add_mime_type(const Glib::ustring& app_id, const Glib::ustring& mime_type); 00175 00182 void remove_mime_type(const Glib::ustring& app_id, const Glib::ustring& mime_type); 00183 00184 00188 void sync() throw(exception); 00189 00190 //TODO: What does "free resources" mean. Are we blocking another application from doing the same thing? 00191 // How is this different to sync()? Do we need to do both? Murray 00194 void shutdown(); 00195 00196 //TODO: So, when would we need to call this? Murray. 00200 void reload(); 00201 00202 /* 00203 * Integrating with gnome-vfs-mime-handlers 00204 */ 00205 00206 //TODO: How is a MimeApplication different to an Application? Murray. 00212 MimeApplication get_mime_application(const Glib::ustring& app_id); 00213 00217 void save_mime_application(const MimeApplication& application); 00218 00219 } //namespace ApplicationRegistry 00220 00221 } // namespace Vfs 00222 } // namespace Gnome 00223 00224 00225 00226 00227 #endif /* _LIBGNOMEVFSMM_APPLICATION_REGISTRY_H */ 00228