1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
<?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'">
]>
<refentry id="libdbusmenu-gtk-menuitem">
<refmeta>
<refentrytitle role="top_of_page" id="libdbusmenu-gtk-menuitem.top_of_page">menuitem</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>
LIBDBUSMENU-GTK Library
</refmiscinfo>
</refmeta>
<refnamediv>
<refname>menuitem</refname>
<refpurpose>Helpers for <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> properties that require a GTK dependency</refpurpose>
</refnamediv>
<refsect1 id="libdbusmenu-gtk-menuitem.stability-level">
<title>Stability Level</title>
Unstable, unless otherwise indicated
</refsect1>
<refsynopsisdiv id="libdbusmenu-gtk-menuitem.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>
<synopsis>
#include <libdbusmenu-gtk/menuitem.h>
<link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> <link linkend="dbusmenu-menuitem-property-set-image">dbusmenu_menuitem_property_set_image</link>
(<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>,
<parameter>const <link linkend="gchar"><type>gchar</type></link> *property</parameter>,
<parameter>const <link linkend="GdkPixbuf"><type>GdkPixbuf</type></link> *data</parameter>);
<link linkend="GdkPixbuf"><returnvalue>GdkPixbuf</returnvalue></link> * <link linkend="dbusmenu-menuitem-property-get-image">dbusmenu_menuitem_property_get_image</link>
(<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>,
<parameter>const <link linkend="gchar"><type>gchar</type></link> *property</parameter>);
<link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> <link linkend="dbusmenu-menuitem-property-set-shortcut">dbusmenu_menuitem_property_set_shortcut</link>
(<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>,
<parameter><link linkend="guint"><type>guint</type></link> key</parameter>,
<parameter><link linkend="GdkModifierType"><type>GdkModifierType</type></link> modifier</parameter>);
<link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> <link linkend="dbusmenu-menuitem-property-set-shortcut-string">dbusmenu_menuitem_property_set_shortcut_string</link>
(<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>,
<parameter>const <link linkend="gchar"><type>gchar</type></link> *shortcut</parameter>);
<link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> <link linkend="dbusmenu-menuitem-property-set-shortcut-menuitem">dbusmenu_menuitem_property_set_shortcut_menuitem</link>
(<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>,
<parameter>const <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> *gmi</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link> <link linkend="dbusmenu-menuitem-property-get-shortcut">dbusmenu_menuitem_property_get_shortcut</link>
(<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>,
<parameter><link linkend="guint"><type>guint</type></link> *key</parameter>,
<parameter><link linkend="GdkModifierType"><type>GdkModifierType</type></link> *modifier</parameter>);
</synopsis>
</refsynopsisdiv>
<refsect1 id="libdbusmenu-gtk-menuitem.description" role="desc">
<title role="desc.title">Description</title>
<para>
Some property helpers can't be done without picking up a GTK+
dependency. So those sit in libdbusmenu-gtk but have very similar
prototypes to the code in libdbusmenu-glib so your code will
look consistent, just with the extra depedency.
</para>
</refsect1>
<refsect1 id="libdbusmenu-gtk-menuitem.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="dbusmenu-menuitem-property-set-image" role="function">
<title>dbusmenu_menuitem_property_set_image ()</title>
<indexterm zone="dbusmenu-menuitem-property-set-image"><primary>dbusmenu_menuitem_property_set_image</primary></indexterm>
<programlisting><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> dbusmenu_menuitem_property_set_image
(<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>,
<parameter>const <link linkend="gchar"><type>gchar</type></link> *property</parameter>,
<parameter>const <link linkend="GdkPixbuf"><type>GdkPixbuf</type></link> *data</parameter>);</programlisting>
<para>
This function takes the pixbuf that is stored in <parameter>data</parameter> and
turns it into a base64 encoded PNG so that it can be placed
onto a standard <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> property.
</para><variablelist role="params">
<varlistentry><term><parameter>menuitem</parameter> :</term>
<listitem><simpara>The <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> to set the property on.</simpara></listitem></varlistentry>
<varlistentry><term><parameter>property</parameter> :</term>
<listitem><simpara>Name of the property to set.</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter> :</term>
<listitem><simpara>The image to place on the property.</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>Whether the function was able to set the property
or not.</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="dbusmenu-menuitem-property-get-image" role="function">
<title>dbusmenu_menuitem_property_get_image ()</title>
<indexterm zone="dbusmenu-menuitem-property-get-image"><primary>dbusmenu_menuitem_property_get_image</primary></indexterm>
<programlisting><link linkend="GdkPixbuf"><returnvalue>GdkPixbuf</returnvalue></link> * dbusmenu_menuitem_property_get_image
(<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>,
<parameter>const <link linkend="gchar"><type>gchar</type></link> *property</parameter>);</programlisting>
<para>
This function looks on the menu item for a property by the
name of <parameter>property</parameter>. If one exists it tries to turn it into
a <link linkend="GdkPixbuf"><type>GdkPixbuf</type></link>. It assumes that the property is a base64 encoded
PNG file like the one created by <link linkend="dbusmenu-menuite-property-set-image"><type>dbusmenu_menuite_property_set_image</type></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>menuitem</parameter> :</term>
<listitem><simpara>The <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> to look for the property on</simpara></listitem></varlistentry>
<varlistentry><term><parameter>property</parameter> :</term>
<listitem><simpara>The name of the property to look for.</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>A pixbuf or <link linkend="NULL:CAPS"><type>NULL</type></link> to signal error. <emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="dbusmenu-menuitem-property-set-shortcut" role="function">
<title>dbusmenu_menuitem_property_set_shortcut ()</title>
<indexterm zone="dbusmenu-menuitem-property-set-shortcut"><primary>dbusmenu_menuitem_property_set_shortcut</primary></indexterm>
<programlisting><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> dbusmenu_menuitem_property_set_shortcut
(<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>,
<parameter><link linkend="guint"><type>guint</type></link> key</parameter>,
<parameter><link linkend="GdkModifierType"><type>GdkModifierType</type></link> modifier</parameter>);</programlisting>
<para>
Takes the modifer described by <parameter>key</parameter> and <parameter>modifier</parameter> and places that into
the format sending across Dbus for shortcuts.
</para><variablelist role="params">
<varlistentry><term><parameter>menuitem</parameter> :</term>
<listitem><simpara>The <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> to set the shortcut on</simpara></listitem></varlistentry>
<varlistentry><term><parameter>key</parameter> :</term>
<listitem><simpara>The keycode of the key to send</simpara></listitem></varlistentry>
<varlistentry><term><parameter>modifier</parameter> :</term>
<listitem><simpara>A bitmask of modifiers used to activate the item</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>Whether it was successful at setting the property.</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="dbusmenu-menuitem-property-set-shortcut-string" role="function">
<title>dbusmenu_menuitem_property_set_shortcut_string ()</title>
<indexterm zone="dbusmenu-menuitem-property-set-shortcut-string"><primary>dbusmenu_menuitem_property_set_shortcut_string</primary></indexterm>
<programlisting><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> dbusmenu_menuitem_property_set_shortcut_string
(<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>,
<parameter>const <link linkend="gchar"><type>gchar</type></link> *shortcut</parameter>);</programlisting>
<para>
This function takes a GTK shortcut string as defined in
<link linkend="gtk-accelerator-parse"><type>gtk_accelerator_parse</type></link> and turns that into the information
required to send it over DBusmenu.
</para><variablelist role="params">
<varlistentry><term><parameter>menuitem</parameter> :</term>
<listitem><simpara>The <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> to set the shortcut on</simpara></listitem></varlistentry>
<varlistentry><term><parameter>shortcut</parameter> :</term>
<listitem><simpara>String describing the shortcut</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>Whether it was successful at setting the property.</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="dbusmenu-menuitem-property-set-shortcut-menuitem" role="function">
<title>dbusmenu_menuitem_property_set_shortcut_menuitem ()</title>
<indexterm zone="dbusmenu-menuitem-property-set-shortcut-menuitem"><primary>dbusmenu_menuitem_property_set_shortcut_menuitem</primary></indexterm>
<programlisting><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> dbusmenu_menuitem_property_set_shortcut_menuitem
(<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>,
<parameter>const <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> *gmi</parameter>);</programlisting>
<para>
Takes the shortcut that is installed on a menu item and calls
<link linkend="dbusmenu-menuitem-property-set-shortcut"><type>dbusmenu_menuitem_property_set_shortcut</type></link> with it. It also sets
up listeners to watch it change.
</para><variablelist role="params">
<varlistentry><term><parameter>menuitem</parameter> :</term>
<listitem><simpara>The <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> to set the shortcut on</simpara></listitem></varlistentry>
<varlistentry><term><parameter>gmi</parameter> :</term>
<listitem><simpara>A menu item to steal the shortcut off of</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>Whether it was successful at setting the property.</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="dbusmenu-menuitem-property-get-shortcut" role="function">
<title>dbusmenu_menuitem_property_get_shortcut ()</title>
<indexterm zone="dbusmenu-menuitem-property-get-shortcut"><primary>dbusmenu_menuitem_property_get_shortcut</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link> dbusmenu_menuitem_property_get_shortcut
(<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>,
<parameter><link linkend="guint"><type>guint</type></link> *key</parameter>,
<parameter><link linkend="GdkModifierType"><type>GdkModifierType</type></link> *modifier</parameter>);</programlisting>
<para>
This function gets a GTK shortcut as a key and a mask
for use to set the accelerators.
</para><variablelist role="params">
<varlistentry><term><parameter>menuitem</parameter> :</term>
<listitem><simpara>The <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> to get the shortcut off</simpara></listitem></varlistentry>
<varlistentry><term><parameter>key</parameter> :</term>
<listitem><simpara>Location to put the key value. <emphasis role="annotation">[<acronym>out</acronym>]</emphasis></simpara></listitem></varlistentry>
<varlistentry><term><parameter>modifier</parameter> :</term>
<listitem><simpara>Location to put the modifier mask. <emphasis role="annotation">[<acronym>out</acronym>]</emphasis></simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>
</refentry>
|