Gtk.Application

Entities

Simple Types

Tagged Types

Access Types

Constants

Subprograms

Generic Instantiations

Description

Gtk.Application.Gtk_Application is a class that handles many important aspects of a GTK+ application in a convenient fashion, without enforcing a one-size-fits-all application model.

Currently, GtkApplication handles GTK+ initialization, application uniqueness, session management, provides some basic scriptability and desktop shell integration by exporting actions and menus and manages a list of toplevel windows whose life-cycle is automatically tied to the life-cycle of your application.

While GtkApplication works fine with plain Gtk_Windows, it is recommended to use it together with Gtk.Application_Window.Gtk_Application_Window.

When GDK threads are enabled, GtkApplication will acquire the GDK lock when invoking actions that arrive from other processes. The GDK lock is not touched for local action invocations. In order to have actions invoked in a predictable context it is therefore recommended that the GDK lock be held while invoking actions locally with Glib.Action_Group.Activate_Action. The same applies to actions associated with Gtk.Application_Window.Gtk_Application_Window and to the "activate" and "open" Glib.Application.Gapplication methods.

## Automatic resources ## {automatic-resources}

Gtk.Application.Gtk_Application will automatically load menus from the Gtk.Builder.Gtk_Builder resource located at "gtk/menus.ui", relative to the application's resource base path (see Glib.Application.Set_Resource_Base_Path). The menu with the ID "app-menu" is taken as the application's app menu and the menu with the ID "menubar" is taken as the application's menubar. Additional menus (most interesting submenus) can be named and accessed via Gtk.Application.Get_Menu_By_Id which allows for dynamic population of a part of the menu structure.

If the resources "gtk/menus-appmenu.ui" or "gtk/menus-traditional.ui" are present then these files will be used in preference, depending on the value of Gtk.Application.Prefers_App_Menu. If the resource "gtk/menus-common.ui" is present it will be loaded as well. This is useful for storing items that are referenced from both "gtk/menus-appmenu.ui" and "gtk/menus-traditional.ui".

It is also possible to provide the menus manually using Gtk.Application.Set_App_Menu and Gtk.Application.Set_Menubar.

Gtk.Application.Gtk_Application will also automatically setup an icon search path for the default icon theme by appending "icons" to the resource base path. This allows your application to easily store its icons as resources. See Gtk.Icon_Theme.Add_Resource_Path for more information.

If there is a resource located at "gtk/help-overlay.ui" which defines a Gtk.Shortcuts_Window.Gtk_Shortcuts_Window with ID "help_overlay" then GtkApplication associates an instance of this shortcuts window with each Gtk.Application_Window.Gtk_Application_Window and sets up keyboard accelerators (Control-F1 and Control-?) to open it. To create a menu item that displays the shortcuts window, associate the item with the action win.show-help-overlay.

## A simple application ## {gtkapplication}

A simple example

GtkApplication optionally registers with a session manager of the users session (if you set the Gtk.Application.Gtk_Application:register-session property) and offers various functionality related to the session life-cycle.

An application can block various ways to end the session with the Gtk.Application.Inhibit function. Typical use cases for this kind of inhibiting are long-running, uninterruptible operations, such as burning a CD or performing a disk backup. The session manager may not honor the inhibitor, but it can be expected to inform the user about the negative consequences of ending the session while inhibitors are present.

## See Also ## {seealso} HowDoI: Using GtkApplication, Getting Started with GTK+: Basics

"+"

function "+"
  (Widget : access Gtk_Application_Record'Class)
return Glib.Action_Group.Gaction_Group
Parameters
Widget
Return Value

"+"

function "+"
  (Widget : access Gtk_Application_Record'Class)
return Glib.Action_Map.Gaction_Map
Parameters
Widget
Return Value

"-"

function "-"
  (Interf : Glib.Action_Group.Gaction_Group)
return Gtk_Application
Parameters
Interf
Return Value

"-"

function "-"
  (Interf : Glib.Action_Map.Gaction_Map)
return Gtk_Application
Parameters
Interf
Return Value

Action_Added

procedure Action_Added
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String)
Parameters
Self
Action_Name

Action_Enabled_Changed

procedure Action_Enabled_Changed
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String;
    Enabled     : Boolean)
