<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
<!ENTITY pi "&#960;">
<!ENTITY solidus "&#8260;">
]>
<refentry id="GtkActionable">
<refmeta>
<refentrytitle role="top_of_page" id="GtkActionable.top_of_page">GtkActionable</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkActionable</refname>
<refpurpose>An interface for widgets that can be associated
with actions</refpurpose>
</refnamediv>

<refsect1 id="GtkActionable.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-actionable-get-action-name">gtk_actionable_get_action_name</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-actionable-set-action-name">gtk_actionable_set_action_name</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-actionable-get-action-target-value">gtk_actionable_get_action_target_value</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-actionable-set-action-target-value">gtk_actionable_set_action_target_value</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-actionable-set-action-target">gtk_actionable_set_action_target</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-actionable-set-detailed-action-name">gtk_actionable_set_detailed_action_name</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkActionable.properties" role="properties">
<title role="properties.title">Properties</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="properties_type" colwidth="150px"/>
<colspec colname="properties_name" colwidth="300px"/>
<colspec colname="properties_flags" colwidth="200px"/>
<tbody>
<row><entry role="property_type"><link linkend="gchar"><type>gchar</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkActionable--action-name">action-name</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="GVariant"><type>GVariant</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkActionable--action-target">action-target</link></entry><entry role="property_flags">Read / Write</entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkActionable.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GtkActionable-struct">GtkActionable</link></entry></row>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GtkActionableInterface">GtkActionableInterface</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkActionable.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    <link linkend="GInterface">GInterface</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GtkActionable
</screen>
</refsect1>
<refsect1 id="GtkActionable.prerequisites" role="prerequisites">
<title role="prerequisites.title">Prerequisites</title>
<para>
GtkActionable requires
 <link linkend="GtkWidget">GtkWidget</link>.</para>

</refsect1>
<refsect1 id="GtkActionable.implementations" role="implementations">
<title role="implementations.title">Known Implementations</title>
<para>
GtkActionable is implemented by
 <link linkend="GtkButton">GtkButton</link>,  <link linkend="GtkCheckButton">GtkCheckButton</link>,  <link linkend="GtkLinkButton">GtkLinkButton</link>,  <link linkend="GtkListBoxRow">GtkListBoxRow</link>,  <link linkend="GtkLockButton">GtkLockButton</link>,  <link linkend="GtkRadioButton">GtkRadioButton</link>,  <link linkend="GtkSwitch">GtkSwitch</link> and  <link linkend="GtkToggleButton">GtkToggleButton</link>.</para>

</refsect1>

<refsect1 id="GtkActionable.includes"><title>Includes</title><synopsis>#include &lt;gtk/gtk.h&gt;
</synopsis></refsect1>

<refsect1 id="GtkActionable.description" role="desc">
<title role="desc.title">Description</title>
<para>This interface provides a convenient way of associating widgets with
actions on a <link linkend="GtkApplicationWindow"><type>GtkApplicationWindow</type></link> or <link linkend="GtkApplication"><type>GtkApplication</type></link>.</para>
<para>It primarily consists of two properties: <link linkend="GtkActionable--action-name"><type>“action-name”</type></link>
and <link linkend="GtkActionable--action-target"><type>“action-target”</type></link>. There are also some convenience APIs
for setting these properties.</para>
<para>The action will be looked up in action groups that are found among
the widgets ancestors. Most commonly, these will be the actions with
the “win.” or “app.” prefix that are associated with the <link linkend="GtkApplicationWindow"><type>GtkApplicationWindow</type></link>
or <link linkend="GtkApplication"><type>GtkApplication</type></link>, but other action groups that are added with
<link linkend="gtk-widget-insert-action-group"><function>gtk_widget_insert_action_group()</function></link> will be consulted as well.</para>

</refsect1>
<refsect1 id="GtkActionable.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gtk-actionable-get-action-name" role="function">
<title>gtk_actionable_get_action_name&#160;()</title>
<indexterm zone="gtk-actionable-get-action-name"><primary>gtk_actionable_get_action_name</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
gtk_actionable_get_action_name (<parameter><link linkend="GtkActionable"><type>GtkActionable</type></link> *actionable</parameter>);</programlisting>
<para>Gets the action name for <parameter>actionable</parameter>
.</para>
<para>See <link linkend="gtk-actionable-set-action-name"><function>gtk_actionable_set_action_name()</function></link> for more information.</para>
<refsect3 id="gtk-actionable-get-action-name.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>actionable</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkActionable"><type>GtkActionable</type></link> widget</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-actionable-get-action-name.returns" role="returns">
<title>Returns</title>
<para>the action name, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if none is set. </para>
<para><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="gtk-actionable-set-action-name" role="function">
<title>gtk_actionable_set_action_name&#160;()</title>
<indexterm zone="gtk-actionable-set-action-name"><primary>gtk_actionable_set_action_name</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_actionable_set_action_name (<parameter><link linkend="GtkActionable"><type>GtkActionable</type></link> *actionable</parameter>,
                                <parameter>const <link linkend="gchar"><type>gchar</type></link> *action_name</parameter>);</programlisting>
