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
32namespace Gnome
33{
34
35namespace 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.
41namespace ApplicationRegistry
42{
43
44typedef Glib::ListHandle<Glib::ustring> ListHandleStrings;
45
46
52bool exists(const Glib::ustring& app_id);
53
54//TODO: Explain what a key is? Why does each application have keys? Murray.
55
61ListHandleStrings get_keys(const Glib::ustring& app_id);
62
69Glib::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()?
82bool get_bool_value(const Glib::ustring& app_id, const Glib::ustring& key, bool& got_key);
83
89void remove_application(const Glib::ustring& app_id);
90
98void 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().
110void 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.
119void unset_key(const Glib::ustring& app_id, const Glib::ustring& key);
120
121/*
122 * Query functions
123 */
124
130ListHandleStrings get_applications(const Glib::ustring& mime_type);
131
137ListHandleStrings get_mime_types(const Glib::ustring& app_id);
138
145bool supports_mime_type(const Glib::ustring& app_id, const Glib::ustring& mime_type);
146
154bool 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
166void clear_mime_types(const Glib::ustring& app_id);
167
174void add_mime_type(const Glib::ustring& app_id, const Glib::ustring& mime_type);
175
182void remove_mime_type(const Glib::ustring& app_id, const Glib::ustring& mime_type);
183
184
188#ifdef GLIBMM_EXCEPTIONS_ENABLED
189void sync() throw(exception);
190#else
191void 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
198void shutdown();
199
200//TODO: So, when would we need to call this? Murray.
204void reload();
205
206/*
207 * Integrating with gnome-vfs-mime-handlers
208 */
209
210//TODO: How is a MimeApplication different to an Application? Murray.
216MimeApplication get_mime_application(const Glib::ustring& app_id);
217
221void 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
Definition: mime-application.h:43
Definition: exception.h:34
ListHandleStrings get_applications(const Glib::ustring &mime_type)
Get all application IDs from the registry that are associated with the given MIME type.
bool exists(const Glib::ustring &app_id)
Check to see if there is an entry for app_id in the registry.
ListHandleStrings get_keys(const Glib::ustring &app_id)
Get a list of keys for a specified application in the registry.
void unset_key(const Glib::ustring &app_id, const Glib::ustring &key)
Wipe the current value that key contains for app_id.
void add_mime_type(const Glib::ustring &app_id, const Glib::ustring &mime_type)
Associate an MIME type with an application.
void clear_mime_types(const Glib::ustring &app_id)
Remove the MIME types associated with an application.
Glib::ListHandle< Glib::ustring > ListHandleStrings
Definition: application-registry.h:44
bool get_bool_value(const Glib::ustring &app_id, const Glib::ustring &key, bool &got_key)
Look up a key in the structure pointed to by app_id and return the boolean value of that key.
void shutdown()
Synchronize the application registry data to disk and free resources.
void reload()
If this function is called for the first time, it will initialize the registry.
Glib::ustring peek_value(const Glib::ustring &app_id, const Glib::ustring &key)
Get the value associated with key for app_id in the registry.
void remove_application(const Glib::ustring &app_id)
Remove the application represented by app_id from the registry.
ListHandleStrings get_mime_types(const Glib::ustring &app_id)
Get all MIME types that can be handled by an application.
MimeApplication get_mime_application(const Glib::ustring &app_id)
Get the MimeApplication associated with app_id .
bool supports_mime_type(const Glib::ustring &app_id, const Glib::ustring &mime_type)
Checks whether an application is associated with a given MIME type.
void sync()
This function will sync the registry.
void save_mime_application(const MimeApplication &application)
Save an application to the registry that will be associated with a defined MIME type.
bool supports_uri_scheme(const Glib::ustring &app_id, const Glib::ustring &uri_scheme)
Checks whether an application supports the given URI scheme.
void remove_mime_type(const Glib::ustring &app_id, const Glib::ustring &mime_type)
De-Associate an MIME type from an application.
void set_value(const Glib::ustring &app_id, const Glib::ustring &key, const Glib::ustring &value)
Set values pertaining to the registry entry pointed to by app_id.
Definition: address.h:37