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  * Conversion parameters:
26  * inFile  = gio-GSettingsSchema-GSettingsSchemaSource.html
27  * outPack = gio
28  * outFile = SettingsSchema
29  * strct   = GSettingsSchema
30  * realStrct=
31  * ctorStrct=
32  * clss    = SettingsSchema
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_settings_schema_
41  * omit structs:
42  * omit prefixes:
43  * 	- g_settings_schema_source_
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gtkc.Loader
49  * 	- gtkc.paths
50  * structWrap:
51  * 	- GSettingsSchema* -> SettingsSchema
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module gio.SettingsSchema;
58 
59 public  import gtkc.giotypes;
60 
61 private import gtkc.gio;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 private import glib.Str;
66 private import gtkc.Loader;
67 private import gtkc.paths;
68 
69 
70 private import gobject.Boxed;
71 
72 /**
73  * The GSettingsSchemaSource and GSettingsSchema APIs provide a
74  * mechanism for advanced control over the loading of schemas and a
75  * mechanism for introspecting their content.
76  *
77  * Plugin loading systems that wish to provide plugins a way to access
78  * settings face the problem of how to make the schemas for these
79  * settings visible to GSettings. Typically, a plugin will want to ship
80  * the schema along with itself and it won't be installed into the
81  * standard system directories for schemas.
82  *
83  * GSettingsSchemaSource provides a mechanism for dealing with this by
84  * allowing the creation of a new 'schema source' from which schemas can
85  * be acquired. This schema source can then become part of the metadata
86  * associated with the plugin and queried whenever the plugin requires
87  * access to some settings.
88  *
89  * Consider the following example:
90  *
91  * $(DDOC_COMMENT example)
92  *
93  * The code above shows how hooks should be added to the code that
94  * initialises (or enables) the plugin to create the schema source and
95  * how an API can be added to the plugin system to provide a convenient
96  * way for the plugin to access its settings, using the schemas that it
97  * ships.
98  *
99  * From the standpoint of the plugin, it would need to ensure that it
100  * ships a gschemas.compiled file as part of itself, and then simply do
101  * the following:
102  *
103  * $(DDOC_COMMENT example)
104  *
105  * It's also possible that the plugin system expects the schema source
106  * files (ie: .gschema.xml files) instead of a gschemas.compiled file.
107  * In that case, the plugin loading system must compile the schemas for
108  * itself before attempting to create the settings source.
109  */
110 public class SettingsSchema : Boxed
111 {
112 	
113 	/** the main Gtk struct */
114 	protected GSettingsSchema* gSettingsSchema;
115 	
116 	
117 	/** Get the main Gtk struct */
118 	public GSettingsSchema* getSettingsSchemaStruct()
119 	{
120 		return gSettingsSchema;
121 	}
122 	
123 	
124 	/** the main Gtk struct as a void* */
125 	protected void* getStruct()
126 	{
127 		return cast(void*)gSettingsSchema;
128 	}
129 	
130 	/**
131 	 * Sets our main struct and passes it to the parent class
132 	 */
133 	public this (GSettingsSchema* gSettingsSchema)
134 	{
135 		this.gSettingsSchema = gSettingsSchema;
136 	}
137 	
138 	~this()
139 	{
140 		if ( Linker.isLoaded(LIBRARY.GIO) && gSettingsSchema != null)
141 		{
142 			g_settings_schema_unref(gSettingsSchema);
143 		}
144 	}
145 	
146 	/**
147 	 */
148 	
149 	/**
150 	 * Increase the reference count of schema, returning a new reference.
151 	 * Since 2.32
152 	 * Returns: a new reference to schema
153 	 */
154 	public SettingsSchema doref()
155 	{
156 		// GSettingsSchema * g_settings_schema_ref (GSettingsSchema *schema);
157 		auto p = g_settings_schema_ref(gSettingsSchema);
158 		
159 		if(p is null)
160 		{
161 			return null;
162 		}
163 		
164 		return ObjectG.getDObject!(SettingsSchema)(cast(GSettingsSchema*) p);
165 	}
166 	
167 	/**
168 	 * Decrease the reference count of schema, possibly freeing it.
169 	 * Since 2.32
170 	 */
171 	public void unref()
172 	{
173 		// void g_settings_schema_unref (GSettingsSchema *schema);
174 		g_settings_schema_unref(gSettingsSchema);
175 	}
176 	
177 	/**
178 	 * Get the ID of schema.
179 	 * Returns: the ID. [transfer none]
180 	 */
181 	public string getId()
182 	{
183 		// const gchar * g_settings_schema_get_id (GSettingsSchema *schema);
184 		return Str.toString(g_settings_schema_get_id(gSettingsSchema));
185 	}
186 	
187 	/**
188 	 * Gets the path associated with schema, or NULL.
189 	 * Schemas may be single-instance or relocatable. Single-instance
190 	 * schemas correspond to exactly one set of keys in the backend
191 	 * database: those located at the path returned by this function.
192 	 * Relocatable schemas can be referenced by other schemas and can
193 	 * threfore describe multiple sets of keys at different locations. For
194 	 * relocatable schemas, this function will return NULL.
195 	 * Since 2.32
196 	 * Returns: the path of the schema, or NULL. [transfer none]
197 	 */
198 	public string getPath()
199 	{
200 		// const gchar * g_settings_schema_get_path (GSettingsSchema *schema);
201 		return Str.toString(g_settings_schema_get_path(gSettingsSchema));
202 	}
203 }