Parameters
Self
Action_Name
Enabled

Action_Removed

procedure Action_Removed
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String)
Parameters
Self
Action_Name

Action_State_Changed

procedure Action_State_Changed
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String;
    State       : Glib.Variant.Gvariant)
Parameters
Self
Action_Name
State

Activate_Action

procedure Activate_Action
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String;
    Parameter   : Glib.Variant.Gvariant)
Parameters
Self
Action_Name
Parameter

Active_Window_Property

Active_Window_Property : constant Glib.Properties.Property_Object;

Type: Gtk.Window.Gtk_Window

Add_Accelerator

procedure Add_Accelerator
   (Self        : not null access Gtk_Application_Record;
    Accelerator : UTF8_String;
    Action_Name : UTF8_String;
    Parameter   : Glib.Variant.Gvariant)

Installs an accelerator that will cause the named action to be activated when the key combination specificed by Accelerator is pressed. Accelerator must be a string that can be parsed by Gtk.Accel_Group.Accelerator_Parse, e.g. "<Primary>q" or "<Control><Alt>p". Action_Name must be the name of an action as it would be used in the app menu, i.e. actions that have been added to the application are referred to with an "app." prefix, and window-specific actions with a "win." prefix. GtkApplication also extracts accelerators out of "accel" attributes in the GMenu_Models passed to Gtk.Application.Set_App_Menu and Gtk.Application.Set_Menubar, which is usually more convenient than calling this function for each accelerator. Since: gtk+ 3.4 Deprecated since 3.14, 1

Parameters
Self
Accelerator

accelerator string

Action_Name

the name of the action to activate

Parameter

parameter to pass when activating the action, or null if the action does not accept an activation parameter

Add_Action

procedure Add_Action
   (Self   : not null access Gtk_Application_Record;
    Action : Glib.Action.Gaction)
Parameters
Self
Action

Add_Action_Entries

procedure Add_Action_Entries
   (Self      : not null access Gtk_Application_Record;
    Entries   : GAction_Entry_Array;
    User_Data : System.Address := System.Null_Address)
Parameters
Self
Entries
User_Data

Add_Window

