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  = 
27  * outPack = gio
28  * outFile = IOExtensionPoint
29  * strct   = GIOExtensionPoint
30  * realStrct=
31  * ctorStrct=
32  * clss    = IOExtensionPoint
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_io_extension_point_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.ListG
48  * 	- gio.IOExtension
49  * structWrap:
50  * 	- GIOExtension* -> IOExtension
51  * 	- GIOExtensionPoint* -> IOExtensionPoint
52  * 	- GList* -> ListG
53  * module aliases:
54  * local aliases:
55  * overrides:
56  */
57 
58 module gio.IOExtensionPoint;
59 
60 public  import gtkc.giotypes;
61 
62 private import gtkc.gio;
63 private import glib.ConstructionException;
64 private import gobject.ObjectG;
65 
66 private import glib.Str;
67 private import glib.ListG;
68 private import gio.IOExtension;
69 
70 
71 
72 /**
73  * GIOExtensionPoint provides a mechanism for modules to extend the
74  * functionality of the library or application that loaded it in an
75  * organized fashion.
76  *
77  * An extension point is identified by a name, and it may optionally
78  * require that any implementation must by of a certain type (or derived
79  * thereof). Use g_io_extension_point_register() to register an
80  * extension point, and g_io_extension_point_set_required_type() to
81  * set a required type.
82  *
83  * A module can implement an extension point by specifying the GType
84  * that implements the functionality. Additionally, each implementation
85  * of an extension point has a name, and a priority. Use
86  * g_io_extension_point_implement() to implement an extension point.
87  *
88  * $(DDOC_COMMENT example)
89  *
90  * $(DDOC_COMMENT example)
91  *
92  *  It is up to the code that registered the extension point how
93  *  it uses the implementations that have been associated with it.
94  *  Depending on the use case, it may use all implementations, or
95  *  only the one with the highest priority, or pick a specific
96  *  one by name.
97  *
98  *  To avoid opening all modules just to find out what extension
99  *  points they implement, GIO makes use of a caching mechanism,
100  *  see gio-querymodules.
101  *  You are expected to run this command after installing a
102  *  GIO module.
103  *
104  *  The GIO_EXTRA_MODULES environment variable can be
105  *  used to specify additional directories to automatically load modules
106  *  from. This environment variable has the same syntax as the
107  *  PATH. If two modules have the same base name in different
108  *  directories, then the latter one will be ignored. If additional
109  *  directories are specified GIO will load modules from the built-in
110  *  directory last.
111  */
112 public class IOExtensionPoint
113 {
114 	
115 	/** the main Gtk struct */
116 	protected GIOExtensionPoint* gIOExtensionPoint;
117 	
118 	
119 	/** Get the main Gtk struct */
120 	public GIOExtensionPoint* getIOExtensionPointStruct()
121 	{
122 		return gIOExtensionPoint;
123 	}
124 	
125 	
126 	/** the main Gtk struct as a void* */
127 	protected void* getStruct()
128 	{
129 		return cast(void*)gIOExtensionPoint;
130 	}
131 	
132 	/**
133 	 * Sets our main struct and passes it to the parent class
134 	 */
135 	public this (GIOExtensionPoint* gIOExtensionPoint)
136 	{
137 		this.gIOExtensionPoint = gIOExtensionPoint;
138 	}
139 	
140 	/**
141 	 */
142 	
143 	/**
144 	 * Finds a GIOExtension for an extension point by name.
145 	 * Params:
146 	 * name = the name of the extension to get
147 	 * Returns: the GIOExtension for extension_point that has the given name, or NULL if there is no extension with that name. [transfer none]
148 	 */
149 	public IOExtension getExtensionByName(string name)
150 	{
151 		// GIOExtension * g_io_extension_point_get_extension_by_name  (GIOExtensionPoint *extension_point,  const char *name);
152 		auto p = g_io_extension_point_get_extension_by_name(gIOExtensionPoint, Str.toStringz(name));
153 		
154 		if(p is null)
155 		{
156 			return null;
157 		}
158 		
159 		return ObjectG.getDObject!(IOExtension)(cast(GIOExtension*) p);
160 	}
161 	
162 	/**
163 	 * Gets a list of all extensions that implement this extension point.
164 	 * The list is sorted by priority, beginning with the highest priority.
165 	 * Returns: a GList of GIOExtensions. The list is owned by GIO and should not be modified. [element-type GIOExtension][transfer none]
166 	 */
167 	public ListG getExtensions()
168 	{
169 		// GList * g_io_extension_point_get_extensions (GIOExtensionPoint *extension_point);
170 		auto p = g_io_extension_point_get_extensions(gIOExtensionPoint);
171 		
172 		if(p is null)
173 		{
174 			return null;
175 		}
176 		
177 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
178 	}
179 	
180 	/**
181 	 * Gets the required type for extension_point.
182 	 * Returns: the GType that all implementations must have, or G_TYPE_INVALID if the extension point has no required type
183 	 */
184 	public GType getRequiredType()
185 	{
186 		// GType g_io_extension_point_get_required_type  (GIOExtensionPoint *extension_point);
187 		return g_io_extension_point_get_required_type(gIOExtensionPoint);
188 	}
189 	
190 	/**
191 	 * Registers type as extension for the extension point with name
192 	 * extension_point_name.
193 	 * If type has already been registered as an extension for this
194 	 * extension point, the existing GIOExtension object is returned.
195 	 * Params:
196 	 * extensionPointName = the name of the extension point
197 	 * type = the GType to register as extension
198 	 * extensionName = the name for the extension
199 	 * priority = the priority for the extension
200 	 * Returns: a GIOExtension object for GType. [transfer none]
201 	 */
202 	public static IOExtension implement(string extensionPointName, GType type, string extensionName, int priority)
203 	{
204 		// GIOExtension * g_io_extension_point_implement (const char *extension_point_name,  GType type,  const char *extension_name,  gint priority);
205 		auto p = g_io_extension_point_implement(Str.toStringz(extensionPointName), type, Str.toStringz(extensionName), priority);
206 		
207 		if(p is null)
208 		{
209 			return null;
210 		}
211 		
212 		return ObjectG.getDObject!(IOExtension)(cast(GIOExtension*) p);
213 	}
214 	
215 	/**
216 	 * Looks up an existing extension point.
217 	 * Params:
218 	 * name = the name of the extension point
219 	 * Returns: the GIOExtensionPoint, or NULL if there is no registered extension point with the given name. [transfer none]
220 	 */
221 	public static IOExtensionPoint lookup(string name)
222 	{
223 		// GIOExtensionPoint * g_io_extension_point_lookup (const char *name);
224 		auto p = g_io_extension_point_lookup(Str.toStringz(name));
225 		
226 		if(p is null)
227 		{
228 			return null;
229 		}
230 		
231 		return ObjectG.getDObject!(IOExtensionPoint)(cast(GIOExtensionPoint*) p);
232 	}
233 	
234 	/**
235 	 * Registers an extension point.
236 	 * Params:
237 	 * name = The name of the extension point
238 	 * Returns: the new GIOExtensionPoint. This object is owned by GIO and should not be freed. [transfer none]
239 	 */
240 	public static IOExtensionPoint register(string name)
241 	{
242 		// GIOExtensionPoint * g_io_extension_point_register (const char *name);
243 		auto p = g_io_extension_point_register(Str.toStringz(name));
244 		
245 		if(p is null)
246 		{
247 			return null;
248 		}
249 		
250 		return ObjectG.getDObject!(IOExtensionPoint)(cast(GIOExtensionPoint*) p);
251 	}
252 	
253 	/**
254 	 * Sets the required type for extension_point to type.
255 	 * All implementations must henceforth have this type.
256 	 * Params:
257 	 * type = the GType to require
258 	 */
259 	public void setRequiredType(GType type)
260 	{
261 		// void g_io_extension_point_set_required_type  (GIOExtensionPoint *extension_point,  GType type);
262 		g_io_extension_point_set_required_type(gIOExtensionPoint, type);
263 	}
264 }