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 peas.PluginInfo;
26 
27 private import gio.Settings;
28 private import glib.ErrorG;
29 private import glib.GException;
30 private import glib.Str;
31 private import gobject.ObjectG;
32 private import peasc.peas;
33 public  import peasc.peastypes;
34 
35 
36 /**
37  * The #PeasPluginInfo structure contains only private data and should only
38  * be accessed using the provided API.
39  */
40 public class PluginInfo
41 {
42 	/** the main Gtk struct */
43 	protected PeasPluginInfo* peasPluginInfo;
44 	protected bool ownedRef;
45 
46 	/** Get the main Gtk struct */
47 	public PeasPluginInfo* getPluginInfoStruct()
48 	{
49 		return peasPluginInfo;
50 	}
51 
52 	/** the main Gtk struct as a void* */
53 	protected void* getStruct()
54 	{
55 		return cast(void*)peasPluginInfo;
56 	}
57 
58 	/**
59 	 * Sets our main struct and passes it to the parent class.
60 	 */
61 	public this (PeasPluginInfo* peasPluginInfo, bool ownedRef = false)
62 	{
63 		this.peasPluginInfo = peasPluginInfo;
64 		this.ownedRef = ownedRef;
65 	}
66 
67 
68 	/** */
69 	public static GType getType()
70 	{
71 		return peas_plugin_info_get_type();
72 	}
73 
74 	/**
75 	 * Gets a %NULL-terminated array of strings with the authors of the plugin.
76 	 *
77 	 * The relevant key in the plugin info file is "Authors".
78 	 *
79 	 * Returns: the plugin's author list.
80 	 */
81 	public string[] getAuthors()
82 	{
83 		return Str.toStringArray(peas_plugin_info_get_authors(peasPluginInfo));
84 	}
85 
86 	/**
87 	 * Gets the copyright of the plugin.
88 	 *
89 	 * The relevant key in the plugin info file is "Copyright".
90 	 *
91 	 * Returns: the plugin's copyright information.
92 	 */
93 	public string getCopyright()
94 	{
95 		return Str.toString(peas_plugin_info_get_copyright(peasPluginInfo));
96 	}
97 
98 	/**
99 	 * Gets the data dir of the plugin.
100 	 *
101 	 * The module data directory is the directory where a plugin should find its
102 	 * runtime data. This is not a value read from the #GKeyFile, but rather a
103 	 * value provided by the #PeasEngine, depending on where the plugin file was
104 	 * found.
105 	 *
106 	 * Returns: the plugin's data dir.
107 	 */
108 	public string getDataDir()
109 	{
110 		return Str.toString(peas_plugin_info_get_data_dir(peasPluginInfo));
111 	}
112 
113 	/**
114 	 * Gets the dependencies of the plugin.
115 	 *
116 	 * The #PeasEngine will always ensure that the dependencies of a plugin are
117 	 * loaded when the said plugin is loaded. It means that dependencies are
118 	 * loaded before the plugin, and unloaded after it. Circular dependencies of
119 	 * plugins lead to undefined loading order.
120 	 *
121 	 * The relevant key in the plugin info file is "Depends".
122 	 *
123 	 * Returns: the plugin's dependencies.
124 	 */
125 	public string[] getDependencies()
126 	{
127 		return Str.toStringArray(peas_plugin_info_get_dependencies(peasPluginInfo));
128 	}
129 
130 	/**
131 	 * Gets the description of the plugin.
132 	 *
133 	 * The description of the plugin should be a string presenting the purpose of
134 	 * the plugin. It will typically be presented in a plugin's about box.
135 	 *
136 	 * The relevant key in the plugin info file is "Description".
137 	 *
138 	 * Returns: the plugin's description.
139 	 */
140 	public string getDescription()
141 	{
142 		return Str.toString(peas_plugin_info_get_description(peasPluginInfo));
143 	}
144 
145 	/**
146 	 * Gets external data specified for the plugin.
147 	 *
148 	 * External data is specified in the plugin info file prefixed with X-. For
149 	 * example, if a key/value pair X-Peas=1 is specified in the key file, you
150 	 * can use "Peas" for @key to retrieve the value "1".
151 	 *
152 	 * Note: that you can omit the X- prefix when retrieving the value,
153 	 * but not when specifying the value in the file.
154 	 *
155 	 * Params:
156 	 *     key = The key to lookup.
157 	 *
158 	 * Returns: the external data, or %NULL if the external data could not be found.
159 	 *
160 	 * Since: 1.6
161 	 */
162 	public string getExternalData(string key)
163 	{
164 		return Str.toString(peas_plugin_info_get_external_data(peasPluginInfo, Str.toStringz(key)));
165 	}
166 
167 	/**
168 	 * Gets the help URI of the plugin.
169 	 *
170 	 * The Help URI of a plugin will typically be presented by the plugin manager
171 	 * as a "Help" button linking to the URI. It can either be a HTTP URL on some
172 	 * website or a ghelp: URI if a Gnome help page is available for the plugin.
173 	 *
174 	 * The relevant key in the plugin info file is "Help". Other platform-specific
175 	 * keys exist for platform-specific help files. Those are "Help-GNOME",
176 	 * "Help-Windows" and "Help-MacOS-X".
177 	 *
178 	 * Returns: the plugin's help URI.
179 	 */
180 	public string getHelpUri()
181 	{
182 		return Str.toString(peas_plugin_info_get_help_uri(peasPluginInfo));
183 	}
184 
185 	/**
186 	 * Gets the icon name of the plugin.
187 	 *
188 	 * The icon of the plugin will be presented in the plugin manager UI. If no
189 	 * icon is specified, the default green puzzle icon will be used.
190 	 *
191 	 * The relevant key in the plugin info file is "Icon".
192 	 *
193 	 * Returns: the plugin's icon name.
194 	 */
195 	public string getIconName()
196 	{
197 		return Str.toString(peas_plugin_info_get_icon_name(peasPluginInfo));
198 	}
199 
200 	/**
201 	 * Gets the module directory.
202 	 *
203 	 * The module directory is the directory where the plugin file was found. This
204 	 * is not a value from the #GKeyFile, but rather a value provided by the
205 	 * #PeasEngine.
206 	 *
207 	 * Returns: the module directory.
208 	 */
209 	public string getModuleDir()
210 	{
211 		return Str.toString(peas_plugin_info_get_module_dir(peasPluginInfo));
212 	}
213 
214 	/**
215 	 * Gets the module name.
216 	 *
217 	 * The module name will be used to find the actual plugin. The way this value
218 	 * will be used depends on the loader (i.e. on the language) of the plugin.
219 	 * This value is also used to uniquely identify a particular plugin.
220 	 *
221 	 * The relevant key in the plugin info file is "Module".
222 	 *
223 	 * Returns: the module name.
224 	 */
225 	public string getModuleName()
226 	{
227 		return Str.toString(peas_plugin_info_get_module_name(peasPluginInfo));
228 	}
229 
230 	/**
231 	 * Gets the name of the plugin.
232 	 *
233 	 * The name of a plugin should be a nice short string to be presented in UIs.
234 	 *
235 	 * The relevant key in the plugin info file is "Name".
236 	 *
237 	 * Returns: the plugin's name.
238 	 */
239 	public string getName()
240 	{
241 		return Str.toString(peas_plugin_info_get_name(peasPluginInfo));
242 	}
243 
244 	/**
245 	 * Creates a new #GSettings for the given @schema_id and if
246 	 * gschemas.compiled is not in the module directory an attempt
247 	 * will be made to create it.
248 	 *
249 	 * Params:
250 	 *     schemaId = The schema id.
251 	 *
252 	 * Returns: a new #GSettings, or %NULL.
253 	 *
254 	 * Since: 1.4
255 	 */
256 	public Settings getSettings(string schemaId)
257 	{
258 		auto p = peas_plugin_info_get_settings(peasPluginInfo, Str.toStringz(schemaId));
259 		
260 		if(p is null)
261 		{
262 			return null;
263 		}
264 		
265 		return ObjectG.getDObject!(Settings)(cast(GSettings*) p, true);
266 	}
267 
268 	/**
269 	 * Gets the version of the plugin.
270 	 *
271 	 * The relevant key in the plugin info file is "Version".
272 	 *
273 	 * Returns: the plugin's version.
274 	 */
275 	public string getVersion()
276 	{
277 		return Str.toString(peas_plugin_info_get_version(peasPluginInfo));
278 	}
279 
280 	/**
281 	 * Gets the website of the plugin.
282 	 *
283 	 * The relevant key in the plugin info file is "Website".
284 	 *
285 	 * Returns: the plugin's associated website.
286 	 */
287 	public string getWebsite()
288 	{
289 		return Str.toString(peas_plugin_info_get_website(peasPluginInfo));
290 	}
291 
292 	/**
293 	 * Check if the plugin depends on another plugin.
294 	 *
295 	 * Params:
296 	 *     moduleName = The name of the plugin to check.
297 	 *
298 	 * Returns: whether the plugin depends on the plugin @module_name.
299 	 */
300 	public bool hasDependency(string moduleName)
301 	{
302 		return peas_plugin_info_has_dependency(peasPluginInfo, Str.toStringz(moduleName)) != 0;
303 	}
304 
305 	/**
306 	 * Check if the plugin is available.
307 	 *
308 	 * A plugin is marked as not available when there is no loader available to
309 	 * load it, or when there has been an error when trying to load it previously.
310 	 * If not available then @error will be set.
311 	 *
312 	 * Returns: %TRUE if the plugin is available.
313 	 *
314 	 * Throws: GException on failure.
315 	 */
316 	public bool isAvailable()
317 	{
318 		GError* err = null;
319 		
320 		auto p = peas_plugin_info_is_available(peasPluginInfo, &err) != 0;
321 		
322 		if (err !is null)
323 		{
324 			throw new GException( new ErrorG(err) );
325 		}
326 		
327 		return p;
328 	}
329 
330 	/**
331 	 * Check if the plugin is a builtin plugin.
332 	 *
333 	 * A builtin plugin is a plugin which cannot be enabled or disabled by the
334 	 * user through a plugin manager (like #PeasGtkPluginManager). Loading or
335 	 * unloading such plugins is the responsibility of the application alone.
336 	 * Most applications will usually load those plugins immediately after
337 	 * the initialization of the #PeasEngine.
338 	 *
339 	 * The relevant key in the plugin info file is "Builtin".
340 	 *
341 	 * Returns: %TRUE if the plugin is a builtin plugin, %FALSE
342 	 *     if not.
343 	 */
344 	public bool isBuiltin()
345 	{
346 		return peas_plugin_info_is_builtin(peasPluginInfo) != 0;
347 	}
348 
349 	/**
350 	 * Check if the plugin is a hidden plugin.
351 	 *
352 	 * A hidden plugin is a plugin which cannot be seen by a
353 	 * user through a plugin manager (like #PeasGtkPluginManager). Loading and
354 	 * unloading such plugins is the responsibility of the application alone or
355 	 * through plugins that depend on them.
356 	 *
357 	 * The relevant key in the plugin info file is "Hidden".
358 	 *
359 	 * Returns: %TRUE if the plugin is a hidden plugin, %FALSE
360 	 *     if not.
361 	 */
362 	public bool isHidden()
363 	{
364 		return peas_plugin_info_is_hidden(peasPluginInfo) != 0;
365 	}
366 
367 	/**
368 	 * Check if the plugin is loaded.
369 	 *
370 	 * Returns: %TRUE if the plugin is loaded.
371 	 */
372 	public bool isLoaded()
373 	{
374 		return peas_plugin_info_is_loaded(peasPluginInfo) != 0;
375 	}
376 
377 	/** */
378 	public static GQuark errorQuark()
379 	{
380 		return peas_plugin_info_error_quark();
381 	}
382 }