root/trunk/src/gio/AppInfoIF.d

Revision 938, 15.1 kB (checked in by Mike Wey, 3 months ago)

Update Gio to 2.28.

Line 
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 = AppInfoIF
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  * extend  =
38  * implements:
39  * prefixes:
40  *  - g_app_info_
41  * omit structs:
42  * omit prefixes:
43  *  - g_app_launch_context_
44  * omit code:
45  * omit signals:
46  * imports:
47  *  - glib.Str
48  *  - glib.ErrorG
49  *  - glib.GException
50  *  - glib.ListG
51  *  - gio.AppInfoIF
52  *  - gio.AppLaunchContext
53  *  - gio.Icon
54  *  - gio.IconIF
55  * structWrap:
56  *  - GAppInfo* -> AppInfoIF
57  *  - GAppLaunchContext* -> AppLaunchContext
58  *  - GIcon* -> IconIF
59  *  - GList* -> ListG
60  * module aliases:
61  * local aliases:
62  * overrides:
63  */
64
65 module gio.AppInfoIF;
66
67 public  import gtkc.giotypes;
68
69 private import gtkc.gio;
70 private import glib.ConstructionException;
71
72
73 private import glib.Str;
74 private import glib.ErrorG;
75 private import glib.GException;
76 private import glib.ListG;
77 private import gio.AppInfoIF;
78 private import gio.AppLaunchContext;
79 private import gio.Icon;
80 private import gio.IconIF;
81
82
83
84
85 /**
86  * Description
87  * GAppInfo and GAppLaunchContext are used for describing and launching
88  * applications installed on the system.
89  * As of GLib 2.20, URIs will always be converted to POSIX paths
90  * (using g_file_get_path()) when using g_app_info_launch() even if
91  * the application requested an URI and not a POSIX path. For example
92  * for an desktop-file based application with Exec key totem
93  * %U and a single URI,
94  * sftp://foo/file.avi, then
95  * /home/user/.gvfs/sftp on foo/file.avi will be
96  * passed. This will only work if a set of suitable GIO extensions
97  * (such as gvfs 2.26 compiled with FUSE support), is available and
98  * operational; if this is not the case, the URI will be passed
99  * unmodified to the application. Some URIs, such as
100  * mailto:, of course cannot be mapped to a POSIX
101  * path (in gvfs there's no FUSE mount for it); such URIs will be
102  * passed unmodified to the application.
103  * Specifically for gvfs 2.26 and later, the POSIX URI will be mapped
104  * back to the GIO URI in the GFile constructors (since gvfs
105  * implements the GVfs extension point). As such, if the application
106  * needs to examine the URI, it needs to use g_file_get_uri() or
107  * similar on GFile. In other words, an application cannot assume
108  * that the URI passed to e.g. g_file_new_for_commandline_arg() is
109  * equal to the result of g_file_get_uri(). The following snippet
110  * illustrates this:
111  * GFile *f;
112  * char *uri;
113  * file = g_file_new_for_commandline_arg (uri_from_commandline);
114  * uri = g_file_get_uri (file);
115  * strcmp (uri, uri_from_commandline) == 0; // FALSE
116  * g_free (uri);
117  * if (g_file_has_uri_scheme (file, "cdda"))
118  *  {
119      *  // do something special with uri
120  *  }
121  * g_object_unref (file);
122  * This code will work when both cdda://sr0/Track
123  * 1.wav and /home/user/.gvfs/cdda on sr0/Track
124  * 1.wav is passed to the application. It should be noted
125  * that it's generally not safe for applications to rely on the format
126  * of a particular URIs. Different launcher applications (e.g. file
127  * managers) may have different ideas of what a given URI means.
128  */
129 public interface AppInfoIF
130 {
131    
132    
133     public GAppInfo* getAppInfoTStruct();
134    
135     /** the main Gtk struct as a void* */
136     protected void* getStruct();
137    
138    
139     /**
140      */
141    
142     /**
143      * Creates a new GAppInfo from the given information.
144      * Params:
145      * commandline = the commandline to use
146      * applicationName = the application name, or NULL to use commandline. [allow-none]
147      * flags = flags that can specify details of the created GAppInfo
148      * Returns: new GAppInfo for given command. [transfer full]
149      * Throws: GException on failure.
150      */
151     public static AppInfoIF createFromCommandline(string commandline, string applicationName, GAppInfoCreateFlags flags);
152    
153     /**
154      * Creates a duplicate of a GAppInfo.
155      * Returns: a duplicate of appinfo. [transfer full]
156      */
157     public AppInfoIF dup();
158    
159     /**
160      * Checks if two GAppInfos are equal.
161      * Params:
162      * appinfo2 = the second GAppInfo.
163      * Returns: TRUE if appinfo1 is equal to appinfo2. FALSE otherwise.
164      */
165     public int equal(AppInfoIF appinfo2);
166    
167     /**
168      * Gets the ID of an application. An id is a string that
169      * identifies the application. The exact format of the id is
170      * platform dependent. For instance, on Unix this is the
171      * desktop file id from the xdg menu specification.
172      * Note that the returned ID may be NULL, depending on how
173      * the appinfo has been constructed.
174      * Returns: a string containing the application's ID.
175      */
176     public string getId();
177    
178     /**
179      * Gets the installed name of the application.
180      * Returns: the name of the application for appinfo.
181      */
182     public string getName();
183    
184     /**
185      * Gets the display name of the application. The display name is often more
186      * descriptive to the user than the name itself.
187      * Since 2.24
188      * Returns: the display name of the application for appinfo, or the name if no display name is available.
189      */
190     public string getDisplayName();
191    
192     /**
193      * Gets a human-readable description of an installed application.
194      * Returns: a string containing a description of the application appinfo, or NULL if none.
195      */
196     public string getDescription();
197    
198     /**
199      * Gets the executable's name for the installed application.
200      * Returns: a string containing the appinfo's application binaries name
201      */
202     public string getExecutable();
203    
204     /**
205      * Gets the commandline with which the application will be
206      * started.
207      * Since 2.20
208      * Returns: a string containing the appinfo's commandline, or NULL if this information is not available
209      */
210     public string getCommandline();
211    
212     /**
213      * Gets the icon for the application.
214      * Returns: the default GIcon for appinfo. [transfer none]
215      */
216     public IconIF getIcon();
217    
218     /**
219      * Launches the application. Passes files to the launched application
220      * as arguments, using the optional launch_context to get information
221      * about the details of the launcher (like what screen it is on).
222      * On error, error will be set accordingly.
223      * To launch the application without arguments pass a NULL files list.
224      * Note that even if the launch is successful the application launched
225      * can fail to start if it runs into problems during startup. There is
226      * no way to detect this.
227      * Some URIs can be changed when passed through a GFile (for instance
228      * unsupported uris with strange formats like mailto:), so if you have
229      * a textual uri you want to pass in as argument, consider using
230      * g_app_info_launch_uris() instead.
231      * On UNIX, this function sets the GIO_LAUNCHED_DESKTOP_FILE
232      * environment variable with the path of the launched desktop file and
233      * GIO_LAUNCHED_DESKTOP_FILE_PID to the process
234      * id of the launched process. This can be used to ignore
235      * GIO_LAUNCHED_DESKTOP_FILE, should it be inherited
236      * by further processes. The DISPLAY and
237      * DESKTOP_STARTUP_ID environment variables are also
238      * set, based on information provided in launch_context.
239      * Params:
240      * files = a GList of GFile objects. [element-type GFile]
241      * launchContext = a GAppLaunchContext or NULL. [allow-none]
242      * Returns: TRUE on successful launch, FALSE otherwise.
243      * Throws: GException on failure.
244      */
245     public int launch(ListG files, AppLaunchContext launchContext);
246    
247     /**
248      * Checks if the application accepts files as arguments.
249      * Returns: TRUE if the appinfo supports files.
250      */
251     public int supportsFiles();
252    
253     /**
254      * Checks if the application supports reading files and directories from URIs.
255      * Returns: TRUE if the appinfo supports URIs.
256      */
257     public int supportsUris();
258    
259     /**
260      * Launches the application. Passes uris to the launched application
261      * as arguments, using the optional launch_context to get information
262      * about the details of the launcher (like what screen it is on).
263      * On error, error will be set accordingly.
264      * To lauch the application without arguments pass a NULL uris list.
265      * Note that even if the launch is successful the application launched
266      * can fail to start if it runs into problems during startup. There is
267      * no way to detect this.
268      * Params:
269      * uris = a GList containing URIs to launch. [element-type utf8]
270      * launchContext = a GAppLaunchContext or NULL. [allow-none]
271      * Returns: TRUE on successful launch, FALSE otherwise.
272      * Throws: GException on failure.
273      */
274     public int launchUris(ListG uris, AppLaunchContext launchContext);
275    
276     /**
277      * Checks if the application info should be shown in menus that
278      * list available applications.
279      * Returns: TRUE if the appinfo should be shown, FALSE otherwise.
280      */
281     public int shouldShow();
282    
283     /**
284      * Obtains the information whether the GAppInfo can be deleted.
285      * See g_app_info_delete().
286      * Since 2.20
287      * Returns: TRUE if appinfo can be deleted
288      */
289     public int canDelete();
290    
291     /**
292      * Tries to delete a GAppInfo.
293      * On some platforms, there may be a difference between user-defined
294      * GAppInfos which can be deleted, and system-wide ones which
295      * cannot. See g_app_info_can_delete().
296      * Virtual: do_delete
297      * Since 2.20
298      * Returns: TRUE if appinfo has been deleted
299      */
300     public int delet();
301    
302     /**
303      * Removes all changes to the type associations done by
304      * g_app_info_set_as_default_for_type(),
305      * g_app_info_set_as_default_for_extension(),
306      * g_app_info_add_supports_type() or g_app_info_remove_supports_type().
307      * Since 2.20
308      * Params:
309      * contentType = a content type
310      */
311     public static void resetTypeAssociations(string contentType);
312    
313     /**
314      * Sets the application as the default handler for a given type.
315      * Params:
316      * contentType = the content type.
317      * Returns: TRUE on success, FALSE on error.
318      * Throws: GException on failure.
319      */
320     public int setAsDefaultForType(string contentType);
321    
322     /**
323      * Sets the application as the default handler for the given file extension.
324      * Params:
325      * extension = a string containing the file extension (without the dot).
326      * Returns: TRUE on success, FALSE on error.
327      * Throws: GException on failure.
328      */
329     public int setAsDefaultForExtension(string extension);
330    
331     /**
332      * Sets the application as the last used application for a given type.
333      * This will make the application appear as first in the list returned by
334      * g_app_info_get_recommended_for_type, regardless of the default application
335      * for that content type.
336      * Params:
337      * contentType = the content type.
338      * Returns: TRUE on success, FALSE on error.
339      * Throws: GException on failure.
340      */
341     public int setAsLastUsedForType(string contentType);
342    
343     /**
344      * Adds a content type to the application information to indicate the
345      * application is capable of opening files with the given content type.
346      * Params:
347      * contentType = a string.
348      * Returns: TRUE on success, FALSE on error.
349      * Throws: GException on failure.
350      */
351     public int addSupportsType(string contentType);
352    
353     /**
354      * Checks if a supported content type can be removed from an application.
355      * Returns: TRUE if it is possible to remove supported content types from a given appinfo, FALSE if not.
356      */
357     public int canRemoveSupportsType();
358    
359     /**
360      * Removes a supported type from an application, if possible.
361      * Params:
362      * contentType = a string.
363      * Returns: TRUE on success, FALSE on error.
364      * Throws: GException on failure.
365      */
366     public int removeSupportsType(string contentType);
367    
368     /**
369      * Gets a list of all of the applications currently registered
370      * on this system.
371      * For desktop files, this includes applications that have
372      * NoDisplay=true set or are excluded from
373      * display by means of OnlyShowIn or
374      * NotShowIn. See g_app_info_should_show().
375      * The returned list does not include applications which have
376      * the Hidden key set.
377      * Returns: a newly allocated GList of references to GAppInfos. [element-type GAppInfo][transfer full]
378      */
379     public static ListG getAll();
380    
381     /**
382      * Gets a list of all GAppInfos for a given content type.
383      * Params:
384      * contentType = the content type to find a GAppInfo for
385      * Returns: GList of GAppInfos for given content_type or NULL on error. [element-type GAppInfo][transfer full]
386      */
387     public static ListG getAllForType(string contentType);
388    
389     /**
390      * Gets the GAppInfo that corresponds to a given content type.
391      * Params:
392      * contentType = the content type to find a GAppInfo for
393      * mustSupportUris = if TRUE, the GAppInfo is expected to
394      * support URIs
395      * Returns: GAppInfo for given content_type or NULL on error. [transfer full]
396      */
397     public static AppInfoIF getDefaultForType(string contentType, int mustSupportUris);
398    
399     /**
400      * Gets the default application for launching applications
401      * using this URI scheme. A URI scheme is the initial part
402      * of the URI, up to but not including the ':', e.g. "http",
403      * "ftp" or "sip".
404      * Params:
405      * uriScheme = a string containing a URI scheme.
406      * Returns: GAppInfo for given uri_scheme or NULL on error. [transfer full]
407      */
408     public static AppInfoIF getDefaultForUriScheme(string uriScheme);
409    
410     /**
411      * Gets a list of fallback GAppInfos for a given content type, i.e.
412      * those applications which claim to support the given content type
413      * by MIME type subclassing and not directly.
414      * Since 2.28
415      * Params:
416      * contentType = the content type to find a GAppInfo for
417      * Returns: GList of GAppInfos for given content_type or NULL on error. [element-type GAppInfo][transfer full]
418      */
419     public static ListG getFallbackForType(string contentType);
420    
421     /**
422      * Gets a list of recommended GAppInfos for a given content type, i.e.
423      * those applications which claim to support the given content type exactly,
424      * and not by MIME type subclassing.
425      * Note that the first application of the list is the last used one, i.e.
426      * the last one for which g_app_info_set_as_last_used_for_type has been
427      * called.
428      * Since 2.28
429      * Params:
430      * contentType = the content type to find a GAppInfo for
431      * Returns: GList of GAppInfos for given content_type or NULL on error. [element-type GAppInfo][transfer full]
432      */
433     public static ListG getRecommendedForType(string contentType);
434    
435     /**
436      * Utility function that launches the default application
437      * registered to handle the specified uri. Synchronous I/O
438      * is done on the uri to detect the type of the file if
439      * required.
440      * Params:
441      * uri = the uri to show
442      * launchContext = an optional GAppLaunchContext. [allow-none]
443      * Returns: TRUE on success, FALSE on error.
444      * Throws: GException on failure.
445      */
446     public static int launchDefaultForUri(string uri, AppLaunchContext launchContext);
447 }
Note: See TracBrowser for help on using the browser.