summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tab-body.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/tab-body.c b/src/tab-body.c
index 1feafc0..07dfcab 100644
--- a/src/tab-body.c
+++ b/src/tab-body.c
@@ -74,20 +74,18 @@ menu_open_image_win_activate_cb(GtkAction __attribute__((unused)) *action,
g_print("Open Image in New Window\n");
}
-#define ITEM_BEGIN_DECLS \
+#define ITEM_DECLS \
GtkAction *action; \
- WebKitContextMenuItem *menu_item; \
- /* Don't blame me; blame WebKitGTK+ for using GtkAction. */ \
- _Pragma("GCC diagnostic push") \
- _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
-#define ITEM_BEGIN_DECLS_NO_CUSTOM \
- WebKitContextMenuItem *menu_item; \
- _Pragma("GCC diagnostic push")
-#define ITEM_END_DECLS \
- _Pragma("GCC diagnostic pop")
+ WebKitContextMenuItem *menu_item;
+#define ITEM_DECLS_NO_CUSTOM \
+ WebKitContextMenuItem *menu_item;
#define NEW_CUSTOM_ITEM(NAME, LABEL) \
do { \
+ /* Don't blame me; blame WebKitGTK+ for using GtkAction. */ \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
action = gtk_action_new(#NAME, (LABEL), NULL, NULL); \
+ _Pragma("GCC diagnostic pop") \
g_signal_connect(action, "activate", \
G_CALLBACK(menu_##NAME##_activate_cb), body); \
menu_item = webkit_context_menu_item_new(action); \
@@ -103,21 +101,19 @@ menu_open_image_win_activate_cb(GtkAction __attribute__((unused)) *action,
static void
context_menu_link_cb(WebKitContextMenu *context_menu, MqTabBody *body)
{
- ITEM_BEGIN_DECLS
+ ITEM_DECLS
NEW_CUSTOM_ITEM(open_link, "Open Link");
NEW_CUSTOM_ITEM(open_link_tab, "Open Link in New Tab");
NEW_CUSTOM_ITEM(open_link_win, "Open Link in New Window");
NEW_STOCK_ITEM(DOWNLOAD_LINK_TO_DISK); /* Download Linked File */
NEW_STOCK_ITEM(COPY_LINK_TO_CLIPBOARD); /* Copy Link Location */
-
- ITEM_END_DECLS
}
static void
context_menu_image_cb(WebKitContextMenu *context_menu, MqTabBody *body)
{
- ITEM_BEGIN_DECLS
+ ITEM_DECLS
NEW_CUSTOM_ITEM(open_image, "Open Image");
NEW_CUSTOM_ITEM(open_image_tab, "Open Image in New Tab");
@@ -125,14 +121,12 @@ context_menu_image_cb(WebKitContextMenu *context_menu, MqTabBody *body)
NEW_STOCK_ITEM(DOWNLOAD_IMAGE_TO_DISK); /* Save Image As */
NEW_STOCK_ITEM(COPY_IMAGE_TO_CLIPBOARD); /* Copy Image */
NEW_STOCK_ITEM(COPY_IMAGE_URL_TO_CLIPBOARD); /* Copy Image Address */
-
- ITEM_END_DECLS
}
static void
context_menu_document_cb(WebKitContextMenu *context_menu, MqTabBody *body)
{
- ITEM_BEGIN_DECLS_NO_CUSTOM
+ ITEM_DECLS_NO_CUSTOM
NEW_STOCK_ITEM(GO_BACK); /* Back */
NEW_STOCK_ITEM(GO_FORWARD); /* Forward */
@@ -142,8 +136,6 @@ context_menu_document_cb(WebKitContextMenu *context_menu, MqTabBody *body)
NEW_STOCK_ITEM(SELECT_ALL); /* Select All */
NEW_STOCK_ITEM(NO_ACTION); /* --- */
/* View Page Source */
-
- ITEM_END_DECLS
}
static gboolean