Class

GtkActionGroup

Description [src]

class Gtk.ActionGroup : GObject.Object
  implements Gtk.Buildable {
  /* No available fields */
}

Actions are organised into groups. An action group is essentially a map from names to GtkAction objects.

All actions that would make sense to use in a particular context should be in a single group. Multiple action groups may be used for a particular user interface. In fact, it is expected that most nontrivial applications will make use of multiple groups. For example, in an application that can edit multiple documents, one group holding global actions (e.g. quit, about, new), and one group per document holding actions that act on that document (eg. save, cut/copy/paste, etc). Each window’s menus would be constructed from a combination of two action groups.

Accelerators ## {Action-Accel}

Accelerators are handled by the GTK+ accelerator map. All actions are assigned an accelerator path (which normally has the form <Actions>/group-name/action-name) and a shortcut is associated with this accelerator path. All menuitems and toolitems take on this accelerator path. The GTK+ accelerator map code makes sure that the correct shortcut is displayed next to the menu item.

GtkActionGroup as GtkBuildable # {GtkActionGroup-BUILDER-UI}

The GtkActionGroup implementation of the GtkBuildable interface accepts GtkAction objects as <child> elements in UI definitions.

Note that it is probably more common to define actions and action groups in the code, since they are directly related to what the code can do.

The GtkActionGroup implementation of the GtkBuildable interface supports a custom <accelerator> element, which has attributes named “key“ and “modifiers“ and allows to specify accelerators. This is similar to the <accelerator> element of GtkWidget, the main difference is that it doesn’t allow you to specify a signal.

A GtkDialog UI definition fragment.

<object class="GtkActionGroup" id="actiongroup">
  <child>
      <object class="GtkAction" id="About">
          <property name="name">About</property>
          <property name="stock_id">gtk-about</property>
          <signal handler="about_activate" name="activate"/>
      </object>
      <accelerator key="F1" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK"/>
  </child>
</object>

Hierarchy

hierarchy this GtkActionGroup implements_0 GtkBuildable this--implements_0 ancestor_0 GObject ancestor_0--this

Ancestors

Implements

Constructors

gtk_action_group_new

Creates a new GtkActionGroup object. The name of the action group is used when associating [keybindings][Action-Accel] with the actions.

deprecated: 3.10 since: 2.4

Instance methods

gtk_action_group_add_action

Adds an action object to the action group. Note that this function does not set up the accel path of the action, which can lead to problems if a user tries to modify the accelerator of a menuitem associated with the action. Therefore you must either set the accel path yourself with gtk_action_set_accel_path(), or use gtk_action_group_add_action_with_accel (..., NULL).

deprecated: 3.10 since: 2.4

gtk_action_group_add_action_with_accel

Adds an action object to the action group and sets up the accelerator.

deprecated: 3.10 since: 2.4

gtk_action_group_add_actions

This is a convenience function to create a number of actions and add them to the action group.

deprecated: 3.10 since: 2.4

gtk_action_group_add_actions_full

This variant of gtk_action_group_add_actions() adds a GDestroyNotify callback for user_data.

deprecated: 3.10 since: 2.4

gtk_action_group_add_radio_actions

This is a convenience routine to create a group of radio actions and add them to the action group.

deprecated: 3.10 since: 2.4

gtk_action_group_add_radio_actions_full

This variant of gtk_action_group_add_radio_actions() adds a GDestroyNotify callback for user_data.

deprecated: 3.10 since: 2.4

gtk_action_group_add_toggle_actions

This is a convenience function to create a number of toggle actions and add them to the action group.

deprecated: 3.10 since: 2.4

gtk_action_group_add_toggle_actions_full

This variant of gtk_action_group_add_toggle_actions() adds a GDestroyNotify callback for user_data.

deprecated: 3.10 since: 2.4

gtk_action_group_get_accel_group

Gets the accelerator group.

deprecated: 3.10 since: 3.6

gtk_action_group_get_action

Looks up an action in the action group by name.

deprecated: 3.10 since: 2.4

gtk_action_group_get_name

Gets the name of the action group.

deprecated: 3.10 since: 2.4

