GtkShortcut

GtkShortcut — An object describing a keyboard shortcut

Properties

GtkShortcutAction * action Read / Write
GVariant * arguments Read / Write
GtkShortcutTrigger * trigger Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GtkShortcut

Includes

#include <gtk/gtk.h>

Description

GtkShortcut is the low level object used for managing keyboard shortcuts.

It contains a description of how to trigger the shortcut via a GtkShortcutTrigger and a way to activate the shortcut on a widget via GtkShortcutAction.

The actual work is usually done via GtkShortcutController, which decides if and when to activate a shortcut. Using that controller directly however is rarely necessary as various higher level convenience APIs exist on GtkWidgets that make it easier to use shortcuts in GTK.

GtkShortcut does provide functionality to make it easy for users to work with shortcuts, either by providing informational strings for display purposes or by allowing shortcuts to be configured.

Functions

gtk_shortcut_new ()

GtkShortcut *
gtk_shortcut_new (GtkShortcutTrigger *trigger,
                  GtkShortcutAction *action);

Creates a new GtkShortcut that is triggered by trigger and then activates action .

Parameters

trigger

The trigger that will trigger the shortcut.

[transfer full][nullable]

action

The action that will be activated upon triggering.

[transfer full][nullable]

Returns

a new GtkShortcut


gtk_shortcut_new_with_arguments ()

GtkShortcut *
gtk_shortcut_new_with_arguments (GtkShortcutTrigger *trigger,
                                 GtkShortcutAction *action,
                                 const gchar *format_string,
                                 ...);

Creates a new GtkShortcut that is triggered by trigger and then activates action with arguments given by format_string .

[skip]

Parameters

trigger

The trigger that will trigger the shortcut.

[transfer full][nullable]

action

The action that will be activated upon triggering.

[transfer full][nullable]

format_string

GVariant format string for arguments or NULL for no arguments.

[allow-none]

...

arguments, as given by format string.

 

Returns

a new GtkShortcut


gtk_shortcut_get_trigger ()

GtkShortcutTrigger *
gtk_shortcut_get_trigger (GtkShortcut *self);

Gets the trigger used to trigger self .

Parameters

self

a GtkShortcut

 

Returns

the trigger used.

[transfer none]


gtk_shortcut_set_trigger ()

void
gtk_shortcut_set_trigger (GtkShortcut *self,
                          GtkShortcutTrigger *trigger);

Sets the new trigger for self to be trigger .

Parameters

self

a GtkShortcut

 

trigger

The new trigger. If the trigger is NULL, the never trigger will be used.

[transfer full][nullable]

gtk_shortcut_get_action ()

GtkShortcutAction *
gtk_shortcut_get_action (GtkShortcut *self);

Gets the action that is activated by this shortcut.

Parameters

self

a GtkShortcut

 

Returns

the action.

[transfer none]


gtk_shortcut_set_action ()

void
gtk_shortcut_set_action (GtkShortcut *self,
                         GtkShortcutAction *action);

Sets the new action for self to be action .

Parameters

self

a GtkShortcut

 

action

The new action. If the action is NULL, the nothing action will be used.

[transfer full][nullable]

gtk_shortcut_get_arguments ()

GVariant *
gtk_shortcut_get_arguments (GtkShortcut *self);

Gets the arguments that are passed when activating the shortcut.

Parameters

self

a GtkShortcut

 

Returns

the arguments.

[transfer none][nullable]


gtk_shortcut_set_arguments ()

void
gtk_shortcut_set_arguments (GtkShortcut *self,
                            GVariant *args);

Sets the arguments to pass when activating the shortcut.

Parameters

self

a GtkShortcut

 

args

arguments to pass when activating self .

[nullable]

Types and Values

GtkShortcut

typedef struct _GtkShortcut GtkShortcut;

Property Details

The “action” property

  “action”                   GtkShortcutAction *

The action that gets activated by this shortcut.

Owner: GtkShortcut

Flags: Read / Write


The “arguments” property

  “arguments”                GVariant *

Arguments passed to activation.

Owner: GtkShortcut

Flags: Read / Write

Allowed values: GVariant<*>

Default value: NULL


The “trigger” property

  “trigger”                  GtkShortcutTrigger *

The trigger that triggers this shortcut.

Owner: GtkShortcut

Flags: Read / Write