package ocgtk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Wrappers.Application

type t = [ `application | `object_ ] Gobject.obj
val new_ : string option -> Ocgtk_gio.Gio.applicationflags -> t

Create a new Application

val uninhibit : t -> int -> unit

Removes an inhibitor that has been previously established.

See method@Gtk.Application.inhibit.

Inhibitors are also cleared when the application exits.

val set_menubar : t -> Ocgtk_gio.Gio.Wrappers.Menu_model.t option -> unit

Sets or unsets the menubar for windows of `application`.

This is a menubar in the traditional sense.

This can only be done in the primary instance of the application, after it has been registered. `GApplication::startup` is a good place to call this.

Depending on the desktop environment, this may appear at the top of each window, or at the top of the screen. In some environments, if both the application menu and the menubar are set, the application menu will be presented as if it were the first item of the menubar. Other environments treat the two as completely separate — for example, the application menu may be rendered by the desktop shell while the menubar (if set) remains in each individual window.

Use the base `GActionMap` interface to add actions, to respond to the user selecting these menu items.

val set_accels_for_action : t -> string -> string array -> unit

Sets zero or more keyboard accelerators that will trigger the given action.

The first item in `accels` will be the primary accelerator, which may be displayed in the UI.

To remove all accelerators for an action, use an empty, zero-terminated array for `accels`.

For the `detailed_action_name`, see `g_action_parse_detailed_name()` and `g_action_print_detailed_name()`.

val remove_window : t -> [ `window | `widget | `initially_unowned | `object_ ] Gobject.obj -> unit

Remove a window from `application`.

If `window` belongs to `application` then this call is equivalent to setting the property@Gtk.Window:application property of `window` to `NULL`.

The application may stop running as a result of a call to this function, if `window` was the last window of the `application`.

val list_action_descriptions : t -> string array

Lists the detailed action names which have associated accelerators.

See method@Gtk.Application.set_accels_for_action.

val inhibit : t -> [ `window | `widget | `initially_unowned | `object_ ] Gobject.obj option -> Gtk_enums.applicationinhibitflags -> string option -> int

Inform the session manager that certain types of actions should be inhibited.

This is not guaranteed to work on all platforms and for all types of actions.

Applications should invoke this method when they begin an operation that should not be interrupted, such as creating a CD or DVD. The types of actions that may be blocked are specified by the `flags` parameter. When the application completes the operation it should call method@Gtk.Application.uninhibit to remove the inhibitor. Note that an application can have multiple inhibitors, and all of them must be individually removed. Inhibitors are also cleared when the application exits.

Applications should not expect that they will always be able to block the action. In most cases, users will be given the option to force the action to take place.

The `reason` message should be short and to the point.

If `window` is given, the session manager may point the user to this window to find out more about why the action is inhibited.

val get_windows : t -> [ `window | `widget | `initially_unowned | `object_ ] Gobject.obj list

Gets a list of the class@Gtk.Window instances associated with `application`.

The list is sorted by most recently focused window, such that the first element is the currently focused window. (Useful for choosing a parent for a transient window.)

The list that is returned should not be modified in any way. It will only remain valid until the next focus change or window creation or deletion.

val get_window_by_id : t -> int -> [ `window | `widget | `initially_unowned | `object_ ] Gobject.obj option

Returns the class@Gtk.ApplicationWindow with the given ID.

The ID of a `GtkApplicationWindow` can be retrieved with method@Gtk.ApplicationWindow.get_id.

val get_menubar : t -> Ocgtk_gio.Gio.Wrappers.Menu_model.t option

Returns the menu model that has been set with method@Gtk.Application.set_menubar.

val get_menu_by_id : t -> string -> Ocgtk_gio.Gio.Wrappers.Menu.t option

Gets a menu from automatically loaded resources.

See the section on Automatic resources(class.Application.html#automatic-resources) for more information.

val get_active_window : t -> [ `window | `widget | `initially_unowned | `object_ ] Gobject.obj option

Gets the “active” window for the application.

The active window is the one that was most recently focused (within the application). This window may not have the focus at the moment if another application has it — this is just the most recently-focused window within this application.

val get_actions_for_accel : t -> string -> string array

Returns the list of actions (possibly empty) that `accel` maps to.

Each item in the list is a detailed action name in the usual form.

This might be useful to discover if an accel already exists in order to prevent installation of a conflicting accelerator (from an accelerator editor or a plugin system, for example). Note that having more than one action per accelerator may not be a bad thing and might make sense in cases where the actions never appear in the same context.

In case there are no actions for a given accelerator, an empty array is returned. `NULL` is never returned.

It is a programmer error to pass an invalid accelerator string.

If you are unsure, check it with func@Gtk.accelerator_parse first.

val get_accels_for_action : t -> string -> string array

Gets the accelerators that are currently associated with the given action.

val add_window : t -> [ `window | `widget | `initially_unowned | `object_ ] Gobject.obj -> unit

Adds a window to `application`.

This call can only happen after the `application` has started; typically, you should add new application windows in response to the emission of the `GApplication::activate` signal.

This call is equivalent to setting the property@Gtk.Window:application property of `window` to `application`.

Normally, the connection between the application and the window will remain until the window is destroyed, but you can explicitly remove it with method@Gtk.Application.remove_window.

GTK will keep the `application` running as long as it has any windows.

val get_register_session : t -> bool

Get property: register-session

val set_register_session : t -> bool -> unit

Set property: register-session

val get_screensaver_active : t -> bool

Get property: screensaver-active

val on_query_end : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id
val on_window_added : ?after:bool -> t -> callback: (window:[ `window | `widget | `initially_unowned | `object_ ] Gobject.obj -> unit) -> Gobject.Signal.handler_id
val on_window_removed : ?after:bool -> t -> callback: (window:[ `window | `widget | `initially_unowned | `object_ ] Gobject.obj -> unit) -> Gobject.Signal.handler_id