<para>Specifies the name of the action with which this widget should be
associated.  If <parameter>action_name</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link> then the widget will be
unassociated from any previous action.</para>
<para>Usually this function is used when the widget is located (or will be
located) within the hierarchy of a <link linkend="GtkApplicationWindow"><type>GtkApplicationWindow</type></link>.</para>
<para>Names are of the form “win.save” or “app.quit” for actions on the
containing <link linkend="GtkApplicationWindow"><type>GtkApplicationWindow</type></link> or its associated <link linkend="GtkApplication"><type>GtkApplication</type></link>,
respectively.  This is the same form used for actions in the <link linkend="GMenu"><type>GMenu</type></link>
associated with the window.</para>
<refsect3 id="gtk-actionable-set-action-name.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>actionable</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkActionable"><type>GtkActionable</type></link> widget</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>action_name</para></entry>
<entry role="parameter_description"><para>an action name, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-actionable-get-action-target-value" role="function">
<title>gtk_actionable_get_action_target_value&#160;()</title>
<indexterm zone="gtk-actionable-get-action-target-value"><primary>gtk_actionable_get_action_target_value</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
gtk_actionable_get_action_target_value
                               (<parameter><link linkend="GtkActionable"><type>GtkActionable</type></link> *actionable</parameter>);</programlisting>
<para>Gets the current target value of <parameter>actionable</parameter>
.</para>
<para>See <link linkend="gtk-actionable-set-action-target-value"><function>gtk_actionable_set_action_target_value()</function></link> for more information.</para>
<refsect3 id="gtk-actionable-get-action-target-value.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>actionable</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkActionable"><type>GtkActionable</type></link> widget</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-actionable-get-action-target-value.returns" role="returns">
<title>Returns</title>
<para>the current target value. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="gtk-actionable-set-action-target-value" role="function">
<title>gtk_actionable_set_action_target_value&#160;()</title>
<indexterm zone="gtk-actionable-set-action-target-value"><primary>gtk_actionable_set_action_target_value</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_actionable_set_action_target_value
                               (<parameter><link linkend="GtkActionable"><type>GtkActionable</type></link> *actionable</parameter>,
                                <parameter><link linkend="GVariant"><type>GVariant</type></link> *target_value</parameter>);</programlisting>
<para>Sets the target value of an actionable widget.</para>
<para>If <parameter>target_value</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link> then the target value is unset.</para>
<para>The target value has two purposes.  First, it is used as the
parameter to activation of the action associated with the
<link linkend="GtkActionable"><type>GtkActionable</type></link> widget. Second, it is used to determine if the widget
should be rendered as “active” — the widget is active if the state
is equal to the given target.</para>
<para>Consider the example of associating a set of buttons with a <link linkend="GAction"><type>GAction</type></link>
with string state in a typical “radio button” situation.  Each button
will be associated with the same action, but with a different target
value for that action.  Clicking on a particular button will activate
the action with the target of that button, which will typically cause
the action’s state to change to that value. Since the action’s state
is now equal to the target value of the button, the button will now
be rendered as active (and the other buttons, with different targets,
rendered inactive).</para>
<refsect3 id="gtk-actionable-set-action-target-value.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>actionable</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkActionable"><type>GtkActionable</type></link> widget</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>target_value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> to set as the target value, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-actionable-set-action-target" role="function">
<title>gtk_actionable_set_action_target&#160;()</title>
<indexterm zone="gtk-actionable-set-action-target"><primary>gtk_actionable_set_action_target</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_actionable_set_action_target (<parameter><link linkend="GtkActionable"><type>GtkActionable</type></link> *actionable</parameter>,
                                  <parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
                                  <parameter>...</parameter>);</programlisting>
<para>Sets the target of an actionable widget.</para>
<para>This is a convenience function that calls <link linkend="g-variant-new"><function>g_variant_new()</function></link> for
<parameter>format_string</parameter>
 and uses the result to call
