Class

GtkAction

Description [src]

class Gtk.Action : GObject.Object {
  object: GObject
}

In GTK+ 3.10, GtkAction has been deprecated. Use GAction instead, and associate actions with GtkActionable widgets. Use GMenuModel for creating menus with gtk_menu_new_from_model().

Actions represent operations that the user can be perform, along with some information how it should be presented in the interface. Each action provides methods to create icons, menu items and toolbar items representing itself.

As well as the callback that is called when the action gets activated, the following also gets associated with the action:

  • a name (not translated, for path lookup)

  • a label (translated, for display)

  • an accelerator

  • whether label indicates a stock id

  • a tooltip (optional, translated)

  • a toolbar label (optional, shorter than label)

The action will also have some state information:

  • visible (shown/hidden)

  • sensitive (enabled/disabled)

Apart from regular actions, there are [toggle actions][GtkToggleAction], which can be toggled between two states and [radio actions][GtkRadioAction], of which only one in a group can be in the “active” state. Other actions can be implemented as GtkAction subclasses.

Each action can have one or more proxy widgets. To act as an action proxy, widget needs to implement GtkActivatable interface. Proxies mirror the state of the action and should change when the action’s state changes. Properties that are always mirrored by proxies are GtkAction:sensitive and GtkAction:visible. GtkAction:gicon, GtkAction:icon-name, GtkAction:label, GtkAction:short-label and GtkAction:stock-id properties are only mirorred if proxy widget has GtkActivatable:use-action-appearance property set to TRUE.

When the proxy is activated, it should activate its action.

Hierarchy

hierarchy this GtkAction implements_0 GtkBuildable this--implements_0 ancestor_0 GObject ancestor_0--this

Ancestors

Implements

Constructors

gtk_action_new

Creates a new GtkAction object. To add the action to a GtkActionGroup and set the accelerator for the action, call gtk_action_group_add_action_with_accel(). See the [UI Definition section][XML-UI] for information on allowed action names.

Available since: 2.4

Deprecated since: 3.10

Instance methods

gtk_action_activate

Emits the “activate” signal on the specified action, if it isn’t insensitive. This gets called by the proxy widgets when they get activated.

Available since: 2.4

Deprecated since: 3.10

gtk_action_block_activate

Disable activation signals from the action.

Available since: 2.16

Deprecated since: 3.10

gtk_action_connect_accelerator

Installs the accelerator for action if action has an accel path and group. See gtk_action_set_accel_path() and gtk_action_set_accel_group()

Available since: 2.4

Deprecated since: 3.10

gtk_action_create_icon

This function is intended for use by action implementations to create icons displayed in the proxy widgets.

Available since: 2.4

Deprecated since: 3.10

gtk_action_create_menu

If action provides a GtkMenu widget as a submenu for the menu item or the toolbar item it creates, this function returns an instance of that menu.

Available since: 2.12

Deprecated since: 3.10

gtk_action_create_menu_item

Creates a menu item widget that proxies for the given action.

Available since: 2.4

Deprecated since: 3.10

gtk_action_create_tool_item

Creates a toolbar item widget that proxies for the given action.

Available since: 2.4

Deprecated since: 3.10

gtk_action_disconnect_accelerator

Undoes the effect of one call to gtk_action_connect_accelerator().

Available since: 2.4

Deprecated since: 3.10

gtk_action_get_accel_closure

Returns the accel closure for this action.

Available since: 2.8

Deprecated since: 3.10

gtk_action_get_accel_path

Returns the accel path for this action.

Available since: 2.6

Deprecated since: 3.10

gtk_action_get_always_show_image

Returns whether actions menu item proxies will always show their image, if available.

Available since: 2.20

Deprecated since: 3.10

gtk_action_get_gicon

Gets the gicon of action.

Available since: 2.16

Deprecated since: 3.10

gtk_action_get_icon_name

Gets the icon name of action.

Available since: 2.16

Deprecated since: 3.10

gtk_action_get_is_important

Checks whether action is important or not.

Available since: 2.16

Deprecated since: 3.10

gtk_action_get_label

Gets the label text of action.

Available since: 2.16

Deprecated since: 3.10

gtk_action_get_name

Returns the name of the action.

Available since: 2.4

Deprecated since: 3.10

gtk_action_get_proxies

Returns the proxy widgets for an action. See also gtk_activatable_get_related_action().

Available since: 2.4

gtk_action_get_sensitive

Returns whether the action itself is sensitive. Note that this doesn’t necessarily mean effective sensitivity. See gtk_action_is_sensitive() for that.

Available since: 2.4

Deprecated since: 3.10

gtk_action_get_short_label

Gets the short label text of action.

Available since: 2.16

Deprecated since: 3.10

