summaryrefslogtreecommitdiff
path: root/gio/src/settingsschema.hg
blob: e4fd8d5bed626d6caaecaad77bc31c0c16e1c9fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* Copyright (C) 2015 The giomm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

_CONFIGINCLUDE(giommconfig.h)

#include <giomm/settingsschemakey.h>

_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)

#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GSettingsSchema GSettingsSchema;
#endif

namespace Gio
{

//TODO: Translate more of the class documentation from the C docs.

/** Introspecting and controlling the loading of GSettings schemas.
 *
 * The SettingsSchemaSource and SettingsSchema APIs provide a
 * mechanism for advanced control over the loading of schemas and a
 * mechanism for introspecting their content.
 *
 * Plugin loading systems that wish to provide plugins a way to access
 * settings face the problem of how to make the schemas for these
 * settings visible to GSettings.  Typically, a plugin will want to ship
 * the schema along with itself and it won't be installed into the
 * standard system directories for schemas.
 *
 * SettingsSchemaSource provides a mechanism for dealing with this by
 * allowing the creation of a new 'schema source' from which schemas can
 * be acquired.  This schema source can then become part of the metadata
 * associated with the plugin and queried whenever the plugin requires
 * access to some settings.
 *
 * @newin{2,32}
 */
class GIOMM_API SettingsSchema final
{
  _CLASS_OPAQUE_REFCOUNTED(SettingsSchema, GSettingsSchema, NONE, g_settings_schema_ref, g_settings_schema_unref, GIOMM_API)
  _IS_REFCOUNTED_BOXEDTYPE

protected:
  _IGNORE(g_settings_schema_ref, g_settings_schema_unref)

  //Ignore internal GSettingsSchema functions.
  _IGNORE(g_settings_schema_get_value, g_settings_schema_list, g_settings_schema_get_string, g_settings_schema_get_gettext_domain)

public:
  _WRAP_METHOD(Glib::ustring get_id() const, g_settings_schema_get_id)
  _WRAP_METHOD(Glib::ustring get_path() const, g_settings_schema_get_path)

  //Note that these don't need refreturn because they seem to return a reference
  //(they are documented as transfer:full)
  _WRAP_METHOD(Glib::RefPtr<SettingsSchemaKey> get_key(const Glib::ustring& name), g_settings_schema_get_key)
  _WRAP_METHOD(Glib::RefPtr<const SettingsSchemaKey> get_key(const Glib::ustring& name) const, g_settings_schema_get_key)

  _WRAP_METHOD(bool has_key(const Glib::ustring& name) const, g_settings_schema_has_key)

#m4 _CONVERSION(`gchar**',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3, Glib::OWNERSHIP_DEEP)')
  _WRAP_METHOD(std::vector<Glib::ustring> list_keys() const, g_settings_schema_list_keys)

  _WRAP_METHOD(std::vector<Glib::ustring> list_children() const, g_settings_schema_list_children)
};

} // namespace Gio