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 25 G_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 39 typedef struct _GMenuItem GMenuItem; 40 typedef struct _GMenu GMenu; 41 42 GLIB_AVAILABLE_IN_2_32 43 GType g_menu_get_type (void) G_GNUC_CONST; 44 GLIB_AVAILABLE_IN_2_32 45 GMenu * g_menu_new (void); 46 47 GLIB_AVAILABLE_IN_2_32 48 void g_menu_freeze (GMenu *menu); 49 50 GLIB_AVAILABLE_IN_2_32 51 void g_menu_insert_item (GMenu *menu, 52 gint position, 53 GMenuItem *item); 54 GLIB_AVAILABLE_IN_2_32 55 void g_menu_prepend_item (GMenu *menu, 56 GMenuItem *item); 57 GLIB_AVAILABLE_IN_2_32 58 void g_menu_append_item (GMenu *menu, 59 GMenuItem *item); 60 GLIB_AVAILABLE_IN_2_32 61 void g_menu_remove (GMenu *menu, 62 gint position); 63 64 GLIB_AVAILABLE_IN_2_38 65 void g_menu_remove_all (GMenu *menu); 66 67 GLIB_AVAILABLE_IN_2_32 68 void g_menu_insert (GMenu *menu, 69 gint position, 70 const gchar *label, 71 const gchar *detailed_action); 72 GLIB_AVAILABLE_IN_2_32 73 void g_menu_prepend (GMenu *menu, 74 const gchar *label, 75 const gchar *detailed_action); 76 GLIB_AVAILABLE_IN_2_32 77 void g_menu_append (GMenu *menu, 78 const gchar *label, 79 const gchar *detailed_action); 80 81 GLIB_AVAILABLE_IN_2_32 82 void g_menu_insert_section (GMenu *menu, 83 gint position, 84 const gchar *label, 85 GMenuModel *section); 86 GLIB_AVAILABLE_IN_2_32 87 void g_menu_prepend_section (GMenu *menu, 88 const gchar *label, 89 GMenuModel *section); 90 GLIB_AVAILABLE_IN_2_32 91 void g_menu_append_section (GMenu *menu, 92 const gchar *label, 93 GMenuModel *section); 94 95 GLIB_AVAILABLE_IN_2_32 96 void g_menu_insert_submenu (GMenu *menu, 97 gint position, 98 const gchar *label, 99 GMenuModel *submenu); 100 GLIB_AVAILABLE_IN_2_32 101 void g_menu_prepend_submenu (GMenu *menu, 102 const gchar *label, 103 GMenuModel *submenu); 104 GLIB_AVAILABLE_IN_2_32 105 void g_menu_append_submenu (GMenu *menu, 106 const gchar *label, 107 GMenuModel *submenu); 108 109 110 GLIB_AVAILABLE_IN_2_32 111 GType g_menu_item_get_type (void) G_GNUC_CONST; 112 GLIB_AVAILABLE_IN_2_32 113 GMenuItem * g_menu_item_new (const gchar *label, 114 const gchar *detailed_action); 115 116 GLIB_AVAILABLE_IN_2_34 117 GMenuItem * g_menu_item_new_from_model (GMenuModel *model, 118 gint item_index); 119 120 GLIB_AVAILABLE_IN_2_32 121 GMenuItem * g_menu_item_new_submenu (const gchar *label, 122 GMenuModel *submenu); 123 124 GLIB_AVAILABLE_IN_2_32 125 GMenuItem * g_menu_item_new_section (const gchar *label, 126 GMenuModel *section); 127 128 GLIB_AVAILABLE_IN_2_34 129 GVariant * g_menu_item_get_attribute_value (GMenuItem *menu_item, 130 const gchar *attribute, 131 const GVariantType *expected_type); 132 GLIB_AVAILABLE_IN_2_34 133 gboolean g_menu_item_get_attribute (GMenuItem *menu_item, 134 const gchar *attribute, 135 const gchar *format_string, 136 ...); 137 GLIB_AVAILABLE_IN_2_34 138 GMenuModel *g_menu_item_get_link (GMenuItem *menu_item, 139 const gchar *link); 140 141 GLIB_AVAILABLE_IN_2_32 142 void g_menu_item_set_attribute_value (GMenuItem *menu_item, 143 const gchar *attribute, 144 GVariant *value); 145 GLIB_AVAILABLE_IN_2_32 146 void g_menu_item_set_attribute (GMenuItem *menu_item, 147 const gchar *attribute, 148 const gchar *format_string, 149 ...); 150 GLIB_AVAILABLE_IN_2_32 151 void g_menu_item_set_link (GMenuItem *menu_item, 152 const gchar *link, 153 GMenuModel *model); 154 GLIB_AVAILABLE_IN_2_32 155 void g_menu_item_set_label (GMenuItem *menu_item, 156 const gchar *label); 157 GLIB_AVAILABLE_IN_2_32 158 void g_menu_item_set_submenu (GMenuItem *menu_item, 159 GMenuModel *submenu); 160 GLIB_AVAILABLE_IN_2_32 161 void g_menu_item_set_section (GMenuItem *menu_item, 162 GMenuModel *section); 163 GLIB_AVAILABLE_IN_2_32 164 void g_menu_item_set_action_and_target_value (GMenuItem *menu_item, 165 const gchar *action, 166 GVariant *target_value); 167 GLIB_AVAILABLE_IN_2_32 168 void g_menu_item_set_action_and_target (GMenuItem *menu_item, 169 const gchar *action, 170 const gchar *format_string, 171 ...); 172 GLIB_AVAILABLE_IN_2_32 173 void g_menu_item_set_detailed_action (GMenuItem *menu_item, 174 const gchar *detailed_action); 175 176 GLIB_AVAILABLE_IN_2_38 177 void g_menu_item_set_icon (GMenuItem *menu_item, 178 GIcon *icon); 179 180 G_END_DECLS 181 182 #endif /* __G_MENU_H__ */ 183