package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gio/Ocgtk_gio/Gio/Wrappers/App_info/index.html

Module Wrappers.App_info

type t = [ `app_info ] Gobject.obj
val from_gobject : 'a Gobject.obj -> t
val supports_uris : t -> bool

Checks if the application supports reading files and directories from URIs.

val supports_files : t -> bool

Checks if the application accepts files as arguments.

val should_show : t -> bool

Checks if the application info should be shown in menus that list available applications.

val set_as_last_used_for_type : t -> string -> (bool, GError.t) result

Sets the application as the last used application for a given type. This will make the application appear as first in the list returned by g_app_info_get_recommended_for_type(), regardless of the default application for that content type.

val set_as_default_for_type : t -> string -> (bool, GError.t) result

Sets the application as the default handler for a given type.

val set_as_default_for_extension : t -> string -> (bool, GError.t) result

Sets the application as the default handler for the given file extension.

val remove_supports_type : t -> string -> (bool, GError.t) result

Removes a supported type from an application, if possible.

val launch_uris_finish : t -> [ `async_result ] Gobject.obj -> (bool, GError.t) result

Finishes a g_app_info_launch_uris_async() operation.

val launch_uris : t -> string list option -> [ `app_launch_context | `object_ ] Gobject.obj option -> (bool, GError.t) result

Launches the application. This passes the @uris to the launched application as arguments, using the optional @context to get information about the details of the launcher (like what screen it is on). On error, @error will be set accordingly. If the application only supports one URI per invocation as part of their command-line, multiple instances of the application will be spawned.

To launch the application without arguments pass a %NULL @uris list.

Note that even if the launch is successful the application launched can fail to start if it runs into problems during startup. There is no way to detect this.

val launch : t -> [ `file ] Gobject.obj list option -> [ `app_launch_context | `object_ ] Gobject.obj option -> (bool, GError.t) result

Launches the application. Passes @files to the launched application as arguments, using the optional @context to get information about the details of the launcher (like what screen it is on). On error, @error will be set accordingly.

To launch the application without arguments pass a %NULL @files list.

Note that even if the launch is successful the application launched can fail to start if it runs into problems during startup. There is no way to detect this.

Some URIs can be changed when passed through a GFile (for instance unsupported URIs with strange formats like mailto:), so if you have a textual URI you want to pass in as argument, consider using g_app_info_launch_uris() instead.

The launched application inherits the environment of the launching process, but it can be modified with g_app_launch_context_setenv() and g_app_launch_context_unsetenv().

On UNIX, this function sets the `GIO_LAUNCHED_DESKTOP_FILE` environment variable with the path of the launched desktop file and `GIO_LAUNCHED_DESKTOP_FILE_PID` to the process id of the launched process. This can be used to ignore `GIO_LAUNCHED_DESKTOP_FILE`, should it be inherited by further processes. The `DISPLAY`, `XDG_ACTIVATION_TOKEN` and `DESKTOP_STARTUP_ID` environment variables are also set, based on information provided in @context.

val get_supported_types : t -> string array

Retrieves the list of content types that @app_info claims to support. If this information is not provided by the environment, this function will return %NULL. This function does not take in consideration associations added with g_app_info_add_supports_type(), but only those exported directly by the application.

val get_name : t -> string

Gets the installed name of the application.

val get_id : t -> string option

Gets the ID of an application. An id is a string that identifies the application. The exact format of the id is platform dependent. For instance, on Unix this is the desktop file id from the xdg menu specification.

Note that the returned ID may be %NULL, depending on how the @appinfo has been constructed.

val get_icon : t -> [ `icon ] Gobject.obj option

Gets the icon for the application.

val get_executable : t -> string

Gets the executable's name for the installed application.

This is intended to be used for debugging or labelling what program is going to be run. To launch the executable, use g_app_info_launch() and related functions, rather than spawning the return value from this function.

val get_display_name : t -> string

Gets the display name of the application. The display name is often more descriptive to the user than the name itself.

val get_description : t -> string option

Gets a human-readable description of an installed application.

val get_commandline : t -> string option

Gets the commandline with which the application will be started.

val equal : t -> t -> bool

Checks if two #GAppInfos are equal.

Note that the check *may not* compare each individual field, and only does an identity check. In case detecting changes in the contents is needed, program code must additionally compare relevant fields.

val dup : t -> t

Creates a duplicate of a #GAppInfo.

val delete : t -> bool

Tries to delete a #GAppInfo.

On some platforms, there may be a difference between user-defined #GAppInfos which can be deleted, and system-wide ones which cannot. See g_app_info_can_delete().

val can_remove_supports_type : t -> bool

Checks if a supported content type can be removed from an application.

val can_delete : t -> bool

Obtains the information whether the #GAppInfo can be deleted. See g_app_info_delete().

val add_supports_type : t -> string -> (bool, GError.t) result

Adds a content type to the application information to indicate the application is capable of opening files with the given content type.