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