gtk_action_get_stock_id

Gets the stock id of action.

Available since: 2.16

Deprecated since: 3.10

gtk_action_get_tooltip

Gets the tooltip text of action.

Available since: 2.16

Deprecated since: 3.10

gtk_action_get_visible

Returns whether the action itself is visible. Note that this doesn’t necessarily mean effective visibility. See gtk_action_is_sensitive() for that.

Available since: 2.4

Deprecated since: 3.10

gtk_action_get_visible_horizontal

Checks whether action is visible when horizontal.

Available since: 2.16

Deprecated since: 3.10

gtk_action_get_visible_vertical

Checks whether action is visible when horizontal.

Available since: 2.16

Deprecated since: 3.10

gtk_action_is_sensitive

Returns whether the action is effectively sensitive.

Available since: 2.4

Deprecated since: 3.10

gtk_action_is_visible

Returns whether the action is effectively visible.

Available since: 2.4

Deprecated since: 3.10

gtk_action_set_accel_group

Sets the GtkAccelGroup in which the accelerator for this action will be installed.

Available since: 2.4

Deprecated since: 3.10

gtk_action_set_accel_path

Sets the accel path for this action. All proxy widgets associated with the action will have this accel path, so that their accelerators are consistent.

Available since: 2.4

Deprecated since: 3.10

gtk_action_set_always_show_image

Sets whether actions menu item proxies will ignore the GtkSettings:gtk-menu-images setting and always show their image, if available.

Available since: 2.20

Deprecated since: 3.10

gtk_action_set_gicon

Sets the icon of action.

Available since: 2.16

Deprecated since: 3.10

gtk_action_set_icon_name

Sets the icon name on action.

Available since: 2.16

Deprecated since: 3.10

gtk_action_set_is_important

Sets whether the action is important, this attribute is used primarily by toolbar items to decide whether to show a label or not.

Available since: 2.16

Deprecated since: 3.10

gtk_action_set_label

Sets the label of action.

Available since: 2.16

Deprecated since: 3.10

gtk_action_set_sensitive

Sets the :sensitive property of the action to sensitive. Note that this doesn’t necessarily mean effective sensitivity. See gtk_action_is_sensitive() for that.

Available since: 2.6

Deprecated since: 3.10

gtk_action_set_short_label

Sets a shorter label text on action.

Available since: 2.16

Deprecated since: 3.10

gtk_action_set_stock_id

Sets the stock id on action.

Available since: 2.16

Deprecated since: 3.10

gtk_action_set_tooltip

Sets the tooltip text on action.

Available since: 2.16

Deprecated since: 3.10

gtk_action_set_visible

Sets the :visible property of the action to visible. Note that this doesn’t necessarily mean effective visibility. See gtk_action_is_visible() for that.

Available since: 2.6

Deprecated since: 3.10

gtk_action_set_visible_horizontal

Sets whether action is visible when horizontal.

Available since: 2.16

Deprecated since: 3.10

gtk_action_set_visible_vertical

Sets whether action is visible when vertical.

Available since: 2.16

Deprecated since: 3.10

gtk_action_unblock_activate

Reenable activation signals from the action.

Available since: 2.16

Deprecated since: 3.10

Methods inherited from GObject (42)
Methods inherited from GtkBuildable (10)
gtk_buildable_add_child

Adds a child to buildable. type is an optional string describing how the child should be added.

Available since: 2.12

gtk_buildable_construct_child

Constructs a child of buildable with the name name.

Available since: 2.12

gtk_buildable_custom_finished

This is similar to gtk_buildable_parser_finished() but is called once for each custom tag handled by the buildable.

Available since: 2.12

gtk_buildable_custom_tag_end

This is called at the end of each custom element handled by the buildable.

Available since: 2.12

gtk_buildable_custom_tag_start

This is called for each unknown element under <child>.

Available since: 2.12

gtk_buildable_get_internal_child

Get the internal child called childname of the buildable object.

Available since: 2.12

gtk_buildable_get_name

Gets the name of the buildable object.

Available since: 2.12

gtk_buildable_parser_finished

Called when the builder finishes the parsing of a [GtkBuilder UI definition][BUILDER-UI]. Note that this will be called once for each time gtk_builder_add_from_file() or gtk_builder_add_from_string() is called on a builder.

Available since: 2.12

gtk_buildable_set_buildable_property

Sets the property name name to value on the buildable object.

Available since: 2.12

gtk_buildable_set_name

Sets the name of the buildable object.

Available since: 2.12

Properties

Gtk.Action:action-group

The GtkActionGroup this GtkAction is associated with, or NULL (for internal use).

Deprecated since: 3.10

Gtk.Action:always-show-image

If TRUE, the action’s menu item proxies will ignore the GtkSettings:gtk-menu-images setting and always show their image, if available.