procedure Add_Window
   (Self   : not null access Gtk_Application_Record;
    Window : not null access Gtk.Window.Gtk_Window_Record'Class)

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 Glib.Application.Gapplication::activate signal. This call is equivalent to setting the Gtk.Window.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 Gtk.Application.Remove_Window. GTK+ will keep the Application running as long as it has any windows. Since: gtk+ 3.0

Parameters
Self
Window

a Gtk.Window.Gtk_Window

App_Menu_Property

App_Menu_Property : constant Glib.Properties.Property_Boxed;

Type: Gio.Menu_Model

Application_Inhibit_Idle

Application_Inhibit_Idle : constant Gtk_Application_Inhibit_Flags := 8;

Application_Inhibit_Logout

Application_Inhibit_Logout : constant Gtk_Application_Inhibit_Flags := 1;

Application_Inhibit_Suspend

Application_Inhibit_Suspend : constant Gtk_Application_Inhibit_Flags := 4;

Application_Inhibit_Switch

Application_Inhibit_Switch : constant Gtk_Application_Inhibit_Flags := 2;

Cb_GObject_Gtk_Window_Void

type Cb_GObject_Gtk_Window_Void is not null access procedure
  (Self   : access Glib.Object.GObject_Record'Class;
   Window : not null access Gtk.Window.Gtk_Window_Record'Class);
Parameters
Self
Window

Cb_GObject_Void

type Cb_GObject_Void is not null access procedure
  (Self : access Glib.Object.GObject_Record'Class);
Parameters
Self

Cb_Gtk_Application_Gtk_Window_Void

type Cb_Gtk_Application_Gtk_Window_Void is not null access procedure
  (Self   : access Gtk_Application_Record'Class;
   Window : not null access Gtk.Window.Gtk_Window_Record'Class);
Parameters
Self
Window

Cb_Gtk_Application_Void

type Cb_Gtk_Application_Void is not null access procedure
  (Self : access Gtk_Application_Record'Class);
Parameters
Self

Change_Action_State

procedure Change_Action_State
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String;
    Value       : Glib.Variant.Gvariant)
Parameters
Self
Action_Name
Value

Get_Accels_For_Action

function Get_Accels_For_Action
   (Self                 : not null access Gtk_Application_Record;
    Detailed_Action_Name : UTF8_String) return GNAT.Strings.String_List

Gets the accelerators that are currently associated with the given action. Since: gtk+ 3.12

Parameters
Self
Detailed_Action_Name

a detailed action name, specifying an action and target to obtain accelerators for

Return Value

accelerators for Detailed_Action_Name, as a null-terminated array. Free with g_strfreev when no longer needed

Get_Action_Enabled

function Get_Action_Enabled
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String) return Boolean
Parameters
Self
Action_Name
Return Value

Get_Action_Parameter_Type

function Get_Action_Parameter_Type
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String) return Glib.Variant.Gvariant_Type
Parameters
Self
Action_Name
Return Value

Get_Action_State

function Get_Action_State
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String) return Glib.Variant.Gvariant
Parameters
Self
Action_Name
Return Value

Get_Action_State_Hint

function Get_Action_State_Hint
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String) return Glib.Variant.Gvariant
Parameters
Self
Action_Name
Return Value

Get_Action_State_Type

function Get_Action_State_Type
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String) return Glib.Variant.Gvariant_Type
Parameters
Self
Action_Name
Return Value

Get_Actions_For_Accel

function Get_Actions_For_Accel
   (Self  : not null access Gtk_Application_Record;
    Accel : UTF8_String) return GNAT.Strings.String_List

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 Gtk.Accel_Group.Accelerator_Parse first. Since: gtk+ 3.14

Parameters
Self
Accel

an accelerator that can be parsed by Gtk.Accel_Group.Accelerator_Parse

Return Value

a null-terminated array of actions for Accel

Get_Active_Window

function Get_Active_Window
   (Self : not null access Gtk_Application_Record)
    return Gtk.Window.Gtk_Window

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. Since: gtk+ 3.6

Parameters
Self
Return Value

the active window, or null if there isn't one.

Get_App_Menu

function Get_App_Menu
   (Self : not null access Gtk_Application_Record)
    return Glib.Menu_Model.Gmenu_Model

Returns the menu model that has been set with Gtk.Application.Set_App_Menu. Since: gtk+ 3.4

Parameters
Self
Return Value

the application menu of Application or null if no application menu has been set.

Get_Menu_By_Id

function Get_Menu_By_Id
   (Self : not null access Gtk_Application_Record;
    Id   : UTF8_String) return Glib.Menu.Gmenu

Gets a menu from automatically loaded resources. See [Automatic resources][automatic-resources] for more information. Since: gtk+ 3.14

Parameters
Self
Id

the id of the menu to look up

Return Value

Gets the menu with the given id from the automatically loaded resources

Get_Menubar

function Get_Menubar
   (Self : not null access Gtk_Application_Record)
    return Glib.Menu_Model.Gmenu_Model

Returns the menu model that has been set with Gtk.Application.Set_Menubar. Since: gtk+ 3.4

Parameters
Self
Return Value

the menubar for windows of Application

Get_Type

function Get_Type return Glib.GType
Return Value

Get_Window_By_Id

function Get_Window_By_Id
   (Self : not null access Gtk_Application_Record;
    Id   : Guint) return Gtk.Window.Gtk_Window

Returns the Gtk.Application_Window.Gtk_Application_Window with the given ID. The ID of a Gtk.Application_Window.Gtk_Application_Window can be retrieved with Gtk.Application_Window.Get_Id. Since: gtk+ 3.6

