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