summaryrefslogtreecommitdiff
path: root/frontends/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/gtk')
-rw-r--r--frontends/gtk/scaffolding.c24
-rw-r--r--frontends/gtk/toolbar.c4
-rw-r--r--frontends/gtk/toolbar_items.h107
3 files changed, 69 insertions, 66 deletions
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index 350d5a986..7432812c8 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -459,8 +459,8 @@ nsgtk_window_tabs_remove(GtkNotebook *notebook,
/**
* handle menu activate signals by calling toolbar item activation
*/
-#define TOOLBAR_ITEM_y(identifier, name) \
-static gboolean \
+#define TOOLBAR_ITEM_y(identifier, name) \
+ static gboolean \
nsgtk_on_##name##_activate_menu(GtkMenuItem *widget, gpointer data) \
{ \
struct nsgtk_scaffolding *gs = (struct nsgtk_scaffolding *)data;\
@@ -468,8 +468,8 @@ nsgtk_on_##name##_activate_menu(GtkMenuItem *widget, gpointer data) \
return TRUE; \
}
#define TOOLBAR_ITEM_n(identifier, name)
-#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate) \
- TOOLBAR_ITEM_ ## activate(identifier, name)
+#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, pass) \
+ TOOLBAR_ITEM_ ## pass(identifier, name)
#include "gtk/toolbar_items.h"
#undef TOOLBAR_ITEM_y
#undef TOOLBAR_ITEM_n
@@ -881,40 +881,42 @@ create_scaffolding_link_menu(struct nsgtk_scaffolding *g, GtkAccelGroup *group)
*/
static nserror nsgtk_menu_initialise(struct nsgtk_scaffolding *g)
{
-#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate) \
- g->menus[identifier].sensitivity = snstvty;
+#define TOOLBAR_ITEM_y(identifier, name) \
+ g->menus[identifier].mhandler = nsgtk_on_##name##_activate_menu;
+#define TOOLBAR_ITEM_n(identifier, name) \
+ g->menus[identifier].mhandler = NULL;
+#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, pass) \
+ g->menus[identifier].sensitivity = snstvty; \
+ TOOLBAR_ITEM_ ## activate(identifier, name)
#include "gtk/toolbar_items.h"
+#undef TOOLBAR_ITEM_y
+#undef TOOLBAR_ITEM_n
#undef TOOLBAR_ITEM
/* items on menubar, burger */
#define ITEM_MAIN(p, q, r) \
- g->menus[p##_BUTTON].mhandler = nsgtk_on_##r##_activate_menu; \
g->menus[p##_BUTTON].main = g->menu_bar->q->r##_menuitem; \
g->menus[p##_BUTTON].burger = g->burger_menu->q->r##_menuitem
/* submenu items on menubar, burger */
#define ITEM_SUB(p, q, r, s) \
- g->menus[p##_BUTTON].mhandler = nsgtk_on_##s##_activate_menu; \
g->menus[p##_BUTTON].main = g->menu_bar->q->r##_submenu->s##_menuitem;\
g->menus[p##_BUTTON].burger = g->burger_menu->q->r##_submenu->s##_menuitem
/* items on menubar, burger and context popup */
#define ITEM_POP(p, q, r) \
- g->menus[p##_BUTTON].mhandler = nsgtk_on_##r##_activate_menu; \
g->menus[p##_BUTTON].main = g->menu_bar->q->r##_menuitem; \
g->menus[p##_BUTTON].burger = g->burger_menu->q->r##_menuitem; \
g->menus[p##_BUTTON].popup = g->popup_menu->r##_menuitem
/* items on menubar, burger and context popup */
#define ITEM_MAINPOP(p, q, r) \
- g->menus[p##_BUTTON].mhandler = nsgtk_on_##r##_activate_menu; \
g->menus[p##_BUTTON].main = g->menu_bar->q->r##_menuitem; \
g->menus[p##_BUTTON].burger = g->burger_menu->q->r##_menuitem; \
g->menus[p##_BUTTON].popup = g->popup_menu->q->r##_menuitem
/* sub submenu items on menubar, burger and context popup */
#define ITEM_SUBPOP(p, q, r, s) \
- g->menus[p##_BUTTON].mhandler = nsgtk_on_##s##_activate_menu; \
g->menus[p##_BUTTON].main = g->menu_bar->q->r##_submenu->s##_menuitem;\
g->menus[p##_BUTTON].burger = g->burger_menu->q->r##_submenu->s##_menuitem; \
g->menus[p##_BUTTON].popup = g->popup_menu->q->r##_submenu->s##_menuitem
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 02097ea13..aa5585bb4 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -202,7 +202,7 @@ int nsgtk_toolbar_get_id_from_widget(GtkWidget *widget, struct nsgtk_scaffolding
/* define data plus and data minus handlers */
-#define TOOLBAR_ITEM(identifier, name, sensitivity, clicked, activate) \
+#define TOOLBAR_ITEM(identifier, name, sensitivity, clicked, activate, pass)\
static gboolean \
nsgtk_toolbar_##name##_data_plus(GtkWidget *widget, \
GdkDragContext *cont, \
@@ -3300,7 +3300,7 @@ toolbar_item_create(nsgtk_toolbar_button id,
item->bhandler = name##_button_clicked_cb;
#define TOOLBAR_ITEM_n(name) \
item->bhandler = NULL;
-#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate) \
+#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, pass)\
case identifier: \
item->sensitivity = snstvty; \
item->dataplus = nsgtk_toolbar_##name##_data_plus; \
diff --git a/frontends/gtk/toolbar_items.h b/frontends/gtk/toolbar_items.h
index 0de276f2a..ae5c6bb07 100644
--- a/frontends/gtk/toolbar_items.h
+++ b/frontends/gtk/toolbar_items.h
@@ -83,66 +83,67 @@ typedef enum {
* name
* initial sensitivity
* if there is a toolbar click signal handler
+ * if there is a menu activate signal handler
* if the menu activate signal handler calls the toolbar click handler
*/
#ifndef TOOLBAR_ITEM
-#define TOOLBAR_ITEM(a, b, c, d, e)
+#define TOOLBAR_ITEM(a, b, c, d, e, f)
#define TOOLBAR_ITEM_SET
#endif
-TOOLBAR_ITEM(BACK_BUTTON, back, false, y, y)
-TOOLBAR_ITEM(HISTORY_BUTTON, history, true, y, n)
-TOOLBAR_ITEM(FORWARD_BUTTON, forward, false, y, y)
-TOOLBAR_ITEM(STOP_BUTTON, stop, false, y, y)
-TOOLBAR_ITEM(RELOAD_BUTTON, reload, true, y, y)
-TOOLBAR_ITEM(HOME_BUTTON, home, true, y, y)
-TOOLBAR_ITEM(URL_BAR_ITEM, url_bar, true, n, n)
-TOOLBAR_ITEM(WEBSEARCH_ITEM, websearch, true, n, n)
-TOOLBAR_ITEM(THROBBER_ITEM, throbber, true, n, n)
-TOOLBAR_ITEM(NEWWINDOW_BUTTON, newwindow, true, y, y)
-TOOLBAR_ITEM(NEWTAB_BUTTON, newtab, true, y, y)
-TOOLBAR_ITEM(OPENFILE_BUTTON, openfile, true, y, y)
-TOOLBAR_ITEM(CLOSETAB_BUTTON, closetab, false, n, n)
-TOOLBAR_ITEM(CLOSEWINDOW_BUTTON, closewindow, true, y, y)
-TOOLBAR_ITEM(SAVEPAGE_BUTTON, savepage, true, y, y)
-TOOLBAR_ITEM(PDF_BUTTON, pdf, false, y, y)
-TOOLBAR_ITEM(PLAINTEXT_BUTTON, plaintext, true, y, y)
-TOOLBAR_ITEM(DRAWFILE_BUTTON, drawfile, false, n, n)
-TOOLBAR_ITEM(POSTSCRIPT_BUTTON, postscript, false, n, n)
-TOOLBAR_ITEM(PRINTPREVIEW_BUTTON, printpreview, false, n, y)
-TOOLBAR_ITEM(PRINT_BUTTON, print, true, y, y)
-TOOLBAR_ITEM(QUIT_BUTTON, quit, true, y, y)
-TOOLBAR_ITEM(CUT_BUTTON, cut, true, y, y)
-TOOLBAR_ITEM(COPY_BUTTON, copy, true, y, y)
-TOOLBAR_ITEM(PASTE_BUTTON, paste, true, y, y)
-TOOLBAR_ITEM(DELETE_BUTTON, delete, false, y, y)
-TOOLBAR_ITEM(SELECTALL_BUTTON, selectall, true, y, y)
-TOOLBAR_ITEM(FIND_BUTTON, find, true, n, n)
-TOOLBAR_ITEM(PREFERENCES_BUTTON, preferences, true, y, y)
-TOOLBAR_ITEM(ZOOMPLUS_BUTTON, zoomplus, true, y, y)
-TOOLBAR_ITEM(ZOOMMINUS_BUTTON, zoomminus, true, y, y)
-TOOLBAR_ITEM(ZOOMNORMAL_BUTTON, zoomnormal, true, y, y)
-TOOLBAR_ITEM(FULLSCREEN_BUTTON, fullscreen, true, y, y)
-TOOLBAR_ITEM(VIEWSOURCE_BUTTON, viewsource, true, y, y)
-TOOLBAR_ITEM(DOWNLOADS_BUTTON, downloads, true, y, y)
-TOOLBAR_ITEM(SAVEWINDOWSIZE_BUTTON, savewindowsize, true, y, y)
-TOOLBAR_ITEM(TOGGLEDEBUGGING_BUTTON, toggledebugging, true, y, y)
-TOOLBAR_ITEM(SAVEBOXTREE_BUTTON, debugboxtree, true, y, y)
-TOOLBAR_ITEM(SAVEDOMTREE_BUTTON, debugdomtree, true, y, y)
-TOOLBAR_ITEM(LOCALHISTORY_BUTTON, localhistory, true, y, y)
-TOOLBAR_ITEM(GLOBALHISTORY_BUTTON, globalhistory, true, y, y)
-TOOLBAR_ITEM(ADDBOOKMARKS_BUTTON, addbookmarks, true, y, y)
-TOOLBAR_ITEM(SHOWBOOKMARKS_BUTTON, showbookmarks, true, y, y)
-TOOLBAR_ITEM(SHOWCOOKIES_BUTTON, showcookies, true, y, y)
-TOOLBAR_ITEM(OPENLOCATION_BUTTON, openlocation, true, y, y)
-TOOLBAR_ITEM(NEXTTAB_BUTTON, nexttab, false, n, n)
-TOOLBAR_ITEM(PREVTAB_BUTTON, prevtab, false, n, n)
-TOOLBAR_ITEM(CONTENTS_BUTTON, contents, true, y, y)
-TOOLBAR_ITEM(GUIDE_BUTTON, guide, true, y, y)
-TOOLBAR_ITEM(INFO_BUTTON, info, true, y, y)
-TOOLBAR_ITEM(ABOUT_BUTTON, about, true, y, y)
-TOOLBAR_ITEM(OPENMENU_BUTTON, openmenu, true, y, n)
+TOOLBAR_ITEM(BACK_BUTTON, back, false, y, y, y)
+TOOLBAR_ITEM(HISTORY_BUTTON, history, true, y, n, n)
+TOOLBAR_ITEM(FORWARD_BUTTON, forward, false, y, y, y)
+TOOLBAR_ITEM(STOP_BUTTON, stop, false, y, y, y)
+TOOLBAR_ITEM(RELOAD_BUTTON, reload, true, y, y, y)
+TOOLBAR_ITEM(HOME_BUTTON, home, true, y, y, y)
+TOOLBAR_ITEM(URL_BAR_ITEM, url_bar, true, n, n, n)
+TOOLBAR_ITEM(WEBSEARCH_ITEM, websearch, true, n, n, n)
+TOOLBAR_ITEM(THROBBER_ITEM, throbber, true, n, n, n)
+TOOLBAR_ITEM(NEWWINDOW_BUTTON, newwindow, true, y, y, y)
+TOOLBAR_ITEM(NEWTAB_BUTTON, newtab, true, y, y, y)
+TOOLBAR_ITEM(OPENFILE_BUTTON, openfile, true, y, y, y)
+TOOLBAR_ITEM(CLOSETAB_BUTTON, closetab, false, n, y, n)
+TOOLBAR_ITEM(CLOSEWINDOW_BUTTON, closewindow, true, y, y, y)
+TOOLBAR_ITEM(SAVEPAGE_BUTTON, savepage, true, y, y, y)
+TOOLBAR_ITEM(PDF_BUTTON, pdf, false, y, y, y)
+TOOLBAR_ITEM(PLAINTEXT_BUTTON, plaintext, true, y, y, y)
+TOOLBAR_ITEM(DRAWFILE_BUTTON, drawfile, false, n, n, n)
+TOOLBAR_ITEM(POSTSCRIPT_BUTTON, postscript, false, n, n, n)
+TOOLBAR_ITEM(PRINTPREVIEW_BUTTON, printpreview, false, n, y, y)
+TOOLBAR_ITEM(PRINT_BUTTON, print, true, y, y, y)
+TOOLBAR_ITEM(QUIT_BUTTON, quit, true, y, y, y)
+TOOLBAR_ITEM(CUT_BUTTON, cut, true, y, y, y)
+TOOLBAR_ITEM(COPY_BUTTON, copy, true, y, y, y)
+TOOLBAR_ITEM(PASTE_BUTTON, paste, true, y, y, y)
+TOOLBAR_ITEM(DELETE_BUTTON, delete, false, y, y, y)
+TOOLBAR_ITEM(SELECTALL_BUTTON, selectall, true, y, y, y)
+TOOLBAR_ITEM(FIND_BUTTON, find, true, n, y, n)
+TOOLBAR_ITEM(PREFERENCES_BUTTON, preferences, true, y, y, y)
+TOOLBAR_ITEM(ZOOMPLUS_BUTTON, zoomplus, true, y, y, y)
+TOOLBAR_ITEM(ZOOMMINUS_BUTTON, zoomminus, true, y, y, y)
+TOOLBAR_ITEM(ZOOMNORMAL_BUTTON, zoomnormal, true, y, y, y)
+TOOLBAR_ITEM(FULLSCREEN_BUTTON, fullscreen, true, y, y, y)
+TOOLBAR_ITEM(VIEWSOURCE_BUTTON, viewsource, true, y, y, y)
+TOOLBAR_ITEM(DOWNLOADS_BUTTON, downloads, true, y, y, y)
+TOOLBAR_ITEM(SAVEWINDOWSIZE_BUTTON, savewindowsize, true, y, y, y)
+TOOLBAR_ITEM(TOGGLEDEBUGGING_BUTTON, toggledebugging, true, y, y, y)
+TOOLBAR_ITEM(SAVEBOXTREE_BUTTON, debugboxtree, true, y, y, y)
+TOOLBAR_ITEM(SAVEDOMTREE_BUTTON, debugdomtree, true, y, y, y)
+TOOLBAR_ITEM(LOCALHISTORY_BUTTON, localhistory, true, y, y, y)
+TOOLBAR_ITEM(GLOBALHISTORY_BUTTON, globalhistory, true, y, y, y)
+TOOLBAR_ITEM(ADDBOOKMARKS_BUTTON, addbookmarks, true, y, y, y)
+TOOLBAR_ITEM(SHOWBOOKMARKS_BUTTON, showbookmarks, true, y, y, y)
+TOOLBAR_ITEM(SHOWCOOKIES_BUTTON, showcookies, true, y, y, y)
+TOOLBAR_ITEM(OPENLOCATION_BUTTON, openlocation, true, y, y, y)
+TOOLBAR_ITEM(NEXTTAB_BUTTON, nexttab, false, n, y, n)
+TOOLBAR_ITEM(PREVTAB_BUTTON, prevtab, false, n, y, n)
+TOOLBAR_ITEM(CONTENTS_BUTTON, contents, true, y, y, y)
+TOOLBAR_ITEM(GUIDE_BUTTON, guide, true, y, y, y)
+TOOLBAR_ITEM(INFO_BUTTON, info, true, y, y, y)
+TOOLBAR_ITEM(ABOUT_BUTTON, about, true, y, y, y)
+TOOLBAR_ITEM(OPENMENU_BUTTON, openmenu, true, y, n, n)
#ifdef TOOLBAR_ITEM_SET
#undef TOOLBAR_ITEM