1/*
2 * Copyright © 2011 Canonical Ltd.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
16 *
17 * Author: Ryan Lortie <desrt@desrt.ca>
18 */
19
20#ifndef __G_MENU_H__
21#define __G_MENU_H__
22
23#include <gio/gmenumodel.h>
24
25G_BEGIN_DECLS
26
27#define G_TYPE_MENU (g_menu_get_type ())
28#define G_MENU(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
29 G_TYPE_MENU, GMenu))
30#define G_IS_MENU(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
31 G_TYPE_MENU))
32
33#define G_TYPE_MENU_ITEM (g_menu_item_get_type ())
34#define G_MENU_ITEM(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
35 G_TYPE_MENU_ITEM, GMenuItem))
36#define G_IS_MENU_ITEM(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
37 G_TYPE_MENU_ITEM))
38
39typedef struct _GMenuItem GMenuItem;
40typedef struct _GMenu GMenu;
41
42GLIB_AVAILABLE_IN_2_32
43GType g_menu_get_type (void) G_GNUC_CONST;
44GLIB_AVAILABLE_IN_2_32
45GMenu * g_menu_new (void);
46
47GLIB_AVAILABLE_IN_2_32
48void g_menu_freeze (GMenu *menu);
49
50GLIB_AVAILABLE_IN_2_32
51void g_menu_insert_item (GMenu *menu,
52 gint position,
53 GMenuItem *item);
54GLIB_AVAILABLE_IN_2_32
55void g_menu_prepend_item (GMenu *menu,
56 GMenuItem *item);
57GLIB_AVAILABLE_IN_2_32
58void g_menu_append_item (GMenu *menu,
59 GMenuItem *item);
60GLIB_AVAILABLE_IN_2_32
61void g_menu_remove (GMenu *menu,
62 gint position);
63
64GLIB_AVAILABLE_IN_2_38
65void g_menu_remove_all (GMenu *menu);
66
67GLIB_AVAILABLE_IN_2_32
68void g_menu_insert (GMenu *menu,
69 gint position,
70 const gchar *label,
71 const gchar *detailed_action);
72GLIB_AVAILABLE_IN_2_32
73void g_menu_prepend (GMenu *menu,
74 const gchar *label,
75 const gchar *detailed_action);
76GLIB_AVAILABLE_IN_2_32
77void g_menu_append (GMenu *menu,
78 const gchar *label,
79 const gchar *detailed_action);
80
81GLIB_AVAILABLE_IN_2_32
82void g_menu_insert_section (GMenu *menu,
83 gint position,
84 const gchar *label,
85 GMenuModel *section);
86GLIB_AVAILABLE_IN_2_32
87void g_menu_prepend_section (GMenu *menu,
88 const gchar *label,
89 GMenuModel *section);
90GLIB_AVAILABLE_IN_2_32
91void g_menu_append_section (GMenu *menu,
92 const gchar *label,
93 GMenuModel *section);
94
95GLIB_AVAILABLE_IN_2_32
96void g_menu_insert_submenu (GMenu *menu,
97 gint position,
98 const gchar *label,
99 GMenuModel *submenu);
100GLIB_AVAILABLE_IN_2_32
101void g_menu_prepend_submenu (GMenu *menu,
102 const gchar *label,
103 GMenuModel *submenu);
104GLIB_AVAILABLE_IN_2_32
105void g_menu_append_submenu (GMenu *menu,
106 const gchar *label,
107 GMenuModel *submenu);
108
109
110GLIB_AVAILABLE_IN_2_32
111GType g_menu_item_get_type (void) G_GNUC_CONST;
112GLIB_AVAILABLE_IN_2_32
113GMenuItem * g_menu_item_new (const gchar *label,
114 const gchar *detailed_action);
115
116GLIB_AVAILABLE_IN_2_34
117GMenuItem * g_menu_item_new_from_model (GMenuModel *model,
118 gint item_index);
119
120GLIB_AVAILABLE_IN_2_32
121GMenuItem * g_menu_item_new_submenu (const gchar *label,
122 GMenuModel *submenu);
123
124GLIB_AVAILABLE_IN_2_32
125GMenuItem * g_menu_item_new_section (const gchar *label,
126 GMenuModel *section);
127
128GLIB_AVAILABLE_IN_2_34
129GVariant * g_menu_item_get_attribute_value (GMenuItem *menu_item,
130 const gchar *attribute,
131 const GVariantType *expected_type);
132GLIB_AVAILABLE_IN_2_34
133gboolean g_menu_item_get_attribute (GMenuItem *menu_item,
134 const gchar *attribute,
135 const gchar *format_string,
136 ...);
137GLIB_AVAILABLE_IN_2_34
138GMenuModel *g_menu_item_get_link (GMenuItem *menu_item,
139 const gchar *link);
140
141GLIB_AVAILABLE_IN_2_32
142void g_menu_item_set_attribute_value (GMenuItem *menu_item,
143 const gchar *attribute,
144 GVariant *value);
145GLIB_AVAILABLE_IN_2_32
146void g_menu_item_set_attribute (GMenuItem *menu_item,
147 const gchar *attribute,
148 const gchar *format_string,
149 ...);
150GLIB_AVAILABLE_IN_2_32
151void g_menu_item_set_link (GMenuItem *menu_item,
152 const gchar *link,
153 GMenuModel *model);
154GLIB_AVAILABLE_IN_2_32
155void g_menu_item_set_label (GMenuItem *menu_item,
156 const gchar *label);
157GLIB_AVAILABLE_IN_2_32
158void g_menu_item_set_submenu (GMenuItem *menu_item,
159 GMenuModel *submenu);
160GLIB_AVAILABLE_IN_2_32
161void g_menu_item_set_section (GMenuItem *menu_item,
162 GMenuModel *section);
163GLIB_AVAILABLE_IN_2_32
164void g_menu_item_set_action_and_target_value (GMenuItem *menu_item,
165 const gchar *action,
166 GVariant *target_value);
167GLIB_AVAILABLE_IN_2_32
168void g_menu_item_set_action_and_target (GMenuItem *menu_item,
169 const gchar *action,
170 const gchar *format_string,
171 ...);
172GLIB_AVAILABLE_IN_2_32
173void g_menu_item_set_detailed_action (GMenuItem *menu_item,
174 const gchar *detailed_action);
175
176GLIB_AVAILABLE_IN_2_38
177void g_menu_item_set_icon (GMenuItem *menu_item,
178 GIcon *icon);
179
180G_END_DECLS
181
182#endif /* __G_MENU_H__ */
183

source code of include/glib-2.0/gio/gmenu.h