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