Application

A base class for Adwaita applications.

adw.application.Application handles library initialization by calling func@init in the default gio.application.Application.startup signal handler, in turn chaining up as required by gtk.application.Application. Therefore, any subclass of adw.application.Application should always chain up its startup handler before using any Adwaita or GTK API.

Automatic Resources

adw.application.Application will automatically load stylesheets located in the application's resource base path (see gio.application.Application.setResourceBasePath, if they're present.

They can be used to add custom styles to the application, as follows:

  • style.css contains styles that are always present.
  • style-dark.css contains styles only used when

property@StyleManager:dark is TRUE.

  • style-hc.css contains styles used when the system high contrast preference is enabled.
  • style-hc-dark.css contains styles used when the system high contrast preference is enabled and property@StyleManager:dark is TRUE.

Constructors

this
this(string applicationId, gio.types.ApplicationFlags flags)

Creates a new adw.application.Application.

Members

Functions

getStyleManager
adw.style_manager.StyleManager getStyleManager()

Gets the style manager for self.

Inherited Members

From Application

addWindow
void addWindow(gtk.window.Window window)

Adds a window to application.

getAccelsForAction
string[] getAccelsForAction(string detailedActionName)

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

getActionsForAccel
string[] getActionsForAccel(string accel)

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

getActiveWindow
gtk.window.Window getActiveWindow()

Gets the “active” window for the application.

getMenuById
gio.menu.Menu getMenuById(string id)

Gets a menu from automatically loaded resources.

getMenubar
gio.menu_model.MenuModel getMenubar()

Returns the menu model that has been set with gtk.application.Application.setMenubar.

getWindowById
gtk.window.Window getWindowById(uint id)

Returns the gtk.application_window.ApplicationWindow with the given ID.

getWindows
gtk.window.Window[] getWindows()

Gets a list of the gtk.window.Window instances associated with application.

inhibit
uint inhibit(gtk.window.Window window, gtk.types.ApplicationInhibitFlags flags, string reason)

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

listActionDescriptions
string[] listActionDescriptions()

Lists the detailed action names which have associated accelerators.

removeWindow
void removeWindow(gtk.window.Window window)

Remove a window from application.

setAccelsForAction
void setAccelsForAction(string detailedActionName, string[] accels)

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

setMenubar
void setMenubar(gio.menu_model.MenuModel menubar)

Sets or unsets the menubar for windows of application.

uninhibit
void uninhibit(uint cookie)

Removes an inhibitor that has been previously established.

connectQueryEnd
ulong connectQueryEnd(T callback, Flag!"After" after)

Connect to QueryEnd signal.

connectWindowAdded
ulong connectWindowAdded(T callback, Flag!"After" after)

Connect to WindowAdded signal.

connectWindowRemoved
ulong connectWindowRemoved(T callback, Flag!"After" after)

Connect to WindowRemoved signal.