Parameters
Self
Id

an identifier number

Return Value

the window with ID Id, or null if there is no window with this ID

Get_Windows

function Get_Windows
   (Self : not null access Gtk_Application_Record)
    return Gtk.Widget.Widget_List.Glist

Gets a list of the Gtk_Windows 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. Since: gtk+ 3.0

Parameters
Self
Return Value

Gtk_Application

type Gtk_Application is access all Gtk_Application_Record'Class;

Gtk_Application_Inhibit_Flags

type Gtk_Application_Inhibit_Flags is mod 2 ** Integer'Size;

Types of user actions that may be blocked by Gtk.Application.Inhibit.

Gtk_Application_Inhibit_Flags_Properties

package Gtk_Application_Inhibit_Flags_Properties is
   new Generic_Internal_Discrete_Property (Gtk_Application_Inhibit_Flags);

Gtk_Application_New

function Gtk_Application_New
   (Application_Id : UTF8_String := "";
    Flags          : Glib.Application.GApplication_Flags)
    return Gtk_Application

Creates a new Gtk.Application.Gtk_Application instance. When using Gtk.Application.Gtk_Application, it is not necessary to call gtk_init manually. It is called as soon as the application gets registered as the primary instance. Concretely, gtk_init is called in the default handler for the Glib.Application.Gapplication::startup signal. Therefore, Gtk.Application.Gtk_Application subclasses should chain up in their Glib.Application.Gapplication::startup handler before using any GTK+ API. Note that commandline arguments are not passed to gtk_init. All GTK+ functionality that is available via commandline arguments can also be achieved by setting suitable environment variables such as G_DEBUG, so this should not be a big problem. If you absolutely must support GTK+ commandline arguments, you can explicitly call gtk_init before creating the application instance. If non-null, the application ID must be valid. See Glib.Application.Id_Is_Valid. If no application ID is given then some features (most notably application uniqueness) will be disabled. A null application ID is only allowed with GTK+ 3.6 or later. Since: gtk+ 3.0

Parameters
Application_Id

The application ID.

Flags

the application flags

Return Value

Gtk_Application_Record

type Gtk_Application_Record is new Gapplication_Record with null record;

Gtk_New

procedure Gtk_New
   (Self           : out Gtk_Application;
    Application_Id : UTF8_String := "";
    Flags          : Glib.Application.GApplication_Flags)

Creates a new Gtk.Application.Gtk_Application instance. When using Gtk.Application.Gtk_Application, it is not necessary to call gtk_init manually. It is called as soon as the application gets registered as the primary instance. Concretely, gtk_init is called in the default handler for the Glib.Application.Gapplication::startup signal. Therefore, Gtk.Application.Gtk_Application subclasses should chain up in their Glib.Application.Gapplication::startup handler before using any GTK+ API. Note that commandline arguments are not passed to gtk_init. All GTK+ functionality that is available via commandline arguments can also be achieved by setting suitable environment variables such as G_DEBUG, so this should not be a big problem. If you absolutely must support GTK+ commandline arguments, you can explicitly call gtk_init before creating the application instance. If non-null, the application ID must be valid. See Glib.Application.Id_Is_Valid. If no application ID is given then some features (most notably application uniqueness) will be disabled. A null application ID is only allowed with GTK+ 3.6 or later. Since: gtk+ 3.0 Initialize does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Self
Application_Id

The application ID.

Flags

the application flags

Has_Action

function Has_Action
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String) return Boolean
Parameters
Self
Action_Name
Return Value

Implements_Gaction_Group

package Implements_Gaction_Group is new Glib.Types.Implements
  (Glib.Action_Group.Gaction_Group, Gtk_Application_Record, Gtk_Application);

Implements_Gaction_Map

package Implements_Gaction_Map is new Glib.Types.Implements
  (Glib.Action_Map.Gaction_Map, Gtk_Application_Record, Gtk_Application);

Inhibit

