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 public class SettingsSchemaKey 36 { 37 /** the main Gtk struct */ 38 protected GSettingsSchemaKey* gSettingsSchemaKey; 39 40 /** Get the main Gtk struct */ 41 public GSettingsSchemaKey* getSettingsSchemaKeyStruct() 42 { 43 return gSettingsSchemaKey; 44 } 45 46 /** the main Gtk struct as a void* */ 47 protected void* getStruct() 48 { 49 return cast(void*)gSettingsSchemaKey; 50 } 51 52 /** 53 * Sets our main struct and passes it to the parent class. 54 */ 55 public this (GSettingsSchemaKey* gSettingsSchemaKey) 56 { 57 this.gSettingsSchemaKey = gSettingsSchemaKey; 58 } 59 60 /** 61 */ 62 63 public static GType getType() 64 { 65 return g_settings_schema_key_get_type(); 66 } 67 68 /** 69 * Gets the default value for @key. 70 * 71 * Note that this is the default value according to the schema. System 72 * administrator defaults and lockdown are not visible via this API. 73 * 74 * Return: the default value for the key 75 * 76 * Since: 2.40 77 */ 78 public Variant getDefaultValue() 79 { 80 auto p = g_settings_schema_key_get_default_value(gSettingsSchemaKey); 81 82 if(p is null) 83 { 84 return null; 85 } 86 87 return new Variant(cast(GVariant*) p); 88 } 89 90 /** 91 * Gets the description for @key. 92 * 93 * If no description has been provided in the schema for @key, returns 94 * %NULL. 95 * 96 * The description can be one sentence to several paragraphs in length. 97 * Paragraphs are delimited with a double newline. Descriptions can be 98 * translated and the value returned from this function is is the 99 * current locale. 100 * 101 * This function is slow. The summary and description information for 102 * the schemas is not stored in the compiled schema database so this 103 * function has to parse all of the source XML files in the schema 104 * directory. 105 * 106 * Return: the description for @key, or %NULL 107 * 108 * Since: 2.34 109 */ 110 public string getDescription() 111 { 112 return Str.toString(g_settings_schema_key_get_description(gSettingsSchemaKey)); 113 } 114 115 /** 116 * Queries the range of a key. 117 * 118 * This function will return a #GVariant that fully describes the range 119 * of values that are valid for @key. 120 * 121 * The type of #GVariant returned is `(sv)`. The string describes 122 * the type of range restriction in effect. The type and meaning of 123 * the value contained in the variant depends on the string. 124 * 125 * If the string is `'type'` then the variant contains an empty array. 126 * The element type of that empty array is the expected type of value 127 * and all values of that type are valid. 128 * 129 * If the string is `'enum'` then the variant contains an array 130 * enumerating the possible values. Each item in the array is 131 * a possible valid value and no other values are valid. 132 * 133 * If the string is `'flags'` then the variant contains an array. Each 134 * item in the array is a value that may appear zero or one times in an 135 * array to be used as the value for this key. For example, if the 136 * variant contained the array `['x', 'y']` then the valid values for 137 * the key would be `[]`, `['x']`, `['y']`, `['x', 'y']` and 138 * `['y', 'x']`. 139 * 140 * Finally, if the string is `'range'` then the variant contains a pair 141 * of like-typed values -- the minimum and maximum permissible values 142 * for this key. 143 * 144 * This information should not be used by normal programs. It is 145 * considered to be a hint for introspection purposes. Normal programs 146 * should already know what is permitted by their own schema. The 147 * format may change in any way in the future -- but particularly, new 148 * forms may be added to the possibilities described above. 149 * 150 * You should free the returned value with g_variant_unref() when it is 151 * no longer needed. 152 * 153 * Return: a #GVariant describing the range 154 * 155 * Since: 2.40 156 */ 157 public Variant getRange() 158 { 159 auto p = g_settings_schema_key_get_range(gSettingsSchemaKey); 160 161 if(p is null) 162 { 163 return null; 164 } 165 166 return new Variant(cast(GVariant*) p); 167 } 168 169 /** 170 * Gets the summary for @key. 171 * 172 * If no summary has been provided in the schema for @key, returns 173 * %NULL. 174 * 175 * The summary is a short description of the purpose of the key; usually 176 * one short sentence. Summaries can be translated and the value 177 * returned from this function is is the current locale. 178 * 179 * This function is slow. The summary and description information for 180 * the schemas is not stored in the compiled schema database so this 181 * function has to parse all of the source XML files in the schema 182 * directory. 183 * 184 * Return: the summary for @key, or %NULL 185 * 186 * Since: 2.34 187 */ 188 public string getSummary() 189 { 190 return Str.toString(g_settings_schema_key_get_summary(gSettingsSchemaKey)); 191 } 192 193 /** 194 * Gets the #GVariantType of @key. 195 * 196 * Return: the type of @key 197 * 198 * Since: 2.40 199 */ 200 public VariantType getValueType() 201 { 202 auto p = g_settings_schema_key_get_value_type(gSettingsSchemaKey); 203 204 if(p is null) 205 { 206 return null; 207 } 208 209 return new VariantType(cast(GVariantType*) p); 210 } 211 212 /** 213 * Checks if the given @value is of the correct type and within the 214 * permitted range for @key. 215 * 216 * It is a programmer error if @value is not of the correct type -- you 217 * must check for this first. 218 * 219 * Params: 220 * value = the value to check 221 * 222 * Return: %TRUE if @value is valid for @key 223 * 224 * Since: 2.40 225 */ 226 public bool rangeCheck(Variant value) 227 { 228 return g_settings_schema_key_range_check(gSettingsSchemaKey, (value is null) ? null : value.getVariantStruct()) != 0; 229 } 230 231 /** 232 * Increase the reference count of @key, returning a new reference. 233 * 234 * Return: a new reference to @key 235 * 236 * Since: 2.40 237 */ 238 public SettingsSchemaKey doref() 239 { 240 auto p = g_settings_schema_key_ref(gSettingsSchemaKey); 241 242 if(p is null) 243 { 244 return null; 245 } 246 247 return ObjectG.getDObject!(SettingsSchemaKey)(cast(GSettingsSchemaKey*) p); 248 } 249 250 /** 251 * Decrease the reference count of @key, possibly freeing it. 252 * 253 * Since: 2.40 254 */ 255 public void unref() 256 { 257 g_settings_schema_key_unref(gSettingsSchemaKey); 258 } 259 }