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  = GAppInfo.html
27  * outPack = gio
28  * outFile = AppInfoT
29  * strct   = GAppInfo
30  * realStrct=
31  * ctorStrct=
32  * clss    = AppInfoT
33  * interf  = AppInfoIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * 	- TStruct
38  * extend  = 
39  * implements:
40  * prefixes:
41  * 	- g_app_info_
42  * omit structs:
43  * omit prefixes:
44  * 	- g_app_launch_context_
45  * omit code:
46  * omit signals:
47  * imports:
48  * 	- glib.Str
49  * 	- glib.ErrorG
50  * 	- glib.GException
51  * 	- glib.ListG
52  * 	- gio.AppInfoIF
53  * 	- gio.AppLaunchContext
54  * 	- gio.Icon
55  * 	- gio.IconIF
56  * structWrap:
57  * 	- GAppInfo* -> AppInfoIF
58  * 	- GAppLaunchContext* -> AppLaunchContext
59  * 	- GIcon* -> IconIF
60  * 	- GList* -> ListG
61  * module aliases:
62  * local aliases:
63  * overrides:
64  */
65 
66 module gio.AppInfoT;
67 
68 public  import gtkc.giotypes;
69 
70 public import gtkc.gio;
71 public import glib.ConstructionException;
72 public import gobject.ObjectG;
73 
74 public import gobject.Signals;
75 public  import gtkc.gdktypes;
76 public import glib.Str;
77 public import glib.ErrorG;
78 public import glib.GException;
79 public import glib.ListG;
80 public import gio.AppInfoIF;
81 public import gio.AppLaunchContext;
82 public import gio.Icon;
83 public import gio.IconIF;
84 
85 
86 
87 /**
88  * GAppInfo and GAppLaunchContext are used for describing and launching
89  * applications installed on the system.
90  *
91  * As of GLib 2.20, URIs will always be converted to POSIX paths
92  * (using g_file_get_path()) when using g_app_info_launch() even if
93  * the application requested an URI and not a POSIX path. For example
94  * for an desktop-file based application with Exec key totem
95  * %U and a single URI,
96  * sftp://foo/file.avi, then
97  * /home/user/.gvfs/sftp on foo/file.avi will be
98  * passed. This will only work if a set of suitable GIO extensions
99  * (such as gvfs 2.26 compiled with FUSE support), is available and
100  * operational; if this is not the case, the URI will be passed
101  * unmodified to the application. Some URIs, such as
102  * mailto:, of course cannot be mapped to a POSIX
103  * path (in gvfs there's no FUSE mount for it); such URIs will be
104  * passed unmodified to the application.
105  *
106  * Specifically for gvfs 2.26 and later, the POSIX URI will be mapped
107  * back to the GIO URI in the GFile constructors (since gvfs
108  * implements the GVfs extension point). As such, if the application
109  * needs to examine the URI, it needs to use g_file_get_uri() or
110  * similar on GFile. In other words, an application cannot assume
111  * that the URI passed to e.g. g_file_new_for_commandline_arg() is
112  * equal to the result of g_file_get_uri(). The following snippet
113  * illustrates this:
114  *
115  * GFile *f;
116  * char *uri;
117  *
118  * file = g_file_new_for_commandline_arg (uri_from_commandline);
119  *
120  * uri = g_file_get_uri (file);
121  * strcmp (uri, uri_from_commandline) == 0; // FALSE
122  * g_free (uri);
123  *
124  * if (g_file_has_uri_scheme (file, "cdda"))
125  *  {
126 	 *  // do something special with uri
127  *  }
128  * g_object_unref (file);
129  *
130  * This code will work when both cdda://sr0/Track
131  * 1.wav and /home/user/.gvfs/cdda on sr0/Track
132  * 1.wav is passed to the application. It should be noted
133  * that it's generally not safe for applications to rely on the format
134  * of a particular URIs. Different launcher applications (e.g. file
135  * managers) may have different ideas of what a given URI means.
136  */
137 public template AppInfoT(TStruct)
138 {
139 	
140 	/** the main Gtk struct */
141 	protected GAppInfo* gAppInfo;
142 	
143 	
144 	/** Get the main Gtk struct */
145 	public GAppInfo* getAppInfoTStruct()
146 	{
147 		return cast(GAppInfo*)getStruct();
148 	}
149 	
150 	
151 	/**
152 	 */
153 	int[string] connectedSignals;
154 	
155 	void delegate(string, AppInfoIF)[] _onLaunchFailedListeners;
156 	@property void delegate(string, AppInfoIF)[] onLaunchFailedListeners()
157 	{
158 		return  _onLaunchFailedListeners;
159 	}
160 	/**
161 	 */
162 	void addOnLaunchFailed(void delegate(string, AppInfoIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
163 	{
164 		if ( !("launch-failed" in connectedSignals) )
165 		{
166 			Signals.connectData(
167 			getStruct(),
168 			"launch-failed",
169 			cast(GCallback)&callBackLaunchFailed,
170 			cast(void*)cast(AppInfoIF)this,
171 			null,
172 			connectFlags);
173 			connectedSignals["launch-failed"] = 1;
174 		}
175 		_onLaunchFailedListeners ~= dlg;
176 	}
177 	extern(C) static void callBackLaunchFailed(GAppLaunchContext* gapplaunchcontextStruct, gchar* arg1, AppInfoIF _appInfoIF)
178 	{
179 		foreach ( void delegate(string, AppInfoIF) dlg ; _appInfoIF.onLaunchFailedListeners )
180 		{
181 			dlg(Str.toString(arg1), _appInfoIF);
182 		}
183 	}
184 	
185 	void delegate(AppInfoIF, GVariant*, AppInfoIF)[] _onLaunchedListeners;
186 	@property void delegate(AppInfoIF, GVariant*, AppInfoIF)[] onLaunchedListeners()
187 	{
188 		return  _onLaunchedListeners;
189 	}
190 	/**
191 	 */
192 	void addOnLaunched(void delegate(AppInfoIF, GVariant*, AppInfoIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
193 	{
194 		if ( !("launched" in connectedSignals) )
195 		{
196 			Signals.connectData(
197 			getStruct(),
198 			"launched",
199 			cast(GCallback)&callBackLaunched,
200 			cast(void*)cast(AppInfoIF)this,
201 			null,
202 			connectFlags);
203 			connectedSignals["launched"] = 1;
204 		}
205 		_onLaunchedListeners ~= dlg;
206 	}
207 	extern(C) static void callBackLaunched(GAppLaunchContext* gapplaunchcontextStruct, GAppInfo* arg1, GVariant* arg2, AppInfoIF _appInfoIF)
208 	{
209 		foreach ( void delegate(AppInfoIF, GVariant*, AppInfoIF) dlg ; _appInfoIF.onLaunchedListeners )
210 		{
211 			dlg(ObjectG.getDObject!(AppInfo, AppInfoIF)(arg1), arg2, _appInfoIF);
212 		}
213 	}
214 	
215 	
216 	/**
217 	 * Creates a new GAppInfo from the given information.
218 	 * Note that for commandline, the quoting rules of the Exec key of the
219 	 * freedesktop.org Desktop
220 	 * Entry Specification are applied. For example, if the commandline contains
221 	 * percent-encoded URIs, the percent-character must be doubled in order to prevent it from
222 	 * being swallowed by Exec key unquoting. See the specification for exact quoting rules.
223 	 * Params:
224 	 * commandline = the commandline to use
225 	 * applicationName = the application name, or NULL to use commandline. [allow-none]
226 	 * flags = flags that can specify details of the created GAppInfo
227 	 * Returns: new GAppInfo for given command. [transfer full]
228 	 * Throws: GException on failure.
229 	 */
230 	public static AppInfoIF createFromCommandline(string commandline, string applicationName, GAppInfoCreateFlags flags)
231 	{
232 		// GAppInfo * g_app_info_create_from_commandline (const char *commandline,  const char *application_name,  GAppInfoCreateFlags flags,  GError **error);
233 		GError* err = null;
234 		
235 		auto p = g_app_info_create_from_commandline(Str.toStringz(commandline), Str.toStringz(applicationName), flags, &err);
236 		
237 		if (err !is null)
238 		{
239 			throw new GException( new ErrorG(err) );
240 		}
241 		
242 		
243 		if(p is null)
244 		{
245 			return null;
246 		}
247 		
248 		return ObjectG.getDObject!(AppInfo, AppInfoIF)(cast(GAppInfo*) p);
249 	}
250 	
251 	/**
252 	 * Creates a duplicate of a GAppInfo.
253 	 * Returns: a duplicate of appinfo. [transfer full]
254 	 */
255 	public AppInfoIF dup()
256 	{
257 		// GAppInfo * g_app_info_dup (GAppInfo *appinfo);
258 		auto p = g_app_info_dup(getAppInfoTStruct());
259 		
260 		if(p is null)
261 		{
262 			return null;
263 		}
264 		
265 		return ObjectG.getDObject!(AppInfo, AppInfoIF)(cast(GAppInfo*) p);
266 	}
267 	
268 	/**
269 	 * Checks if two GAppInfos are equal.
270 	 * Params:
271 	 * appinfo2 = the second GAppInfo.
272 	 * Returns: TRUE if appinfo1 is equal to appinfo2. FALSE otherwise.
273 	 */
274 	public int equal(AppInfoIF appinfo2)
275 	{
276 		// gboolean g_app_info_equal (GAppInfo *appinfo1,  GAppInfo *appinfo2);
277 		return g_app_info_equal(getAppInfoTStruct(), (appinfo2 is null) ? null : appinfo2.getAppInfoTStruct());
278 	}
279 	
280 	/**
281 	 * Gets the ID of an application. An id is a string that
282 	 * identifies the application. The exact format of the id is
283 	 * platform dependent. For instance, on Unix this is the
284 	 * desktop file id from the xdg menu specification.
285 	 * Note that the returned ID may be NULL, depending on how
286 	 * the appinfo has been constructed.
287 	 * Returns: a string containing the application's ID.
288 	 */
289 	public string getId()
290 	{
291 		// const char * g_app_info_get_id (GAppInfo *appinfo);
292 		return Str.toString(g_app_info_get_id(getAppInfoTStruct()));
293 	}
294 	
295 	/**
296 	 * Gets the installed name of the application.
297 	 * Returns: the name of the application for appinfo.
298 	 */
299 	public string getName()
300 	{
301 		// const char * g_app_info_get_name (GAppInfo *appinfo);
302 		return Str.toString(g_app_info_get_name(getAppInfoTStruct()));
303 	}
304 	
305 	/**
306 	 * Gets the display name of the application. The display name is often more
307 	 * descriptive to the user than the name itself.
308 	 * Since 2.24
309 	 * Returns: the display name of the application for appinfo, or the name if no display name is available.
310 	 */
311 	public string getDisplayName()
312 	{
313 		// const char * g_app_info_get_display_name (GAppInfo *appinfo);
314 		return Str.toString(g_app_info_get_display_name(getAppInfoTStruct()));
315 	}
316 	
317 	/**
318 	 * Gets a human-readable description of an installed application.
319 	 * Returns: a string containing a description of the application appinfo, or NULL if none.
320 	 */
321 	public string getDescription()
322 	{
323 		// const char * g_app_info_get_description (GAppInfo *appinfo);
324 		return Str.toString(g_app_info_get_description(getAppInfoTStruct()));
325 	}
326 	
327 	/**
328 	 * Gets the executable's name for the installed application.
329 	 * Returns: a string containing the appinfo's application binaries name
330 	 */
331 	public string getExecutable()
332 	{
333 		// const char * g_app_info_get_executable (GAppInfo *appinfo);
334 		return Str.toString(g_app_info_get_executable(getAppInfoTStruct()));
335 	}
336 	
337 	/**
338 	 * Gets the commandline with which the application will be
339 	 * started.
340 	 * Since 2.20
341 	 * Returns: a string containing the appinfo's commandline, or NULL if this information is not available
342 	 */
343 	public string getCommandline()
344 	{
345 		// const char * g_app_info_get_commandline (GAppInfo *appinfo);
346 		return Str.toString(g_app_info_get_commandline(getAppInfoTStruct()));
347 	}
348 	
349 	/**
350 	 * Gets the icon for the application.
351 	 * Returns: the default GIcon for appinfo or NULL if there is no default icon. [transfer none]
352 	 */
353 	public IconIF getIcon()
354 	{
355 		// GIcon * g_app_info_get_icon (GAppInfo *appinfo);
356 		auto p = g_app_info_get_icon(getAppInfoTStruct());
357 		
358 		if(p is null)
359 		{
360 			return null;
361 		}
362 		
363 		return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p);
364 	}
365 	
366 	/**
367 	 * Launches the application. Passes files to the launched application
368 	 * as arguments, using the optional launch_context to get information
369 	 * about the details of the launcher (like what screen it is on).
370 	 * On error, error will be set accordingly.
371 	 * To launch the application without arguments pass a NULL files list.
372 	 * Note that even if the launch is successful the application launched
373 	 * can fail to start if it runs into problems during startup. There is
374 	 * no way to detect this.
375 	 * Some URIs can be changed when passed through a GFile (for instance
376 	 * unsupported URIs with strange formats like mailto:), so if you have
377 	 * a textual URI you want to pass in as argument, consider using
378 	 * g_app_info_launch_uris() instead.
379 	 * The launched application inherits the environment of the launching
380 	 * process, but it can be modified with g_app_launch_context_setenv() and
381 	 * g_app_launch_context_unsetenv().
382 	 * On UNIX, this function sets the GIO_LAUNCHED_DESKTOP_FILE
383 	 * environment variable with the path of the launched desktop file and
384 	 * GIO_LAUNCHED_DESKTOP_FILE_PID to the process
385 	 * id of the launched process. This can be used to ignore
386 	 * GIO_LAUNCHED_DESKTOP_FILE, should it be inherited
387 	 * by further processes. The DISPLAY and
388 	 * DESKTOP_STARTUP_ID environment variables are also
389 	 * set, based on information provided in launch_context.
390 	 * Params:
391 	 * files = a GList of GFile objects. [allow-none][element-type GFile]
392 	 * launchContext = a GAppLaunchContext or NULL. [allow-none]
393 	 * Returns: TRUE on successful launch, FALSE otherwise.
394 	 * Throws: GException on failure.
395 	 */
396 	public int launch(ListG files, AppLaunchContext launchContext)
397 	{
398 		// gboolean g_app_info_launch (GAppInfo *appinfo,  GList *files,  GAppLaunchContext *launch_context,  GError **error);
399 		GError* err = null;
400 		
401 		auto p = g_app_info_launch(getAppInfoTStruct(), (files is null) ? null : files.getListGStruct(), (launchContext is null) ? null : launchContext.getAppLaunchContextStruct(), &err);
402 		
403 		if (err !is null)
404 		{
405 			throw new GException( new ErrorG(err) );
406 		}
407 		
408 		return p;
409 	}
410 	
411 	/**
412 	 * Checks if the application accepts files as arguments.
413 	 * Returns: TRUE if the appinfo supports files.
414 	 */
415 	public int supportsFiles()
416 	{
417 		// gboolean g_app_info_supports_files (GAppInfo *appinfo);
418 		return g_app_info_supports_files(getAppInfoTStruct());
419 	}
420 	
421 	/**
422 	 * Checks if the application supports reading files and directories from URIs.
423 	 * Returns: TRUE if the appinfo supports URIs.
424 	 */
425 	public int supportsUris()
426 	{
427 		// gboolean g_app_info_supports_uris (GAppInfo *appinfo);
428 		return g_app_info_supports_uris(getAppInfoTStruct());
429 	}
430 	
431 	/**
432 	 * Launches the application. This passes the uris to the launched application
433 	 * as arguments, using the optional launch_context to get information
434 	 * about the details of the launcher (like what screen it is on).
435 	 * On error, error will be set accordingly.
436 	 * To launch the application without arguments pass a NULL uris list.
437 	 * Note that even if the launch is successful the application launched
438 	 * can fail to start if it runs into problems during startup. There is
439 	 * no way to detect this.
440 	 * Params:
441 	 * uris = a GList containing URIs to launch. [allow-none][element-type utf8]
442 	 * launchContext = a GAppLaunchContext or NULL. [allow-none]
443 	 * Returns: TRUE on successful launch, FALSE otherwise.
444 	 * Throws: GException on failure.
445 	 */
446 	public int launchUris(ListG uris, AppLaunchContext launchContext)
447 	{
448 		// gboolean g_app_info_launch_uris (GAppInfo *appinfo,  GList *uris,  GAppLaunchContext *launch_context,  GError **error);
449 		GError* err = null;
450 		
451 		auto p = g_app_info_launch_uris(getAppInfoTStruct(), (uris is null) ? null : uris.getListGStruct(), (launchContext is null) ? null : launchContext.getAppLaunchContextStruct(), &err);
452 		
453 		if (err !is null)
454 		{
455 			throw new GException( new ErrorG(err) );
456 		}
457 		
458 		return p;
459 	}
460 	
461 	/**
462 	 * Checks if the application info should be shown in menus that
463 	 * list available applications.
464 	 * Returns: TRUE if the appinfo should be shown, FALSE otherwise.
465 	 */
466 	public int shouldShow()
467 	{
468 		// gboolean g_app_info_should_show (GAppInfo *appinfo);
469 		return g_app_info_should_show(getAppInfoTStruct());
470 	}
471 	
472 	/**
473 	 * Obtains the information whether the GAppInfo can be deleted.
474 	 * See g_app_info_delete().
475 	 * Since 2.20
476 	 * Returns: TRUE if appinfo can be deleted
477 	 */
478 	public int canDelete()
479 	{
480 		// gboolean g_app_info_can_delete (GAppInfo *appinfo);
481 		return g_app_info_can_delete(getAppInfoTStruct());
482 	}
483 	
484 	/**
485 	 * Tries to delete a GAppInfo.
486 	 * On some platforms, there may be a difference between user-defined
487 	 * GAppInfos which can be deleted, and system-wide ones which
488 	 * cannot. See g_app_info_can_delete().
489 	 * Virtual: do_delete
490 	 * Since 2.20
491 	 * Returns: TRUE if appinfo has been deleted
492 	 */
493 	public int delet()
494 	{
495 		// gboolean g_app_info_delete (GAppInfo *appinfo);
496 		return g_app_info_delete(getAppInfoTStruct());
497 	}
498 	
499 	/**
500 	 * Removes all changes to the type associations done by
501 	 * g_app_info_set_as_default_for_type(),
502 	 * g_app_info_set_as_default_for_extension(),
503 	 * g_app_info_add_supports_type() or
504 	 * g_app_info_remove_supports_type().
505 	 * Since 2.20
506 	 * Params:
507 	 * contentType = a content type
508 	 */
509 	public static void resetTypeAssociations(string contentType)
510 	{
511 		// void g_app_info_reset_type_associations (const char *content_type);
512 		g_app_info_reset_type_associations(Str.toStringz(contentType));
513 	}
514 	
515 	/**
516 	 * Sets the application as the default handler for a given type.
517 	 * Params:
518 	 * contentType = the content type.
519 	 * Returns: TRUE on success, FALSE on error.
520 	 * Throws: GException on failure.
521 	 */
522 	public int setAsDefaultForType(string contentType)
523 	{
524 		// gboolean g_app_info_set_as_default_for_type (GAppInfo *appinfo,  const char *content_type,  GError **error);
525 		GError* err = null;
526 		
527 		auto p = g_app_info_set_as_default_for_type(getAppInfoTStruct(), Str.toStringz(contentType), &err);
528 		
529 		if (err !is null)
530 		{
531 			throw new GException( new ErrorG(err) );
532 		}
533 		
534 		return p;
535 	}
536 	
537 	/**
538 	 * Sets the application as the default handler for the given file extension.
539 	 * Params:
540 	 * extension = a string containing the file extension (without the dot).
541 	 * Returns: TRUE on success, FALSE on error.
542 	 * Throws: GException on failure.
543 	 */
544 	public int setAsDefaultForExtension(string extension)
545 	{
546 		// gboolean g_app_info_set_as_default_for_extension  (GAppInfo *appinfo,  const char *extension,  GError **error);
547 		GError* err = null;
548 		
549 		auto p = g_app_info_set_as_default_for_extension(getAppInfoTStruct(), Str.toStringz(extension), &err);
550 		
551 		if (err !is null)
552 		{
553 			throw new GException( new ErrorG(err) );
554 		}
555 		
556 		return p;
557 	}
558 	
559 	/**
560 	 * Sets the application as the last used application for a given type.
561 	 * This will make the application appear as first in the list returned
562 	 * by g_app_info_get_recommended_for_type(), regardless of the default
563 	 * application for that content type.
564 	 * Params:
565 	 * contentType = the content type.
566 	 * Returns: TRUE on success, FALSE on error.
567 	 * Throws: GException on failure.
568 	 */
569 	public int setAsLastUsedForType(string contentType)
570 	{
571 		// gboolean g_app_info_set_as_last_used_for_type  (GAppInfo *appinfo,  const char *content_type,  GError **error);
572 		GError* err = null;
573 		
574 		auto p = g_app_info_set_as_last_used_for_type(getAppInfoTStruct(), Str.toStringz(contentType), &err);
575 		
576 		if (err !is null)
577 		{
578 			throw new GException( new ErrorG(err) );
579 		}
580 		
581 		return p;
582 	}
583 	
584 	/**
585 	 * Adds a content type to the application information to indicate the
586 	 * application is capable of opening files with the given content type.
587 	 * Params:
588 	 * contentType = a string.
589 	 * Returns: TRUE on success, FALSE on error.
590 	 * Throws: GException on failure.
591 	 */
592 	public int addSupportsType(string contentType)
593 	{
594 		// gboolean g_app_info_add_supports_type (GAppInfo *appinfo,  const char *content_type,  GError **error);
595 		GError* err = null;
596 		
597 		auto p = g_app_info_add_supports_type(getAppInfoTStruct(), Str.toStringz(contentType), &err);
598 		
599 		if (err !is null)
600 		{
601 			throw new GException( new ErrorG(err) );
602 		}
603 		
604 		return p;
605 	}
606 	
607 	/**
608 	 * Checks if a supported content type can be removed from an application.
609 	 * Returns: TRUE if it is possible to remove supported content types from a given appinfo, FALSE if not.
610 	 */
611 	public int canRemoveSupportsType()
612 	{
613 		// gboolean g_app_info_can_remove_supports_type (GAppInfo *appinfo);
614 		return g_app_info_can_remove_supports_type(getAppInfoTStruct());
615 	}
616 	
617 	/**
618 	 * Removes a supported type from an application, if possible.
619 	 * Params:
620 	 * contentType = a string.
621 	 * Returns: TRUE on success, FALSE on error.
622 	 * Throws: GException on failure.
623 	 */
624 	public int removeSupportsType(string contentType)
625 	{
626 		// gboolean g_app_info_remove_supports_type (GAppInfo *appinfo,  const char *content_type,  GError **error);
627 		GError* err = null;
628 		
629 		auto p = g_app_info_remove_supports_type(getAppInfoTStruct(), Str.toStringz(contentType), &err);
630 		
631 		if (err !is null)
632 		{
633 			throw new GException( new ErrorG(err) );
634 		}
635 		
636 		return p;
637 	}
638 	
639 	/**
640 	 * Retrieves the list of content types that app_info claims to support.
641 	 * If this information is not provided by the environment, this function
642 	 * will return NULL.
643 	 * This function does not take in consideration associations added with
644 	 * g_app_info_add_supports_type(), but only those exported directly by
645 	 * the application.
646 	 * Since 2.34
647 	 * Returns: a list of content types. [transfer none][array zero-terminated=1][element-type utf8]
648 	 */
649 	public string[] getSupportedTypes()
650 	{
651 		// const char ** g_app_info_get_supported_types (GAppInfo *appinfo);
652 		return Str.toStringArray(g_app_info_get_supported_types(getAppInfoTStruct()));
653 	}
654 	
655 	/**
656 	 * Gets a list of all of the applications currently registered
657 	 * on this system.
658 	 * For desktop files, this includes applications that have
659 	 * NoDisplay=true set or are excluded from
660 	 * display by means of OnlyShowIn or
661 	 * NotShowIn. See g_app_info_should_show().
662 	 * The returned list does not include applications which have
663 	 * the Hidden key set.
664 	 * Returns: a newly allocated GList of references to GAppInfos. [element-type GAppInfo][transfer full]
665 	 */
666 	public static ListG getAll()
667 	{
668 		// GList * g_app_info_get_all (void);
669 		auto p = g_app_info_get_all();
670 		
671 		if(p is null)
672 		{
673 			return null;
674 		}
675 		
676 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
677 	}
678 	
679 	/**
680 	 * Gets a list of all GAppInfos for a given content type,
681 	 * including the recommended and fallback GAppInfos. See
682 	 * g_app_info_get_recommended_for_type() and
683 	 * g_app_info_get_fallback_for_type().
684 	 * Params:
685 	 * contentType = the content type to find a GAppInfo for
686 	 * Returns: GList of GAppInfos for given content_type or NULL on error. [element-type GAppInfo][transfer full]
687 	 */
688 	public static ListG getAllForType(string contentType)
689 	{
690 		// GList * g_app_info_get_all_for_type (const char *content_type);
691 		auto p = g_app_info_get_all_for_type(Str.toStringz(contentType));
692 		
693 		if(p is null)
694 		{
695 			return null;
696 		}
697 		
698 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
699 	}
700 	
701 	/**
702 	 * Gets the default GAppInfo for a given content type.
703 	 * Params:
704 	 * contentType = the content type to find a GAppInfo for
705 	 * mustSupportUris = if TRUE, the GAppInfo is expected to
706 	 * support URIs
707 	 * Returns: GAppInfo for given content_type or NULL on error. [transfer full]
708 	 */
709 	public static AppInfoIF getDefaultForType(string contentType, int mustSupportUris)
710 	{
711 		// GAppInfo * g_app_info_get_default_for_type (const char *content_type,  gboolean must_support_uris);
712 		auto p = g_app_info_get_default_for_type(Str.toStringz(contentType), mustSupportUris);
713 		
714 		if(p is null)
715 		{
716 			return null;
717 		}
718 		
719 		return ObjectG.getDObject!(AppInfo, AppInfoIF)(cast(GAppInfo*) p);
720 	}
721 	
722 	/**
723 	 * Gets the default application for handling URIs with
724 	 * the given URI scheme. A URI scheme is the initial part
725 	 * of the URI, up to but not including the ':', e.g. "http",
726 	 * "ftp" or "sip".
727 	 * Params:
728 	 * uriScheme = a string containing a URI scheme.
729 	 * Returns: GAppInfo for given uri_scheme or NULL on error. [transfer full]
730 	 */
731 	public static AppInfoIF getDefaultForUriScheme(string uriScheme)
732 	{
733 		// GAppInfo * g_app_info_get_default_for_uri_scheme  (const char *uri_scheme);
734 		auto p = g_app_info_get_default_for_uri_scheme(Str.toStringz(uriScheme));
735 		
736 		if(p is null)
737 		{
738 			return null;
739 		}
740 		
741 		return ObjectG.getDObject!(AppInfo, AppInfoIF)(cast(GAppInfo*) p);
742 	}
743 	
744 	/**
745 	 * Gets a list of fallback GAppInfos for a given content type, i.e.
746 	 * those applications which claim to support the given content type
747 	 * by MIME type subclassing and not directly.
748 	 * Since 2.28
749 	 * Params:
750 	 * contentType = the content type to find a GAppInfo for
751 	 * Returns: GList of GAppInfos for given content_type or NULL on error. [element-type GAppInfo][transfer full]
752 	 */
753 	public static ListG getFallbackForType(string contentType)
754 	{
755 		// GList * g_app_info_get_fallback_for_type (const gchar *content_type);
756 		auto p = g_app_info_get_fallback_for_type(Str.toStringz(contentType));
757 		
758 		if(p is null)
759 		{
760 			return null;
761 		}
762 		
763 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
764 	}
765 	
766 	/**
767 	 * Gets a list of recommended GAppInfos for a given content type, i.e.
768 	 * those applications which claim to support the given content type exactly,
769 	 * and not by MIME type subclassing.
770 	 * Note that the first application of the list is the last used one, i.e.
771 	 * the last one for which g_app_info_set_as_last_used_for_type() has been
772 	 * called.
773 	 * Since 2.28
774 	 * Params:
775 	 * contentType = the content type to find a GAppInfo for
776 	 * Returns: GList of GAppInfos for given content_type or NULL on error. [element-type GAppInfo][transfer full]
777 	 */
778 	public static ListG getRecommendedForType(string contentType)
779 	{
780 		// GList * g_app_info_get_recommended_for_type (const gchar *content_type);
781 		auto p = g_app_info_get_recommended_for_type(Str.toStringz(contentType));
782 		
783 		if(p is null)
784 		{
785 			return null;
786 		}
787 		
788 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
789 	}
790 	
791 	/**
792 	 * Utility function that launches the default application
793 	 * registered to handle the specified uri. Synchronous I/O
794 	 * is done on the uri to detect the type of the file if
795 	 * required.
796 	 * Params:
797 	 * uri = the uri to show
798 	 * launchContext = an optional GAppLaunchContext. [allow-none]
799 	 * Returns: TRUE on success, FALSE on error.
800 	 * Throws: GException on failure.
801 	 */
802 	public static int launchDefaultForUri(string uri, AppLaunchContext launchContext)
803 	{
804 		// gboolean g_app_info_launch_default_for_uri (const char *uri,  GAppLaunchContext *launch_context,  GError **error);
805 		GError* err = null;
806 		
807 		auto p = g_app_info_launch_default_for_uri(Str.toStringz(uri), (launchContext is null) ? null : launchContext.getAppLaunchContextStruct(), &err);
808 		
809 		if (err !is null)
810 		{
811 			throw new GException( new ErrorG(err) );
812 		}
813 		
814 		return p;
815 	}
816 }