Available since: 2.20

Deprecated since: 3.10

Gtk.Action:gicon

The GIcon displayed in the GtkAction.

Available since: 2.16

Deprecated since: 3.10

Gtk.Action:hide-if-empty

When TRUE, empty menu proxies for this action are hidden.

Deprecated since: 3.10

Gtk.Action:icon-name

The name of the icon from the icon theme.

Available since: 2.10

Deprecated since: 3.10

Gtk.Action:is-important

Whether the action is considered important. When TRUE, toolitem proxies for this action show text in GTK_TOOLBAR_BOTH_HORIZ mode.

Deprecated since: 3.10

Gtk.Action:label

The label used for menu items and buttons that activate this action. If the label is NULL, GTK+ uses the stock label specified via the stock-id property.

Deprecated since: 3.10

Gtk.Action:name

A unique name for the action.

Deprecated since: 3.10

Gtk.Action:sensitive

Whether the action is enabled.

Deprecated since: 3.10

Gtk.Action:short-label

A shorter label that may be used on toolbar buttons.

Deprecated since: 3.10

Gtk.Action:stock-id

The stock icon displayed in widgets representing this action.

Deprecated since: 3.10

Gtk.Action:tooltip

A tooltip for this action.

Deprecated since: 3.10

Gtk.Action:visible

Whether the action is visible.

Deprecated since: 3.10

Gtk.Action:visible-horizontal

Whether the toolbar item is visible when the toolbar is in a horizontal orientation.

Deprecated since: 3.10

Gtk.Action:visible-overflown

When TRUE, toolitem proxies for this action are represented in the toolbar overflow menu.

Available since: 2.6

Deprecated since: 3.10

Gtk.Action:visible-vertical

Whether the toolbar item is visible when the toolbar is in a vertical orientation.

Deprecated since: 3.10

Signals

Gtk.Action::activate

The “activate” signal is emitted when the action is activated.

Available since: 2.4

Deprecated since: 3.10

Signals inherited from GObject (1)

Class structure

struct GtkActionClass {
  GObjectClass parent_class;
  void (* activate) (
    GtkAction* action
  );
  GtkWidget* (* create_menu_item) (
    GtkAction* action
  );
  GtkWidget* (* create_tool_item) (
    GtkAction* action
  );
  void (* connect_proxy) (
    GtkAction* action,
    GtkWidget* proxy
  );
  void (* disconnect_proxy) (
    GtkAction* action,
    GtkWidget* proxy
  );
  GtkWidget* (* create_menu) (
    GtkAction* action
  );
  void (* _gtk_reserved1) (
void
  );
  void (* _gtk_reserved2) (
void
  );
  void (* _gtk_reserved3) (
void
  );
  void (* _gtk_reserved4) (
void
  );
  
}
Class members
parent_class
GObjectClass
 

The parent class.

activate
void (* activate) (
    GtkAction* action
  )
  No description available.
create_menu_item
GtkWidget* (* create_menu_item) (
    GtkAction* action
  )
  No description available.
create_tool_item
GtkWidget* (* create_tool_item) (
    GtkAction* action
  )
  No description available.
connect_proxy
void (* connect_proxy) (
    GtkAction* action,
    GtkWidget* proxy
  )
  No description available.
disconnect_proxy
void (* disconnect_proxy) (
    GtkAction* action,
    GtkWidget* proxy
  )
  No description available.
create_menu
GtkWidget* (* create_menu) (
    GtkAction* action
  )
  No description available.
_gtk_reserved1
void (* _gtk_reserved1) (
void
  )
  No description available.
_gtk_reserved2
void (* _gtk_reserved2) (
void
  )
  No description available.
_gtk_reserved3
void (* _gtk_reserved3) (
void
  )
  No description available.
_gtk_reserved4
void (* _gtk_reserved4) (
void
  )
  No description available.

Virtual methods

Gtk.ActionClass.activate

Emits the “activate” signal on the specified action, if it isn’t insensitive. This gets called by the proxy widgets when they get activated.

Available since: 2.4

Deprecated since: 3.10

Gtk.ActionClass.connect_proxy
No description available.
Gtk.ActionClass.create_menu

If action provides a GtkMenu widget as a submenu for the menu item or the toolbar item it creates, this function returns an instance of that menu.

Available since: 2.12

Deprecated since: 3.10

Gtk.ActionClass.create_menu_item

Creates a menu item widget that proxies for the given action.

Available since: 2.4

Deprecated since: 3.10

Gtk.ActionClass.create_tool_item

Creates a toolbar item widget that proxies for the given action.

Available since: 2.4

Deprecated since: 3.10

Gtk.ActionClass.disconnect_proxy
No description available.