File: | frontends/gtk/menu.c |
Warning: | line 541, column 2 The left operand of '!=' is a garbage value |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* | |||
2 | * Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin@dfgh.net> | |||
3 | * | |||
4 | * This file is part of NetSurf, http://www.netsurf-browser.org/ | |||
5 | * | |||
6 | * NetSurf is free software; you can redistribute it and/or modify | |||
7 | * it under the terms of the GNU General Public License as published by | |||
8 | * the Free Software Foundation; version 2 of the License. | |||
9 | * | |||
10 | * NetSurf is distributed in the hope that it will be useful, | |||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
13 | * GNU General Public License for more details. | |||
14 | * | |||
15 | * You should have received a copy of the GNU General Public License | |||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
17 | */ | |||
18 | ||||
19 | #include <stdlib.h> | |||
20 | #include <stdbool.h> | |||
21 | ||||
22 | #include <gdk/gdkkeysyms.h> | |||
23 | #include <gtk1/gtk1.h> | |||
24 | ||||
25 | #include "utils/messages.h" | |||
26 | ||||
27 | #include "gtk/compat.h" | |||
28 | #include "gtk/menu.h" | |||
29 | #include "gtk/warn.h" | |||
30 | #include "gtk/accelerator.h" | |||
31 | ||||
32 | /** | |||
33 | * Adds image menu item to a menu. | |||
34 | * | |||
35 | * \param menu the menu to add the item to | |||
36 | * \param item_out a pointer to the item's location in the menu struct | |||
37 | * \param message the menu item I18n lookup value | |||
38 | * \param group the 'global' in a gtk sense accelerator group | |||
39 | * \return true if sucessful and \a item_out updated else false. | |||
40 | */ | |||
41 | ||||
42 | static bool_Bool | |||
43 | nsgtk_menu_add_image_item(GtkMenu *menu, | |||
44 | GtkWidget **item_out, | |||
45 | const char *message, | |||
46 | GtkAccelGroup *group) | |||
47 | { | |||
48 | unsigned int key; | |||
49 | GdkModifierType mod; | |||
50 | GtkWidget *item; | |||
51 | const char *accelerator_desc; /* accelerator key description */ | |||
52 | ||||
53 | item = nsgtk_image_menu_item_new_with_mnemonic(messages_get(message)); | |||
54 | if (item == NULL((void*)0)) { | |||
55 | return false0; | |||
56 | } | |||
57 | ||||
58 | accelerator_desc = nsgtk_accelerator_get_desc(message); | |||
59 | if (accelerator_desc != NULL((void*)0)) { | |||
60 | gtk_accelerator_parse(accelerator_desc, &key, &mod); | |||
61 | if (key > 0) { | |||
62 | gtk_widget_add_accelerator(item, | |||
63 | "activate", | |||
64 | group, | |||
65 | key, | |||
66 | mod, | |||
67 | GTK_ACCEL_VISIBLE); | |||
68 | } | |||
69 | } | |||
70 | gtk_menu_shell_append(GTK_MENU_SHELL(menu)((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menu)), ((gtk_menu_shell_get_type ())))))), item); | |||
71 | gtk_widget_show(item); | |||
72 | ||||
73 | *item_out = item; | |||
74 | ||||
75 | return true1; | |||
76 | } | |||
77 | ||||
78 | #define NEW_MENU(n, m)n = malloc(sizeof(*n)); if (n == ((void*)0)) { return ((void* )0); } n->m_menu = ((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((gtk_menu_new())), ((gtk_menu_get_type () )))))) \ | |||
79 | n = malloc(sizeof(*n)); \ | |||
80 | if (n == NULL((void*)0)) { \ | |||
81 | return NULL((void*)0); \ | |||
82 | } \ | |||
83 | n->m##_menu = GTK_MENU(gtk_menu_new())((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((gtk_menu_new())), ((gtk_menu_get_type ())))))) | |||
84 | ||||
85 | #define IMAGE_ITEM(p, q, r, s, t)nsgtk_menu_add_image_item(s->p_menu, &(s->q_menuitem ), "r", t)\ | |||
86 | nsgtk_menu_add_image_item(s->p##_menu, &(s->q##_menuitem), #r, t) | |||
87 | ||||
88 | #define CHECK_ITEM(p, q, r, s)do { s->q_menuitem = ((((GtkCheckMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((gtk_check_menu_item_new_with_mnemonic( messages_get ("r")))), ((gtk_check_menu_item_get_type ())))))); if ((s-> q_menuitem != ((void*)0)) && (s->p_menu != ((void* )0))) { gtk_menu_shell_append(((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((s->p_menu)), ((gtk_menu_shell_get_type ())))))), ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((s->q_menuitem)), ((gtk_widget_get_type ()))))))); gtk_widget_show(((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((s->q_menuitem)), ((gtk_widget_get_type ()))))))); } } while(0) \ | |||
89 | do { \ | |||
90 | s->q##_menuitem = GTK_CHECK_MENU_ITEM( \((((GtkCheckMenuItem*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((gtk_check_menu_item_new_with_mnemonic( messages_get (#r)))), ((gtk_check_menu_item_get_type ())))))) | |||
91 | gtk_check_menu_item_new_with_mnemonic(\((((GtkCheckMenuItem*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((gtk_check_menu_item_new_with_mnemonic( messages_get (#r)))), ((gtk_check_menu_item_get_type ())))))) | |||
92 | messages_get(#r)))((((GtkCheckMenuItem*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((gtk_check_menu_item_new_with_mnemonic( messages_get (#r)))), ((gtk_check_menu_item_get_type ()))))));\ | |||
93 | if ((s->q##_menuitem != NULL((void*)0)) && (s->p##_menu != NULL((void*)0))) { \ | |||
94 | gtk_menu_shell_append(GTK_MENU_SHELL(s->p##_menu)((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((s->p##_menu)), ((gtk_menu_shell_get_type ())))))), \ | |||
95 | GTK_WIDGET(s->q##_menuitem)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((s->q##_menuitem)), ((gtk_widget_get_type ()))))))); \ | |||
96 | gtk_widget_show(GTK_WIDGET(s->q##_menuitem)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((s->q##_menuitem)), ((gtk_widget_get_type ()))))))); \ | |||
97 | } \ | |||
98 | } while(0) | |||
99 | ||||
100 | #define SET_SUBMENU(q, r)do { r->q_submenu = nsgtk_menu_q_submenu(group); if ((r-> q_submenu != ((void*)0)) && (r->q_submenu->q_menu != ((void*)0)) && (r->q_menuitem != ((void*)0))) { gtk_menu_item_set_submenu(((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((r->q_menuitem)), ((gtk_menu_item_get_type ())))))), ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((r->q_submenu->q_menu)), ((gtk_widget_get_type ()))))))); } } while(0) \ | |||
101 | do { \ | |||
102 | r->q##_submenu = nsgtk_menu_##q##_submenu(group); \ | |||
103 | if ((r->q##_submenu != NULL((void*)0)) && \ | |||
104 | (r->q##_submenu->q##_menu != NULL((void*)0)) && \ | |||
105 | (r->q##_menuitem != NULL((void*)0))) { \ | |||
106 | gtk_menu_item_set_submenu(GTK_MENU_ITEM(r->q##_menuitem)((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((r->q##_menuitem)), ((gtk_menu_item_get_type ())))))), \ | |||
107 | GTK_WIDGET(r->q##_submenu->q##_menu)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((r->q##_submenu->q##_menu)), ((gtk_widget_get_type ( )))))))); \ | |||
108 | } \ | |||
109 | } while(0) | |||
110 | ||||
111 | #define ADD_NAMED_SEP(q, r, s)do { s->r_separator = gtk_separator_menu_item_new(); if (( s->r_separator != ((void*)0)) && (s->q_menu != ( (void*)0))) { gtk_menu_shell_append(((((GtkMenuShell*) (void * ) g_type_check_instance_cast ((GTypeInstance*) ((s->q_menu )), ((gtk_menu_shell_get_type ())))))), s->r_separator); gtk_widget_show (s->r_separator); } } while(0) \ | |||
112 | do { \ | |||
113 | s->r##_separator = gtk_separator_menu_item_new(); \ | |||
114 | if ((s->r##_separator != NULL((void*)0)) && (s->q##_menu != NULL((void*)0))) { \ | |||
115 | gtk_menu_shell_append(GTK_MENU_SHELL(s->q##_menu)((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((s->q##_menu)), ((gtk_menu_shell_get_type ())))))), s->r##_separator); \ | |||
116 | gtk_widget_show(s->r##_separator); \ | |||
117 | } \ | |||
118 | } while(0) | |||
119 | ||||
120 | #define ADD_SEP(q, r)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (r->q_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((r->q_menu)), ((gtk_menu_shell_get_type ())))))), w); gtk_widget_show (w); } } while(0) \ | |||
121 | do { \ | |||
122 | GtkWidget *w = gtk_separator_menu_item_new(); \ | |||
123 | if ((w != NULL((void*)0)) && (r->q##_menu != NULL((void*)0))) { \ | |||
124 | gtk_menu_shell_append(GTK_MENU_SHELL(r->q##_menu)((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((r->q##_menu)), ((gtk_menu_shell_get_type ())))))), w); \ | |||
125 | gtk_widget_show(w); \ | |||
126 | } \ | |||
127 | } while(0) | |||
128 | ||||
129 | #define ATTACH_PARENT(parent, msgname, menuv, group)do { menuv = ((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((gtk_menu_item_new_with_mnemonic(messages_get ("msgname")))), ((gtk_menu_item_get_type ())))))); gtk_menu_shell_append (parent, ((((GtkWidget*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((menuv)), ((gtk_widget_get_type ()))))))); gtk_widget_show (((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menuv)), ((gtk_widget_get_type ()))))))); gtk_menu_item_set_submenu (menuv, ((((GtkWidget*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((menuv_menu)), ((gtk_widget_get_type ())))) ))); gtk_menu_set_accel_group(menuv_menu, group); } while(0) \ | |||
130 | do { \ | |||
131 | /* create top level menu entry and attach to parent */ \ | |||
132 | menuv = GTK_MENU_ITEM(gtk_menu_item_new_with_mnemonic(messages_get(#msgname)))((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((gtk_menu_item_new_with_mnemonic(messages_get(#msgname))) ), ((gtk_menu_item_get_type ())))))); \ | |||
133 | gtk_menu_shell_append(parent, GTK_WIDGET(menuv)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menuv)), ((gtk_widget_get_type ()))))))); \ | |||
134 | gtk_widget_show(GTK_WIDGET(menuv)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menuv)), ((gtk_widget_get_type ()))))))); \ | |||
135 | /* attach submenu to parent */ \ | |||
136 | gtk_menu_item_set_submenu(menuv, GTK_WIDGET(menuv##_menu)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menuv##_menu)), ((gtk_widget_get_type ()))))))); \ | |||
137 | gtk_menu_set_accel_group(menuv##_menu, group); \ | |||
138 | } while(0) | |||
139 | ||||
140 | /** | |||
141 | * creates an export submenu | |||
142 | * \param group the 'global' in a gtk sense accelerator reference | |||
143 | */ | |||
144 | static struct nsgtk_export_submenu * | |||
145 | nsgtk_menu_export_submenu(GtkAccelGroup *group) | |||
146 | { | |||
147 | struct nsgtk_export_submenu *ret; | |||
148 | ret = malloc(sizeof(struct nsgtk_export_submenu)); | |||
149 | ||||
150 | if (ret == NULL((void*)0)) { | |||
151 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
152 | return NULL((void*)0); | |||
153 | } | |||
154 | ||||
155 | ret->export_menu = GTK_MENU(gtk_menu_new())((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((gtk_menu_new())), ((gtk_menu_get_type ())))))); | |||
156 | if (ret->export_menu == NULL((void*)0)) { | |||
157 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
158 | free(ret); | |||
159 | return NULL((void*)0); | |||
160 | } | |||
161 | ||||
162 | IMAGE_ITEM(export, savepage, gtkSavePage, ret, group)nsgtk_menu_add_image_item(ret->export_menu, &(ret-> savepage_menuitem), "gtkSavePage", group); | |||
163 | IMAGE_ITEM(export, plaintext, gtkPlainText, ret, group)nsgtk_menu_add_image_item(ret->export_menu, &(ret-> plaintext_menuitem), "gtkPlainText", group); | |||
164 | IMAGE_ITEM(export, pdf, gtkPDF, ret, group)nsgtk_menu_add_image_item(ret->export_menu, &(ret-> pdf_menuitem), "gtkPDF", group); | |||
165 | return ret; | |||
166 | } | |||
167 | ||||
168 | /** | |||
169 | * creates a scaleview submenu | |||
170 | * \param group the 'global' in a gtk sense accelerator reference | |||
171 | */ | |||
172 | ||||
173 | static struct nsgtk_scaleview_submenu * | |||
174 | nsgtk_menu_scaleview_submenu(GtkAccelGroup *group) | |||
175 | { | |||
176 | struct nsgtk_scaleview_submenu *ret = | |||
177 | malloc(sizeof(struct nsgtk_scaleview_submenu)); | |||
178 | if (ret == NULL((void*)0)) { | |||
179 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
180 | return NULL((void*)0); | |||
181 | } | |||
182 | ret->scaleview_menu = GTK_MENU(gtk_menu_new())((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((gtk_menu_new())), ((gtk_menu_get_type ())))))); | |||
183 | if (ret->scaleview_menu == NULL((void*)0)) { | |||
184 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
185 | free(ret); | |||
186 | return NULL((void*)0); | |||
187 | } | |||
188 | IMAGE_ITEM(scaleview, zoomplus, gtkZoomPlus, ret, group)nsgtk_menu_add_image_item(ret->scaleview_menu, &(ret-> zoomplus_menuitem), "gtkZoomPlus", group); | |||
189 | IMAGE_ITEM(scaleview, zoomnormal, gtkZoomNormal, ret, group)nsgtk_menu_add_image_item(ret->scaleview_menu, &(ret-> zoomnormal_menuitem), "gtkZoomNormal", group); | |||
190 | IMAGE_ITEM(scaleview, zoomminus, gtkZoomMinus, ret, group)nsgtk_menu_add_image_item(ret->scaleview_menu, &(ret-> zoomminus_menuitem), "gtkZoomMinus", group); | |||
191 | return ret; | |||
192 | } | |||
193 | ||||
194 | /** | |||
195 | * creates a tab navigation submenu | |||
196 | * \param group the 'global' in a gtk sense accelerator reference | |||
197 | */ | |||
198 | ||||
199 | static struct nsgtk_tabs_submenu *nsgtk_menu_tabs_submenu(GtkAccelGroup *group) | |||
200 | { | |||
201 | struct nsgtk_tabs_submenu *ret; | |||
202 | ret = malloc(sizeof(struct nsgtk_tabs_submenu)); | |||
203 | if (ret == NULL((void*)0)) { | |||
204 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
205 | return NULL((void*)0); | |||
206 | } | |||
207 | ret->tabs_menu = GTK_MENU(gtk_menu_new())((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((gtk_menu_new())), ((gtk_menu_get_type ())))))); | |||
208 | if (ret->tabs_menu == NULL((void*)0)) { | |||
209 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
210 | free(ret); | |||
211 | return NULL((void*)0); | |||
212 | } | |||
213 | IMAGE_ITEM(tabs, nexttab, gtkNextTab, ret, group)nsgtk_menu_add_image_item(ret->tabs_menu, &(ret->nexttab_menuitem ), "gtkNextTab", group); | |||
214 | IMAGE_ITEM(tabs, prevtab, gtkPrevTab, ret, group)nsgtk_menu_add_image_item(ret->tabs_menu, &(ret->prevtab_menuitem ), "gtkPrevTab", group); | |||
215 | IMAGE_ITEM(tabs, closetab, gtkCloseTab, ret, group)nsgtk_menu_add_image_item(ret->tabs_menu, &(ret->closetab_menuitem ), "gtkCloseTab", group); | |||
216 | ||||
217 | return ret; | |||
218 | } | |||
219 | ||||
220 | ||||
221 | /** | |||
222 | * creates a toolbars submenu | |||
223 | * | |||
224 | * \param group the 'global' in a gtk sense accelerator reference | |||
225 | */ | |||
226 | static struct nsgtk_toolbars_submenu * | |||
227 | nsgtk_menu_toolbars_submenu(GtkAccelGroup *group) | |||
228 | { | |||
229 | struct nsgtk_toolbars_submenu *tmenu; | |||
230 | ||||
231 | tmenu = malloc(sizeof(struct nsgtk_toolbars_submenu)); | |||
232 | if (tmenu == NULL((void*)0)) { | |||
233 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
234 | return NULL((void*)0); | |||
235 | } | |||
236 | ||||
237 | tmenu->toolbars_menu = GTK_MENU(gtk_menu_new())((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((gtk_menu_new())), ((gtk_menu_get_type ())))))); | |||
238 | if (tmenu->toolbars_menu == NULL((void*)0)) { | |||
239 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
240 | free(tmenu); | |||
241 | return NULL((void*)0); | |||
242 | } | |||
243 | ||||
244 | CHECK_ITEM(toolbars, menubar, gtkMenuBar, tmenu)do { tmenu->menubar_menuitem = ((((GtkCheckMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((gtk_check_menu_item_new_with_mnemonic ( messages_get("gtkMenuBar")))), ((gtk_check_menu_item_get_type ())))))); if ((tmenu->menubar_menuitem != ((void*)0)) && (tmenu->toolbars_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmenu->toolbars_menu)), ((gtk_menu_shell_get_type ()) ))))), ((((GtkWidget*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((tmenu->menubar_menuitem)), ((gtk_widget_get_type ()))))))); gtk_widget_show(((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((tmenu->menubar_menuitem)), ((gtk_widget_get_type ()))))))); } } while(0); | |||
245 | if (tmenu->menubar_menuitem != NULL((void*)0)) { | |||
246 | gtk_check_menu_item_set_active(tmenu->menubar_menuitem, TRUE(!(0))); | |||
247 | } | |||
248 | ||||
249 | CHECK_ITEM(toolbars, toolbar, gtkToolBar, tmenu)do { tmenu->toolbar_menuitem = ((((GtkCheckMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((gtk_check_menu_item_new_with_mnemonic ( messages_get("gtkToolBar")))), ((gtk_check_menu_item_get_type ())))))); if ((tmenu->toolbar_menuitem != ((void*)0)) && (tmenu->toolbars_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmenu->toolbars_menu)), ((gtk_menu_shell_get_type ()) ))))), ((((GtkWidget*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((tmenu->toolbar_menuitem)), ((gtk_widget_get_type ()))))))); gtk_widget_show(((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((tmenu->toolbar_menuitem)), ((gtk_widget_get_type ()))))))); } } while(0); | |||
250 | if (tmenu->toolbar_menuitem != NULL((void*)0)) { | |||
251 | gtk_check_menu_item_set_active(tmenu->toolbar_menuitem, TRUE(!(0))); | |||
252 | } | |||
253 | ||||
254 | ADD_SEP(toolbars, tmenu)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (tmenu->toolbars_menu != ((void*)0)) ) { gtk_menu_shell_append(((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((tmenu->toolbars_menu)), ((gtk_menu_shell_get_type ())))))), w); gtk_widget_show(w); } } while(0); | |||
255 | ||||
256 | IMAGE_ITEM(toolbars, customize, gtkCustomize, tmenu, group)nsgtk_menu_add_image_item(tmenu->toolbars_menu, &(tmenu ->customize_menuitem), "gtkCustomize", group); | |||
257 | ||||
258 | return tmenu; | |||
259 | } | |||
260 | ||||
261 | /** | |||
262 | * creates a debugging submenu | |||
263 | * \param group the 'global' in a gtk sense accelerator reference | |||
264 | */ | |||
265 | ||||
266 | static struct nsgtk_developer_submenu * | |||
267 | nsgtk_menu_developer_submenu(GtkAccelGroup *group) | |||
268 | { | |||
269 | struct nsgtk_developer_submenu *dmenu = | |||
270 | malloc(sizeof(struct nsgtk_developer_submenu)); | |||
271 | if (dmenu == NULL((void*)0)) { | |||
272 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
273 | return NULL((void*)0); | |||
274 | } | |||
275 | dmenu->developer_menu = GTK_MENU(gtk_menu_new())((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((gtk_menu_new())), ((gtk_menu_get_type ())))))); | |||
276 | if (dmenu->developer_menu == NULL((void*)0)) { | |||
277 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
278 | free(dmenu); | |||
279 | return NULL((void*)0); | |||
280 | } | |||
281 | ||||
282 | IMAGE_ITEM(developer, viewsource, gtkPageSource, dmenu, group)nsgtk_menu_add_image_item(dmenu->developer_menu, &(dmenu ->viewsource_menuitem), "gtkPageSource", group); | |||
283 | IMAGE_ITEM(developer, toggledebugging, gtkToggleDebugging, dmenu, group)nsgtk_menu_add_image_item(dmenu->developer_menu, &(dmenu ->toggledebugging_menuitem), "gtkToggleDebugging", group); | |||
284 | IMAGE_ITEM(developer, debugboxtree, gtkDebugBoxTree, dmenu, group)nsgtk_menu_add_image_item(dmenu->developer_menu, &(dmenu ->debugboxtree_menuitem), "gtkDebugBoxTree", group); | |||
285 | IMAGE_ITEM(developer, debugdomtree, gtkDebugDomTree, dmenu, group)nsgtk_menu_add_image_item(dmenu->developer_menu, &(dmenu ->debugdomtree_menuitem), "gtkDebugDomTree", group); | |||
286 | ||||
287 | return dmenu; | |||
288 | } | |||
289 | ||||
290 | /** | |||
291 | * creates the file menu | |||
292 | * | |||
293 | * \param group The gtk 'global' accelerator reference | |||
294 | * \return The new file menu or NULL on error | |||
295 | */ | |||
296 | static struct nsgtk_file_menu *nsgtk_menu_file_submenu(GtkAccelGroup *group) | |||
297 | { | |||
298 | struct nsgtk_file_menu *fmenu; | |||
299 | ||||
300 | fmenu = malloc(sizeof(struct nsgtk_file_menu)); | |||
301 | if (fmenu == NULL((void*)0)) { | |||
302 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
303 | return NULL((void*)0); | |||
304 | } | |||
305 | ||||
306 | fmenu->file_menu = GTK_MENU(gtk_menu_new())((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((gtk_menu_new())), ((gtk_menu_get_type ())))))); | |||
307 | if (fmenu->file_menu == NULL((void*)0)) { | |||
308 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
309 | free(fmenu); | |||
310 | return NULL((void*)0); | |||
311 | } | |||
312 | ||||
313 | IMAGE_ITEM(file, newwindow, gtkNewWindow, fmenu, group)nsgtk_menu_add_image_item(fmenu->file_menu, &(fmenu-> newwindow_menuitem), "gtkNewWindow", group); | |||
314 | IMAGE_ITEM(file, newtab, gtkNewTab, fmenu, group)nsgtk_menu_add_image_item(fmenu->file_menu, &(fmenu-> newtab_menuitem), "gtkNewTab", group); | |||
315 | IMAGE_ITEM(file, openfile, gtkOpenFile, fmenu, group)nsgtk_menu_add_image_item(fmenu->file_menu, &(fmenu-> openfile_menuitem), "gtkOpenFile", group); | |||
316 | IMAGE_ITEM(file, closewindow, gtkCloseWindow, fmenu, group)nsgtk_menu_add_image_item(fmenu->file_menu, &(fmenu-> closewindow_menuitem), "gtkCloseWindow", group); | |||
317 | ADD_SEP(file, fmenu)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (fmenu->file_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((fmenu->file_menu)), ((gtk_menu_shell_get_type ()))))) ), w); gtk_widget_show(w); } } while(0); | |||
318 | IMAGE_ITEM(file, export, gtkExport, fmenu, group)nsgtk_menu_add_image_item(fmenu->file_menu, &(fmenu-> export_menuitem), "gtkExport", group); | |||
319 | ADD_SEP(file, fmenu)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (fmenu->file_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((fmenu->file_menu)), ((gtk_menu_shell_get_type ()))))) ), w); gtk_widget_show(w); } } while(0); | |||
320 | IMAGE_ITEM(file, printpreview, gtkPrintPreview, fmenu, group)nsgtk_menu_add_image_item(fmenu->file_menu, &(fmenu-> printpreview_menuitem), "gtkPrintPreview", group); | |||
321 | IMAGE_ITEM(file, print, gtkPrint, fmenu, group)nsgtk_menu_add_image_item(fmenu->file_menu, &(fmenu-> print_menuitem), "gtkPrint", group); | |||
322 | ADD_SEP(file, fmenu)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (fmenu->file_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((fmenu->file_menu)), ((gtk_menu_shell_get_type ()))))) ), w); gtk_widget_show(w); } } while(0); | |||
323 | IMAGE_ITEM(file, quit, gtkQuitMenu, fmenu, group)nsgtk_menu_add_image_item(fmenu->file_menu, &(fmenu-> quit_menuitem), "gtkQuitMenu", group); | |||
324 | SET_SUBMENU(export, fmenu)do { fmenu->export_submenu = nsgtk_menu_export_submenu(group ); if ((fmenu->export_submenu != ((void*)0)) && (fmenu ->export_submenu->export_menu != ((void*)0)) && (fmenu->export_menuitem != ((void*)0))) { gtk_menu_item_set_submenu (((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((fmenu->export_menuitem)), ((gtk_menu_item_get_type () )))))), ((((GtkWidget*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((fmenu->export_submenu->export_menu)) , ((gtk_widget_get_type ()))))))); } } while(0); | |||
325 | ||||
326 | return fmenu; | |||
327 | } | |||
328 | ||||
329 | /** | |||
330 | * creates an edit menu | |||
331 | * \param group the 'global' in a gtk sense accelerator reference | |||
332 | */ | |||
333 | ||||
334 | static struct nsgtk_edit_menu *nsgtk_menu_edit_submenu(GtkAccelGroup *group) | |||
335 | { | |||
336 | struct nsgtk_edit_menu *ret = malloc(sizeof(struct nsgtk_edit_menu)); | |||
337 | if (ret == NULL((void*)0)) { | |||
338 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
339 | return NULL((void*)0); | |||
340 | } | |||
341 | ret->edit_menu = GTK_MENU(gtk_menu_new())((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((gtk_menu_new())), ((gtk_menu_get_type ())))))); | |||
342 | if (ret->edit_menu == NULL((void*)0)) { | |||
343 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
344 | free(ret); | |||
345 | return NULL((void*)0); | |||
346 | } | |||
347 | IMAGE_ITEM(edit, cut, gtkCut, ret, group)nsgtk_menu_add_image_item(ret->edit_menu, &(ret->cut_menuitem ), "gtkCut", group); | |||
348 | IMAGE_ITEM(edit, copy, gtkCopy, ret, group)nsgtk_menu_add_image_item(ret->edit_menu, &(ret->copy_menuitem ), "gtkCopy", group); | |||
349 | IMAGE_ITEM(edit, paste, gtkPaste, ret, group)nsgtk_menu_add_image_item(ret->edit_menu, &(ret->paste_menuitem ), "gtkPaste", group); | |||
350 | IMAGE_ITEM(edit, delete, gtkDelete, ret, group)nsgtk_menu_add_image_item(ret->edit_menu, &(ret->delete_menuitem ), "gtkDelete", group); | |||
351 | ADD_SEP(edit, ret)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (ret->edit_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ret->edit_menu)), ((gtk_menu_shell_get_type ())))))), w); gtk_widget_show(w); } } while(0); | |||
352 | IMAGE_ITEM(edit, selectall, gtkSelectAll, ret, group)nsgtk_menu_add_image_item(ret->edit_menu, &(ret->selectall_menuitem ), "gtkSelectAll", group); | |||
353 | ADD_SEP(edit, ret)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (ret->edit_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ret->edit_menu)), ((gtk_menu_shell_get_type ())))))), w); gtk_widget_show(w); } } while(0); | |||
354 | IMAGE_ITEM(edit, find, gtkFind, ret, group)nsgtk_menu_add_image_item(ret->edit_menu, &(ret->find_menuitem ), "gtkFind", group); | |||
355 | ADD_SEP(edit, ret)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (ret->edit_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ret->edit_menu)), ((gtk_menu_shell_get_type ())))))), w); gtk_widget_show(w); } } while(0); | |||
356 | IMAGE_ITEM(edit, preferences, gtkPreferences, ret, group)nsgtk_menu_add_image_item(ret->edit_menu, &(ret->preferences_menuitem ), "gtkPreferences", group); | |||
357 | ||||
358 | return ret; | |||
359 | } | |||
360 | ||||
361 | /** | |||
362 | * creates a view menu | |||
363 | * \param group the 'global' in a gtk sense accelerator reference | |||
364 | */ | |||
365 | ||||
366 | static struct nsgtk_view_menu *nsgtk_menu_view_submenu(GtkAccelGroup *group) | |||
367 | { | |||
368 | struct nsgtk_view_menu *ret = malloc(sizeof(struct nsgtk_view_menu)); | |||
369 | if (ret == NULL((void*)0)) { | |||
370 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
371 | return NULL((void*)0); | |||
372 | } | |||
373 | ret->view_menu = GTK_MENU(gtk_menu_new())((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((gtk_menu_new())), ((gtk_menu_get_type ())))))); | |||
374 | if (ret->view_menu == NULL((void*)0)) { | |||
375 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
376 | free(ret); | |||
377 | return NULL((void*)0); | |||
378 | } | |||
379 | IMAGE_ITEM(view, scaleview, gtkScaleView, ret, group)nsgtk_menu_add_image_item(ret->view_menu, &(ret->scaleview_menuitem ), "gtkScaleView", group); | |||
380 | SET_SUBMENU(scaleview, ret)do { ret->scaleview_submenu = nsgtk_menu_scaleview_submenu (group); if ((ret->scaleview_submenu != ((void*)0)) && (ret->scaleview_submenu->scaleview_menu != ((void*)0)) && (ret->scaleview_menuitem != ((void*)0))) { gtk_menu_item_set_submenu (((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ret->scaleview_menuitem)), ((gtk_menu_item_get_type ( ))))))), ((((GtkWidget*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((ret->scaleview_submenu->scaleview_menu )), ((gtk_widget_get_type ()))))))); } } while(0); | |||
381 | IMAGE_ITEM(view, fullscreen, gtkFullScreen, ret, group)nsgtk_menu_add_image_item(ret->view_menu, &(ret->fullscreen_menuitem ), "gtkFullScreen", group); | |||
382 | ADD_SEP(view, ret)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (ret->view_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ret->view_menu)), ((gtk_menu_shell_get_type ())))))), w); gtk_widget_show(w); } } while(0); | |||
383 | IMAGE_ITEM(view, toolbars, gtkToolbars, ret, group)nsgtk_menu_add_image_item(ret->view_menu, &(ret->toolbars_menuitem ), "gtkToolbars", group); | |||
384 | SET_SUBMENU(toolbars, ret)do { ret->toolbars_submenu = nsgtk_menu_toolbars_submenu(group ); if ((ret->toolbars_submenu != ((void*)0)) && (ret ->toolbars_submenu->toolbars_menu != ((void*)0)) && (ret->toolbars_menuitem != ((void*)0))) { gtk_menu_item_set_submenu (((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ret->toolbars_menuitem)), ((gtk_menu_item_get_type () )))))), ((((GtkWidget*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((ret->toolbars_submenu->toolbars_menu )), ((gtk_widget_get_type ()))))))); } } while(0); | |||
385 | IMAGE_ITEM(view, tabs, gtkTabs, ret, group)nsgtk_menu_add_image_item(ret->view_menu, &(ret->tabs_menuitem ), "gtkTabs", group); | |||
386 | SET_SUBMENU(tabs, ret)do { ret->tabs_submenu = nsgtk_menu_tabs_submenu(group); if ((ret->tabs_submenu != ((void*)0)) && (ret->tabs_submenu ->tabs_menu != ((void*)0)) && (ret->tabs_menuitem != ((void*)0))) { gtk_menu_item_set_submenu(((((GtkMenuItem* ) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ret ->tabs_menuitem)), ((gtk_menu_item_get_type ())))))), (((( GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ret->tabs_submenu->tabs_menu)), ((gtk_widget_get_type ()))))))); } } while(0); | |||
387 | ADD_SEP(view, ret)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (ret->view_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ret->view_menu)), ((gtk_menu_shell_get_type ())))))), w); gtk_widget_show(w); } } while(0); | |||
388 | IMAGE_ITEM(view, savewindowsize, gtkSaveWindowSize, ret, group)nsgtk_menu_add_image_item(ret->view_menu, &(ret->savewindowsize_menuitem ), "gtkSaveWindowSize", group); | |||
389 | ||||
390 | return ret; | |||
391 | } | |||
392 | ||||
393 | /** | |||
394 | * creates a nav menu | |||
395 | * \param group the 'global' in a gtk sense accelerator reference | |||
396 | */ | |||
397 | ||||
398 | static struct nsgtk_nav_menu *nsgtk_menu_nav_submenu(GtkAccelGroup *group) | |||
399 | { | |||
400 | struct nsgtk_nav_menu *ret = malloc(sizeof(struct nsgtk_nav_menu)); | |||
401 | if (ret == NULL((void*)0)) { | |||
402 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
403 | return NULL((void*)0); | |||
404 | } | |||
405 | ret->nav_menu = GTK_MENU(gtk_menu_new())((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((gtk_menu_new())), ((gtk_menu_get_type ())))))); | |||
406 | if (ret->nav_menu == NULL((void*)0)) { | |||
407 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
408 | free(ret); | |||
409 | return NULL((void*)0); | |||
410 | } | |||
411 | ||||
412 | IMAGE_ITEM(nav, back, gtkBack, ret, group)nsgtk_menu_add_image_item(ret->nav_menu, &(ret->back_menuitem ), "gtkBack", group); | |||
413 | IMAGE_ITEM(nav, forward, gtkForward, ret, group)nsgtk_menu_add_image_item(ret->nav_menu, &(ret->forward_menuitem ), "gtkForward", group); | |||
414 | IMAGE_ITEM(nav, stop, gtkStop, ret, group)nsgtk_menu_add_image_item(ret->nav_menu, &(ret->stop_menuitem ), "gtkStop", group); | |||
415 | IMAGE_ITEM(nav, reload, gtkReload, ret, group)nsgtk_menu_add_image_item(ret->nav_menu, &(ret->reload_menuitem ), "gtkReload", group); | |||
416 | IMAGE_ITEM(nav, home, gtkHome, ret, group)nsgtk_menu_add_image_item(ret->nav_menu, &(ret->home_menuitem ), "gtkHome", group); | |||
417 | ADD_SEP(nav, ret)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (ret->nav_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ret->nav_menu)), ((gtk_menu_shell_get_type ())))))), w ); gtk_widget_show(w); } } while(0); | |||
418 | IMAGE_ITEM(nav, localhistory, gtkLocalHistory, ret, group)nsgtk_menu_add_image_item(ret->nav_menu, &(ret->localhistory_menuitem ), "gtkLocalHistory", group); | |||
419 | IMAGE_ITEM(nav, globalhistory, gtkGlobalHistory, ret, group)nsgtk_menu_add_image_item(ret->nav_menu, &(ret->globalhistory_menuitem ), "gtkGlobalHistory", group); | |||
420 | ADD_SEP(nav, ret)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (ret->nav_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ret->nav_menu)), ((gtk_menu_shell_get_type ())))))), w ); gtk_widget_show(w); } } while(0); | |||
421 | IMAGE_ITEM(nav, addbookmarks, gtkAddBookMarks, ret, group)nsgtk_menu_add_image_item(ret->nav_menu, &(ret->addbookmarks_menuitem ), "gtkAddBookMarks", group); | |||
422 | IMAGE_ITEM(nav, showbookmarks, gtkShowBookMarks, ret, group)nsgtk_menu_add_image_item(ret->nav_menu, &(ret->showbookmarks_menuitem ), "gtkShowBookMarks", group); | |||
423 | ADD_SEP(nav, ret)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (ret->nav_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ret->nav_menu)), ((gtk_menu_shell_get_type ())))))), w ); gtk_widget_show(w); } } while(0); | |||
424 | IMAGE_ITEM(nav, openlocation, gtkOpenLocation, ret, group)nsgtk_menu_add_image_item(ret->nav_menu, &(ret->openlocation_menuitem ), "gtkOpenLocation", group); | |||
425 | ||||
426 | return ret; | |||
427 | } | |||
428 | ||||
429 | /** | |||
430 | * creates the tools menu | |||
431 | * \param group the 'global' in a gtk sense accelerator reference | |||
432 | */ | |||
433 | static struct nsgtk_tools_menu *nsgtk_menu_tools_submenu(GtkAccelGroup *group) | |||
434 | { | |||
435 | struct nsgtk_tools_menu *ret = malloc(sizeof(struct nsgtk_tools_menu)); | |||
436 | if (ret == NULL((void*)0)) { | |||
437 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
438 | return NULL((void*)0); | |||
439 | } | |||
440 | ret->tools_menu = GTK_MENU(gtk_menu_new())((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((gtk_menu_new())), ((gtk_menu_get_type ())))))); | |||
441 | if (ret->tools_menu == NULL((void*)0)) { | |||
442 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
443 | free(ret); | |||
444 | return NULL((void*)0); | |||
445 | } | |||
446 | ||||
447 | IMAGE_ITEM(tools, downloads, gtkDownloads, ret, group)nsgtk_menu_add_image_item(ret->tools_menu, &(ret->downloads_menuitem ), "gtkDownloads", group); | |||
448 | IMAGE_ITEM(tools, showcookies, gtkShowCookies, ret, group)nsgtk_menu_add_image_item(ret->tools_menu, &(ret->showcookies_menuitem ), "gtkShowCookies", group); | |||
449 | IMAGE_ITEM(tools, developer, gtkDeveloper, ret, group)nsgtk_menu_add_image_item(ret->tools_menu, &(ret->developer_menuitem ), "gtkDeveloper", group); | |||
450 | SET_SUBMENU(developer, ret)do { ret->developer_submenu = nsgtk_menu_developer_submenu (group); if ((ret->developer_submenu != ((void*)0)) && (ret->developer_submenu->developer_menu != ((void*)0)) && (ret->developer_menuitem != ((void*)0))) { gtk_menu_item_set_submenu (((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ret->developer_menuitem)), ((gtk_menu_item_get_type ( ))))))), ((((GtkWidget*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((ret->developer_submenu->developer_menu )), ((gtk_widget_get_type ()))))))); } } while(0); | |||
451 | ||||
452 | return ret; | |||
453 | } | |||
454 | ||||
455 | /** | |||
456 | * creates a help menu | |||
457 | * \param group the 'global' in a gtk sense accelerator reference | |||
458 | */ | |||
459 | static struct nsgtk_help_menu *nsgtk_menu_help_submenu(GtkAccelGroup *group) | |||
460 | { | |||
461 | struct nsgtk_help_menu *ret = malloc(sizeof(struct nsgtk_help_menu)); | |||
462 | if (ret == NULL((void*)0)) { | |||
463 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
464 | return NULL((void*)0); | |||
465 | } | |||
466 | ret->help_menu = GTK_MENU(gtk_menu_new())((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((gtk_menu_new())), ((gtk_menu_get_type ())))))); | |||
467 | if (ret->help_menu == NULL((void*)0)) { | |||
468 | nsgtk_warning(messages_get("NoMemory"), 0); | |||
469 | free(ret); | |||
470 | return NULL((void*)0); | |||
471 | } | |||
472 | IMAGE_ITEM(help, contents, gtkContents, ret, group)nsgtk_menu_add_image_item(ret->help_menu, &(ret->contents_menuitem ), "gtkContents", group); | |||
473 | IMAGE_ITEM(help, guide, gtkGuide, ret, group)nsgtk_menu_add_image_item(ret->help_menu, &(ret->guide_menuitem ), "gtkGuide", group); | |||
474 | IMAGE_ITEM(help, info, gtkUserInformation, ret, group)nsgtk_menu_add_image_item(ret->help_menu, &(ret->info_menuitem ), "gtkUserInformation", group); | |||
475 | ADD_SEP(help, ret)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (ret->help_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ret->help_menu)), ((gtk_menu_shell_get_type ())))))), w); gtk_widget_show(w); } } while(0); | |||
476 | IMAGE_ITEM(help, about, gtkAbout, ret, group)nsgtk_menu_add_image_item(ret->help_menu, &(ret->about_menuitem ), "gtkAbout", group); | |||
477 | ||||
478 | return ret; | |||
479 | } | |||
480 | ||||
481 | ||||
482 | /** | |||
483 | * Generate menubar menus. | |||
484 | * | |||
485 | * Generate the main menu structure and attach it to a menubar widget. | |||
486 | */ | |||
487 | struct nsgtk_bar_submenu * | |||
488 | nsgtk_menu_bar_create(GtkMenuShell *menubar, GtkAccelGroup *group) | |||
489 | { | |||
490 | struct nsgtk_bar_submenu *nmenu; | |||
491 | ||||
492 | nmenu = calloc(1, sizeof(struct nsgtk_bar_submenu)); | |||
493 | if (nmenu == NULL((void*)0)) { | |||
494 | return NULL((void*)0); | |||
495 | } | |||
496 | ||||
497 | /* create sub menus */ | |||
498 | nmenu->file_submenu = nsgtk_menu_file_submenu(group); | |||
499 | nmenu->edit_submenu = nsgtk_menu_edit_submenu(group); | |||
500 | nmenu->view_submenu = nsgtk_menu_view_submenu(group); | |||
501 | nmenu->nav_submenu = nsgtk_menu_nav_submenu(group); | |||
502 | nmenu->tools_submenu = nsgtk_menu_tools_submenu(group); | |||
503 | nmenu->help_submenu = nsgtk_menu_help_submenu(group); | |||
504 | ||||
505 | if (menubar != NULL((void*)0)) { | |||
506 | nmenu->bar_menu = GTK_MENU_BAR(menubar)((((GtkMenuBar*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menubar)), ((gtk_menu_bar_get_type ())))))); | |||
507 | ||||
508 | /* attach menus to menubar */ | |||
509 | ATTACH_PARENT(menubar, gtkFile, nmenu->file_submenu->file, group)do { nmenu->file_submenu->file = ((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((gtk_menu_item_new_with_mnemonic (messages_get("gtkFile")))), ((gtk_menu_item_get_type ()))))) ); gtk_menu_shell_append(menubar, ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((nmenu->file_submenu->file)), ((gtk_widget_get_type ()))))))); gtk_widget_show(((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((nmenu->file_submenu->file)), ((gtk_widget_get_type ()))))))); gtk_menu_item_set_submenu(nmenu->file_submenu-> file, ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->file_submenu->file_menu)), ((gtk_widget_get_type ()))))))); gtk_menu_set_accel_group(nmenu->file_submenu-> file_menu, group); } while(0); | |||
510 | ATTACH_PARENT(menubar, gtkEdit, nmenu->edit_submenu->edit, group)do { nmenu->edit_submenu->edit = ((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((gtk_menu_item_new_with_mnemonic (messages_get("gtkEdit")))), ((gtk_menu_item_get_type ()))))) ); gtk_menu_shell_append(menubar, ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((nmenu->edit_submenu->edit)), ((gtk_widget_get_type ()))))))); gtk_widget_show(((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((nmenu->edit_submenu->edit)), ((gtk_widget_get_type ()))))))); gtk_menu_item_set_submenu(nmenu->edit_submenu-> edit, ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->edit_submenu->edit_menu)), ((gtk_widget_get_type ()))))))); gtk_menu_set_accel_group(nmenu->edit_submenu-> edit_menu, group); } while(0); | |||
511 | ATTACH_PARENT(menubar, gtkView, nmenu->view_submenu->view, group)do { nmenu->view_submenu->view = ((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((gtk_menu_item_new_with_mnemonic (messages_get("gtkView")))), ((gtk_menu_item_get_type ()))))) ); gtk_menu_shell_append(menubar, ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((nmenu->view_submenu->view)), ((gtk_widget_get_type ()))))))); gtk_widget_show(((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((nmenu->view_submenu->view)), ((gtk_widget_get_type ()))))))); gtk_menu_item_set_submenu(nmenu->view_submenu-> view, ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->view_submenu->view_menu)), ((gtk_widget_get_type ()))))))); gtk_menu_set_accel_group(nmenu->view_submenu-> view_menu, group); } while(0); | |||
512 | ATTACH_PARENT(menubar, gtkNavigate, nmenu->nav_submenu->nav, group)do { nmenu->nav_submenu->nav = ((((GtkMenuItem*) (void * ) g_type_check_instance_cast ((GTypeInstance*) ((gtk_menu_item_new_with_mnemonic (messages_get("gtkNavigate")))), ((gtk_menu_item_get_type ()) ))))); gtk_menu_shell_append(menubar, ((((GtkWidget*) (void * ) g_type_check_instance_cast ((GTypeInstance*) ((nmenu->nav_submenu ->nav)), ((gtk_widget_get_type ()))))))); gtk_widget_show( ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->nav_submenu->nav)), ((gtk_widget_get_type ( )))))))); gtk_menu_item_set_submenu(nmenu->nav_submenu-> nav, ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->nav_submenu->nav_menu)), ((gtk_widget_get_type ()))))))); gtk_menu_set_accel_group(nmenu->nav_submenu-> nav_menu, group); } while(0); | |||
513 | ATTACH_PARENT(menubar, gtkTools, nmenu->tools_submenu->tools, group)do { nmenu->tools_submenu->tools = ((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((gtk_menu_item_new_with_mnemonic (messages_get("gtkTools")))), ((gtk_menu_item_get_type ())))) )); gtk_menu_shell_append(menubar, ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((nmenu->tools_submenu->tools)), ((gtk_widget_get_type ()))))))); gtk_widget_show(((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((nmenu->tools_submenu->tools)), ((gtk_widget_get_type ()))))))); gtk_menu_item_set_submenu(nmenu->tools_submenu ->tools, ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((nmenu->tools_submenu->tools_menu)) , ((gtk_widget_get_type ()))))))); gtk_menu_set_accel_group(nmenu ->tools_submenu->tools_menu, group); } while(0); | |||
514 | ATTACH_PARENT(menubar, gtkHelp, nmenu->help_submenu->help, group)do { nmenu->help_submenu->help = ((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((gtk_menu_item_new_with_mnemonic (messages_get("gtkHelp")))), ((gtk_menu_item_get_type ()))))) ); gtk_menu_shell_append(menubar, ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((nmenu->help_submenu->help)), ((gtk_widget_get_type ()))))))); gtk_widget_show(((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((nmenu->help_submenu->help)), ((gtk_widget_get_type ()))))))); gtk_menu_item_set_submenu(nmenu->help_submenu-> help, ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->help_submenu->help_menu)), ((gtk_widget_get_type ()))))))); gtk_menu_set_accel_group(nmenu->help_submenu-> help_menu, group); } while(0); | |||
515 | } | |||
516 | ||||
517 | return nmenu; | |||
518 | } | |||
519 | ||||
520 | ||||
521 | /* exported function documented in gtk/menu.h */ | |||
522 | struct nsgtk_burger_menu *nsgtk_burger_menu_create(GtkAccelGroup *group) | |||
523 | { | |||
524 | struct nsgtk_burger_menu *nmenu; | |||
525 | ||||
526 | NEW_MENU(nmenu, burger)nmenu = malloc(sizeof(*nmenu)); if (nmenu == ((void*)0)) { return ((void*)0); } nmenu->burger_menu = ((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((gtk_menu_new( ))), ((gtk_menu_get_type ())))))); | |||
| ||||
527 | ||||
528 | IMAGE_ITEM(burger, file, gtkFile, nmenu, group)nsgtk_menu_add_image_item(nmenu->burger_menu, &(nmenu-> file_menuitem), "gtkFile", group); | |||
529 | SET_SUBMENU(file, nmenu)do { nmenu->file_submenu = nsgtk_menu_file_submenu(group); if ((nmenu->file_submenu != ((void*)0)) && (nmenu ->file_submenu->file_menu != ((void*)0)) && (nmenu ->file_menuitem != ((void*)0))) { gtk_menu_item_set_submenu (((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->file_menuitem)), ((gtk_menu_item_get_type ())) )))), ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->file_submenu->file_menu)), ((gtk_widget_get_type ()))))))); } } while(0); | |||
530 | ||||
531 | IMAGE_ITEM(burger, edit, gtkEdit, nmenu, group)nsgtk_menu_add_image_item(nmenu->burger_menu, &(nmenu-> edit_menuitem), "gtkEdit", group); | |||
532 | SET_SUBMENU(edit, nmenu)do { nmenu->edit_submenu = nsgtk_menu_edit_submenu(group); if ((nmenu->edit_submenu != ((void*)0)) && (nmenu ->edit_submenu->edit_menu != ((void*)0)) && (nmenu ->edit_menuitem != ((void*)0))) { gtk_menu_item_set_submenu (((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->edit_menuitem)), ((gtk_menu_item_get_type ())) )))), ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->edit_submenu->edit_menu)), ((gtk_widget_get_type ()))))))); } } while(0); | |||
533 | ||||
534 | IMAGE_ITEM(burger, view, gtkView, nmenu, group)nsgtk_menu_add_image_item(nmenu->burger_menu, &(nmenu-> view_menuitem), "gtkView", group); | |||
535 | SET_SUBMENU(view, nmenu)do { nmenu->view_submenu = nsgtk_menu_view_submenu(group); if ((nmenu->view_submenu != ((void*)0)) && (nmenu ->view_submenu->view_menu != ((void*)0)) && (nmenu ->view_menuitem != ((void*)0))) { gtk_menu_item_set_submenu (((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->view_menuitem)), ((gtk_menu_item_get_type ())) )))), ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->view_submenu->view_menu)), ((gtk_widget_get_type ()))))))); } } while(0); | |||
536 | ||||
537 | IMAGE_ITEM(burger, nav, gtkNavigate, nmenu, group)nsgtk_menu_add_image_item(nmenu->burger_menu, &(nmenu-> nav_menuitem), "gtkNavigate", group); | |||
538 | SET_SUBMENU(nav, nmenu)do { nmenu->nav_submenu = nsgtk_menu_nav_submenu(group); if ((nmenu->nav_submenu != ((void*)0)) && (nmenu-> nav_submenu->nav_menu != ((void*)0)) && (nmenu-> nav_menuitem != ((void*)0))) { gtk_menu_item_set_submenu((((( GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->nav_menuitem)), ((gtk_menu_item_get_type ()))) ))), ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->nav_submenu->nav_menu)), ((gtk_widget_get_type ()))))))); } } while(0); | |||
539 | ||||
540 | IMAGE_ITEM(burger, tools, gtkTools, nmenu, group)nsgtk_menu_add_image_item(nmenu->burger_menu, &(nmenu-> tools_menuitem), "gtkTools", group); | |||
541 | SET_SUBMENU(tools, nmenu)do { nmenu->tools_submenu = nsgtk_menu_tools_submenu(group ); if ((nmenu->tools_submenu != ((void*)0)) && (nmenu ->tools_submenu->tools_menu != ((void*)0)) && ( nmenu->tools_menuitem != ((void*)0))) { gtk_menu_item_set_submenu (((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->tools_menuitem)), ((gtk_menu_item_get_type ()) ))))), ((((GtkWidget*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((nmenu->tools_submenu->tools_menu)), ( (gtk_widget_get_type ()))))))); } } while(0); | |||
| ||||
542 | ||||
543 | IMAGE_ITEM(burger, help, gtkHelp, nmenu, group)nsgtk_menu_add_image_item(nmenu->burger_menu, &(nmenu-> help_menuitem), "gtkHelp", group); | |||
544 | SET_SUBMENU(help, nmenu)do { nmenu->help_submenu = nsgtk_menu_help_submenu(group); if ((nmenu->help_submenu != ((void*)0)) && (nmenu ->help_submenu->help_menu != ((void*)0)) && (nmenu ->help_menuitem != ((void*)0))) { gtk_menu_item_set_submenu (((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->help_menuitem)), ((gtk_menu_item_get_type ())) )))), ((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->help_submenu->help_menu)), ((gtk_widget_get_type ()))))))); } } while(0); | |||
545 | ||||
546 | return nmenu; | |||
547 | } | |||
548 | ||||
549 | ||||
550 | /* exported function documented in gtk/menu.h */ | |||
551 | struct nsgtk_popup_menu *nsgtk_popup_menu_create(GtkAccelGroup *group) | |||
552 | { | |||
553 | struct nsgtk_popup_menu *nmenu; | |||
554 | ||||
555 | NEW_MENU(nmenu, popup)nmenu = malloc(sizeof(*nmenu)); if (nmenu == ((void*)0)) { return ((void*)0); } nmenu->popup_menu = ((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((gtk_menu_new())), ((gtk_menu_get_type () )))))); | |||
556 | ||||
557 | IMAGE_ITEM(popup, back, gtkBack, nmenu, group)nsgtk_menu_add_image_item(nmenu->popup_menu, &(nmenu-> back_menuitem), "gtkBack", group); | |||
558 | IMAGE_ITEM(popup, forward, gtkForward, nmenu, group)nsgtk_menu_add_image_item(nmenu->popup_menu, &(nmenu-> forward_menuitem), "gtkForward", group); | |||
559 | IMAGE_ITEM(popup, stop, gtkStop, nmenu, group)nsgtk_menu_add_image_item(nmenu->popup_menu, &(nmenu-> stop_menuitem), "gtkStop", group); | |||
560 | IMAGE_ITEM(popup, reload, gtkReload, nmenu, group)nsgtk_menu_add_image_item(nmenu->popup_menu, &(nmenu-> reload_menuitem), "gtkReload", group); | |||
561 | ||||
562 | ADD_NAMED_SEP(popup, first, nmenu)do { nmenu->first_separator = gtk_separator_menu_item_new( ); if ((nmenu->first_separator != ((void*)0)) && ( nmenu->popup_menu != ((void*)0))) { gtk_menu_shell_append( ((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->popup_menu)), ((gtk_menu_shell_get_type ())))) )), nmenu->first_separator); gtk_widget_show(nmenu->first_separator ); } } while(0); | |||
563 | ||||
564 | IMAGE_ITEM(popup, cut, gtkCut, nmenu, group)nsgtk_menu_add_image_item(nmenu->popup_menu, &(nmenu-> cut_menuitem), "gtkCut", group); | |||
565 | IMAGE_ITEM(popup, copy, gtkCopy, nmenu, group)nsgtk_menu_add_image_item(nmenu->popup_menu, &(nmenu-> copy_menuitem), "gtkCopy", group); | |||
566 | IMAGE_ITEM(popup, paste, gtkPaste, nmenu, group)nsgtk_menu_add_image_item(nmenu->popup_menu, &(nmenu-> paste_menuitem), "gtkPaste", group); | |||
567 | ||||
568 | ADD_NAMED_SEP(popup, second, nmenu)do { nmenu->second_separator = gtk_separator_menu_item_new (); if ((nmenu->second_separator != ((void*)0)) && (nmenu->popup_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->popup_menu)), ((gtk_menu_shell_get_type ())))) )), nmenu->second_separator); gtk_widget_show(nmenu->second_separator ); } } while(0); | |||
569 | ||||
570 | IMAGE_ITEM(popup, toolbars, gtkToolbars, nmenu, group)nsgtk_menu_add_image_item(nmenu->popup_menu, &(nmenu-> toolbars_menuitem), "gtkToolbars", group); | |||
571 | SET_SUBMENU(toolbars, nmenu)do { nmenu->toolbars_submenu = nsgtk_menu_toolbars_submenu (group); if ((nmenu->toolbars_submenu != ((void*)0)) && (nmenu->toolbars_submenu->toolbars_menu != ((void*)0)) && (nmenu->toolbars_menuitem != ((void*)0))) { gtk_menu_item_set_submenu (((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->toolbars_menuitem)), ((gtk_menu_item_get_type ( ))))))), ((((GtkWidget*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((nmenu->toolbars_submenu->toolbars_menu )), ((gtk_widget_get_type ()))))))); } } while(0); | |||
572 | ||||
573 | IMAGE_ITEM(popup, tools, gtkTools, nmenu, group)nsgtk_menu_add_image_item(nmenu->popup_menu, &(nmenu-> tools_menuitem), "gtkTools", group); | |||
574 | SET_SUBMENU(tools, nmenu)do { nmenu->tools_submenu = nsgtk_menu_tools_submenu(group ); if ((nmenu->tools_submenu != ((void*)0)) && (nmenu ->tools_submenu->tools_menu != ((void*)0)) && ( nmenu->tools_menuitem != ((void*)0))) { gtk_menu_item_set_submenu (((((GtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->tools_menuitem)), ((gtk_menu_item_get_type ()) ))))), ((((GtkWidget*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((nmenu->tools_submenu->tools_menu)), ( (gtk_widget_get_type ()))))))); } } while(0); | |||
575 | ||||
576 | return nmenu; | |||
577 | } | |||
578 | ||||
579 | ||||
580 | /* exported function documented in gtk/menu.h */ | |||
581 | struct nsgtk_link_menu * | |||
582 | nsgtk_link_menu_create(GtkAccelGroup *group) | |||
583 | { | |||
584 | struct nsgtk_link_menu *nmenu; | |||
585 | ||||
586 | NEW_MENU(nmenu, link)nmenu = malloc(sizeof(*nmenu)); if (nmenu == ((void*)0)) { return ((void*)0); } nmenu->link_menu = ((((GtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((gtk_menu_new())), ((gtk_menu_get_type () )))))); | |||
587 | ||||
588 | IMAGE_ITEM(link, opentab, gtkOpentab, nmenu, group)nsgtk_menu_add_image_item(nmenu->link_menu, &(nmenu-> opentab_menuitem), "gtkOpentab", group); | |||
589 | IMAGE_ITEM(link, openwin, gtkOpenwin, nmenu, group)nsgtk_menu_add_image_item(nmenu->link_menu, &(nmenu-> openwin_menuitem), "gtkOpenwin", group); | |||
590 | ||||
591 | ADD_SEP(link, nmenu)do { GtkWidget *w = gtk_separator_menu_item_new(); if ((w != ( (void*)0)) && (nmenu->link_menu != ((void*)0))) { gtk_menu_shell_append (((((GtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((nmenu->link_menu)), ((gtk_menu_shell_get_type ()))))) ), w); gtk_widget_show(w); } } while(0); | |||
592 | ||||
593 | IMAGE_ITEM(link, save, gtkSavelink, nmenu, group)nsgtk_menu_add_image_item(nmenu->link_menu, &(nmenu-> save_menuitem), "gtkSavelink", group); | |||
594 | IMAGE_ITEM(link, bookmark, gtkBookmarklink, nmenu, group)nsgtk_menu_add_image_item(nmenu->link_menu, &(nmenu-> bookmark_menuitem), "gtkBookmarklink", group); | |||
595 | IMAGE_ITEM(link, copy, gtkCopylink, nmenu, group)nsgtk_menu_add_image_item(nmenu->link_menu, &(nmenu-> copy_menuitem), "gtkCopylink", group); | |||
596 | ||||
597 | return nmenu; | |||
598 | } | |||
599 | ||||
600 | ||||
601 | /* exported function documented in gtk/menu.h */ | |||
602 | nserror nsgtk_menu_bar_destroy(struct nsgtk_bar_submenu *menu) | |||
603 | { | |||
604 | gtk_widget_destroy(GTK_WIDGET(menu->bar_menu)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menu->bar_menu)), ((gtk_widget_get_type ()))))))); | |||
605 | ||||
606 | free(menu->file_submenu->export_submenu); | |||
607 | free(menu->file_submenu); | |||
608 | free(menu->edit_submenu); | |||
609 | free(menu->view_submenu->tabs_submenu); | |||
610 | free(menu->view_submenu->toolbars_submenu); | |||
611 | free(menu->view_submenu->scaleview_submenu); | |||
612 | free(menu->view_submenu); | |||
613 | free(menu->nav_submenu); | |||
614 | free(menu->tools_submenu->developer_submenu); | |||
615 | free(menu->tools_submenu); | |||
616 | free(menu->help_submenu); | |||
617 | free(menu); | |||
618 | ||||
619 | return NSERROR_OK; | |||
620 | } | |||
621 | ||||
622 | /* exported function documented in gtk/menu.h */ | |||
623 | nserror nsgtk_burger_menu_destroy(struct nsgtk_burger_menu *menu) | |||
624 | { | |||
625 | gtk_widget_destroy(GTK_WIDGET(menu->burger_menu)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menu->burger_menu)), ((gtk_widget_get_type ()))))))); | |||
626 | ||||
627 | free(menu->file_submenu->export_submenu); | |||
628 | free(menu->file_submenu); | |||
629 | free(menu->edit_submenu); | |||
630 | free(menu->view_submenu->tabs_submenu); | |||
631 | free(menu->view_submenu->toolbars_submenu); | |||
632 | free(menu->view_submenu->scaleview_submenu); | |||
633 | free(menu->view_submenu); | |||
634 | free(menu->nav_submenu); | |||
635 | free(menu->tools_submenu->developer_submenu); | |||
636 | free(menu->tools_submenu); | |||
637 | free(menu->help_submenu); | |||
638 | free(menu); | |||
639 | ||||
640 | return NSERROR_OK; | |||
641 | } | |||
642 | ||||
643 | ||||
644 | /* exported function documented in gtk/menu.h */ | |||
645 | nserror nsgtk_popup_menu_destroy(struct nsgtk_popup_menu *menu) | |||
646 | { | |||
647 | gtk_widget_destroy(GTK_WIDGET(menu->popup_menu)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menu->popup_menu)), ((gtk_widget_get_type ()))))))); | |||
648 | ||||
649 | free(menu->toolbars_submenu); | |||
650 | free(menu->tools_submenu->developer_submenu); | |||
651 | free(menu->tools_submenu); | |||
652 | free(menu); | |||
653 | ||||
654 | return NSERROR_OK; | |||
655 | } | |||
656 | ||||
657 | ||||
658 | /* exported function documented in gtk/menu.h */ | |||
659 | nserror nsgtk_link_menu_destroy(struct nsgtk_link_menu *menu) | |||
660 | { | |||
661 | gtk_widget_destroy(GTK_WIDGET(menu->link_menu)((((GtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menu->link_menu)), ((gtk_widget_get_type ()))))))); | |||
662 | ||||
663 | free(menu); | |||
664 | ||||
665 | return NSERROR_OK; | |||
666 | } |