From 27d1910dc994cc7c2a08125bf05b09a8c909ee55 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 07 Oct 2017 15:09:26 -0400 Subject: MqTabBody: Restore spelling items in context menu Also, split spelling suggestions from Ignore Spelling and Learn Spelling items. --- (limited to 'src') diff --git a/src/tab-body.c b/src/tab-body.c index 229e303..843fe5b 100644 --- a/src/tab-body.c +++ b/src/tab-body.c @@ -238,16 +238,21 @@ context_menu_media_cb(WebKitContextMenu *context_menu, GList *media_ctrl_items, } static void -context_menu_editable_cb(WebKitContextMenu *context_menu, GList *edit_items, +context_menu_editable_cb(WebKitContextMenu *context_menu, + GList *spell_repl_items, GList *spell_ctrl_items, GList *edit_items, GList *input_items, MqTabBody __attribute__((unused)) *body) { ITEM_DECLS_NO_CUSTOM - RESTORE_ITEMS(edit_items); /* Cu_t, _Copy, _Paste, _Delete */ - NEW_SEPARATOR_ITEM(); /* --- */ - NEW_STOCK_ITEM(SELECT_ALL); /* Select _All */ - NEW_SEPARATOR_ITEM(); /* --- */ - RESTORE_ITEMS(input_items); /* _Insert Unicode Character */ + RESTORE_ITEMS(spell_repl_items); /* Spelling suggestions */ + NEW_SEPARATOR_ITEM(); /* --- */ + RESTORE_ITEMS(spell_ctrl_items); /* _Ignore Spelling, _Learn Spelling */ + NEW_SEPARATOR_ITEM(); /* --- */ + RESTORE_ITEMS(edit_items); /* Cu_t, _Copy, _Paste, _Delete */ + NEW_SEPARATOR_ITEM(); /* --- */ + NEW_STOCK_ITEM(SELECT_ALL); /* Select _All */ + NEW_SEPARATOR_ITEM(); /* --- */ + RESTORE_ITEMS(input_items); /* _Insert Unicode Character */ } static void context_menu_document_cb(WebKitContextMenu *context_menu, GList *nav_items, @@ -278,7 +283,8 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view, GList *nav_items; GList *edit_items; GList *input_items; - GList *spell_items; + GList *spell_repl_items; + GList *spell_ctrl_items; GList *media_ctrl_items; GList *media_toggle_items; gboolean is_selection; @@ -296,7 +302,8 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view, nav_items = NULL; edit_items = NULL; input_items = NULL; - spell_items = NULL; + spell_repl_items = NULL; + spell_ctrl_items = NULL; media_ctrl_items = NULL; media_toggle_items = NULL; is_selection = FALSE; @@ -328,10 +335,12 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view, break; case WKCMA(SPELLING_GUESS): case WKCMA(NO_GUESSES_FOUND): + PRESERVE_ITEM(spell_repl_items); + break; case WKCMA(IGNORE_SPELLING): case WKCMA(LEARN_SPELLING): case WKCMA(IGNORE_GRAMMAR): - PRESERVE_ITEM(spell_items); + PRESERVE_ITEM(spell_ctrl_items); break; case WKCMA(OPEN_VIDEO_IN_NEW_WINDOW): case WKCMA(COPY_VIDEO_LINK_TO_CLIPBOARD): @@ -359,7 +368,8 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view, nav_items = g_list_reverse(nav_items); edit_items = g_list_reverse(edit_items); input_items = g_list_reverse(input_items); - spell_items = g_list_reverse(spell_items); + spell_repl_items = g_list_reverse(spell_repl_items); + spell_ctrl_items = g_list_reverse(spell_ctrl_items); media_ctrl_items = g_list_reverse(media_ctrl_items); media_toggle_items = g_list_reverse(media_toggle_items); @@ -394,8 +404,8 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view, context_handled = TRUE; } if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) { - context_menu_editable_cb(context_menu, edit_items, input_items, - body); + context_menu_editable_cb(context_menu, spell_repl_items, + spell_ctrl_items, edit_items, input_items, body); context_handled = TRUE; } if (!context_handled && -- cgit v0.9.1