libgnomevfsmm  2.26.0
application-registry.h
Go to the documentation of this file.
1 /* $Id: application-registry.h 2019 2009-01-27 08:29:42Z murrayc $ */
2 
3 /* Copyright 2003 gnome-vfsmm Development Team
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 
21 #ifndef _LIBGNOMEVFSMM_APPLICATION_REGISTRY_H
22 #define _LIBGNOMEVFSMM_APPLICATION_REGISTRY_H
23 
24 #include <glibmm.h>
25 
26 #include <libgnomevfsmm/enums.h>
29 #include <libgnomevfs/gnome-vfs-application-registry.h>
30 
31 
32 namespace Gnome
33 {
34 
35 namespace Vfs
36 {
37 
38 //TODO: Some explanation of how/when this might be used.
39 //TODO: There seems to be some duplication of functinoality between here and the Mime namespace.
40 //At first glance it seems like something that would be used by the GNOME file-types control panel, and nothing else. Murray.
41 namespace ApplicationRegistry
42 {
43 
44 typedef Glib::ListHandle<Glib::ustring> ListHandleStrings;
45 
46 
52 bool exists(const Glib::ustring& app_id);
53 
54 //TODO: Explain what a key is? Why does each application have keys? Murray.
55 
61 ListHandleStrings get_keys(const Glib::ustring& app_id);
62 
69 Glib::ustring peek_value(const Glib::ustring& app_id, const Glib::ustring& key);
70 
71 //TODO: "the structure pointed to by @a app_id" doesn't make much sense here. Is it an application or a structure? Murray.
72 //TODO: This looks like a simple convenience method. If so, it should say so.
73 //TODO: Why does this have the got_key() method, but peek_value() doesn't.
74 //TODO: Should peek_value() be called get_value()?
82 bool get_bool_value(const Glib::ustring& app_id, const Glib::ustring& key, bool& got_key);
83 
89 void remove_application(const Glib::ustring& app_id);
90 
98 void set_value(const Glib::ustring& app_id, const Glib::ustring& key, const Glib::ustring& value);
99 
100 //TODO: Consider calling sync() automatically - we need to investigate possible performance problems of doing this. Murray.
101 //TODO: The default argument here is only appropriate if a bool is more likely to be used than any other type,
102 // and if so we should have bool get_value() and string get_string_value().
110 void set_value(const Glib::ustring& app_id, const Glib::ustring& key, bool value = true);
111 
112 //TODO: Say what would happen when get_value() is then used.
119 void unset_key(const Glib::ustring& app_id, const Glib::ustring& key);
120 
121 /*
122  * Query functions
123  */
124 
130 ListHandleStrings get_applications(const Glib::ustring& mime_type);
131 
137 ListHandleStrings get_mime_types(const Glib::ustring& app_id);
138 
145 bool supports_mime_type(const Glib::ustring& app_id, const Glib::ustring& mime_type);
146 
154 bool supports_uri_scheme(const Glib::ustring& app_id, const Glib::ustring& uri_scheme);
155 
156 /*
157  * Mime type functions
158  * Note that mime_type can be a specific(image/png) or generic (image/<star>) type
159  */
160 
166 void clear_mime_types(const Glib::ustring& app_id);
167 
174 void add_mime_type(const Glib::ustring& app_id, const Glib::ustring& mime_type);
175 
182 void remove_mime_type(const Glib::ustring& app_id, const Glib::ustring& mime_type);
183 
184 
188 #ifdef GLIBMM_EXCEPTIONS_ENABLED
189 void sync() throw(exception);
190 #else
191 void sync(std::auto_ptr<Gnome::Vfs::exception>& error);
192 #endif
193 
194 //TODO: What does "free resources" mean. Are we blocking another application from doing the same thing?
195 // How is this different to sync()? Do we need to do both? Murray
198 void shutdown();
199 
200 //TODO: So, when would we need to call this? Murray.
204 void reload();
205 
206 /*
207  * Integrating with gnome-vfs-mime-handlers
208  */
209 
210 //TODO: How is a MimeApplication different to an Application? Murray.
216 MimeApplication get_mime_application(const Glib::ustring& app_id);
217 
221 void save_mime_application(const MimeApplication& application);
222 
223 } //namespace ApplicationRegistry
224 
225 } // namespace Vfs
226 } // namespace Gnome
227 
228 
229 
230 
231 #endif /* _LIBGNOMEVFSMM_APPLICATION_REGISTRY_H */
232