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