diff --git a/src/dialogs/menu.c b/src/dialogs/menu.c index 5eff89c3..aa81e26a 100644 --- a/src/dialogs/menu.c +++ b/src/dialogs/menu.c @@ -216,7 +216,7 @@ unhistory_menu(struct terminal *term, void *xxx, void *ses_) void tab_menu(struct session *ses, int x, int y, int place_above_cursor) { - /* [gettext_accelerator_context(tab_menu.uri_frame, tab_menu.uri_link, tab_menu.uri_tab)] */ + /* [gettext_accelerator_context(tab_menu)] */ struct menu_item *menu; int tabs; #ifdef CONFIG_BOOKMARKS @@ -247,7 +247,8 @@ tab_menu(struct session *ses, int x, int y, int place_above_cursor) if (ses->doc_view && document_has_frames(ses->doc_view->document)) { add_menu_action(&menu, N_("Frame at ~full-screen"), ACT_MAIN_FRAME_MAXIMIZE); - add_uri_command_to_menu(&menu, PASS_URI_FRAME); + add_uri_command_to_menu(&menu, PASS_URI_FRAME, + N_("~Pass frame URI to external command")); } } @@ -272,8 +273,10 @@ tab_menu(struct session *ses, int x, int y, int place_above_cursor) #endif } - if (have_location(ses)) - add_uri_command_to_menu(&menu, PASS_URI_TAB); + if (have_location(ses)) { + add_uri_command_to_menu(&menu, PASS_URI_TAB, + N_("Pass tab URI to e~xternal command")); + } /* Adjust the menu position taking the menu frame into account */ if (place_above_cursor) { @@ -869,37 +872,30 @@ pass_uri_to_command(struct session *ses, struct document_view *doc_view, return FRAME_EVENT_OK; } +/* The caller provides the text of the menu item, so that it can + * choose an available accelerator key. */ void -add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type) +add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type, + unsigned char *text) { struct list_head *tree = get_opt_tree("document.uri_passing"); struct option *option; int commands = 0; enum menu_item_flags flags = NO_FLAG; action_id_T action_id; - unsigned char *text; switch (type) { case PASS_URI_FRAME: - /* [gettext_accelerator_context(tab_menu.uri_frame)] */ action_id = ACT_MAIN_FRAME_EXTERNAL_COMMAND; - text = N_("~Pass frame URI to external command"); - /* [gettext_accelerator_context()] */ break; case PASS_URI_LINK: - /* [gettext_accelerator_context(tab_menu.uri_link)] */ action_id = ACT_MAIN_LINK_EXTERNAL_COMMAND; - text = N_("Pass link URI to e~xternal command"); - /* [gettext_accelerator_context()] */ break; default: case PASS_URI_TAB: - /* [gettext_accelerator_context(tab_menu.uri_tab)] */ action_id = ACT_MAIN_TAB_EXTERNAL_COMMAND; - text = N_("Pass tab URI to e~xternal command"); - /* [gettext_accelerator_context()] */ }; foreach (option, *tree) { diff --git a/src/dialogs/menu.h b/src/dialogs/menu.h index e59c27d6..4d0077bd 100644 --- a/src/dialogs/menu.h +++ b/src/dialogs/menu.h @@ -51,7 +51,7 @@ enum pass_uri_type { PASS_URI_TAB, }; -void add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type); +void add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type, unsigned char *text); enum frame_event_status pass_uri_to_command(struct session *ses, struct document_view *doc_view, int /* enum pass_uri_type */ type); void diff --git a/src/viewer/text/link.c b/src/viewer/text/link.c index d9a0617d..3e10d6fe 100644 --- a/src/viewer/text/link.c +++ b/src/viewer/text/link.c @@ -1254,7 +1254,8 @@ link_menu(struct terminal *term, void *xxx, void *ses_) add_menu_action(&mi, N_("~Add link to bookmarks"), ACT_MAIN_ADD_BOOKMARK_LINK); #endif - add_uri_command_to_menu(&mi, PASS_URI_LINK); + add_uri_command_to_menu(&mi, PASS_URI_LINK, + N_("Pass link URI to e~xternal command")); } /* [gettext_accelerator_context()] */ }