function Inhibit
   (Self   : not null access Gtk_Application_Record;
    Window : access Gtk.Window.Gtk_Window_Record'Class;
    Flags  : Gtk_Application_Inhibit_Flags;
    Reason : UTF8_String := "") return Guint

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 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. Reasons 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. Since: gtk+ 3.4

Parameters
Self
Window

a Gtk.Window.Gtk_Window, or null

Flags

what types of actions should be inhibited

Reason

a short, human-readable string that explains why these operations are inhibited

Return Value

A non-zero cookie that is used to uniquely identify this request. It should be used as an argument to Gtk.Application.Uninhibit in order to remove the request. If the platform does not support inhibiting or the request failed for some reason, 0 is returned.

Initialize

procedure Initialize
   (Self           : not null access Gtk_Application_Record'Class;
    Application_Id : UTF8_String := "";
    Flags          : Glib.Application.GApplication_Flags)

Creates a new Gtk.Application.Gtk_Application instance. When using Gtk.Application.Gtk_Application, it is not necessary to call gtk_init manually. It is called as soon as the application gets registered as the primary instance. Concretely, gtk_init is called in the default handler for the Glib.Application.Gapplication::startup signal. Therefore, Gtk.Application.Gtk_Application subclasses should chain up in their Glib.Application.Gapplication::startup handler before using any GTK+ API. Note that commandline arguments are not passed to gtk_init. All GTK+ functionality that is available via commandline arguments can also be achieved by setting suitable environment variables such as G_DEBUG, so this should not be a big problem. If you absolutely must support GTK+ commandline arguments, you can explicitly call gtk_init before creating the application instance. If non-null, the application ID must be valid. See Glib.Application.Id_Is_Valid. If no application ID is given then some features (most notably application uniqueness) will be disabled. A null application ID is only allowed with GTK+ 3.6 or later. Since: gtk+ 3.0 Initialize does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Self
Application_Id

The application ID.

Flags

the application flags

Is_Inhibited

function Is_Inhibited
   (Self  : not null access Gtk_Application_Record;
    Flags : Gtk_Application_Inhibit_Flags) return Boolean

Determines if any of the actions specified in Flags are currently inhibited (possibly by another application). Note that this information may not be available (for example when the application is running in a sandbox). Since: gtk+ 3.4

Parameters
Self
Flags

what types of actions should be queried

Return Value

True if any of the actions specified in Flags are inhibited

List_Action_Descriptions

function List_Action_Descriptions
   (Self : not null access Gtk_Application_Record)
    return GNAT.Strings.String_List

Lists the detailed action names which have associated accelerators. See Gtk.Application.Set_Accels_For_Action. Since: gtk+ 3.12

Parameters
Self
Return Value

a null-terminated array of strings, free with g_strfreev when done

List_Actions

function List_Actions
   (Self : not null access Gtk_Application_Record)
    return GNAT.Strings.String_List
Parameters
Self
Return Value

Lookup_Action

function Lookup_Action
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String) return Glib.Action.Gaction
Parameters
Self
Action_Name
Return Value

Menubar_Property

Menubar_Property : constant Glib.Properties.Property_Boxed;

Type: Gio.Menu_Model

On_Query_End

