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