source: appstream-generator/build/girepo/gio/AppInfoIF.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 15.6 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.AppInfoIF;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.AppInfo;
26private import gio.AppInfoIF;
27private import gio.AppLaunchContext;
28private import gio.FileIF;
29private import gio.Icon;
30private import gio.IconIF;
31private import glib.ErrorG;
32private import glib.GException;
33private import glib.ListG;
34private import glib.Str;
35private import gobject.ObjectG;
36
37
38/**
39 * #GAppInfo and #GAppLaunchContext are used for describing and launching
40 * applications installed on the system.
41 *
42 * As of GLib 2.20, URIs will always be converted to POSIX paths
43 * (using g_file_get_path()) when using g_app_info_launch() even if
44 * the application requested an URI and not a POSIX path. For example
45 * for an desktop-file based application with Exec key `totem
46 * %U` and a single URI, `sftp://foo/file.avi`, then
47 * `/home/user/.gvfs/sftp on foo/file.avi` will be passed. This will
48 * only work if a set of suitable GIO extensions (such as gvfs 2.26
49 * compiled with FUSE support), is available and operational; if this
50 * is not the case, the URI will be passed unmodified to the application.
51 * Some URIs, such as `mailto:`, of course cannot be mapped to a POSIX
52 * path (in gvfs there's no FUSE mount for it); such URIs will be
53 * passed unmodified to the application.
54 *
55 * Specifically for gvfs 2.26 and later, the POSIX URI will be mapped
56 * back to the GIO URI in the #GFile constructors (since gvfs
57 * implements the #GVfs extension point). As such, if the application
58 * needs to examine the URI, it needs to use g_file_get_uri() or
59 * similar on #GFile. In other words, an application cannot assume
60 * that the URI passed to e.g. g_file_new_for_commandline_arg() is
61 * equal to the result of g_file_get_uri(). The following snippet
62 * illustrates this:
63 *
64 * |[
65 * GFile *f;
66 * char *uri;
67 *
68 * file = g_file_new_for_commandline_arg (uri_from_commandline);
69 *
70 * uri = g_file_get_uri (file);
71 * strcmp (uri, uri_from_commandline) == 0;
72 * g_free (uri);
73 *
74 * if (g_file_has_uri_scheme (file, "cdda"))
75 * {
76 * // do something special with uri
77 * }
78 * g_object_unref (file);
79 * ]|
80 *
81 * This code will work when both `cdda://sr0/Track 1.wav` and
82 * `/home/user/.gvfs/cdda on sr0/Track 1.wav` is passed to the
83 * application. It should be noted that it's generally not safe
84 * for applications to rely on the format of a particular URIs.
85 * Different launcher applications (e.g. file managers) may have
86 * different ideas of what a given URI means.
87 */
88public interface AppInfoIF{
89        /** Get the main Gtk struct */
90        public GAppInfo* getAppInfoStruct();
91
92        /** the main Gtk struct as a void* */
93        protected void* getStruct();
94
95
96        /**
97         * Creates a new #GAppInfo from the given information.
98         *
99         * Note that for @commandline, the quoting rules of the Exec key of the
100         * [freedesktop.org Desktop Entry Specification](http://freedesktop.org/Standards/desktop-entry-spec)
101         * are applied. For example, if the @commandline contains
102         * percent-encoded URIs, the percent-character must be doubled in order to prevent it from
103         * being swallowed by Exec key unquoting. See the specification for exact quoting rules.
104         *
105         * Params:
106         *     commandline = the commandline to use
107         *     applicationName = the application name, or %NULL to use @commandline
108         *     flags = flags that can specify details of the created #GAppInfo
109         *
110         * Returns: new #GAppInfo for given command.
111         *
112         * Throws: GException on failure.
113         */
114        public static AppInfoIF createFromCommandline(string commandline, string applicationName, GAppInfoCreateFlags flags);
115
116        /**
117         * Gets a list of all of the applications currently registered
118         * on this system.
119         *
120         * For desktop files, this includes applications that have
121         * `NoDisplay=true` set or are excluded from display by means
122         * of `OnlyShowIn` or `NotShowIn`. See g_app_info_should_show().
123         * The returned list does not include applications which have
124         * the `Hidden` key set.
125         *
126         * Returns: a newly allocated #GList of references to #GAppInfos.
127         */
128        public static ListG getAll();
129
130        /**
131         * Gets a list of all #GAppInfos for a given content type,
132         * including the recommended and fallback #GAppInfos. See
133         * g_app_info_get_recommended_for_type() and
134         * g_app_info_get_fallback_for_type().
135         *
136         * Params:
137         *     contentType = the content type to find a #GAppInfo for
138         *
139         * Returns: #GList of #GAppInfos
140         *     for given @content_type or %NULL on error.
141         */
142        public static ListG getAllForType(string contentType);
143
144        /**
145         * Gets the default #GAppInfo for a given content type.
146         *
147         * Params:
148         *     contentType = the content type to find a #GAppInfo for
149         *     mustSupportUris = if %TRUE, the #GAppInfo is expected to
150         *         support URIs
151         *
152         * Returns: #GAppInfo for given @content_type or
153         *     %NULL on error.
154         */
155        public static AppInfoIF getDefaultForType(string contentType, bool mustSupportUris);
156
157        /**
158         * Gets the default application for handling URIs with
159         * the given URI scheme. A URI scheme is the initial part
160         * of the URI, up to but not including the ':', e.g. "http",
161         * "ftp" or "sip".
162         *
163         * Params:
164         *     uriScheme = a string containing a URI scheme.
165         *
166         * Returns: #GAppInfo for given @uri_scheme or %NULL on error.
167         */
168        public static AppInfoIF getDefaultForUriScheme(string uriScheme);
169
170        /**
171         * Gets a list of fallback #GAppInfos for a given content type, i.e.
172         * those applications which claim to support the given content type
173         * by MIME type subclassing and not directly.
174         *
175         * Params:
176         *     contentType = the content type to find a #GAppInfo for
177         *
178         * Returns: #GList of #GAppInfos
179         *     for given @content_type or %NULL on error.
180         *
181         * Since: 2.28
182         */
183        public static ListG getFallbackForType(string contentType);
184
185        /**
186         * Gets a list of recommended #GAppInfos for a given content type, i.e.
187         * those applications which claim to support the given content type exactly,
188         * and not by MIME type subclassing.
189         * Note that the first application of the list is the last used one, i.e.
190         * the last one for which g_app_info_set_as_last_used_for_type() has been
191         * called.
192         *
193         * Params:
194         *     contentType = the content type to find a #GAppInfo for
195         *
196         * Returns: #GList of #GAppInfos
197         *     for given @content_type or %NULL on error.
198         *
199         * Since: 2.28
200         */
201        public static ListG getRecommendedForType(string contentType);
202
203        /**
204         * Utility function that launches the default application
205         * registered to handle the specified uri. Synchronous I/O
206         * is done on the uri to detect the type of the file if
207         * required.
208         *
209         * Params:
210         *     uri = the uri to show
211         *     launchContext = an optional #GAppLaunchContext.
212         *
213         * Returns: %TRUE on success, %FALSE on error.
214         *
215         * Throws: GException on failure.
216         */
217        public static bool launchDefaultForUri(string uri, AppLaunchContext launchContext);
218
219        /**
220         * Removes all changes to the type associations done by
221         * g_app_info_set_as_default_for_type(),
222         * g_app_info_set_as_default_for_extension(),
223         * g_app_info_add_supports_type() or
224         * g_app_info_remove_supports_type().
225         *
226         * Params:
227         *     contentType = a content type
228         *
229         * Since: 2.20
230         */
231        public static void resetTypeAssociations(string contentType);
232
233        /**
234         * Adds a content type to the application information to indicate the
235         * application is capable of opening files with the given content type.
236         *
237         * Params:
238         *     contentType = a string.
239         *
240         * Returns: %TRUE on success, %FALSE on error.
241         *
242         * Throws: GException on failure.
243         */
244        public bool addSupportsType(string contentType);
245
246        /**
247         * Obtains the information whether the #GAppInfo can be deleted.
248         * See g_app_info_delete().
249         *
250         * Returns: %TRUE if @appinfo can be deleted
251         *
252         * Since: 2.20
253         */
254        public bool canDelete();
255
256        /**
257         * Checks if a supported content type can be removed from an application.
258         *
259         * Returns: %TRUE if it is possible to remove supported
260         *     content types from a given @appinfo, %FALSE if not.
261         */
262        public bool canRemoveSupportsType();
263
264        /**
265         * Tries to delete a #GAppInfo.
266         *
267         * On some platforms, there may be a difference between user-defined
268         * #GAppInfos which can be deleted, and system-wide ones which cannot.
269         * See g_app_info_can_delete().
270         *
271         * Returns: %TRUE if @appinfo has been deleted
272         *
273         * Since: 2.20
274         */
275        public bool delet();
276
277        /**
278         * Creates a duplicate of a #GAppInfo.
279         *
280         * Returns: a duplicate of @appinfo.
281         */
282        public AppInfoIF dup();
283
284        /**
285         * Checks if two #GAppInfos are equal.
286         *
287         * Params:
288         *     appinfo2 = the second #GAppInfo.
289         *
290         * Returns: %TRUE if @appinfo1 is equal to @appinfo2. %FALSE otherwise.
291         */
292        public bool equal(AppInfoIF appinfo2);
293
294        /**
295         * Gets the commandline with which the application will be
296         * started.
297         *
298         * Returns: a string containing the @appinfo's commandline,
299         *     or %NULL if this information is not available
300         *
301         * Since: 2.20
302         */
303        public string getCommandline();
304
305        /**
306         * Gets a human-readable description of an installed application.
307         *
308         * Returns: a string containing a description of the
309         *     application @appinfo, or %NULL if none.
310         */
311        public string getDescription();
312
313        /**
314         * Gets the display name of the application. The display name is often more
315         * descriptive to the user than the name itself.
316         *
317         * Returns: the display name of the application for @appinfo, or the name if
318         *     no display name is available.
319         *
320         * Since: 2.24
321         */
322        public string getDisplayName();
323
324        /**
325         * Gets the executable's name for the installed application.
326         *
327         * Returns: a string containing the @appinfo's application
328         *     binaries name
329         */
330        public string getExecutable();
331
332        /**
333         * Gets the icon for the application.
334         *
335         * Returns: the default #GIcon for @appinfo or %NULL
336         *     if there is no default icon.
337         */
338        public IconIF getIcon();
339
340        /**
341         * Gets the ID of an application. An id is a string that
342         * identifies the application. The exact format of the id is
343         * platform dependent. For instance, on Unix this is the
344         * desktop file id from the xdg menu specification.
345         *
346         * Note that the returned ID may be %NULL, depending on how
347         * the @appinfo has been constructed.
348         *
349         * Returns: a string containing the application's ID.
350         */
351        public string getId();
352
353        /**
354         * Gets the installed name of the application.
355         *
356         * Returns: the name of the application for @appinfo.
357         */
358        public string getName();
359
360        /**
361         * Retrieves the list of content types that @app_info claims to support.
362         * If this information is not provided by the environment, this function
363         * will return %NULL.
364         * This function does not take in consideration associations added with
365         * g_app_info_add_supports_type(), but only those exported directly by
366         * the application.
367         *
368         * Returns: a list of content types.
369         *
370         * Since: 2.34
371         */
372        public string[] getSupportedTypes();
373
374        /**
375         * Launches the application. Passes @files to the launched application
376         * as arguments, using the optional @launch_context to get information
377         * about the details of the launcher (like what screen it is on).
378         * On error, @error will be set accordingly.
379         *
380         * To launch the application without arguments pass a %NULL @files list.
381         *
382         * Note that even if the launch is successful the application launched
383         * can fail to start if it runs into problems during startup. There is
384         * no way to detect this.
385         *
386         * Some URIs can be changed when passed through a GFile (for instance
387         * unsupported URIs with strange formats like mailto:), so if you have
388         * a textual URI you want to pass in as argument, consider using
389         * g_app_info_launch_uris() instead.
390         *
391         * The launched application inherits the environment of the launching
392         * process, but it can be modified with g_app_launch_context_setenv()
393         * and g_app_launch_context_unsetenv().
394         *
395         * On UNIX, this function sets the `GIO_LAUNCHED_DESKTOP_FILE`
396         * environment variable with the path of the launched desktop file and
397         * `GIO_LAUNCHED_DESKTOP_FILE_PID` to the process id of the launched
398         * process. This can be used to ignore `GIO_LAUNCHED_DESKTOP_FILE`,
399         * should it be inherited by further processes. The `DISPLAY` and
400         * `DESKTOP_STARTUP_ID` environment variables are also set, based
401         * on information provided in @launch_context.
402         *
403         * Params:
404         *     files = a #GList of #GFile objects
405         *     launchContext = a #GAppLaunchContext or %NULL
406         *
407         * Returns: %TRUE on successful launch, %FALSE otherwise.
408         *
409         * Throws: GException on failure.
410         */
411        public bool launch(ListG files, AppLaunchContext launchContext);
412
413        /**
414         * Launches the application. This passes the @uris to the launched application
415         * as arguments, using the optional @launch_context to get information
416         * about the details of the launcher (like what screen it is on).
417         * On error, @error will be set accordingly.
418         *
419         * To launch the application without arguments pass a %NULL @uris list.
420         *
421         * Note that even if the launch is successful the application launched
422         * can fail to start if it runs into problems during startup. There is
423         * no way to detect this.
424         *
425         * Params:
426         *     uris = a #GList containing URIs to launch.
427         *     launchContext = a #GAppLaunchContext or %NULL
428         *
429         * Returns: %TRUE on successful launch, %FALSE otherwise.
430         *
431         * Throws: GException on failure.
432         */
433        public bool launchUris(ListG uris, AppLaunchContext launchContext);
434
435        /**
436         * Removes a supported type from an application, if possible.
437         *
438         * Params:
439         *     contentType = a string.
440         *
441         * Returns: %TRUE on success, %FALSE on error.
442         *
443         * Throws: GException on failure.
444         */
445        public bool removeSupportsType(string contentType);
446
447        /**
448         * Sets the application as the default handler for the given file extension.
449         *
450         * Params:
451         *     extension = a string containing the file extension (without the dot).
452         *
453         * Returns: %TRUE on success, %FALSE on error.
454         *
455         * Throws: GException on failure.
456         */
457        public bool setAsDefaultForExtension(string extension);
458
459        /**
460         * Sets the application as the default handler for a given type.
461         *
462         * Params:
463         *     contentType = the content type.
464         *
465         * Returns: %TRUE on success, %FALSE on error.
466         *
467         * Throws: GException on failure.
468         */
469        public bool setAsDefaultForType(string contentType);
470
471        /**
472         * Sets the application as the last used application for a given type.
473         * This will make the application appear as first in the list returned
474         * by g_app_info_get_recommended_for_type(), regardless of the default
475         * application for that content type.
476         *
477         * Params:
478         *     contentType = the content type.
479         *
480         * Returns: %TRUE on success, %FALSE on error.
481         *
482         * Throws: GException on failure.
483         */
484        public bool setAsLastUsedForType(string contentType);
485
486        /**
487         * Checks if the application info should be shown in menus that
488         * list available applications.
489         *
490         * Returns: %TRUE if the @appinfo should be shown, %FALSE otherwise.
491         */
492        public bool shouldShow();
493
494        /**
495         * Checks if the application accepts files as arguments.
496         *
497         * Returns: %TRUE if the @appinfo supports files.
498         */
499        public bool supportsFiles();
500
501        /**
502         * Checks if the application supports reading files and directories from URIs.
503         *
504         * Returns: %TRUE if the @appinfo supports URIs.
505         */
506        public bool supportsUris();
507}
Note: See TracBrowser for help on using the repository browser.