procedure On_Query_End
   (Self  : not null access Gtk_Application_Record;
    Call  : Cb_GObject_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

Emitted when the session manager is about to end the session, only if Gtk.Application.Gtk_Application::register-session is True. Applications can connect to this signal and call Gtk.Application.Inhibit with Gtk.Application.Application_Inhibit_Logout to delay the end of the session until state has been saved.

Parameters
Self
Call
Slot
After

On_Query_End

procedure On_Query_End
   (Self  : not null access Gtk_Application_Record;
    Call  : Cb_Gtk_Application_Void;
    After : Boolean := False)

Emitted when the session manager is about to end the session, only if Gtk.Application.Gtk_Application::register-session is True. Applications can connect to this signal and call Gtk.Application.Inhibit with Gtk.Application.Application_Inhibit_Logout to delay the end of the session until state has been saved.

Parameters
Self
Call
After

On_Window_Added

procedure On_Window_Added
   (Self  : not null access Gtk_Application_Record;
    Call  : Cb_GObject_Gtk_Window_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

Emitted when a Gtk.Window.Gtk_Window is added to Application through Gtk.Application.Add_Window.

Parameters
Self
Call
Slot
After

On_Window_Added

procedure On_Window_Added
   (Self  : not null access Gtk_Application_Record;
    Call  : Cb_Gtk_Application_Gtk_Window_Void;
    After : Boolean := False)

Emitted when a Gtk.Window.Gtk_Window is added to Application through Gtk.Application.Add_Window.

Parameters
Self
Call
After

On_Window_Removed

procedure On_Window_Removed
   (Self  : not null access Gtk_Application_Record;
    Call  : Cb_GObject_Gtk_Window_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

Emitted when a Gtk.Window.Gtk_Window is removed from Application, either as a side-effect of being destroyed or explicitly through Gtk.Application.Remove_Window.

Parameters
Self
Call
Slot
After

On_Window_Removed

procedure On_Window_Removed
   (Self  : not null access Gtk_Application_Record;
    Call  : Cb_Gtk_Application_Gtk_Window_Void;
    After : Boolean := False)

Emitted when a Gtk.Window.Gtk_Window is removed from Application, either as a side-effect of being destroyed or explicitly through Gtk.Application.Remove_Window.

Parameters
Self
Call
After

Prefers_App_Menu

function Prefers_App_Menu
   (Self : not null access Gtk_Application_Record) return Boolean

Determines if the desktop environment in which the application is running would prefer an application menu be shown. If this function returns True then the application should call Gtk.Application.Set_App_Menu with the contents of an application menu, which will be shown by the desktop environment. If it returns False then you should consider using an alternate approach, such as a menubar. The value returned by this function is purely advisory and you are free to ignore it. If you call Gtk.Application.Set_App_Menu even if the desktop environment doesn't support app menus, then a fallback will be provided. Applications are similarly free not to set an app menu even if the desktop environment wants to show one. In that case, a fallback will also be created by the desktop environment (GNOME, for example, uses a menu with only a "Quit" item in it). The value returned by this function never changes. Once it returns a particular value, it is guaranteed to always return the same value. You may only call this function after the application has been registered and after the base startup handler has run. You're most likely to want to use this from your own startup handler. It may also make sense to consult this function while constructing UI (in activate, open or an action activation handler) in order to determine if you should show a gear menu or not. This function will return False on Mac OS and a default app menu will be created automatically with the "usual" contents of that menu typical to most Mac OS applications. If you call Gtk.Application.Set_App_Menu anyway, then this menu will be replaced with your own. Since: gtk+ 3.14

Parameters
Self
Return Value

True if you should set an app menu

Property_Gtk_Application_Inhibit_Flags

type Property_Gtk_Application_Inhibit_Flags is new Gtk_Application_Inhibit_Flags_Properties.Property;

Query_Action

function Query_Action
   (Self           : not null access Gtk_Application_Record;
    Action_Name    : UTF8_String;
    Enabled        : access Boolean;
    Parameter_Type : access Glib.Variant.Gvariant_Type;
    State_Type     : access Glib.Variant.Gvariant_Type;
    State_Hint     : access Glib.Variant.Gvariant;
    State          : access Glib.Variant.Gvariant) return Boolean
Parameters
Self
Action_Name
Enabled
Parameter_Type
State_Type
State_Hint
State
Return Value

Register_Session_Property

Register_Session_Property : constant Glib.Properties.Property_Boolean;

Set this property to True to register with the session manager.

Remove_Accelerator

procedure Remove_Accelerator
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String;
    Parameter   : Glib.Variant.Gvariant)

Removes an accelerator that has been previously added with Gtk.Application.Add_Accelerator. Since: gtk+ 3.4 Deprecated since 3.14, 1

Parameters
Self
Action_Name

the name of the action to activate

Parameter

parameter to pass when activating the action, or null if the action does not accept an activation parameter

Remove_Action

procedure Remove_Action
   (Self        : not null access Gtk_Application_Record;
    Action_Name : UTF8_String)
Parameters
Self
Action_Name

Remove_Window

procedure Remove_Window
   (Self   : not null access Gtk_Application_Record;
    Window : not null access Gtk.Window.Gtk_Window_Record'Class)

Remove a window from Application. If Window belongs to Application then this call is equivalent to setting the Gtk.Window.Gtk_Window:application property of Window to null. The application may stop running as a result of a call to this function. Since: gtk+ 3.0

Parameters
Self
Window

a Gtk.Window.Gtk_Window

Screensaver_Active_Property

Screensaver_Active_Property : constant Glib.Properties.Property_Boolean;

This property is True if GTK+ believes that the screensaver is currently active. GTK+ only tracks session state (including this) when Gtk.Application.Gtk_Application::register-session is set to True.

Tracking the screensaver state is supported on Linux.

Set_Accels_For_Action

procedure Set_Accels_For_Action
   (Self                 : not null access Gtk_Application_Record;
    Detailed_Action_Name : UTF8_String;
    Accels               : GNAT.Strings.String_List)

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 Glib.Action.Print_Detailed_Name. Since: gtk+ 3.12

Parameters
Self
Detailed_Action_Name

a detailed action name, specifying an action and target to associate accelerators with

Accels

a list of accelerators in the format understood by Gtk.Accel_Group.Accelerator_Parse

Set_App_Menu

procedure Set_App_Menu
   (Self     : not null access Gtk_Application_Record;
    App_Menu : access Glib.Menu_Model.Gmenu_Model_Record'Class)

Sets or unsets the application menu for Application. This can only be done in the primary instance of the application, after it has been registered. Glib.Application.Gapplication::startup is a good place to call this. The application menu is a single menu containing items that typically impact the application as a whole, rather than acting on a specific window or document. For example, you would expect to see "Preferences" or "Quit" in an application menu, but not "Save" or "Print". If supported, the application menu will be rendered by the desktop environment. Use the base Glib.Action_Map.Gaction_Map interface to add actions, to respond to the user selecting these menu items. Since: gtk+ 3.4

Parameters
Self
App_Menu

a Glib.Menu_Model.Gmenu_Model, or null

Set_Menubar

procedure Set_Menubar
   (Self    : not null access Gtk_Application_Record;
    Menubar : access Glib.Menu_Model.Gmenu_Model_Record'Class)

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. Glib.Application.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 Glib.Action_Map.Gaction_Map interface to add actions, to respond to the user selecting these menu items. Since: gtk+ 3.4

Parameters
Self
Menubar

a Glib.Menu_Model.Gmenu_Model, or null

Signal_Query_End

Signal_Query_End : constant Glib.Signal_Name := "query-end";

Emitted when the session manager is about to end the session, only if Gtk.Application.Gtk_Application::register-session is True. Applications can connect to this signal and call Gtk.Application.Inhibit with Gtk.Application.Application_Inhibit_Logout to delay the end of the session until state has been saved.

Signal_Window_Added

Signal_Window_Added : constant Glib.Signal_Name := "window-added";

Emitted when a Gtk.Window.Gtk_Window is added to Application through Gtk.Application.Add_Window.

Signal_Window_Removed

Signal_Window_Removed : constant Glib.Signal_Name := "window-removed";

Emitted when a Gtk.Window.Gtk_Window is removed from Application, either as a side-effect of being destroyed or explicitly through Gtk.Application.Remove_Window.

Uninhibit

procedure Uninhibit
   (Self   : not null access Gtk_Application_Record;
    Cookie : Guint)

Removes an inhibitor that has been established with Gtk.Application.Inhibit. Inhibitors are also cleared when the application exits. Since: gtk+ 3.4

Parameters
Self
Cookie

a cookie that was returned by Gtk.Application.Inhibit