gtk_action_group_get_sensitive

Returns TRUE if the group is sensitive. The constituent actions can only be logically sensitive (see gtk_action_is_sensitive()) if they are sensitive (see gtk_action_get_sensitive()) and their group is sensitive.

deprecated: 3.10 since: 2.4

gtk_action_group_get_visible

Returns TRUE if the group is visible. The constituent actions can only be logically visible (see gtk_action_is_visible()) if they are visible (see gtk_action_get_visible()) and their group is visible.

deprecated: 3.10 since: 2.4

gtk_action_group_list_actions

Lists the actions in the action group.

deprecated: 3.10 since: 2.4

gtk_action_group_remove_action

Removes an action object from the action group.

deprecated: 3.10 since: 2.4

gtk_action_group_set_accel_group

Sets the accelerator group to be used by every action in this group.

deprecated: 3.10 since: 3.6

gtk_action_group_set_sensitive

Changes the sensitivity of action_group.

deprecated: 3.10 since: 2.4

gtk_action_group_set_translate_func

Sets a function to be used for translating the label and tooltip of GtkActionEntrys added by gtk_action_group_add_actions().

deprecated: 3.10 since: 2.4

gtk_action_group_set_translation_domain

Sets the translation domain and uses g_dgettext() for translating the label and tooltip of GtkActionEntrys added by gtk_action_group_add_actions().

deprecated: 3.10 since: 2.4

gtk_action_group_set_visible

Changes the visible of action_group.

deprecated: 3.10 since: 2.4

gtk_action_group_translate_string

Translates a string using the function set with gtk_action_group_set_translate_func(). This is mainly intended for language bindings.

deprecated: 3.10 since: 2.6

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

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.

since: 2.12

gtk_buildable_construct_child

Constructs a child of buildable with the name name.

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.

since: 2.12

gtk_buildable_custom_tag_end

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

since: 2.12

gtk_buildable_custom_tag_start

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

since: 2.12

gtk_buildable_get_internal_child

Get the internal child called childname of the buildable object.

since: 2.12

gtk_buildable_get_name

Gets the name of the buildable object.

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.

since: 2.12

gtk_buildable_set_buildable_property

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

since: 2.12

gtk_buildable_set_name

Sets the name of the buildable object.

since: 2.12

Properties

Gtk.ActionGroup:accel-group

The accelerator group the actions of this group should use.

deprecated: 3.10 

Gtk.ActionGroup:name

A name for the action.

deprecated: 3.10 

Gtk.ActionGroup:sensitive

Whether the action group is enabled.

deprecated: 3.10 

Gtk.ActionGroup:visible

Whether the action group is visible.

deprecated: 3.10 

Signals

Gtk.ActionGroup::connect-proxy

The ::connect-proxy signal is emitted after connecting a proxy to an action in the group. Note that the proxy may have been connected to a different action before.

deprecated: 3.10 since: 2.4

Gtk.ActionGroup::disconnect-proxy

The ::disconnect-proxy signal is emitted after disconnecting a proxy from an action in the group.

deprecated: 3.10 since: 2.4

Gtk.ActionGroup::post-activate

The ::post-activate signal is emitted just after the action in the action_group is activated.

deprecated: 3.10 since: 2.4

Gtk.ActionGroup::pre-activate

The ::pre-activate signal is emitted just before the action in the action_group is activated.

deprecated: 3.10 since: 2.4

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GtkActionGroupClass {
  GObjectClass parent_class;
  GtkAction* (* get_action) (
    GtkActionGroup* action_group,
    const gchar* action_name
  );
  void (* _gtk_reserved1) (
void
  );
  void (* _gtk_reserved2) (
void
  );
  void (* _gtk_reserved3) (
void
  );
  void (* _gtk_reserved4) (
void
  );
  
}

No description available.

Class members
parent_class: GObjectClass

The parent class.

get_action: GtkAction* (* get_action) ( GtkActionGroup* action_group, const gchar* action_name )

Looks up an action in the action group by name.

_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.ActionGroupClass.get_action

Looks up an action in the action group by name.

deprecated: 3.10 since: 2.4