diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-09-26 18:40:15 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-09-26 18:40:15 (EDT) |
commit | ba12edabbd690d249985991a61dec39ce5081eb2 (patch) | |
tree | 0c92b5a0a0443630c9a82847fb6b8c16f8e6c6e5 | |
parent | a978ca48df2fa14be4d8fba318ff8f44cccc1945 (diff) | |
download | marquee-ba12edabbd690d249985991a61dec39ce5081eb2.zip marquee-ba12edabbd690d249985991a61dec39ce5081eb2.tar.gz marquee-ba12edabbd690d249985991a61dec39ce5081eb2.tar.bz2 |
MqTabBody: Better localize diagnostic pragmas
-rw-r--r-- | src/tab-body.c | 30 |
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 |