<link linkend="gtk-actionable-set-action-target-value"><function>gtk_actionable_set_action_target_value()</function></link>.</para>
<para>If you are setting a string-valued target and want to set the action
name at the same time, you can use
<link linkend="gtk-actionable-set-detailed-action-name"><function>gtk_actionable_set_detailed_action_name()</function></link>.</para>
<refsect3 id="gtk-actionable-set-action-target.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>actionable</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkActionable"><type>GtkActionable</type></link> widget</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a GVariant format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>arguments appropriate for <parameter>format_string</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-actionable-set-detailed-action-name" role="function">
<title>gtk_actionable_set_detailed_action_name&#160;()</title>
<indexterm zone="gtk-actionable-set-detailed-action-name"><primary>gtk_actionable_set_detailed_action_name</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_actionable_set_detailed_action_name
                               (<parameter><link linkend="GtkActionable"><type>GtkActionable</type></link> *actionable</parameter>,
                                <parameter>const <link linkend="gchar"><type>gchar</type></link> *detailed_action_name</parameter>);</programlisting>
<para>Sets the action-name and associated string target value of an
actionable widget.</para>
<para><parameter>detailed_action_name</parameter>
 is a string in the format accepted by
<link linkend="g-action-parse-detailed-name"><function>g_action_parse_detailed_name()</function></link>.</para>
<para>(Note that prior to version 3.22.25,
this function is only usable for actions with a simple "s" target, and
<parameter>detailed_action_name</parameter>
 must be of the form <literal>"action::target"</literal> where
<literal>action</literal> is the action name and <literal>target</literal> is the string to use
as the target.)</para>
<refsect3 id="gtk-actionable-set-detailed-action-name.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>actionable</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkActionable"><type>GtkActionable</type></link> widget</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>detailed_action_name</para></entry>
<entry role="parameter_description"><para>the detailed action name</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>

</refsect1>
<refsect1 id="GtkActionable.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GtkActionable-struct" role="struct">
<title>GtkActionable</title>
<indexterm zone="GtkActionable-struct"><primary>GtkActionable</primary></indexterm>
<programlisting language="C">typedef struct _GtkActionable GtkActionable;</programlisting>
<para>An opaque pointer type.</para>
</refsect2>
<refsect2 id="GtkActionableInterface" role="struct">
<title>struct GtkActionableInterface</title>
<indexterm zone="GtkActionableInterface"><primary>GtkActionableInterface</primary></indexterm>
<programlisting language="C">struct GtkActionableInterface {
  const gchar * (* get_action_name)             (GtkActionable *actionable);
  void          (* set_action_name)             (GtkActionable *actionable,
                                                 const gchar   *action_name);
  GVariant *    (* get_action_target_value)     (GtkActionable *actionable);
  void          (* set_action_target_value)     (GtkActionable *actionable,
                                                 GVariant      *target_value);
};
</programlisting>
<para>The interface vtable for <link linkend="GtkActionable"><type>GtkActionable</type></link>.</para>
<refsect3 id="GtkActionableInterface.members" role="struct_members">
<title>Members</title>
<informaltable role="struct_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="struct_members_name" colwidth="300px"/>
<colspec colname="struct_members_description"/>
<colspec colname="struct_members_annotations" colwidth="200px"/>
<tbody>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkActionableInterface.get-action-name">get_action_name</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>virtual function for <link linkend="gtk-actionable-get-action-name"><function>gtk_actionable_get_action_name()</function></link></para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkActionableInterface.set-action-name">set_action_name</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>virtual function for <link linkend="gtk-actionable-set-action-name"><function>gtk_actionable_set_action_name()</function></link></para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkActionableInterface.get-action-target-value">get_action_target_value</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>virtual function for <link linkend="gtk-actionable-get-action-target-value"><function>gtk_actionable_get_action_target_value()</function></link></para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkActionableInterface.set-action-target-value">set_action_target_value</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>virtual function for <link linkend="gtk-actionable-set-action-target-value"><function>gtk_actionable_set_action_target_value()</function></link></para></entry>
<entry role="struct_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3>
</refsect2>

</refsect1>
<refsect1 id="GtkActionable.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GtkActionable--action-name" role="property"><title>The <literal>“action-name”</literal> property</title>
<indexterm zone="GtkActionable--action-name"><primary>GtkActionable:action-name</primary></indexterm>
<programlisting>  “action-name”              <link linkend="gchar"><type>gchar</type></link>&#160;*</programlisting>
<para>The name of the associated action, like “app.quit”.</para><para>Owner: GtkActionable</para>
<para>Flags: Read / Write</para>
<para>Default value: NULL</para>
</refsect2>
<refsect2 id="GtkActionable--action-target" role="property"><title>The <literal>“action-target”</literal> property</title>
<indexterm zone="GtkActionable--action-target"><primary>GtkActionable:action-target</primary></indexterm>
<programlisting>  “action-target”            <link linkend="GVariant"><type>GVariant</type></link>&#160;*</programlisting>
<para>The parameter for action invocations.</para><para>Owner: GtkActionable</para>
<para>Flags: Read / Write</para>
<para>Allowed values: GVariant&lt;*&gt;</para>
<para>Default value: NULL</para>
</refsect2>

</refsect1>

</refentry>
