source: appstream-generator/build/girepo/gio/SettingsSchemaKey.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 7.2 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.SettingsSchemaKey;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import glib.Str;
26private import glib.Variant;
27private import glib.VariantType;
28private import gobject.ObjectG;
29
30
31/**
32 * #GSettingsSchemaKey is an opaque data structure and can only be accessed
33 * using the following functions.
34 */
35public class SettingsSchemaKey
36{
37        /** the main Gtk struct */
38        protected GSettingsSchemaKey* gSettingsSchemaKey;
39        protected bool ownedRef;
40
41        /** Get the main Gtk struct */
42        public GSettingsSchemaKey* getSettingsSchemaKeyStruct()
43        {
44                return gSettingsSchemaKey;
45        }
46
47        /** the main Gtk struct as a void* */
48        protected void* getStruct()
49        {
50                return cast(void*)gSettingsSchemaKey;
51        }
52
53        /**
54         * Sets our main struct and passes it to the parent class.
55         */
56        public this (GSettingsSchemaKey* gSettingsSchemaKey, bool ownedRef = false)
57        {
58                this.gSettingsSchemaKey = gSettingsSchemaKey;
59                this.ownedRef = ownedRef;
60        }
61
62
63        /** */
64        public static GType getType()
65        {
66                return g_settings_schema_key_get_type();
67        }
68
69        /**
70         * Gets the default value for @key.
71         *
72         * Note that this is the default value according to the schema.  System
73         * administrator defaults and lockdown are not visible via this API.
74         *
75         * Returns: the default value for the key
76         *
77         * Since: 2.40
78         */
79        public Variant getDefaultValue()
80        {
81                auto p = g_settings_schema_key_get_default_value(gSettingsSchemaKey);
82               
83                if(p is null)
84                {
85                        return null;
86                }
87               
88                return new Variant(cast(GVariant*) p, true);
89        }
90
91        /**
92         * Gets the description for @key.
93         *
94         * If no description has been provided in the schema for @key, returns
95         * %NULL.
96         *
97         * The description can be one sentence to several paragraphs in length.
98         * Paragraphs are delimited with a double newline.  Descriptions can be
99         * translated and the value returned from this function is is the
100         * current locale.
101         *
102         * This function is slow.  The summary and description information for
103         * the schemas is not stored in the compiled schema database so this
104         * function has to parse all of the source XML files in the schema
105         * directory.
106         *
107         * Returns: the description for @key, or %NULL
108         *
109         * Since: 2.34
110         */
111        public string getDescription()
112        {
113                return Str.toString(g_settings_schema_key_get_description(gSettingsSchemaKey));
114        }
115
116        /**
117         * Gets the name of @key.
118         *
119         * Returns: the name of @key.
120         *
121         * Since: 2.44
122         */
123        public string getName()
124        {
125                return Str.toString(g_settings_schema_key_get_name(gSettingsSchemaKey));
126        }
127
128        /**
129         * Queries the range of a key.
130         *
131         * This function will return a #GVariant that fully describes the range
132         * of values that are valid for @key.
133         *
134         * The type of #GVariant returned is `(sv)`. The string describes
135         * the type of range restriction in effect. The type and meaning of
136         * the value contained in the variant depends on the string.
137         *
138         * If the string is `'type'` then the variant contains an empty array.
139         * The element type of that empty array is the expected type of value
140         * and all values of that type are valid.
141         *
142         * If the string is `'enum'` then the variant contains an array
143         * enumerating the possible values. Each item in the array is
144         * a possible valid value and no other values are valid.
145         *
146         * If the string is `'flags'` then the variant contains an array. Each
147         * item in the array is a value that may appear zero or one times in an
148         * array to be used as the value for this key. For example, if the
149         * variant contained the array `['x', 'y']` then the valid values for
150         * the key would be `[]`, `['x']`, `['y']`, `['x', 'y']` and
151         * `['y', 'x']`.
152         *
153         * Finally, if the string is `'range'` then the variant contains a pair
154         * of like-typed values -- the minimum and maximum permissible values
155         * for this key.
156         *
157         * This information should not be used by normal programs.  It is
158         * considered to be a hint for introspection purposes.  Normal programs
159         * should already know what is permitted by their own schema.  The
160         * format may change in any way in the future -- but particularly, new
161         * forms may be added to the possibilities described above.
162         *
163         * You should free the returned value with g_variant_unref() when it is
164         * no longer needed.
165         *
166         * Returns: a #GVariant describing the range
167         *
168         * Since: 2.40
169         */
170        public Variant getRange()
171        {
172                auto p = g_settings_schema_key_get_range(gSettingsSchemaKey);
173               
174                if(p is null)
175                {
176                        return null;
177                }
178               
179                return new Variant(cast(GVariant*) p, true);
180        }
181
182        /**
183         * Gets the summary for @key.
184         *
185         * If no summary has been provided in the schema for @key, returns
186         * %NULL.
187         *
188         * The summary is a short description of the purpose of the key; usually
189         * one short sentence.  Summaries can be translated and the value
190         * returned from this function is is the current locale.
191         *
192         * This function is slow.  The summary and description information for
193         * the schemas is not stored in the compiled schema database so this
194         * function has to parse all of the source XML files in the schema
195         * directory.
196         *
197         * Returns: the summary for @key, or %NULL
198         *
199         * Since: 2.34
200         */
201        public string getSummary()
202        {
203                return Str.toString(g_settings_schema_key_get_summary(gSettingsSchemaKey));
204        }
205
206        /**
207         * Gets the #GVariantType of @key.
208         *
209         * Returns: the type of @key
210         *
211         * Since: 2.40
212         */
213        public VariantType getValueType()
214        {
215                auto p = g_settings_schema_key_get_value_type(gSettingsSchemaKey);
216               
217                if(p is null)
218                {
219                        return null;
220                }
221               
222                return new VariantType(cast(GVariantType*) p);
223        }
224
225        /**
226         * Checks if the given @value is of the correct type and within the
227         * permitted range for @key.
228         *
229         * It is a programmer error if @value is not of the correct type -- you
230         * must check for this first.
231         *
232         * Params:
233         *     value = the value to check
234         *
235         * Returns: %TRUE if @value is valid for @key
236         *
237         * Since: 2.40
238         */
239        public bool rangeCheck(Variant value)
240        {
241                return g_settings_schema_key_range_check(gSettingsSchemaKey, (value is null) ? null : value.getVariantStruct()) != 0;
242        }
243
244        /**
245         * Increase the reference count of @key, returning a new reference.
246         *
247         * Returns: a new reference to @key
248         *
249         * Since: 2.40
250         */
251        public SettingsSchemaKey doref()
252        {
253                auto p = g_settings_schema_key_ref(gSettingsSchemaKey);
254               
255                if(p is null)
256                {
257                        return null;
258                }
259               
260                return ObjectG.getDObject!(SettingsSchemaKey)(cast(GSettingsSchemaKey*) p, true);
261        }
262
263        /**
264         * Decrease the reference count of @key, possibly freeing it.
265         *
266         * Since: 2.40
267         */
268        public void unref()
269        {
270                g_settings_schema_key_unref(gSettingsSchemaKey);
271        }
272}
Note: See TracBrowser for help on using the repository browser.