RAGS - v1.10.0
    Preparing search index...

    Class App

    The main AGS application singleton.

    Manages windows, CSS styling, icon themes, and the DBus interface. Access the running instance via the global App object or import app from this module.

    App.config({
    style: './style.css',
    windows: [MyWindow()],
    });

    Hierarchy

    • Application
      • App
    Index

    Accessors

    Constructors

    Methods

    _init action_added action_enabled_changed action_removed action_state_changed activate activate_action add_accelerator add_action add_action_entries add_main_option add_main_option_entries add_option_group add_window addIcons addWindow applyCss bind_busy_property bind_property bind_property_full block_signal_handler change_action_state closeWindow config connect connect_after disconnect emit force_floating freeze_notify get_accels_for_action get_action_enabled get_action_parameter_type get_action_state get_action_state_hint get_action_state_type get_actions_for_accel get_active_window get_app_menu get_application_id get_data get_dbus_connection get_dbus_object_path get_flags get_inactivity_timeout get_is_busy get_is_registered get_is_remote get_menu_by_id get_menubar get_property get_qdata get_resource_base_path get_version get_window_by_id get_windows getv getWindow has_action hold inhibit Inspector is_floating is_inhibited list_action_descriptions list_actions lookup_action mark_busy notify notify_by_pspec open openWindow prefers_app_menu query_action quit Quit ref ref_sink register registerTheme release remove_accelerator remove_action remove_action_entries remove_window removeWindow resetCss run run_dispose runAsync RunFile RunJs RunPromise send_notification set set_accels_for_action set_action_group set_app_menu set_application_id set_data set_default set_flags set_inactivity_timeout set_menubar set_option_context_description set_option_context_parameter_string set_option_context_summary set_property set_resource_base_path set_version setTheme steal_data steal_qdata stop_emission_by_name thaw_notify toggleWindow ToggleWindow toJSON unbind_busy_property unblock_signal_handler uninhibit unmark_busy unref vfunc_action_added vfunc_action_enabled_changed vfunc_action_removed vfunc_action_state_changed vfunc_activate vfunc_activate_action vfunc_add_action vfunc_add_platform_data vfunc_after_emit vfunc_before_emit vfunc_change_action_state vfunc_command_line vfunc_constructed vfunc_dbus_register vfunc_dbus_unregister vfunc_dispatch_properties_changed vfunc_dispose vfunc_finalize vfunc_get_action_enabled vfunc_get_action_parameter_type vfunc_get_action_state vfunc_get_action_state_hint vfunc_get_action_state_type vfunc_get_property vfunc_handle_local_options vfunc_has_action vfunc_list_actions vfunc_local_command_line vfunc_lookup_action vfunc_name_lost vfunc_notify vfunc_open vfunc_query_action vfunc_quit_mainloop vfunc_remove_action vfunc_run_mainloop vfunc_set_property vfunc_shutdown vfunc_startup vfunc_window_added vfunc_window_removed watch_closure withdraw_notification _classInit compat_control find_property get_default id_is_valid install_properties install_property interface_find_property interface_install_property interface_list_properties list_properties new newv override_property

    Properties

    Accessors

    • set action_group(val: ActionGroup): void

      The group of actions that the application exports.

      Parameters

      • val: ActionGroup

      Returns void

    • set actionGroup(val: ActionGroup): void

      The group of actions that the application exports.

      Parameters

      • val: ActionGroup

      Returns void

    • get active_window(): Window

      Returns Window

    • get activeTheme(): string | null

      The name of the currently active theme, or null if none has been set.

      Returns string | null

    • get activeWindow(): Window

      Returns Window

    • get app_menu(): MenuModel

      Returns MenuModel

    • set app_menu(val: MenuModel): void

      Parameters

      • val: MenuModel

      Returns void

    • get application_id(): string

      The unique identifier for the application.

      Returns string

    • set application_id(val: string): void

      Parameters

      • val: string

      Returns void

    • get applicationId(): string

      The unique identifier for the application.

      Returns string

    • set applicationId(val: string): void

      Parameters

      • val: string

      Returns void

    • get appMenu(): MenuModel

      Returns MenuModel

    • set appMenu(val: MenuModel): void

      Parameters

      • val: MenuModel

      Returns void

    • get closeWindowDelay(): { [key: string]: number }

      Map of window names to close delays in milliseconds.

      Returns { [key: string]: number }

    • set closeWindowDelay(v: { [key: string]: number }): void

      Parameters

      • v: { [key: string]: number }

      Returns void

    • get configDir(): string

      Directory containing the user's config file.

      Returns string

    • get configPath(): string

      Absolute path to the user's config file.

      Returns string

    • get cursorTheme(): string

      Returns string

    • set cursorTheme(name: string): void

      The current cursor theme name.

      Parameters

      • name: string

      Returns void

    • get flags(): ApplicationFlags

      Flags specifying the behaviour of the application.

      Returns ApplicationFlags

    • set flags(val: ApplicationFlags): void

      Parameters

      • val: ApplicationFlags

      Returns void

    • get gtkTheme(): string

      Returns string

    • set gtkTheme(name: string): void

      The current GTK theme name.

      Parameters

      • name: string

      Returns void

    • get iconTheme(): string

      Returns string

    • set iconTheme(name: string): void

      The current GTK icon theme name.

      Parameters

      • name: string

      Returns void

    • get inactivity_timeout(): number

      Time (in milliseconds) to stay alive after becoming idle.

      Returns number

    • set inactivity_timeout(val: number): void

      Parameters

      • val: number

      Returns void

    • get inactivityTimeout(): number

      Time (in milliseconds) to stay alive after becoming idle.

      Returns number

    • set inactivityTimeout(val: number): void

      Parameters

      • val: number

      Returns void

    • get is_busy(): boolean

      Whether the application is currently marked as busy through g_application_mark_busy() or g_application_bind_busy_property().

      Returns boolean

    • get is_registered(): boolean

      Whether [methodGio.Application.register] has been called.

      Returns boolean

    • get is_remote(): boolean

      Whether this application instance is remote.

      Returns boolean

    • get isBusy(): boolean

      Whether the application is currently marked as busy through g_application_mark_busy() or g_application_bind_busy_property().

      Returns boolean

    • get isRegistered(): boolean

      Whether [methodGio.Application.register] has been called.

      Returns boolean

    • get isRemote(): boolean

      Whether this application instance is remote.

      Returns boolean

    • Returns MenuModel

    • Parameters

      • val: MenuModel

      Returns void

    • get register_session(): boolean

      Set this property to %TRUE to register with the session manager.

      Returns boolean

    • set register_session(val: boolean): void

      Parameters

      • val: boolean

      Returns void

    • get registerSession(): boolean

      Set this property to %TRUE to register with the session manager.

      Returns boolean

    • set registerSession(val: boolean): void

      Parameters

      • val: boolean

      Returns void

    • get resource_base_path(): string

      The base resource path for the application.

      Returns string

    • set resource_base_path(val: string): void

      Parameters

      • val: string

      Returns void

    • get resourceBasePath(): string

      The base resource path for the application.

      Returns string

    • set resourceBasePath(val: string): void

      Parameters

      • val: string

      Returns void

    • get screensaver_active(): boolean

      This property is %TRUE if GTK+ believes that the screensaver is currently active. GTK+ only tracks session state (including this) when #GtkApplication::register-session is set to %TRUE.

      Tracking the screensaver state is supported on Linux.

      Returns boolean

    • get screensaverActive(): boolean

      This property is %TRUE if GTK+ believes that the screensaver is currently active. GTK+ only tracks session state (including this) when #GtkApplication::register-session is set to %TRUE.

      Tracking the screensaver state is supported on Linux.

      Returns boolean

    • get version(): string

      The human-readable version number of the application.

      Returns string

    • set version(val: string): void

      Parameters

      • val: string

      Returns void

    • get windows(): Window[]

      All registered windows.

      Returns Window[]

    Constructors

    • Parameters

      • Optionalproperties: Partial<ConstructorProps>
      • ...args: any[]

      Returns App

    Methods

    • Parameters

      • ...args: any[]

      Returns void

    • Emits the [signalGio.ActionGroup::action-added] signal on action_group.

      This function should only be called by [typeGio.ActionGroup] implementations.

      Parameters

      • action_name: string

        the name of an action in the group

      Returns void

    • Emits the [signalGio.ActionGroup::action-enabled-changed] signal on action_group.

      This function should only be called by [typeGio.ActionGroup] implementations.

      Parameters

      • action_name: string

        the name of an action in the group

      • enabled: boolean

        whether the action is now enabled

      Returns void

    • Emits the [signalGio.ActionGroup::action-removed] signal on action_group.

      This function should only be called by [typeGio.ActionGroup] implementations.

      Parameters

      • action_name: string

        the name of an action in the group

      Returns void

    • Emits the [signalGio.ActionGroup::action-state-changed] signal on action_group.

      This function should only be called by [typeGio.ActionGroup] implementations.

      Parameters

      • action_name: string

        the name of an action in the group

      • state: Variant

        the new state of the named action

      Returns void

    • Activates the application.

      In essence, this results in the #GApplication::activate signal being emitted in the primary instance.

      The application must be registered before calling this function.

      Returns void

    • Activate the named action within action_group.

      If the action is expecting a parameter, then the correct type of parameter must be given as parameter. If the action is expecting no parameters then parameter must be NULL. See [methodGio.ActionGroup.get_action_parameter_type].

      If the [typeGio.ActionGroup] implementation supports asynchronous remote activation over D-Bus, this call may return before the relevant D-Bus traffic has been sent, or any replies have been received. In order to block on such asynchronous activation calls, [methodGio.DBusConnection.flush] should be called prior to the code, which depends on the result of the action activation. Without flushing the D-Bus connection, there is no guarantee that the action would have been activated.

      The following code which runs in a remote app instance, shows an example of a ‘quit’ action being activated on the primary app instance over D-Bus. Here [methodGio.DBusConnection.flush] is called before exit(). Without g_dbus_connection_flush(), the ‘quit’ action may fail to be activated on the primary instance.

      // call ‘quit’ action on primary instance
      g_action_group_activate_action (G_ACTION_GROUP (app), "quit", NULL);

      // make sure the action is activated now
      g_dbus_connection_flush (…);

      g_debug ("Application has been terminated. Exiting.");

      exit (0);

      Parameters

      • action_name: string

        the name of the action to activate

      • Optionalparameter: Variant<any> | null

        parameters to the activation

      Returns void

    • 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_accelerator_parse(), e.g. "q" or “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 #GMenuModels passed to gtk_application_set_app_menu() and gtk_application_set_menubar(), which is usually more convenient than calling this function for each accelerator.

      Parameters

      • accelerator: string

        accelerator string

      • action_name: string

        the name of the action to activate

      • Optionalparameter: Variant<any> | null

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

      Returns void

    • Adds an action to the action_map.

      If the action map already contains an action with the same name as action then the old action is dropped from the action map.

      The action map takes its own reference on action.

      Parameters

      • action: Action

        a [iface@Gio.Action]

      Returns void

    • A convenience function for creating multiple simple actions. See Gio.ActionEntryObj for the structure of the action entry.

      Parameters

      • entries: ActionEntryObj[]

        Array of action entries to add

      Returns void

    • Add an option to be handled by application.

      Calling this function is the equivalent of calling g_application_add_main_option_entries() with a single #GOptionEntry that has its arg_data member set to %NULL.

      The parsed arguments will be packed into a #GVariantDict which is passed to #GApplication::handle-local-options. If %G_APPLICATION_HANDLES_COMMAND_LINE is set, then it will also be sent to the primary instance. See g_application_add_main_option_entries() for more details.

      See #GOptionEntry for more documentation of the arguments.

      Parameters

      • long_name: string

        the long name of an option used to specify it in a commandline

      • short_name: number

        the short name of an option

      • flags: OptionFlags | null

        flags from #GOptionFlags

      • arg: OptionArg | null

        the type of the option, as a #GOptionArg

      • description: string

        the description for the option in --help output

      • Optionalarg_description: string | null

        the placeholder to use for the extra argument parsed by the option in --help output

      Returns void

    • Adds main option entries to be handled by application.

      This function is comparable to g_option_context_add_main_entries().

      After the commandline arguments are parsed, the #GApplication::handle-local-options signal will be emitted. At this point, the application can inspect the values pointed to by arg_data in the given #GOptionEntrys.

      Unlike #GOptionContext, #GApplication supports giving a %NULL arg_data for a non-callback #GOptionEntry. This results in the argument in question being packed into a #GVariantDict which is also passed to #GApplication::handle-local-options, where it can be inspected and modified. If %G_APPLICATION_HANDLES_COMMAND_LINE is set, then the resulting dictionary is sent to the primary instance, where g_application_command_line_get_options_dict() will return it. As it has been passed outside the process at this point, the types of all values in the options dict must be checked before being used. This "packing" is done according to the type of the argument -- booleans for normal flags, strings for strings, bytestrings for filenames, etc. The packing only occurs if the flag is given (ie: we do not pack a "false" #GVariant in the case that a flag is missing).

      In general, it is recommended that all commandline arguments are parsed locally. The options dictionary should then be used to transmit the result of the parsing to the primary instance, where g_variant_dict_lookup() can be used. For local options, it is possible to either use arg_data in the usual way, or to consult (and potentially remove) the option from the options dictionary.

      This function is new in GLib 2.40. Before then, the only real choice was to send all of the commandline arguments (options and all) to the primary instance for handling. #GApplication ignored them completely on the local side. Calling this function "opts in" to the new behaviour, and in particular, means that unrecognized options will be treated as errors. Unrecognized options have never been ignored when %G_APPLICATION_HANDLES_COMMAND_LINE is unset.

      If #GApplication::handle-local-options needs to see the list of filenames, then the use of %G_OPTION_REMAINING is recommended. If arg_data is %NULL then %G_OPTION_REMAINING can be used as a key into the options dictionary. If you do use %G_OPTION_REMAINING then you need to handle these arguments for yourself because once they are consumed, they will no longer be visible to the default handling (which treats them as filenames to be opened).

      It is important to use the proper GVariant format when retrieving the options with g_variant_dict_lookup():

      • for %G_OPTION_ARG_NONE, use b
      • for %G_OPTION_ARG_STRING, use &s
      • for %G_OPTION_ARG_INT, use i
      • for %G_OPTION_ARG_INT64, use x
      • for %G_OPTION_ARG_DOUBLE, use d
      • for %G_OPTION_ARG_FILENAME, use ^&ay
      • for %G_OPTION_ARG_STRING_ARRAY, use ^a&s
      • for %G_OPTION_ARG_FILENAME_ARRAY, use ^a&ay

      Parameters

      • entries: OptionEntry[]

        the main options for the application

      Returns void

    • Adds a #GOptionGroup to the commandline handling of application.

      This function is comparable to g_option_context_add_group().

      Unlike g_application_add_main_option_entries(), this function does not deal with %NULL arg_data and never transmits options to the primary instance.

      The reason for that is because, by the time the options arrive at the primary instance, it is typically too late to do anything with them. Taking the GTK option group as an example: GTK will already have been initialised by the time the #GApplication::command-line handler runs. In the case that this is not the first-running instance of the application, the existing instance may already have been running for a very long time.

      This means that the options from #GOptionGroup are only really usable in the case that the instance of the application being run is the first instance. Passing options like --display= or --gdk-debug= on future runs will have no effect on the existing primary instance.

      Calling this function will cause the options in the supplied option group to be parsed, but it does not cause you to be "opted in" to the new functionality whereby unrecognized options are rejected even if %G_APPLICATION_HANDLES_COMMAND_LINE was given.

      Parameters

      • group: OptionGroup

        a #GOptionGroup

      Returns void

    • 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 #GtkWindow: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.

      Parameters

      • window: Window

        a #GtkWindow

      Returns void

    • Prepends a directory to the icon search path.

      Parameters

      • path: string

        Directory containing icon files

      Returns void

    • Registers a window with the application.

      The window must have a name property set. Emits 'window-toggled' when the window's visibility changes.

      Parameters

      • w: Window

        The GTK window to register

      Returns void

    • Applies CSS styling from a file path or inline CSS string.

      Parameters

      • pathOrStyle: string

        A file path to a CSS file or an inline CSS string

      • reset: boolean = false

        If true, removes all previously applied CSS first

      Returns void

    • Marks application as busy (see g_application_mark_busy()) while property on object is %TRUE.

      The binding holds a reference to application while it is active, but not to object. Instead, the binding is destroyed when object is finalized.

      Parameters

      • object: Object

        a #GObject

      • property: string

        the name of a boolean property of

      Returns void

    • Creates a binding between source_property on source and target_property on target.

      Whenever the source_property is changed the target_property is updated using the same value. For instance:

        g_object_bind_property (action, "active", widget, "sensitive", 0);
      

      Will result in the "sensitive" property of the widget #GObject instance to be updated with the same value of the "active" property of the action #GObject instance.

      If flags contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well.

      The binding will automatically be removed when either the source or the target instances are finalized. To remove the binding without affecting the source and the target you can just call g_object_unref() on the returned #GBinding instance.

      Removing the binding by calling g_object_unref() on it must only be done if the binding, source and target are only used from a single thread and it is clear that both source and target outlive the binding. Especially it is not safe to rely on this if the binding, source or target can be finalized from different threads. Keep another reference to the binding and use g_binding_unbind() instead to be on the safe side.

      A #GObject can have multiple bindings.

      Parameters

      • source_property: string

        the property on

      • target: Object

        the target #GObject

      • target_property: string

        the property on

      • flags: BindingFlags | null

        flags to pass to #GBinding

      Returns Binding

      the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.

      to bind

      to bind

    • Complete version of g_object_bind_property().

      Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

      If flags contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well. The transform_from function is only used in case of bidirectional bindings, otherwise it will be ignored

      The binding will automatically be removed when either the source or the target instances are finalized. This will release the reference that is being held on the #GBinding instance; if you want to hold on to the #GBinding instance, you will need to hold a reference to it.

      To remove the binding, call g_binding_unbind().

      A #GObject can have multiple bindings.

      The same user_data parameter will be used for both transform_to and transform_from transformation functions; the notify function will be called once, when the binding is removed. If you need different data for each transformation function, please use g_object_bind_property_with_closures() instead.

      Parameters

      • source_property: string

        the property on

      • target: Object

        the target #GObject

      • target_property: string

        the property on

      • flags: BindingFlags | null

        flags to pass to #GBinding

      • Optionaltransform_to: BindingTransformFunc | null

        the transformation function from the

      • Optionaltransform_from: BindingTransformFunc | null

        the transformation function from the

      • Optionalnotify: DestroyNotify | null

        a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required

      Returns Binding

      the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.

      to bind

      to bind

      to the @target, or %NULL to use the default

      to the @source, or %NULL to use the default

    • Complete version of g_object_bind_property().

      Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

      If flags contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well. The transform_from function is only used in case of bidirectional bindings, otherwise it will be ignored

      The binding will automatically be removed when either the source or the target instances are finalized. This will release the reference that is being held on the #GBinding instance; if you want to hold on to the #GBinding instance, you will need to hold a reference to it.

      To remove the binding, call g_binding_unbind().

      A #GObject can have multiple bindings.

      The same user_data parameter will be used for both transform_to and transform_from transformation functions; the notify function will be called once, when the binding is removed. If you need different data for each transformation function, please use g_object_bind_property_with_closures() instead.

      Parameters

      • ...args: never[]

      Returns any

      the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.

      to bind

      to bind

      to the @target, or %NULL to use the default

      to the @source, or %NULL to use the default

    • Blocks a handler of an instance so it will not be called during any signal emissions

      Parameters

      • id: number

        Handler ID of the handler to be blocked

      Returns void

    • Request for the state of the named action within action_group to be changed to value.

      The action must be stateful and value must be of the correct type. See [methodGio.ActionGroup.get_action_state_type].

      This call merely requests a change. The action may refuse to change its state or may change its state to something other than value. See [methodGio.ActionGroup.get_action_state_hint].

      If the value GVariant is floating, it is consumed.

      Parameters

      • action_name: string

        the name of the action to request the change on

      • value: Variant

        the new state

      Returns void

    • Hides a window by name, respecting any configured close delay.

      Parameters

      • name: string

        The window name

      Returns void

    • Applies configuration settings to the application.

      Parameters

      • config: Config

        The configuration object

      Returns void

    • Connects a callback to a signal.

      Parameters

      • signal: string = 'window-toggled'

        The signal name (defaults to 'window-toggled')

      • callback: (_: this, ...args: any[]) => void

        The callback to invoke

      Returns number

      The connection ID

    • Type Parameters

      • K extends keyof SignalSignatures

      Parameters

      • signal: K
      • callback: SignalCallback<App, SignalSignatures[K]>

      Returns number

    • Parameters

      • signal: string
      • callback: (...args: any[]) => any

      Returns number

    • Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.

      Parameters

      • id: number

        Handler ID of the handler to be disconnected

      Returns void

    • Type Parameters

      • K extends keyof SignalSignatures

      Parameters

      • signal: K
      • ...args: GjsParameters<SignalSignatures[K]> extends [any, ...Q[]] ? Q : never

      Returns void

    • Parameters

      • signal: string
      • ...args: any[]

      Returns void

    • This function is intended for #GObject implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().

      Returns void

    • Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one #GObject::notify signal is emitted for each property modified while the object is frozen.

      This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.

      Returns void

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

      Parameters

      • detailed_action_name: string

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

      Returns string[]

      accelerators for @detailed_action_name, as a %NULL-terminated array. Free with g_strfreev() when no longer needed

    • Checks if the named action within action_group is currently enabled.

      An action must be enabled in order to be activated or in order to have its state changed from outside callers.

      Parameters

      • action_name: string

        the name of the action to query

      Returns boolean

      whether the action is currently enabled

    • Queries the type of the parameter that must be given when activating the named action within action_group.

      When activating the action using [methodGio.ActionGroup.activate_action], the [typeGLib.Variant] given to that function must be of the type returned by this function.

      In the case that this function returns NULL, you must not give any [typeGLib.Variant], but NULL instead.

      The parameter type of a particular action will never change but it is possible for an action to be removed and for a new action to be added with the same name but a different parameter type.

      Parameters

      • action_name: string

        the name of the action to query

      Returns VariantType<any> | null

      the parameter type

    • Queries the current state of the named action within action_group.

      If the action is not stateful then NULL will be returned. If the action is stateful then the type of the return value is the type given by [methodGio.ActionGroup.get_action_state_type].

      The return value (if non-NULL) should be freed with [methodGLib.Variant.unref] when it is no longer required.

      Parameters

      • action_name: string

        the name of the action to query

      Returns Variant<any> | null

      the current state of the action

    • Requests a hint about the valid range of values for the state of the named action within action_group.

      If NULL is returned it either means that the action is not stateful or that there is no hint about the valid range of values for the state of the action.

      If a [typeGLib.Variant] array is returned then each item in the array is a possible value for the state. If a [typeGLib.Variant] pair (ie: two-tuple) is returned then the tuple specifies the inclusive lower and upper bound of valid values for the state.

      In any case, the information is merely a hint. It may be possible to have a state value outside of the hinted range and setting a value within the range may fail.

      The return value (if non-NULL) should be freed with [methodGLib.Variant.unref] when it is no longer required.

      Parameters

      • action_name: string

        the name of the action to query

      Returns Variant<any> | null

      the state range hint

    • Queries the type of the state of the named action within action_group.

      If the action is stateful then this function returns the [typeGLib.VariantType] of the state. All calls to [methodGio.ActionGroup.change_action_state] must give a [typeGLib.Variant] of this type and [methodGio.ActionGroup.get_action_state] will return a [typeGLib.Variant] of the same type.

      If the action is not stateful then this function will return NULL. In that case, [methodGio.ActionGroup.get_action_state] will return NULL and you must not call [methodGio.ActionGroup.change_action_state].

      The state type of a particular action will never change but it is possible for an action to be removed and for a new action to be added with the same name but a different state type.

      Parameters

      • action_name: string

        the name of the action to query

      Returns VariantType<any> | null

      the state type, if the action is stateful

    • 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_accelerator_parse() first.

      Parameters

      • accel: string

        an accelerator that can be parsed by gtk_accelerator_parse()

      Returns string[]

      a %NULL-terminated array of actions for

    • 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.

      Returns Window | null

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

    • Returns the menu model that has been set with gtk_application_set_app_menu().

      Returns MenuModel | null

      the application menu of

      or %NULL if no application menu has been set.

    • Gets the unique identifier for application.

      Returns string | null

      the identifier for @application, owned by

    • Gets a named field from the objects table of associations (see g_object_set_data()).

      Parameters

      • key: string

        name of the key for that association

      Returns any

      the data if found, or %NULL if no such data exists.

    • Gets the #GDBusConnection being used by the application, or %NULL.

      If #GApplication is using its D-Bus backend then this function will return the #GDBusConnection being used for uniqueness and communication with the desktop environment and other instances of the application.

      If #GApplication is not using D-Bus then this function will return %NULL. This includes the situation where the D-Bus backend would normally be in use but we were unable to connect to the bus.

      This function must not be called before the application has been registered. See g_application_get_is_registered().

      Returns DBusConnection | null

      a #GDBusConnection, or %NULL

    • Gets the D-Bus object path being used by the application, or %NULL.

      If #GApplication is using its D-Bus backend then this function will return the D-Bus object path that #GApplication is using. If the application is the primary instance then there is an object published at this path. If the application is not the primary instance then the result of this function is undefined.

      If #GApplication is not using D-Bus then this function will return %NULL. This includes the situation where the D-Bus backend would normally be in use but we were unable to connect to the bus.

      This function must not be called before the application has been registered. See g_application_get_is_registered().

      Returns string | null

      the object path, or %NULL

    • Gets the flags for application.

      See #GApplicationFlags.

      Returns ApplicationFlags

      the flags for

    • Gets the current inactivity timeout for the application.

      This is the amount of time (in milliseconds) after the last call to g_application_release() before the application stops running.

      Returns number

      the timeout, in milliseconds

    • Gets the application's current busy state, as set through g_application_mark_busy() or g_application_bind_busy_property().

      Returns boolean

      %TRUE if

      is currently marked as busy

    • Checks if application is registered.

      An application is registered if g_application_register() has been successfully called.

      Returns boolean

      %TRUE if

      is registered

    • Checks if application is remote.

      If application is remote then it means that another instance of application already exists (the 'primary' instance). Calls to perform actions on application will result in the actions being performed by the primary instance.

      The value of this property cannot be accessed before g_application_register() has been called. See g_application_get_is_registered().

      Returns boolean

      %TRUE if

      is remote

    • Gets a menu from automatically loaded resources. See [Automatic resources][automatic-resources] for more information.

      Parameters

      • id: string

        the id of the menu to look up

      Returns Menu

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

    • Returns the menu model that has been set with gtk_application_set_menubar().

      Returns MenuModel

      the menubar for windows of

    • Gets a property of an object.

      The value can be:

      • an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
      • a GObject.Value initialized with the expected type of the property
      • a GObject.Value initialized with a type to which the expected type of the property can be transformed

      In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.

      Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.

      Parameters

      • property_name: string

        The name of the property to get

      • value: any

        Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type

      Returns any

    • This function gets back user data pointers stored via g_object_set_qdata().

      Parameters

      • quark: number

        A #GQuark, naming the user data pointer

      Returns any

      The user data pointer set, or %NULL

    • Gets the resource base path of application.

      See g_application_set_resource_base_path() for more information.

      Returns string | null

      the base resource path, if one is set

    • Gets the version of application.

      Returns string | null

      the version of

    • Returns the #GtkApplicationWindow with the given ID.

      The ID of a #GtkApplicationWindow can be retrieved with gtk_application_window_get_id().

      Parameters

      • id: number

        an identifier number

      Returns Window | null

      the window with ID @id, or %NULL if there is no window with this ID

    • Gets a list of the #GtkWindows 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.

      Returns Window[]

      a #GList of #GtkWindow

    • Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

      Parameters

      • names: string[]

        the names of each property to get

      • values: any[]

        the values of each property to get

      Returns void

    • Retrieves a registered window by name.

      Parameters

      • name: string

        The window name

      Returns Window | undefined

      The window, or undefined if not found

    • Checks if the named action exists within action_group.

      Parameters

      • action_name: string

        the name of the action to check for

      Returns boolean

      whether the named action exists

    • Increases the use count of application.

      Use this function to indicate that the application has a reason to continue to run. For example, g_application_hold() is called by GTK when a toplevel window is on the screen.

      To cancel the hold, call g_application_release().

      Returns void

    • 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.

      Parameters

      • window: Window | null

        a #GtkWindow, or %NULL

      • flags: ApplicationInhibitFlags | null

        what types of actions should be inhibited

      • Optionalreason: string | null

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

      Returns number

      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.

    • Opens the GTK interactive debugger.

      Returns void

    • Checks whether object has a [floating][floating-ref] reference.

      Returns boolean

      %TRUE if

      has a floating reference

    • 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).

      Parameters

      • flags: ApplicationInhibitFlags | null

        what types of actions should be queried

      Returns boolean

      %TRUE if any of the actions specified in

      are inhibited

    • Lists the detailed action names which have associated accelerators. See gtk_application_set_accels_for_action().

      Returns string[]

      a %NULL-terminated array of strings, free with g_strfreev() when done

    • Lists the actions contained within action_group.

      The caller is responsible for freeing the list with [funcGLib.strfreev] when it is no longer required.

      Returns string[]

      a NULL-terminated array of the names of the actions in the group

    • Looks up the action with the name action_name in action_map.

      If no such action exists, returns NULL.

      Parameters

      • action_name: string

        the name of an action

      Returns Action | null

      a [iface@Gio.Action]

    • Increases the busy count of application.

      Use this function to indicate that the application is busy, for instance while a long running operation is pending.

      The busy state will be exposed to other processes, so a session shell will use that information to indicate the state to the user (e.g. with a spinner).

      To cancel the busy indication, use g_application_unmark_busy().

      The application must be registered before calling this function.

      Returns void

    • Emits a "notify" signal for the property property_name on object.

      When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

      Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

      Parameters

      • property_name: string

        the name of a property installed on the class of @object.

      Returns void

    • Emits a "notify" signal for the property specified by pspec on object.

      This function omits the property name lookup, hence it is faster than g_object_notify().

      One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with g_object_class_install_property() inside a static array, e.g.:

        typedef enum
      {
      PROP_FOO = 1,
      PROP_LAST
      } MyObjectProperty;

      static GParamSpec *properties[PROP_LAST];

      static void
      my_object_class_init (MyObjectClass *klass)
      {
      properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
      0, 100,
      50,
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
      g_object_class_install_property (gobject_class,
      PROP_FOO,
      properties[PROP_FOO]);
      }

      and then notify a change on the "foo" property with:

        g_object_notify_by_pspec (self, properties[PROP_FOO]);
      

      Parameters

      • pspec: ParamSpec

        the #GParamSpec of a property installed on the class of @object.

      Returns void

    • Opens the given files.

      In essence, this results in the #GApplication::open signal being emitted in the primary instance.

      n_files must be greater than zero.

      hint is simply passed through to the ::open signal. It is intended to be used by applications that have multiple modes for opening files (eg: "view" vs "edit", etc). Unless you have a need for this functionality, you should use "".

      The application must be registered before calling this function and it must have the %G_APPLICATION_HANDLES_OPEN flag set.

      Parameters

      • files: File[]

        an array of #GFiles to open

      • hint: string

        a hint (or ""), but never %NULL

      Returns void

    • Shows a window by name.

      Parameters

      • name: string

        The window name

      Returns void

    • 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.

      Returns boolean

      %TRUE if you should set an app menu

    • Queries all aspects of the named action within an action_group.

      This function acquires the information available from [methodGio.ActionGroup.has_action], [methodGio.ActionGroup.get_action_enabled], [methodGio.ActionGroup.get_action_parameter_type], [methodGio.ActionGroup.get_action_state_type], [methodGio.ActionGroup.get_action_state_hint] and [methodGio.ActionGroup.get_action_state] with a single function call.

      This provides two main benefits.

      The first is the improvement in efficiency that comes with not having to perform repeated lookups of the action in order to discover different things about it. The second is that implementing [typeGio.ActionGroup] can now be done by only overriding this one virtual function.

      The interface provides a default implementation of this function that calls the individual functions, as required, to fetch the information. The interface also provides default implementations of those functions that call this function. All implementations, therefore, must override either this function or all of the others.

      If the action exists, TRUE is returned and any of the requested fields (as indicated by having a non-NULL reference passed in) are filled. If the action doesn’t exist, FALSE is returned and the fields may or may not have been modified.

      Parameters

      • action_name: string

        the name of an action in the group

      Returns [
          boolean,
          boolean,
          VariantType<any>
          | null,
          VariantType<any> | null,
          Variant<any> | null,
          Variant<any> | null,
      ]

      TRUE if the action exists, else FALSE

    • Quits the application.

      Returns void

    • DBus method to quit the application.

      Returns void

    • Increases the reference count of object.

      Since GLib 2.56, if GLIB_VERSION_MAX_ALLOWED is 2.56 or greater, the type of object will be propagated to the return type (using the GCC typeof() extension), so any casting the caller needs to do on the return type must be explicit.

      Returns Object

      the same

    • Increase the reference count of object, and possibly remove the [floating][floating-ref] reference, if object has a floating reference.

      In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.

      Since GLib 2.56, the type of object will be propagated to the return type under the same conditions as for g_object_ref().

      Returns Object

    • Attempts registration of the application.

      This is the point at which the application discovers if it is the primary instance or merely acting as a remote for an already-existing primary instance. This is implemented by attempting to acquire the application identifier as a unique bus name on the session bus using GDBus.

      If there is no application ID or if %G_APPLICATION_NON_UNIQUE was given, then this process will always become the primary instance.

      Due to the internal architecture of GDBus, method calls can be dispatched at any time (even if a main loop is not running). For this reason, you must ensure that any object paths that you wish to register are registered before calling this function.

      If the application has already been registered then %TRUE is returned with no work performed.

      The #GApplication::startup signal is emitted if registration succeeds and application is the primary instance (including the non-unique case).

      In the event of an error (such as cancellable being cancelled, or a failure to connect to the session bus), %FALSE is returned and error is set appropriately.

      Note: the return value of this function is not an indicator that this instance is or is not the primary instance of the application. See g_application_get_is_remote() for that.

      Parameters

      • Optionalcancellable: Cancellable | null

        a #GCancellable, or %NULL

      Returns boolean

      %TRUE if registration succeeded

    • Registers a named theme (CSS file path or inline CSS string).

      Parameters

      • name: string

        A unique theme name

      • pathOrCss: string

        Path to a CSS file or inline CSS string

      Returns void

    • Decrease the use count of application.

      When the use count reaches zero, the application will stop running.

      Never call this function except to cancel the effect of a previous call to g_application_hold().

      Returns void

    • Removes an accelerator that has been previously added with gtk_application_add_accelerator().

      Parameters

      • action_name: string

        the name of the action to activate

      • Optionalparameter: Variant<any> | null

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

      Returns void

    • Removes the named action from the action map.

      If no action of this name is in the map then nothing happens.

      Parameters

      • action_name: string

        the name of the action

      Returns void

    • Remove actions from a [ifaceGio.ActionMap]. This is meant as the reverse of [methodGio.ActionMap.add_action_entries].

      static const GActionEntry entries[] = {
      { "quit", activate_quit },
      { "print-string", activate_print_string, "s" }
      };

      void
      add_actions (GActionMap *map)
      {
      g_action_map_add_action_entries (map, entries, G_N_ELEMENTS (entries), NULL);
      }

      void
      remove_actions (GActionMap *map)
      {
      g_action_map_remove_action_entries (map, entries, G_N_ELEMENTS (entries));
      }

      Parameters

      • entries: ActionEntry[]

        a pointer to the first item in an array of [struct@Gio.ActionEntry] structs

      Returns void

    • Remove a window from application.

      If window belongs to application then this call is equivalent to setting the #GtkWindow:application property of window to %NULL.

      The application may stop running as a result of a call to this function.

      Parameters

      • window: Window

        a #GtkWindow

      Returns void

    • Removes and destroys a registered window.

      Parameters

      • w: string | Window

        The window instance or its name

      Returns void

    • Removes all CSS providers that were applied via applyCss.

      Returns void

    • Runs the application.

      This function is intended to be run from main() and its return value is intended to be returned by main(). Although you are expected to pass the argc, argv parameters from main() to this function, it is possible to pass %NULL if argv is not available or commandline handling is not required. Note that on Windows, argc and argv are ignored, and g_win32_get_command_line() is called internally (for proper support of Unicode commandline arguments).

      #GApplication will attempt to parse the commandline arguments. You can add commandline flags to the list of recognised options by way of g_application_add_main_option_entries(). After this, the #GApplication::handle-local-options signal is emitted, from which the application can inspect the values of its #GOptionEntrys.

      #GApplication::handle-local-options is a good place to handle options such as --version, where an immediate reply from the local process is desired (instead of communicating with an already-running instance). A #GApplication::handle-local-options handler can stop further processing by returning a non-negative value, which then becomes the exit status of the process.

      What happens next depends on the flags: if %G_APPLICATION_HANDLES_COMMAND_LINE was specified then the remaining commandline arguments are sent to the primary instance, where a #GApplication::command-line signal is emitted. Otherwise, the remaining commandline arguments are assumed to be a list of files. If there are no files listed, the application is activated via the #GApplication::activate signal. If there are one or more files, and %G_APPLICATION_HANDLES_OPEN was specified then the files are opened via the #GApplication::open signal.

      If you are interested in doing more complicated local handling of the commandline then you should implement your own #GApplication subclass and override local_command_line(). In this case, you most likely want to return %TRUE from your local_command_line() implementation to suppress the default handling. See [gapplication-example-cmdline2.c][https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-cmdline2.c] for an example.

      If, after the above is done, the use count of the application is zero then the exit status is returned immediately. If the use count is non-zero then the default main context is iterated until the use count falls to zero, at which point 0 is returned.

      If the %G_APPLICATION_IS_SERVICE flag is set, then the service will run for as much as 10 seconds with a use count of zero while waiting for the message that caused the activation to arrive. After that, if the use count falls to zero the application will exit immediately, except in the case that g_application_set_inactivity_timeout() is in use.

      This function sets the prgname (g_set_prgname()), if not already set, to the basename of argv[0].

      Much like g_main_loop_run(), this function will acquire the main context for the duration that the application is running.

      Since 2.40, applications that are not explicitly flagged as services or launchers (ie: neither %G_APPLICATION_IS_SERVICE or %G_APPLICATION_IS_LAUNCHER are given as flags) will check (from the default handler for local_command_line) if "--gapplication-service" was given in the command line. If this flag is present then normal commandline processing is interrupted and the %G_APPLICATION_IS_SERVICE flag is set. This provides a "compromise" solution whereby running an application directly from the commandline will invoke it in the normal way (which can be useful for debugging) while still allowing applications to be D-Bus activated in service mode. The D-Bus service file should invoke the executable with "--gapplication-service" as the sole commandline argument. This approach is suitable for use by most graphical applications but should not be used from applications like editors that need precise control over when processes invoked via the commandline will exit and what their exit status will be.

      Parameters

      • Optionalargv: string[] | null

        the argv from main(), or %NULL

      Returns number

      the exit status

    • Releases all references to other objects. This can be used to break reference cycles.

      This function should only be called from object system implementations.

      Returns void

    • Similar to Gio.Application.run but return a Promise which resolves when the main loop ends, instead of blocking while the main loop runs. This helps avoid the situation where Promises never resolved if you didn't run the application inside a callback.

      Parameters

      • Optionalargv: string[]

        Commandline arguments

      Returns Promise<number>

    • Reads and evaluates a JavaScript file in the application context.

      Parameters

      • file: string

        Path to the JavaScript file

      • Optionalbus: string

        The client's DBus bus name

      • Optionalpath: string

        The client's DBus object path

      Returns void

    • Evaluates a JavaScript string in the application context. Called via DBus from the client.

      Parameters

      • js: string

        JavaScript code to evaluate

      • OptionalclientBusName: string

        The client's DBus bus name for returning results

      • OptionalclientObjPath: string

        The client's DBus object path

      Returns void

    • Parameters

      • js: string
      • OptionalbusName: string
      • OptionalobjPath: string

      Returns void

      Use RunJs instead, which now supports await syntax.

    • Sends a notification on behalf of application to the desktop shell. There is no guarantee that the notification is displayed immediately, or even at all.

      Notifications may persist after the application exits. It will be D-Bus-activated when the notification or one of its actions is activated.

      Modifying notification after this call has no effect. However, the object can be reused for a later call to this function.

      id may be any string that uniquely identifies the event for the application. It does not need to be in any special format. For example, "new-message" might be appropriate for a notification about new messages.

      If a previous notification was sent with the same id, it will be replaced with notification and shown again as if it was a new notification. This works even for notifications sent from a previous execution of the application, as long as id is the same string.

      id may be NULL, but it is impossible to replace or withdraw notifications without an id.

      If notification is no longer relevant, it can be withdrawn with [methodGio.Application.withdraw_notification].

      It is an error to call this function if application has no application ID.

      Parameters

      • id: string | null

        id of the notification, or %NULL

      • notification: Notification

        the #GNotification to send

      Returns void

    • Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.

      Parameters

      • properties: { [key: string]: any }

        Object containing the properties to set

      Returns void

    • 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().

      Parameters

      • detailed_action_name: string

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

      • accels: string[]

        a list of accelerators in the format understood by gtk_accelerator_parse()

      Returns void

    • This used to be how actions were associated with a #GApplication. Now there is #GActionMap for that.

      Parameters

      • Optionalaction_group: ActionGroup | null

        a #GActionGroup, or %NULL

      Returns void

    • 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. #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 #GActionMap interface to add actions, to respond to the user selecting these menu items.

      Parameters

      • Optionalapp_menu: MenuModel | null

        a #GMenuModel, or %NULL

      Returns void

    • Sets the unique identifier for application.

      The application id can only be modified if application has not yet been registered.

      If non-%NULL, the application id must be valid. See g_application_id_is_valid().

      Parameters

      • Optionalapplication_id: string | null

        the identifier for

      Returns void

    • Each object carries around a table of associations from strings to pointers. This function lets you set an association.

      If the object already had an association with that name, the old association will be destroyed.

      Internally, the key is converted to a #GQuark using g_quark_from_string(). This means a copy of key is kept permanently (even after object has been finalized) — so it is recommended to only use a small, bounded set of values for key in your program, to avoid the #GQuark storage growing unbounded.

      Parameters

      • key: string

        name of the key

      • Optionaldata: any

        data to associate with that key

      Returns void

    • Sets or unsets the default application for the process, as returned by g_application_get_default().

      This function does not take its own reference on application. If application is destroyed then the default application will revert back to %NULL.

      Returns void

    • Sets the flags for application.

      The flags can only be modified if application has not yet been registered.

      See #GApplicationFlags.

      Parameters

      • flags: ApplicationFlags | null

        the flags for

      Returns void

    • Sets the current inactivity timeout for the application.

      This is the amount of time (in milliseconds) after the last call to g_application_release() before the application stops running.

      This call has no side effects of its own. The value set here is only used for next time g_application_release() drops the use count to zero. Any timeouts currently in progress are not impacted.

      Parameters

      • inactivity_timeout: number

        the timeout, in milliseconds

      Returns void

    • 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.

      Parameters

      • Optionalmenubar: MenuModel | null

        a #GMenuModel, or %NULL

      Returns void

    • Adds a description to the application option context.

      See g_option_context_set_description() for more information.

      Parameters

      • Optionaldescription: string | null

        a string to be shown in --help output after the list of options, or %NULL

      Returns void

    • Sets the parameter string to be used by the commandline handling of application.

      This function registers the argument to be passed to g_option_context_new() when the internal #GOptionContext of application is created.

      See g_option_context_new() for more information about parameter_string.

      Parameters

      • Optionalparameter_string: string | null

        a string which is displayed in the first line of --help output, after the usage summary programname [OPTION...].

      Returns void

    • Adds a summary to the application option context.

      See g_option_context_set_summary() for more information.

      Parameters

      • Optionalsummary: string | null

        a string to be shown in --help output before the list of options, or %NULL

      Returns void

    • Sets a property on an object.

      Parameters

      • property_name: string

        The name of the property to set

      • value: any

        The value to set the property to

      Returns void

    • Sets (or unsets) the base resource path of application.

      The path is used to automatically load various [application resources][structGio.Resource] such as menu layouts and action descriptions. The various types of resources will be found at fixed names relative to the given base path.

      By default, the resource base path is determined from the application ID by prefixing '/' and replacing each '.' with '/'. This is done at the time that the #GApplication object is constructed. Changes to the application ID after that point will not have an impact on the resource base path.

      As an example, if the application has an ID of "org.example.app" then the default resource base path will be "/org/example/app". If this is a #GtkApplication (and you have not manually changed the path) then Gtk will then search for the menus of the application at "/org/example/app/gtk/menus.ui".

      See #GResource for more information about adding resources to your application.

      You can disable automatic resource loading functionality by setting the path to %NULL.

      Changing the resource base path once the application is running is not recommended. The point at which the resource path is consulted for forming paths for various purposes is unspecified. When writing a sub-class of #GApplication you should either set the #GApplication:resource-base-path property at construction time, or call this function during the instance initialization. Alternatively, you can call this function in the #GApplicationClass.startup virtual function, before chaining up to the parent implementation.

      Parameters

      • Optionalresource_path: string | null

        the resource path to use

      Returns void

    • Sets the version number of application. This will be used to implement a --version command line argument

      The application version can only be modified if application has not yet been registered.

      Parameters

      • version: string

        the version of

      Returns void

    • Switches to a registered theme by name.

      Resets all current CSS and applies the theme CSS. Use @define-color in theme CSS files for GTK3-compatible theming.

      Parameters

      • name: string

        The theme name previously registered via registerTheme

      Returns void

    • Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

      Parameters

      • key: string

        name of the key

      Returns any

      the data if found, or %NULL if no such data exists.

    • This function gets back user data pointers stored via g_object_set_qdata() and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

      void
      object_add_to_user_list (GObject *object,
      const gchar *new_string)
      {
      // the quark, naming the object data
      GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
      // retrieve the old string list
      GList *list = g_object_steal_qdata (object, quark_string_list);

      // prepend new string
      list = g_list_prepend (list, g_strdup (new_string));
      // this changed 'list', so we need to set it again
      g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
      }
      static void
      free_string_list (gpointer data)
      {
      GList *node, *list = data;

      for (node = list; node; node = node->next)
      g_free (node->data);
      g_list_free (list);
      }

      Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata() would have left the destroy function set, and thus the partial string list would have been freed upon g_object_set_qdata_full().

      Parameters

      • quark: number

        A #GQuark, naming the user data pointer

      Returns any

      The user data pointer set, or %NULL

    • Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.

      Parameters

      • detailedName: string

        Name of the signal to stop emission of

      Returns void

    • Reverts the effect of a previous call to g_object_freeze_notify(). The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.

      Duplicate notifications for each property are squashed so that at most one #GObject::notify signal is emitted for each property, in the reverse order in which they have been queued.

      It is an error to call this function when the freeze count is zero.

      Returns void

    • Toggles a window's visibility by name.

      Parameters

      • name: string

        The window name

      Returns string | undefined

    • DBus method to toggle a window. Returns the window's visibility as a string.

      Parameters

      • name: string

      Returns string

    • Returns a JSON-serializable representation of the application state.

      Returns { bus: string; configDir: string; windows: { [k: string]: Window } }

    • Destroys a binding between property and the busy state of application that was previously created with g_application_bind_busy_property().

      Parameters

      • object: Object

        a #GObject

      • property: string

        the name of a boolean property of

      Returns void

    • Unblocks a handler so it will be called again during any signal emissions

      Parameters

      • id: number

        Handler ID of the handler to be unblocked

      Returns void

    • Removes an inhibitor that has been established with gtk_application_inhibit(). Inhibitors are also cleared when the application exits.

      Parameters

      • cookie: number

        a cookie that was returned by gtk_application_inhibit()

      Returns void

    • Decreases the busy count of application.

      When the busy count reaches zero, the new state will be propagated to other processes.

      This function must only be called to cancel the effect of a previous call to g_application_mark_busy().

      Returns void

    • Decreases the reference count of object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

      If the pointer to the #GObject may be reused in future (for example, if it is an instance variable of another object), it is recommended to clear the pointer to %NULL rather than retain a dangling pointer to a potentially invalid #GObject instance. Use g_clear_object() for this.

      Returns void

    • Emits the [signalGio.ActionGroup::action-added] signal on action_group.

      This function should only be called by [typeGio.ActionGroup] implementations.

      Parameters

      • action_name: string

        the name of an action in the group

      Returns void

    • Emits the [signalGio.ActionGroup::action-enabled-changed] signal on action_group.

      This function should only be called by [typeGio.ActionGroup] implementations.

      Parameters

      • action_name: string

        the name of an action in the group

      • enabled: boolean

        whether the action is now enabled

      Returns void

    • Emits the [signalGio.ActionGroup::action-removed] signal on action_group.

      This function should only be called by [typeGio.ActionGroup] implementations.

      Parameters

      • action_name: string

        the name of an action in the group

      Returns void

    • Emits the [signalGio.ActionGroup::action-state-changed] signal on action_group.

      This function should only be called by [typeGio.ActionGroup] implementations.

      Parameters

      • action_name: string

        the name of an action in the group

      • state: Variant

        the new state of the named action

      Returns void

    • Activates the application.

      In essence, this results in the #GApplication::activate signal being emitted in the primary instance.

      The application must be registered before calling this function.

      Returns void

    • Activate the named action within action_group.

      If the action is expecting a parameter, then the correct type of parameter must be given as parameter. If the action is expecting no parameters then parameter must be NULL. See [methodGio.ActionGroup.get_action_parameter_type].

      If the [typeGio.ActionGroup] implementation supports asynchronous remote activation over D-Bus, this call may return before the relevant D-Bus traffic has been sent, or any replies have been received. In order to block on such asynchronous activation calls, [methodGio.DBusConnection.flush] should be called prior to the code, which depends on the result of the action activation. Without flushing the D-Bus connection, there is no guarantee that the action would have been activated.

      The following code which runs in a remote app instance, shows an example of a ‘quit’ action being activated on the primary app instance over D-Bus. Here [methodGio.DBusConnection.flush] is called before exit(). Without g_dbus_connection_flush(), the ‘quit’ action may fail to be activated on the primary instance.

      // call ‘quit’ action on primary instance
      g_action_group_activate_action (G_ACTION_GROUP (app), "quit", NULL);

      // make sure the action is activated now
      g_dbus_connection_flush (…);

      g_debug ("Application has been terminated. Exiting.");

      exit (0);

      Parameters

      • action_name: string

        the name of the action to activate

      • Optionalparameter: Variant<any> | null

        parameters to the activation

      Returns void

    • Adds an action to the action_map.

      If the action map already contains an action with the same name as action then the old action is dropped from the action map.

      The action map takes its own reference on action.

      Parameters

      • action: Action

        a [iface@Gio.Action]

      Returns void

    • invoked (locally) to add 'platform data' to be sent to the primary instance when activating, opening or invoking actions. Must chain up

      Parameters

      • builder: VariantBuilder

      Returns void

    • invoked on the primary instance after 'activate', 'open', 'command-line' or any action invocation, gets the 'platform data' from the calling instance. Must chain up

      Parameters

      • platform_data: Variant

      Returns void

    • invoked on the primary instance before 'activate', 'open', 'command-line' or any action invocation, gets the 'platform data' from the calling instance. Must chain up

      Parameters

      • platform_data: Variant

      Returns void

    • Request for the state of the named action within action_group to be changed to value.

      The action must be stateful and value must be of the correct type. See [methodGio.ActionGroup.get_action_state_type].

      This call merely requests a change. The action may refuse to change its state or may change its state to something other than value. See [methodGio.ActionGroup.get_action_state_hint].

      If the value GVariant is floating, it is consumed.

      Parameters

      • action_name: string

        the name of the action to request the change on

      • value: Variant

        the new state

      Returns void

    • invoked on the primary instance when a command-line is not handled locally

      Parameters

      • command_line: ApplicationCommandLine

      Returns number

    • the constructed function is called by g_object_new() as the final step of the object creation process. At the point of the call, all construction properties have been set on the object. The purpose of this call is to allow for object initialisation steps that can only be performed after construction properties have been set. constructed implementors should chain up to the constructed call of their parent class to allow it to complete its initialisation.

      Returns void

    • invoked locally during registration, if the application is using its D-Bus backend. You can use this to export extra objects on the bus, that need to exist before the application tries to own the bus name. The function is passed the #GDBusConnection to to session bus, and the object path that #GApplication will use to export its D-Bus API. If this function returns %TRUE, registration will proceed; otherwise registration will abort. Since: 2.34

      Parameters

      • connection: DBusConnection
      • object_path: string

      Returns boolean

    • invoked locally during unregistration, if the application is using its D-Bus backend. Use this to undo anything done by the dbus_register vfunc. Since: 2.34

      Parameters

      • connection: DBusConnection
      • object_path: string

      Returns void

    • emits property change notification for a bunch of properties. Overriding dispatch_properties_changed should be rarely needed.

      Parameters

      • n_pspecs: number
      • pspecs: ParamSpec

      Returns void

    • the dispose function is supposed to drop all references to other objects, but keep the instance otherwise intact, so that client method invocations still work. It may be run multiple times (due to reference loops). Before returning, dispose should chain up to the dispose method of the parent class.

      Returns void

    • instance finalization function, should finish the finalization of the instance begun in dispose and chain up to the finalize method of the parent class.

      Returns void

    • Checks if the named action within action_group is currently enabled.

      An action must be enabled in order to be activated or in order to have its state changed from outside callers.

      Parameters

      • action_name: string

        the name of the action to query

      Returns boolean

    • Queries the type of the parameter that must be given when activating the named action within action_group.

      When activating the action using [methodGio.ActionGroup.activate_action], the [typeGLib.Variant] given to that function must be of the type returned by this function.

      In the case that this function returns NULL, you must not give any [typeGLib.Variant], but NULL instead.

      The parameter type of a particular action will never change but it is possible for an action to be removed and for a new action to be added with the same name but a different parameter type.

      Parameters

      • action_name: string

        the name of the action to query

      Returns VariantType<any> | null

    • Queries the current state of the named action within action_group.

      If the action is not stateful then NULL will be returned. If the action is stateful then the type of the return value is the type given by [methodGio.ActionGroup.get_action_state_type].

      The return value (if non-NULL) should be freed with [methodGLib.Variant.unref] when it is no longer required.

      Parameters

      • action_name: string

        the name of the action to query

      Returns Variant<any> | null

    • Requests a hint about the valid range of values for the state of the named action within action_group.

      If NULL is returned it either means that the action is not stateful or that there is no hint about the valid range of values for the state of the action.

      If a [typeGLib.Variant] array is returned then each item in the array is a possible value for the state. If a [typeGLib.Variant] pair (ie: two-tuple) is returned then the tuple specifies the inclusive lower and upper bound of valid values for the state.

      In any case, the information is merely a hint. It may be possible to have a state value outside of the hinted range and setting a value within the range may fail.

      The return value (if non-NULL) should be freed with [methodGLib.Variant.unref] when it is no longer required.

      Parameters

      • action_name: string

        the name of the action to query

      Returns Variant<any> | null

    • Queries the type of the state of the named action within action_group.

      If the action is stateful then this function returns the [typeGLib.VariantType] of the state. All calls to [methodGio.ActionGroup.change_action_state] must give a [typeGLib.Variant] of this type and [methodGio.ActionGroup.get_action_state] will return a [typeGLib.Variant] of the same type.

      If the action is not stateful then this function will return NULL. In that case, [methodGio.ActionGroup.get_action_state] will return NULL and you must not call [methodGio.ActionGroup.change_action_state].

      The state type of a particular action will never change but it is possible for an action to be removed and for a new action to be added with the same name but a different state type.

      Parameters

      • action_name: string

        the name of the action to query

      Returns VariantType<any> | null

    • the generic getter for all properties of this type. Should be overridden for every type with properties.

      Parameters

      • property_id: number
      • value: any
      • pspec: ParamSpec

      Returns void

    • invoked locally after the parsing of the commandline options has occurred. Since: 2.40

      Parameters

      • options: VariantDict

      Returns number

    • Checks if the named action exists within action_group.

      Parameters

      • action_name: string

        the name of the action to check for

      Returns boolean

    • Lists the actions contained within action_group.

      The caller is responsible for freeing the list with [funcGLib.strfreev] when it is no longer required.

      Returns string[]

    • This virtual function is always invoked in the local instance. It gets passed a pointer to a %NULL-terminated copy of argv and is expected to remove arguments that it handled (shifting up remaining arguments).

      The last argument to local_command_line() is a pointer to the status variable which can used to set the exit status that is returned from g_application_run().

      See g_application_run() for more details on #GApplication startup.

      Parameters

      • _arguments: string[]

        array of command line arguments

      Returns [boolean, string[], number]

    • Looks up the action with the name action_name in action_map.

      If no such action exists, returns NULL.

      Parameters

      • action_name: string

        the name of an action

      Returns Action | null

    • invoked when another instance is taking over the name. Since: 2.60

      Returns boolean

    • Emits a "notify" signal for the property property_name on object.

      When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

      Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

      Parameters

      • pspec: ParamSpec

      Returns void

    • Opens the given files.

      In essence, this results in the #GApplication::open signal being emitted in the primary instance.

      n_files must be greater than zero.

      hint is simply passed through to the ::open signal. It is intended to be used by applications that have multiple modes for opening files (eg: "view" vs "edit", etc). Unless you have a need for this functionality, you should use "".

      The application must be registered before calling this function and it must have the %G_APPLICATION_HANDLES_OPEN flag set.

      Parameters

      • files: File[]

        an array of #GFiles to open

      • hint: string

        a hint (or ""), but never %NULL

      Returns void

    • Queries all aspects of the named action within an action_group.

      This function acquires the information available from [methodGio.ActionGroup.has_action], [methodGio.ActionGroup.get_action_enabled], [methodGio.ActionGroup.get_action_parameter_type], [methodGio.ActionGroup.get_action_state_type], [methodGio.ActionGroup.get_action_state_hint] and [methodGio.ActionGroup.get_action_state] with a single function call.

      This provides two main benefits.

      The first is the improvement in efficiency that comes with not having to perform repeated lookups of the action in order to discover different things about it. The second is that implementing [typeGio.ActionGroup] can now be done by only overriding this one virtual function.

      The interface provides a default implementation of this function that calls the individual functions, as required, to fetch the information. The interface also provides default implementations of those functions that call this function. All implementations, therefore, must override either this function or all of the others.

      If the action exists, TRUE is returned and any of the requested fields (as indicated by having a non-NULL reference passed in) are filled. If the action doesn’t exist, FALSE is returned and the fields may or may not have been modified.

      Parameters

      • action_name: string

        the name of an action in the group

      Returns [
          boolean,
          boolean,
          VariantType<any>
          | null,
          VariantType<any> | null,
          Variant<any> | null,
          Variant<any> | null,
      ]

    • Used to be invoked on the primary instance when the use count of the application drops to zero (and after any inactivity timeout, if requested). Not used anymore since 2.32

      Returns void

    • Removes the named action from the action map.

      If no action of this name is in the map then nothing happens.

      Parameters

      • action_name: string

        the name of the action

      Returns void

    • Used to be invoked on the primary instance from g_application_run() if the use-count is non-zero. Since 2.32, GApplication is iterating the main context directly and is not using run_mainloop anymore

      Returns void

    • the generic setter for all properties of this type. Should be overridden for every type with properties. If implementations of set_property don't emit property change notification explicitly, this will be done implicitly by the type system. However, if the notify signal is emitted explicitly, the type system will not emit it a second time.

      Parameters

      • property_id: number
      • value: any
      • pspec: ParamSpec

      Returns void

    • invoked only on the registered primary instance immediately after the main loop terminates

      Returns void

    • invoked on the primary instance immediately after registration

      Returns void

    • Signal emitted when a #GtkWindow is added to application through gtk_application_add_window().

      Parameters

      • window: Window

      Returns void

    • Signal emitted when a #GtkWindow is removed from application, either as a side-effect of being destroyed or explicitly through gtk_application_remove_window().

      Parameters

      • window: Window

      Returns void

    • This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling g_closure_invalidate() on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, g_object_ref() and g_object_unref() are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

      Parameters

      • closure: Closure

        #GClosure to watch

      Returns void

    • Withdraws a notification that was sent with g_application_send_notification().

      This call does nothing if a notification with id doesn't exist or the notification was never sent.

      This function works even for notifications sent in previous executions of this application, as long id is the same as it was for the sent notification.

      Note that notifications are dismissed when the user clicks on one of the buttons in a notification or triggers its default action, so there is no need to explicitly withdraw the notification in that case.

      Parameters

      • id: string

        id of a previously sent notification

      Returns void

    • Parameters

      • klass: any

      Returns any

    • Parameters

      • what: number
      • Optionaldata: any

      Returns number

    • Parameters

      • property_name: string

      Returns ParamSpec

    • Returns the default #GApplication instance for this process.

      Normally there is only one #GApplication per process and it becomes the default when it is created. You can exercise more control over this by using g_application_set_default().

      If there is no default application then %NULL is returned.

      Returns Application | null

    • Checks if application_id is a valid application identifier.

      A valid ID is required for calls to g_application_new() and g_application_set_application_id().

      Application identifiers follow the same format as D-Bus well-known bus names. For convenience, the restrictions on application identifiers are reproduced here:

      • Application identifiers are composed of 1 or more elements separated by a period (.) character. All elements must contain at least one character.

      • Each element must only contain the ASCII characters [A-Z][a-z][0-9]_-, with - discouraged in new application identifiers. Each element must not begin with a digit.

      • Application identifiers must contain at least one . (period) character (and thus at least two elements).

      • Application identifiers must not begin with a . (period) character.

      • Application identifiers must not exceed 255 characters.

      Note that the hyphen (-) character is allowed in application identifiers, but is problematic or not allowed in various specifications and APIs that refer to D-Bus, such as Flatpak application IDs, the DBusActivatable interface in the Desktop Entry Specification, and the convention that an application's "main" interface and object path resemble its application identifier and bus name. To avoid situations that require special-case handling, it is recommended that new application identifiers consistently replace hyphens with underscores.

      Like D-Bus interface names, application identifiers should start with the reversed DNS domain name of the author of the interface (in lower-case), and it is conventional for the rest of the application identifier to consist of words run together, with initial capital letters.

      As with D-Bus interface names, if the author's DNS domain name contains hyphen/minus characters they should be replaced by underscores, and if it contains leading digits they should be escaped by prepending an underscore. For example, if the owner of 7-zip.org used an application identifier for an archiving application, it might be named org._7_zip.Archiver.

      Parameters

      • application_id: string

        a potential application identifier

      Returns boolean

    • Parameters

      • pspecs: ParamSpec<unknown>[]

      Returns void

    • Parameters

      • property_id: number
      • pspec: ParamSpec

      Returns void

    • Find the #GParamSpec with the given name for an interface. Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

      Parameters

      • g_iface: TypeInterface

        any interface vtable for the interface, or the default vtable for the interface

      • property_name: string

        name of a property to look up.

      Returns ParamSpec

    • Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created #GParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property.

      This function is meant to be called from the interface's default vtable initialization function (the class_init member of #GTypeInfo.) It must not be called after after class_init has been called for any object types implementing this interface.

      If pspec is a floating reference, it will be consumed.

      Parameters

      • g_iface: TypeInterface

        any interface vtable for the interface, or the default vtable for the interface.

      • pspec: ParamSpec

        the #GParamSpec for the new property

      Returns void

    • Lists the properties of an interface.Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

      Parameters

      • g_iface: TypeInterface

        any interface vtable for the interface, or the default vtable for the interface

      Returns ParamSpec<unknown>[]

    • Returns ParamSpec<unknown>[]

    • Parameters

      • application_id: string | null
      • flags: ApplicationFlags

      Returns Application

    • Parameters

      • object_type: GType
      • parameters: Parameter[]

      Returns Object

    • Parameters

      • property_id: number
      • name: string

      Returns void

    Properties

    $gtype: GType<Application>