⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.10
Server IP:
157.245.101.34
Server:
Linux skvinfotech-website 5.4.0-131-generic #147-Ubuntu SMP Fri Oct 14 17:07:22 UTC 2022 x86_64
Server Software:
Apache/2.4.41 (Ubuntu)
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
usr
/
share
/
doc
/
libglib2.0-doc
/
gio
/
View File Name :
GMenuModel.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>GMenuModel: GIO Reference Manual</title> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="index.html" title="GIO Reference Manual"> <link rel="up" href="application.html" title="Application support"> <link rel="prev" href="GMemoryMonitor.html" title="GMemoryMonitor"> <link rel="next" href="GMenu.html" title="GMenu"> <meta name="generator" content="GTK-Doc V1.32 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"> <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> <a href="#GMenuModel.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> <a href="#GMenuModel.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_signals"> <span class="dim">|</span> <a href="#GMenuModel.signals" class="shortcut">Signals</a></span> </td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><a accesskey="u" href="application.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="GMemoryMonitor.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="GMenu.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="refentry"> <a name="GMenuModel"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2><span class="refentrytitle"><a name="GMenuModel.top_of_page"></a>GMenuModel</span></h2> <p>GMenuModel — An abstract class representing the contents of a menu</p> </td> <td class="gallery_image" valign="top" align="right"></td> </tr></table></div> <div class="refsect1"> <a name="GMenuModel.functions"></a><h2>Functions</h2> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="functions_proto_type"> <col class="functions_proto_name"> </colgroup> <tbody> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-model-is-mutable" title="g_menu_model_is_mutable ()">g_menu_model_is_mutable</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gint</span> </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-model-get-n-items" title="g_menu_model_get_n_items ()">g_menu_model_get_n_items</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">GVariant</span> * </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-model-get-item-attribute-value" title="g_menu_model_get_item_attribute_value ()">g_menu_model_get_item_attribute_value</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-model-get-item-attribute" title="g_menu_model_get_item_attribute ()">g_menu_model_get_item_attribute</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="returnvalue">GMenuModel</span></a> * </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-model-get-item-link" title="g_menu_model_get_item_link ()">g_menu_model_get_item_link</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="GMenuModel.html#GMenuAttributeIter"><span class="returnvalue">GMenuAttributeIter</span></a> * </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-model-iterate-item-attributes" title="g_menu_model_iterate_item_attributes ()">g_menu_model_iterate_item_attributes</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="GMenuModel.html#GMenuLinkIter"><span class="returnvalue">GMenuLinkIter</span></a> * </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-model-iterate-item-links" title="g_menu_model_iterate_item_links ()">g_menu_model_iterate_item_links</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-model-items-changed" title="g_menu_model_items_changed ()">g_menu_model_items_changed</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-attribute-iter-get-next" title="g_menu_attribute_iter_get_next ()">g_menu_attribute_iter_get_next</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type">const <span class="returnvalue">gchar</span> * </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-attribute-iter-get-name" title="g_menu_attribute_iter_get_name ()">g_menu_attribute_iter_get_name</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">GVariant</span> * </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-attribute-iter-get-value" title="g_menu_attribute_iter_get_value ()">g_menu_attribute_iter_get_value</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-attribute-iter-next" title="g_menu_attribute_iter_next ()">g_menu_attribute_iter_next</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type">const <span class="returnvalue">gchar</span> * </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-link-iter-get-name" title="g_menu_link_iter_get_name ()">g_menu_link_iter_get_name</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-link-iter-get-next" title="g_menu_link_iter_get_next ()">g_menu_link_iter_get_next</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="returnvalue">GMenuModel</span></a> * </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-link-iter-get-value" title="g_menu_link_iter_get_value ()">g_menu_link_iter_get_value</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">gboolean</span> </td> <td class="function_name"> <a class="link" href="GMenuModel.html#g-menu-link-iter-next" title="g_menu_link_iter_next ()">g_menu_link_iter_next</a> <span class="c_punctuation">()</span> </td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="GMenuModel.signals"></a><h2>Signals</h2> <div class="informaltable"><table class="informaltable" border="0"> <colgroup> <col width="150px" class="signal_proto_type"> <col width="300px" class="signal_proto_name"> <col width="200px" class="signal_proto_flags"> </colgroup> <tbody><tr> <td class="signal_type"><span class="returnvalue">void</span></td> <td class="signal_name"><a class="link" href="GMenuModel.html#GMenuModel-items-changed" title="The “items-changed” signal">items-changed</a></td> <td class="signal_flags">Run Last</td> </tr></tbody> </table></div> </div> <a name="GMenuAttributeIter"></a><a name="GMenuLinkIter"></a><div class="refsect1"> <a name="GMenuModel.other"></a><h2>Types and Values</h2> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="other_proto_type"> <col class="other_proto_name"> </colgroup> <tbody> <tr> <td class="datatype_keyword"> </td> <td class="function_name"><a class="link" href="GMenuModel.html#GMenuModel-struct" title="GMenuModel">GMenuModel</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="GMenuModel.html#G-MENU-ATTRIBUTE-ACTION:CAPS" title="G_MENU_ATTRIBUTE_ACTION">G_MENU_ATTRIBUTE_ACTION</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="GMenuModel.html#G-MENU-ATTRIBUTE-ACTION-NAMESPACE:CAPS" title="G_MENU_ATTRIBUTE_ACTION_NAMESPACE">G_MENU_ATTRIBUTE_ACTION_NAMESPACE</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="GMenuModel.html#G-MENU-ATTRIBUTE-TARGET:CAPS" title="G_MENU_ATTRIBUTE_TARGET">G_MENU_ATTRIBUTE_TARGET</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="GMenuModel.html#G-MENU-ATTRIBUTE-LABEL:CAPS" title="G_MENU_ATTRIBUTE_LABEL">G_MENU_ATTRIBUTE_LABEL</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="GMenuModel.html#G-MENU-ATTRIBUTE-ICON:CAPS" title="G_MENU_ATTRIBUTE_ICON">G_MENU_ATTRIBUTE_ICON</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="GMenuModel.html#G-MENU-LINK-SECTION:CAPS" title="G_MENU_LINK_SECTION">G_MENU_LINK_SECTION</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="GMenuModel.html#G-MENU-LINK-SUBMENU:CAPS" title="G_MENU_LINK_SUBMENU">G_MENU_LINK_SUBMENU</a></td> </tr> <tr> <td class="datatype_keyword">struct</td> <td class="function_name"><a class="link" href="GMenuModel.html#GMenuAttributeIter-struct" title="struct GMenuAttributeIter">GMenuAttributeIter</a></td> </tr> <tr> <td class="datatype_keyword">struct</td> <td class="function_name"><a class="link" href="GMenuModel.html#GMenuLinkIter-struct" title="struct GMenuLinkIter">GMenuLinkIter</a></td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="GMenuModel.object-hierarchy"></a><h2>Object Hierarchy</h2> <pre class="screen"> GObject <span class="lineart">├──</span> GMenuAttributeIter <span class="lineart">├──</span> GMenuLinkIter <span class="lineart">╰──</span> GMenuModel <span class="lineart">├──</span> <a class="link" href="GDBusMenuModel.html" title="GDBusMenuModel">GDBusMenuModel</a> <span class="lineart">╰──</span> <a class="link" href="GMenu.html" title="GMenu">GMenu</a> </pre> </div> <div class="refsect1"> <a name="GMenuModel.includes"></a><h2>Includes</h2> <pre class="synopsis">#include <gio/gio.h> </pre> </div> <div class="refsect1"> <a name="GMenuModel.description"></a><h2>Description</h2> <p><a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> represents the contents of a menu -- an ordered list of menu items. The items are associated with actions, which can be activated through them. Items can be grouped in sections, and may have submenus associated with them. Both items and sections usually have some representation data, such as labels or icons. The type of the associated action (ie whether it is stateful, and what kind of state it has) can influence the representation of the item.</p> <p>The conceptual model of menus in <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> is hierarchical: sections and submenus are again represented by <a href="GMenuModel.html#GMenuModel-struct"><span class="type">GMenuModels</span></a>. Menus themselves do not define their own roles. Rather, the role of a particular <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> is defined by the item that references it (or, in the case of the 'root' menu, is defined by the context in which it is used).</p> <p>As an example, consider the visible portions of this menu:</p> <div class="refsect3"> <a name="menu-example"></a><h4>An example menu</h4> <p><span class="inlinemediaobject"><img src="menu-example.png"></span></p> <p>There are 8 "menus" visible in the screenshot: one menubar, two submenus and 5 sections:</p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"><p>the toplevel menubar (containing 4 items)</p></li> <li class="listitem"><p>the View submenu (containing 3 sections)</p></li> <li class="listitem"><p>the first section of the View submenu (containing 2 items)</p></li> <li class="listitem"><p>the second section of the View submenu (containing 1 item)</p></li> <li class="listitem"><p>the final section of the View submenu (containing 1 item)</p></li> <li class="listitem"><p>the Highlight Mode submenu (containing 2 sections)</p></li> <li class="listitem"><p>the Sources section (containing 2 items)</p></li> <li class="listitem"><p>the Markup section (containing 2 items)</p></li> </ul></div> <p>The <a class="link" href="GMenuModel.html#menu-model" title="A menu example">example</a> illustrates the conceptual connection between these 8 menus. Each large block in the figure represents a menu and the smaller blocks within the large block represent items in that menu. Some items contain references to other menus.</p> </div> <div class="refsect3"> <a name="menu-model"></a><h4>A menu example</h4> <p><span class="inlinemediaobject"><img src="menu-model.png"></span></p> <p>Notice that the separators visible in the <a class="link" href="GMenuModel.html#menu-example" title="An example menu">example</a> appear nowhere in the <a class="link" href="GMenuModel.html#menu-model" title="A menu example">menu model</a>. This is because separators are not explicitly represented in the menu model. Instead, a separator is inserted between any two non-empty sections of a menu. Section items can have labels just like any other item. In that case, a display system may show a section header instead of a separator.</p> <p>The motivation for this abstract model of application controls is that modern user interfaces tend to make these controls available outside the application. Examples include global menus, jumplists, dash boards, etc. To support such uses, it is necessary to 'export' information about actions and their representation in menus, which is exactly what the <a class="link" href="gio-GActionGroup-exporter.html" title="GActionGroup exporter">GActionGroup exporter</a> and the <a class="link" href="gio-GMenuModel-exporter.html" title="GMenuModel exporter">GMenuModel exporter</a> do for <a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a> and <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a>. The client-side counterparts to make use of the exported information are <a class="link" href="GDBusActionGroup.html" title="GDBusActionGroup"><span class="type">GDBusActionGroup</span></a> and <a class="link" href="GDBusMenuModel.html" title="GDBusMenuModel"><span class="type">GDBusMenuModel</span></a>.</p> <p>The API of <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> is very generic, with iterators for the attributes and links of an item, see <a class="link" href="GMenuModel.html#g-menu-model-iterate-item-attributes" title="g_menu_model_iterate_item_attributes ()"><code class="function">g_menu_model_iterate_item_attributes()</code></a> and <a class="link" href="GMenuModel.html#g-menu-model-iterate-item-links" title="g_menu_model_iterate_item_links ()"><code class="function">g_menu_model_iterate_item_links()</code></a>. The 'standard' attributes and link types have predefined names: <a class="link" href="GMenuModel.html#G-MENU-ATTRIBUTE-LABEL:CAPS" title="G_MENU_ATTRIBUTE_LABEL"><code class="literal">G_MENU_ATTRIBUTE_LABEL</code></a>, <a class="link" href="GMenuModel.html#G-MENU-ATTRIBUTE-ACTION:CAPS" title="G_MENU_ATTRIBUTE_ACTION"><code class="literal">G_MENU_ATTRIBUTE_ACTION</code></a>, <a class="link" href="GMenuModel.html#G-MENU-ATTRIBUTE-TARGET:CAPS" title="G_MENU_ATTRIBUTE_TARGET"><code class="literal">G_MENU_ATTRIBUTE_TARGET</code></a>, <a class="link" href="GMenuModel.html#G-MENU-LINK-SECTION:CAPS" title="G_MENU_LINK_SECTION"><code class="literal">G_MENU_LINK_SECTION</code></a> and <a class="link" href="GMenuModel.html#G-MENU-LINK-SUBMENU:CAPS" title="G_MENU_LINK_SUBMENU"><code class="literal">G_MENU_LINK_SUBMENU</code></a>.</p> <p>Items in a <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> represent active controls if they refer to an action that can get activated when the user interacts with the menu item. The reference to the action is encoded by the string id in the <a class="link" href="GMenuModel.html#G-MENU-ATTRIBUTE-ACTION:CAPS" title="G_MENU_ATTRIBUTE_ACTION"><code class="literal">G_MENU_ATTRIBUTE_ACTION</code></a> attribute. An action id uniquely identifies an action in an action group. Which action group(s) provide actions depends on the context in which the menu model is used. E.g. when the model is exported as the application menu of a <span class="type">GtkApplication</span>, actions can be application-wide or window-specific (and thus come from two different action groups). By convention, the application-wide actions have names that start with "app.", while the names of window-specific actions start with "win.".</p> <p>While a wide variety of stateful actions is possible, the following is the minimum that is expected to be supported by all users of exported menu information:</p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"><p>an action with no parameter type and no state</p></li> <li class="listitem"><p>an action with no parameter type and boolean state</p></li> <li class="listitem"><p>an action with string parameter type and string state</p></li> </ul></div> </div> <div class="refsect3"> <a name="id-1.4.23.14.10.7"></a><h4>Stateless</h4> <p>A stateless action typically corresponds to an ordinary menu item.</p> <p>Selecting such a menu item will activate the action (with no parameter).</p> </div> <div class="refsect3"> <a name="id-1.4.23.14.10.8"></a><h4>Boolean State</h4> <p>An action with a boolean state will most typically be used with a "toggle" or "switch" menu item. The state can be set directly, but activating the action (with no parameter) results in the state being toggled.</p> <p>Selecting a toggle menu item will activate the action. The menu item should be rendered as "checked" when the state is true.</p> </div> <div class="refsect3"> <a name="id-1.4.23.14.10.9"></a><h4>String Parameter and State</h4> <p>Actions with string parameters and state will most typically be used to represent an enumerated choice over the items available for a group of radio menu items. Activating the action with a string parameter is equivalent to setting that parameter as the state.</p> <p>Radio menu items, in addition to being associated with the action, will have a target value. Selecting that menu item will result in activation of the action with the target value as the parameter. The menu item should be rendered as "selected" when the state of the action is equal to the target value of the menu item.</p> </div> </div> <div class="refsect1"> <a name="GMenuModel.functions_details"></a><h2>Functions</h2> <div class="refsect2"> <a name="g-menu-model-is-mutable"></a><h3>g_menu_model_is_mutable ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_menu_model_is_mutable (<em class="parameter"><code><a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> *model</code></em>);</pre> <p>Queries if <em class="parameter"><code>model</code></em> is mutable.</p> <p>An immutable <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> will never emit the <a class="link" href="GMenuModel.html#GMenuModel-items-changed" title="The “items-changed” signal"><span class="type">“items-changed”</span></a> signal. Consumers of the model may make optimisations accordingly.</p> <div class="refsect3"> <a name="g-menu-model-is-mutable.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>model</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a></p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-model-is-mutable.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> if the model is mutable (ie: "items-changed" may be emitted).</p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-model-get-n-items"></a><h3>g_menu_model_get_n_items ()</h3> <pre class="programlisting"><span class="returnvalue">gint</span> g_menu_model_get_n_items (<em class="parameter"><code><a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> *model</code></em>);</pre> <p>Query the number of items in <em class="parameter"><code>model</code></em> .</p> <div class="refsect3"> <a name="g-menu-model-get-n-items.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>model</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a></p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-model-get-n-items.returns"></a><h4>Returns</h4> <p> the number of items</p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-model-get-item-attribute-value"></a><h3>g_menu_model_get_item_attribute_value ()</h3> <pre class="programlisting"><span class="returnvalue">GVariant</span> * g_menu_model_get_item_attribute_value (<em class="parameter"><code><a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> *model</code></em>, <em class="parameter"><code><span class="type">gint</span> item_index</code></em>, <em class="parameter"><code>const <span class="type">gchar</span> *attribute</code></em>, <em class="parameter"><code>const <span class="type">GVariantType</span> *expected_type</code></em>);</pre> <p>Queries the item at position <em class="parameter"><code>item_index</code></em> in <em class="parameter"><code>model</code></em> for the attribute specified by <em class="parameter"><code>attribute</code></em> .</p> <p>If <em class="parameter"><code>expected_type</code></em> is non-<code class="literal">NULL</code> then it specifies the expected type of the attribute. If it is <code class="literal">NULL</code> then any type will be accepted.</p> <p>If the attribute exists and matches <em class="parameter"><code>expected_type</code></em> (or if the expected type is unspecified) then the value is returned.</p> <p>If the attribute does not exist, or does not match the expected type then <code class="literal">NULL</code> is returned.</p> <div class="refsect3"> <a name="g-menu-model-get-item-attribute-value.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>model</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>item_index</p></td> <td class="parameter_description"><p>the index of the item</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>attribute</p></td> <td class="parameter_description"><p>the attribute to query</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>expected_type</p></td> <td class="parameter_description"><p>the expected type of the attribute, or <code class="literal">NULL</code>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-model-get-item-attribute-value.returns"></a><h4>Returns</h4> <p>the value of the attribute. </p> <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-model-get-item-attribute"></a><h3>g_menu_model_get_item_attribute ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_menu_model_get_item_attribute (<em class="parameter"><code><a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> *model</code></em>, <em class="parameter"><code><span class="type">gint</span> item_index</code></em>, <em class="parameter"><code>const <span class="type">gchar</span> *attribute</code></em>, <em class="parameter"><code>const <span class="type">gchar</span> *format_string</code></em>, <em class="parameter"><code>...</code></em>);</pre> <p>Queries item at position <em class="parameter"><code>item_index</code></em> in <em class="parameter"><code>model</code></em> for the attribute specified by <em class="parameter"><code>attribute</code></em> .</p> <p>If the attribute exists and matches the <span class="type">GVariantType</span> corresponding to <em class="parameter"><code>format_string</code></em> then <em class="parameter"><code>format_string</code></em> is used to deconstruct the value into the positional parameters and <code class="literal">TRUE</code> is returned.</p> <p>If the attribute does not exist, or it does exist but has the wrong type, then the positional parameters are ignored and <code class="literal">FALSE</code> is returned.</p> <p>This function is a mix of <a class="link" href="GMenuModel.html#g-menu-model-get-item-attribute-value" title="g_menu_model_get_item_attribute_value ()"><code class="function">g_menu_model_get_item_attribute_value()</code></a> and <code class="function">g_variant_get()</code>, followed by a <code class="function">g_variant_unref()</code>. As such, <em class="parameter"><code>format_string</code></em> must make a complete copy of the data (since the <span class="type">GVariant</span> may go away after the call to <code class="function">g_variant_unref()</code>). In particular, no '&' characters are allowed in <em class="parameter"><code>format_string</code></em> .</p> <div class="refsect3"> <a name="g-menu-model-get-item-attribute.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>model</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>item_index</p></td> <td class="parameter_description"><p>the index of the item</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>attribute</p></td> <td class="parameter_description"><p>the attribute to query</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>format_string</p></td> <td class="parameter_description"><p>a <span class="type">GVariant</span> format string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>...</p></td> <td class="parameter_description"><p>positional parameters, as per <em class="parameter"><code>format_string</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-model-get-item-attribute.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> if the named attribute was found with the expected type</p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-model-get-item-link"></a><h3>g_menu_model_get_item_link ()</h3> <pre class="programlisting"><a class="link" href="GMenuModel.html" title="GMenuModel"><span class="returnvalue">GMenuModel</span></a> * g_menu_model_get_item_link (<em class="parameter"><code><a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> *model</code></em>, <em class="parameter"><code><span class="type">gint</span> item_index</code></em>, <em class="parameter"><code>const <span class="type">gchar</span> *link</code></em>);</pre> <p>Queries the item at position <em class="parameter"><code>item_index</code></em> in <em class="parameter"><code>model</code></em> for the link specified by <em class="parameter"><code>link</code></em> .</p> <p>If the link exists, the linked <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> is returned. If the link does not exist, <code class="literal">NULL</code> is returned.</p> <div class="refsect3"> <a name="g-menu-model-get-item-link.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>model</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>item_index</p></td> <td class="parameter_description"><p>the index of the item</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>link</p></td> <td class="parameter_description"><p>the link to query</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-model-get-item-link.returns"></a><h4>Returns</h4> <p>the linked <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a>, or <code class="literal">NULL</code>. </p> <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-model-iterate-item-attributes"></a><h3>g_menu_model_iterate_item_attributes ()</h3> <pre class="programlisting"><a class="link" href="GMenuModel.html#GMenuAttributeIter"><span class="returnvalue">GMenuAttributeIter</span></a> * g_menu_model_iterate_item_attributes (<em class="parameter"><code><a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> *model</code></em>, <em class="parameter"><code><span class="type">gint</span> item_index</code></em>);</pre> <p>Creates a <a class="link" href="GMenuModel.html#GMenuAttributeIter"><span class="type">GMenuAttributeIter</span></a> to iterate over the attributes of the item at position <em class="parameter"><code>item_index</code></em> in <em class="parameter"><code>model</code></em> .</p> <p>You must free the iterator with <code class="function">g_object_unref()</code> when you are done.</p> <div class="refsect3"> <a name="g-menu-model-iterate-item-attributes.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>model</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>item_index</p></td> <td class="parameter_description"><p>the index of the item</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-model-iterate-item-attributes.returns"></a><h4>Returns</h4> <p>a new <a class="link" href="GMenuModel.html#GMenuAttributeIter"><span class="type">GMenuAttributeIter</span></a>. </p> <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-model-iterate-item-links"></a><h3>g_menu_model_iterate_item_links ()</h3> <pre class="programlisting"><a class="link" href="GMenuModel.html#GMenuLinkIter"><span class="returnvalue">GMenuLinkIter</span></a> * g_menu_model_iterate_item_links (<em class="parameter"><code><a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> *model</code></em>, <em class="parameter"><code><span class="type">gint</span> item_index</code></em>);</pre> <p>Creates a <a class="link" href="GMenuModel.html#GMenuLinkIter"><span class="type">GMenuLinkIter</span></a> to iterate over the links of the item at position <em class="parameter"><code>item_index</code></em> in <em class="parameter"><code>model</code></em> .</p> <p>You must free the iterator with <code class="function">g_object_unref()</code> when you are done.</p> <div class="refsect3"> <a name="g-menu-model-iterate-item-links.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>model</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>item_index</p></td> <td class="parameter_description"><p>the index of the item</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-model-iterate-item-links.returns"></a><h4>Returns</h4> <p>a new <a class="link" href="GMenuModel.html#GMenuLinkIter"><span class="type">GMenuLinkIter</span></a>. </p> <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-model-items-changed"></a><h3>g_menu_model_items_changed ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> g_menu_model_items_changed (<em class="parameter"><code><a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> *model</code></em>, <em class="parameter"><code><span class="type">gint</span> position</code></em>, <em class="parameter"><code><span class="type">gint</span> removed</code></em>, <em class="parameter"><code><span class="type">gint</span> added</code></em>);</pre> <p>Requests emission of the <a class="link" href="GMenuModel.html#GMenuModel-items-changed" title="The “items-changed” signal"><span class="type">“items-changed”</span></a> signal on <em class="parameter"><code>model</code></em> .</p> <p>This function should never be called except by <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> subclasses. Any other calls to this function will very likely lead to a violation of the interface of the model.</p> <p>The implementation should update its internal representation of the menu before emitting the signal. The implementation should further expect to receive queries about the new state of the menu (and particularly added menu items) while signal handlers are running.</p> <p>The implementation must dispatch this call directly from a mainloop entry and not in response to calls -- particularly those from the <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> API. Said another way: the menu must not change while user code is running without returning to the mainloop.</p> <div class="refsect3"> <a name="g-menu-model-items-changed.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>model</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>position</p></td> <td class="parameter_description"><p>the position of the change</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>removed</p></td> <td class="parameter_description"><p>the number of items removed</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>added</p></td> <td class="parameter_description"><p>the number of items added</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-attribute-iter-get-next"></a><h3>g_menu_attribute_iter_get_next ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_menu_attribute_iter_get_next (<em class="parameter"><code><a class="link" href="GMenuModel.html#GMenuAttributeIter"><span class="type">GMenuAttributeIter</span></a> *iter</code></em>, <em class="parameter"><code>const <span class="type">gchar</span> **out_name</code></em>, <em class="parameter"><code><span class="type">GVariant</span> **value</code></em>);</pre> <p>This function combines <a class="link" href="GMenuModel.html#g-menu-attribute-iter-next" title="g_menu_attribute_iter_next ()"><code class="function">g_menu_attribute_iter_next()</code></a> with <a class="link" href="GMenuModel.html#g-menu-attribute-iter-get-name" title="g_menu_attribute_iter_get_name ()"><code class="function">g_menu_attribute_iter_get_name()</code></a> and <a class="link" href="GMenuModel.html#g-menu-attribute-iter-get-value" title="g_menu_attribute_iter_get_value ()"><code class="function">g_menu_attribute_iter_get_value()</code></a>.</p> <p>First the iterator is advanced to the next (possibly first) attribute. If that fails, then <code class="literal">FALSE</code> is returned and there are no other effects.</p> <p>If successful, <em class="parameter"><code>name</code></em> and <em class="parameter"><code>value</code></em> are set to the name and value of the attribute that has just been advanced to. At this point, <a class="link" href="GMenuModel.html#g-menu-attribute-iter-get-name" title="g_menu_attribute_iter_get_name ()"><code class="function">g_menu_attribute_iter_get_name()</code></a> and <a class="link" href="GMenuModel.html#g-menu-attribute-iter-get-value" title="g_menu_attribute_iter_get_value ()"><code class="function">g_menu_attribute_iter_get_value()</code></a> will return the same values again.</p> <p>The value returned in <em class="parameter"><code>name</code></em> remains valid for as long as the iterator remains at the current position. The value returned in <em class="parameter"><code>value</code></em> must be unreffed using <code class="function">g_variant_unref()</code> when it is no longer in use.</p> <div class="refsect3"> <a name="g-menu-attribute-iter-get-next.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>iter</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html#GMenuAttributeIter"><span class="type">GMenuAttributeIter</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>out_name</p></td> <td class="parameter_description"><p>the type of the attribute. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>value</p></td> <td class="parameter_description"><p>the attribute value. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-attribute-iter-get-next.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, or <code class="literal">FALSE</code> if there is no additional attribute</p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-attribute-iter-get-name"></a><h3>g_menu_attribute_iter_get_name ()</h3> <pre class="programlisting">const <span class="returnvalue">gchar</span> * g_menu_attribute_iter_get_name (<em class="parameter"><code><a class="link" href="GMenuModel.html#GMenuAttributeIter"><span class="type">GMenuAttributeIter</span></a> *iter</code></em>);</pre> <p>Gets the name of the attribute at the current iterator position, as a string.</p> <p>The iterator is not advanced.</p> <div class="refsect3"> <a name="g-menu-attribute-iter-get-name.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>iter</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html#GMenuAttributeIter"><span class="type">GMenuAttributeIter</span></a></p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-attribute-iter-get-name.returns"></a><h4>Returns</h4> <p> the name of the attribute</p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-attribute-iter-get-value"></a><h3>g_menu_attribute_iter_get_value ()</h3> <pre class="programlisting"><span class="returnvalue">GVariant</span> * g_menu_attribute_iter_get_value (<em class="parameter"><code><a class="link" href="GMenuModel.html#GMenuAttributeIter"><span class="type">GMenuAttributeIter</span></a> *iter</code></em>);</pre> <p>Gets the value of the attribute at the current iterator position.</p> <p>The iterator is not advanced.</p> <div class="refsect3"> <a name="g-menu-attribute-iter-get-value.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>iter</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html#GMenuAttributeIter"><span class="type">GMenuAttributeIter</span></a></p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-attribute-iter-get-value.returns"></a><h4>Returns</h4> <p>the value of the current attribute. </p> <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-attribute-iter-next"></a><h3>g_menu_attribute_iter_next ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_menu_attribute_iter_next (<em class="parameter"><code><a class="link" href="GMenuModel.html#GMenuAttributeIter"><span class="type">GMenuAttributeIter</span></a> *iter</code></em>);</pre> <p>Attempts to advance the iterator to the next (possibly first) attribute.</p> <p><code class="literal">TRUE</code> is returned on success, or <code class="literal">FALSE</code> if there are no more attributes.</p> <p>You must call this function when you first acquire the iterator to advance it to the first attribute (and determine if the first attribute exists at all).</p> <div class="refsect3"> <a name="g-menu-attribute-iter-next.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>iter</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html#GMenuAttributeIter"><span class="type">GMenuAttributeIter</span></a></p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-attribute-iter-next.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, or <code class="literal">FALSE</code> when there are no more attributes</p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-link-iter-get-name"></a><h3>g_menu_link_iter_get_name ()</h3> <pre class="programlisting">const <span class="returnvalue">gchar</span> * g_menu_link_iter_get_name (<em class="parameter"><code><a class="link" href="GMenuModel.html#GMenuLinkIter"><span class="type">GMenuLinkIter</span></a> *iter</code></em>);</pre> <p>Gets the name of the link at the current iterator position.</p> <p>The iterator is not advanced.</p> <div class="refsect3"> <a name="g-menu-link-iter-get-name.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>iter</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html#GMenuLinkIter"><span class="type">GMenuLinkIter</span></a></p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-link-iter-get-name.returns"></a><h4>Returns</h4> <p> the type of the link</p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-link-iter-get-next"></a><h3>g_menu_link_iter_get_next ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_menu_link_iter_get_next (<em class="parameter"><code><a class="link" href="GMenuModel.html#GMenuLinkIter"><span class="type">GMenuLinkIter</span></a> *iter</code></em>, <em class="parameter"><code>const <span class="type">gchar</span> **out_link</code></em>, <em class="parameter"><code><a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> **value</code></em>);</pre> <p>This function combines <a class="link" href="GMenuModel.html#g-menu-link-iter-next" title="g_menu_link_iter_next ()"><code class="function">g_menu_link_iter_next()</code></a> with <a class="link" href="GMenuModel.html#g-menu-link-iter-get-name" title="g_menu_link_iter_get_name ()"><code class="function">g_menu_link_iter_get_name()</code></a> and <a class="link" href="GMenuModel.html#g-menu-link-iter-get-value" title="g_menu_link_iter_get_value ()"><code class="function">g_menu_link_iter_get_value()</code></a>.</p> <p>First the iterator is advanced to the next (possibly first) link. If that fails, then <code class="literal">FALSE</code> is returned and there are no other effects.</p> <p>If successful, <em class="parameter"><code>out_link</code></em> and <em class="parameter"><code>value</code></em> are set to the name and <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> of the link that has just been advanced to. At this point, <a class="link" href="GMenuModel.html#g-menu-link-iter-get-name" title="g_menu_link_iter_get_name ()"><code class="function">g_menu_link_iter_get_name()</code></a> and <a class="link" href="GMenuModel.html#g-menu-link-iter-get-value" title="g_menu_link_iter_get_value ()"><code class="function">g_menu_link_iter_get_value()</code></a> will return the same values again.</p> <p>The value returned in <em class="parameter"><code>out_link</code></em> remains valid for as long as the iterator remains at the current position. The value returned in <em class="parameter"><code>value</code></em> must be unreffed using <code class="function">g_object_unref()</code> when it is no longer in use.</p> <div class="refsect3"> <a name="g-menu-link-iter-get-next.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>iter</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html#GMenuLinkIter"><span class="type">GMenuLinkIter</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>out_link</p></td> <td class="parameter_description"><p>the name of the link. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>value</p></td> <td class="parameter_description"><p>the linked <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-link-iter-get-next.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, or <code class="literal">FALSE</code> if there is no additional link</p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-link-iter-get-value"></a><h3>g_menu_link_iter_get_value ()</h3> <pre class="programlisting"><a class="link" href="GMenuModel.html" title="GMenuModel"><span class="returnvalue">GMenuModel</span></a> * g_menu_link_iter_get_value (<em class="parameter"><code><a class="link" href="GMenuModel.html#GMenuLinkIter"><span class="type">GMenuLinkIter</span></a> *iter</code></em>);</pre> <p>Gets the linked <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> at the current iterator position.</p> <p>The iterator is not advanced.</p> <div class="refsect3"> <a name="g-menu-link-iter-get-value.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>iter</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html#GMenuLinkIter"><span class="type">GMenuLinkIter</span></a></p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-link-iter-get-value.returns"></a><h4>Returns</h4> <p>the <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> that is linked to. </p> <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="g-menu-link-iter-next"></a><h3>g_menu_link_iter_next ()</h3> <pre class="programlisting"><span class="returnvalue">gboolean</span> g_menu_link_iter_next (<em class="parameter"><code><a class="link" href="GMenuModel.html#GMenuLinkIter"><span class="type">GMenuLinkIter</span></a> *iter</code></em>);</pre> <p>Attempts to advance the iterator to the next (possibly first) link.</p> <p><code class="literal">TRUE</code> is returned on success, or <code class="literal">FALSE</code> if there are no more links.</p> <p>You must call this function when you first acquire the iterator to advance it to the first link (and determine if the first link exists at all).</p> <div class="refsect3"> <a name="g-menu-link-iter-next.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>iter</p></td> <td class="parameter_description"><p>a <a class="link" href="GMenuModel.html#GMenuLinkIter"><span class="type">GMenuLinkIter</span></a></p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="g-menu-link-iter-next.returns"></a><h4>Returns</h4> <p> <code class="literal">TRUE</code> on success, or <code class="literal">FALSE</code> when there are no more links</p> </div> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> </div> <div class="refsect1"> <a name="GMenuModel.other_details"></a><h2>Types and Values</h2> <div class="refsect2"> <a name="GMenuModel-struct"></a><h3>GMenuModel</h3> <pre class="programlisting">typedef struct _GMenuModel GMenuModel;</pre> <p><a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> is an opaque structure type. You must access it using the functions below.</p> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="G-MENU-ATTRIBUTE-ACTION:CAPS"></a><h3>G_MENU_ATTRIBUTE_ACTION</h3> <pre class="programlisting">#define G_MENU_ATTRIBUTE_ACTION "action" </pre> <p>The menu item attribute which holds the action name of the item. Action names are namespaced with an identifier for the action group in which the action resides. For example, "win." for window-specific actions and "app." for application-wide actions.</p> <p>See also <a class="link" href="GMenuModel.html#g-menu-model-get-item-attribute" title="g_menu_model_get_item_attribute ()"><code class="function">g_menu_model_get_item_attribute()</code></a> and <a class="link" href="GMenu.html#g-menu-item-set-attribute" title="g_menu_item_set_attribute ()"><code class="function">g_menu_item_set_attribute()</code></a>.</p> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="G-MENU-ATTRIBUTE-ACTION-NAMESPACE:CAPS"></a><h3>G_MENU_ATTRIBUTE_ACTION_NAMESPACE</h3> <pre class="programlisting">#define G_MENU_ATTRIBUTE_ACTION_NAMESPACE "action-namespace" </pre> <p>The menu item attribute that holds the namespace for all action names in menus that are linked from this item.</p> <p class="since">Since: <a class="link" href="api-index-2-36.html#api-index-2.36">2.36</a></p> </div> <hr> <div class="refsect2"> <a name="G-MENU-ATTRIBUTE-TARGET:CAPS"></a><h3>G_MENU_ATTRIBUTE_TARGET</h3> <pre class="programlisting">#define G_MENU_ATTRIBUTE_TARGET "target" </pre> <p>The menu item attribute which holds the target with which the item's action will be activated.</p> <p>See also <a class="link" href="GMenu.html#g-menu-item-set-action-and-target" title="g_menu_item_set_action_and_target ()"><code class="function">g_menu_item_set_action_and_target()</code></a></p> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="G-MENU-ATTRIBUTE-LABEL:CAPS"></a><h3>G_MENU_ATTRIBUTE_LABEL</h3> <pre class="programlisting">#define G_MENU_ATTRIBUTE_LABEL "label" </pre> <p>The menu item attribute which holds the label of the item.</p> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="G-MENU-ATTRIBUTE-ICON:CAPS"></a><h3>G_MENU_ATTRIBUTE_ICON</h3> <pre class="programlisting">#define G_MENU_ATTRIBUTE_ICON "icon" </pre> <p>The menu item attribute which holds the icon of the item.</p> <p>The icon is stored in the format returned by <a class="link" href="GIcon.html#g-icon-serialize" title="g_icon_serialize ()"><code class="function">g_icon_serialize()</code></a>.</p> <p>This attribute is intended only to represent 'noun' icons such as favicons for a webpage, or application icons. It should not be used for 'verbs' (ie: stock icons).</p> <p class="since">Since: <a class="link" href="api-index-2-38.html#api-index-2.38">2.38</a></p> </div> <hr> <div class="refsect2"> <a name="G-MENU-LINK-SECTION:CAPS"></a><h3>G_MENU_LINK_SECTION</h3> <pre class="programlisting">#define G_MENU_LINK_SECTION "section" </pre> <p>The name of the link that associates a menu item with a section. The linked menu will usually be shown in place of the menu item, using the item's label as a header.</p> <p>See also <a class="link" href="GMenu.html#g-menu-item-set-link" title="g_menu_item_set_link ()"><code class="function">g_menu_item_set_link()</code></a>.</p> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="G-MENU-LINK-SUBMENU:CAPS"></a><h3>G_MENU_LINK_SUBMENU</h3> <pre class="programlisting">#define G_MENU_LINK_SUBMENU "submenu" </pre> <p>The name of the link that associates a menu item with a submenu.</p> <p>See also <a class="link" href="GMenu.html#g-menu-item-set-link" title="g_menu_item_set_link ()"><code class="function">g_menu_item_set_link()</code></a>.</p> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="GMenuAttributeIter-struct"></a><h3>struct GMenuAttributeIter</h3> <pre class="programlisting">struct GMenuAttributeIter;</pre> <p><a class="link" href="GMenuModel.html#GMenuAttributeIter"><span class="type">GMenuAttributeIter</span></a> is an opaque structure type. You must access it using the functions below.</p> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="GMenuLinkIter-struct"></a><h3>struct GMenuLinkIter</h3> <pre class="programlisting">struct GMenuLinkIter;</pre> <p><a class="link" href="GMenuModel.html#GMenuLinkIter"><span class="type">GMenuLinkIter</span></a> is an opaque structure type. You must access it using the functions below.</p> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> </div> <div class="refsect1"> <a name="GMenuModel.signal-details"></a><h2>Signal Details</h2> <div class="refsect2"> <a name="GMenuModel-items-changed"></a><h3>The <code class="literal">“items-changed”</code> signal</h3> <pre class="programlisting"><span class="returnvalue">void</span> user_function (<a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> *model, <span class="type">gint</span> position, <span class="type">gint</span> removed, <span class="type">gint</span> added, <span class="type">gpointer</span> user_data)</pre> <p>Emitted when a change has occured to the menu.</p> <p>The only changes that can occur to a menu is that items are removed or added. Items may not change (except by being removed and added back in the same location). This signal is capable of describing both of those changes (at the same time).</p> <p>The signal means that starting at the index <em class="parameter"><code>position</code></em> , <em class="parameter"><code>removed</code></em> items were removed and <em class="parameter"><code>added</code></em> items were added in their place. If <em class="parameter"><code>removed</code></em> is zero then only items were added. If <em class="parameter"><code>added</code></em> is zero then only items were removed.</p> <p>As an example, if the menu contains items a, b, c, d (in that order) and the signal (2, 1, 3) occurs then the new composition of the menu will be a, b, _, _, _, d (with each _ representing some new item).</p> <p>Signal handlers may query the model (particularly the added items) and expect to see the results of the modification that is being reported. The signal is emitted after the modification.</p> <div class="refsect3"> <a name="GMenuModel-items-changed.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>model</p></td> <td class="parameter_description"><p>the <a class="link" href="GMenuModel.html" title="GMenuModel"><span class="type">GMenuModel</span></a> that is changing</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>position</p></td> <td class="parameter_description"><p>the position of the change</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>removed</p></td> <td class="parameter_description"><p>the number of items removed</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>added</p></td> <td class="parameter_description"><p>the number of items added</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>user_data</p></td> <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <p>Flags: Run Last</p> </div> </div> <div class="refsect1"> <a name="GMenuModel.see-also"></a><h2>See Also</h2> <p><a class="link" href="GActionGroup.html" title="GActionGroup"><span class="type">GActionGroup</span></a></p> </div> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.32</div> </body> </html>