2003-08-24 20:47:37 +00:00
|
|
|
<!-- ##### SECTION Title ##### -->
|
|
|
|
GtkActionGroup
|
|
|
|
|
|
|
|
<!-- ##### SECTION Short_Description ##### -->
|
2004-10-11 18:08:35 +00:00
|
|
|
A group of actions
|
2003-08-24 20:47:37 +00:00
|
|
|
|
|
|
|
<!-- ##### SECTION Long_Description ##### -->
|
|
|
|
<para>
|
2003-08-31 00:27:15 +00:00
|
|
|
Actions are organised into groups. An action group is essentially a
|
|
|
|
map from names to #GtkAction objects.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
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
|
2003-09-01 23:20:33 +00:00
|
|
|
(e.g. quit, about, new), and one group per document holding actions that
|
2003-08-31 00:27:15 +00:00
|
|
|
act on that document (eg. save, cut/copy/paste, etc). Each window's menus
|
|
|
|
would be constructed from a combination of two action groups.
|
2003-08-24 20:47:37 +00:00
|
|
|
</para>
|
2003-09-01 23:45:54 +00:00
|
|
|
<para id="Action-Accel">
|
2003-09-04 00:49:37 +00:00
|
|
|
Accelerators are handled by the GTK+ accelerator map. All actions are assigned an
|
|
|
|
accelerator path (which normally has the form
|
|
|
|
<literal><Actions>/<replaceable>group-name</replaceable>/<replaceable>action-name</replaceable></literal>)
|
2003-09-01 23:20:33 +00:00
|
|
|
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.
|
|
|
|
</para>
|
2003-08-24 20:47:37 +00:00
|
|
|
|
2007-07-01 23:38:07 +00:00
|
|
|
<refsect2 id="GtkActionGroup-BUILDER-UI">
|
|
|
|
<title>GtkActionGroup as GtkBuildable</title>
|
|
|
|
<para>
|
|
|
|
The GtkActionGroup implementation of the GtkBuildable interface accepts
|
|
|
|
GtkAction objects as <child> elements in UI definitions.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
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.
|
|
|
|
</para>
|
2007-07-09 13:41:13 +00:00
|
|
|
<para>
|
|
|
|
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.
|
|
|
|
</para>
|
|
|
|
<example>
|
|
|
|
<title>A <structname>GtkDialog</structname> UI definition fragment.</title>
|
|
|
|
<programlisting><![CDATA[
|
|
|
|
<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>
|
|
|
|
]]></programlisting>
|
|
|
|
</example>
|
2007-07-01 23:38:07 +00:00
|
|
|
</refsect2>
|
|
|
|
|
2003-08-24 20:47:37 +00:00
|
|
|
<!-- ##### SECTION See_Also ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2005-06-20 22:06:27 +00:00
|
|
|
<!-- ##### SECTION Stability_Level ##### -->
|
|
|
|
|
|
|
|
|
2010-05-08 05:18:53 +00:00
|
|
|
<!-- ##### SECTION Image ##### -->
|
|
|
|
|
|
|
|
|
2003-08-24 20:47:37 +00:00
|
|
|
<!-- ##### STRUCT GtkActionGroup ##### -->
|
|
|
|
<para>
|
2003-09-01 23:20:33 +00:00
|
|
|
The <structname>GtkActionGroup</structname> struct contains only private
|
|
|
|
members and should not be accessed directly.
|
2003-08-24 20:47:37 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
2004-07-20 02:26:06 +00:00
|
|
|
<!-- ##### SIGNAL GtkActionGroup::connect-proxy ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@actiongroup: the object which received the signal.
|
|
|
|
@arg1:
|
|
|
|
@widget:
|
|
|
|
|
|
|
|
<!-- ##### SIGNAL GtkActionGroup::disconnect-proxy ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@actiongroup: the object which received the signal.
|
|
|
|
@arg1:
|
|
|
|
@widget:
|
|
|
|
|
|
|
|
<!-- ##### SIGNAL GtkActionGroup::post-activate ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@actiongroup: the object which received the signal.
|
|
|
|
@arg1:
|
|
|
|
|
|
|
|
<!-- ##### SIGNAL GtkActionGroup::pre-activate ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@actiongroup: the object which received the signal.
|
|
|
|
@arg1:
|
|
|
|
|
|
|
|
<!-- ##### ARG GtkActionGroup:name ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### ARG GtkActionGroup:sensitive ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### ARG GtkActionGroup:visible ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2003-08-24 20:47:37 +00:00
|
|
|
<!-- ##### FUNCTION gtk_action_group_new ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@name:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_action_group_get_name ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
2004-01-22 06:48:20 +00:00
|
|
|
<!-- ##### FUNCTION gtk_action_group_get_sensitive ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_action_group_set_sensitive ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@sensitive:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_action_group_get_visible ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_action_group_set_visible ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@visible:
|
|
|
|
|
|
|
|
|
2003-08-24 20:47:37 +00:00
|
|
|
<!-- ##### FUNCTION gtk_action_group_get_action ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@action_name:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_action_group_list_actions ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_action_group_add_action ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@action:
|
|
|
|
|
|
|
|
|
2004-01-22 06:48:20 +00:00
|
|
|
<!-- ##### FUNCTION gtk_action_group_add_action_with_accel ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@action:
|
|
|
|
@accelerator:
|
|
|
|
|
|
|
|
|
2003-08-24 20:47:37 +00:00
|
|
|
<!-- ##### FUNCTION gtk_action_group_remove_action ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@action:
|
|
|
|
|
|
|
|
|
2003-09-15 22:21:26 +00:00
|
|
|
<!-- ##### STRUCT GtkActionEntry ##### -->
|
|
|
|
<para>
|
|
|
|
<structname>GtkActionEntry</structname> structs are used with
|
|
|
|
gtk_action_group_add_actions() to construct actions.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@name: The name of the action.
|
2006-03-13 05:11:23 +00:00
|
|
|
@stock_id: The stock id for the action, or the name of an icon from the icon
|
|
|
|
theme.
|
2003-09-15 22:21:26 +00:00
|
|
|
@label: The label for the action. This field should typically be marked for
|
2006-12-31 04:14:28 +00:00
|
|
|
translation, see gtk_action_group_set_translation_domain(). If @label
|
|
|
|
is %NULL, the label of the stock item with id @stock_id is used.
|
2003-09-15 22:21:26 +00:00
|
|
|
@accelerator: The accelerator for the action, in the format understood by
|
|
|
|
gtk_accelerator_parse().
|
|
|
|
@tooltip: The tooltip for the action. This field should typically be marked
|
|
|
|
for translation, see gtk_action_group_set_translation_domain().
|
|
|
|
@callback: The function to call when the action is activated.
|
|
|
|
|
2003-08-24 20:47:37 +00:00
|
|
|
<!-- ##### FUNCTION gtk_action_group_add_actions ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@entries:
|
|
|
|
@n_entries:
|
2003-08-31 00:27:15 +00:00
|
|
|
@user_data:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_action_group_add_actions_full ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@entries:
|
|
|
|
@n_entries:
|
|
|
|
@user_data:
|
|
|
|
@destroy:
|
|
|
|
|
|
|
|
|
2003-09-15 22:21:26 +00:00
|
|
|
<!-- ##### STRUCT GtkToggleActionEntry ##### -->
|
|
|
|
<para>
|
|
|
|
<structname>GtkToggleActionEntry</structname> structs are used with
|
|
|
|
gtk_action_group_add_toggle_actions() to construct toggle actions.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@name: The name of the action.
|
2006-03-13 05:11:23 +00:00
|
|
|
@stock_id: The stock id for the action, or the name of an icon from the icon
|
|
|
|
theme.
|
2003-09-15 22:21:26 +00:00
|
|
|
@label: The label for the action. This field should typically be marked for
|
|
|
|
translation, see gtk_action_group_set_translation_domain().
|
|
|
|
@accelerator: The accelerator for the action, in the format understood by
|
|
|
|
gtk_accelerator_parse().
|
|
|
|
@tooltip: The tooltip for the action. This field should typically be marked
|
|
|
|
for translation, see gtk_action_group_set_translation_domain().
|
|
|
|
@callback: The function to call when the action is activated.
|
|
|
|
@is_active: The initial state of the toggle action.
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_action_group_add_toggle_actions ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@entries:
|
|
|
|
@n_entries:
|
|
|
|
@user_data:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_action_group_add_toggle_actions_full ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@entries:
|
|
|
|
@n_entries:
|
|
|
|
@user_data:
|
|
|
|
@destroy:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### STRUCT GtkRadioActionEntry ##### -->
|
|
|
|
<para>
|
|
|
|
<structname>GtkRadioActionEntry</structname> structs are used with
|
|
|
|
gtk_action_group_add_radio_actions() to construct groups of radio actions.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@name: The name of the action.
|
2006-03-13 05:11:23 +00:00
|
|
|
@stock_id: The stock id for the action, or the name of an icon from the icon
|
|
|
|
theme.
|
2003-09-15 22:21:26 +00:00
|
|
|
@label: The label for the action. This field should typically be marked for
|
|
|
|
translation, see gtk_action_group_set_translation_domain().
|
|
|
|
@accelerator: The accelerator for the action, in the format understood by
|
|
|
|
gtk_accelerator_parse().
|
|
|
|
@tooltip: The tooltip for the action. This field should typically be marked for
|
|
|
|
translation, see gtk_action_group_set_translation_domain().
|
|
|
|
@value: The value to set on the radio action. See gtk_radio_action_get_current_value().
|
|
|
|
|
2003-08-31 00:27:15 +00:00
|
|
|
<!-- ##### FUNCTION gtk_action_group_add_radio_actions ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@entries:
|
|
|
|
@n_entries:
|
2003-09-15 22:21:26 +00:00
|
|
|
@value:
|
2003-08-31 00:27:15 +00:00
|
|
|
@on_change:
|
|
|
|
@user_data:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_action_group_add_radio_actions_full ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@entries:
|
|
|
|
@n_entries:
|
2003-09-15 22:21:26 +00:00
|
|
|
@value:
|
2003-08-31 00:27:15 +00:00
|
|
|
@on_change:
|
|
|
|
@user_data:
|
|
|
|
@destroy:
|
|
|
|
|
|
|
|
|
2010-05-26 02:57:46 +00:00
|
|
|
<!-- ##### USER_FUNCTION GtkTranslateFunc ##### -->
|
|
|
|
<para>
|
|
|
|
The function used to translate messages in e.g. #GtkIconFactory
|
|
|
|
and #GtkActionGroup.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@path: The id of the message. In #GtkItemFactory this will be a path
|
|
|
|
from a #GtkItemFactoryEntry, in #GtkActionGroup, it will be a label
|
|
|
|
or tooltip from a #GtkActionEntry.
|
|
|
|
@func_data: user data passed in when registering the function
|
|
|
|
@Returns: the translated message
|
|
|
|
|
|
|
|
|
2003-08-31 00:27:15 +00:00
|
|
|
<!-- ##### FUNCTION gtk_action_group_set_translate_func ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@func:
|
|
|
|
@data:
|
|
|
|
@notify:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_action_group_set_translation_domain ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@domain:
|
2003-08-24 20:47:37 +00:00
|
|
|
|
|
|
|
|
2004-10-12 15:11:19 +00:00
|
|
|
<!-- ##### FUNCTION gtk_action_group_translate_string ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@action_group:
|
|
|
|
@string:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|