From 4d72bb33995794f84cc59630fd7d5032cae2a566 Mon Sep 17 00:00:00 2001
From: Patrick McDermott <pj@pehjota.net>
Date: Tue, 26 Sep 2017 18:35:39 -0400
Subject: MqTabBody: Define macro to shorten long WK macros

---
diff --git a/src/tab-body.c b/src/tab-body.c
index ad2e2ac..0cc79c3 100644
--- a/src/tab-body.c
+++ b/src/tab-body.c
@@ -27,6 +27,9 @@
 #include "tab-body.h"
 #include "tab.h"
 
+#define WKCMA(ACTION) \
+	WEBKIT_CONTEXT_MENU_ACTION_##ACTION
+
 static void
 menu_open_link_activate_cb(GtkAction __attribute__((unused)) *action,
 	MqTabBody *body)
@@ -173,34 +176,34 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view,
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wswitch"
 		switch (stock_action) {
-			case WEBKIT_CONTEXT_MENU_ACTION_COPY:
+			case WKCMA(COPY):
 				is_selection = TRUE;
 				break;
-			case WEBKIT_CONTEXT_MENU_ACTION_INPUT_METHODS:
-			case WEBKIT_CONTEXT_MENU_ACTION_UNICODE:
+			case WKCMA(INPUT_METHODS):
+			case WKCMA(UNICODE):
 				input_items = g_list_prepend(input_items,
 					items->data);
 				break;
-			case WEBKIT_CONTEXT_MENU_ACTION_SPELLING_GUESS:
-			case WEBKIT_CONTEXT_MENU_ACTION_NO_GUESSES_FOUND:
-			case WEBKIT_CONTEXT_MENU_ACTION_IGNORE_SPELLING:
-			case WEBKIT_CONTEXT_MENU_ACTION_LEARN_SPELLING:
-			case WEBKIT_CONTEXT_MENU_ACTION_IGNORE_GRAMMAR:
+			case WKCMA(SPELLING_GUESS):
+			case WKCMA(NO_GUESSES_FOUND):
+			case WKCMA(IGNORE_SPELLING):
+			case WKCMA(LEARN_SPELLING):
+			case WKCMA(IGNORE_GRAMMAR):
 				spell_items = g_list_prepend(spell_items,
 					items->data);
 				break;
-			case WEBKIT_CONTEXT_MENU_ACTION_OPEN_VIDEO_IN_NEW_WINDOW:
-			case WEBKIT_CONTEXT_MENU_ACTION_COPY_VIDEO_LINK_TO_CLIPBOARD:
-			case WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_VIDEO_TO_DISK:
+			case WKCMA(OPEN_VIDEO_IN_NEW_WINDOW):
+			case WKCMA(COPY_VIDEO_LINK_TO_CLIPBOARD):
+			case WKCMA(DOWNLOAD_VIDEO_TO_DISK):
 				is_video = TRUE;
 				break;
-			case WEBKIT_CONTEXT_MENU_ACTION_OPEN_AUDIO_IN_NEW_WINDOW:
-			case WEBKIT_CONTEXT_MENU_ACTION_COPY_AUDIO_LINK_TO_CLIPBOARD:
-			case WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_AUDIO_TO_DISK:
+			case WKCMA(OPEN_AUDIO_IN_NEW_WINDOW):
+			case WKCMA(COPY_AUDIO_LINK_TO_CLIPBOARD):
+			case WKCMA(DOWNLOAD_AUDIO_TO_DISK):
 				is_video = FALSE;
 				break;
-			case WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PLAY:
-			case WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PAUSE:
+			case WKCMA(MEDIA_PLAY):
+			case WKCMA(MEDIA_PAUSE):
 				break;
 		}
 #pragma GCC diagnostic pop
--
cgit v0.9.1