mirror of
https://github.com/rkd77/elinks.git
synced 2025-06-30 22:19:29 -04:00
accel-check: add_uri_command_to_menu now wants the title as a parameter.
Thus, each caller must now choose the accelerator key and declare the accelerator contexts (i.e. menus) to which it may add the command. Also, use only one context for tab_menu. These changes fix the following bugs in accelerator conflict detection: * "~Pass frame URI to external command" may be displayed together with "Pass tab URI to e~xternal command", but that was not declared. * "Pass link URI to e~xternal command" was declared as being in the tab menu, but it is actually displayed in the link menu.
This commit is contained in:
parent
defafbd202
commit
8fc8a00844
@ -216,7 +216,7 @@ unhistory_menu(struct terminal *term, void *xxx, void *ses_)
|
|||||||
void
|
void
|
||||||
tab_menu(struct session *ses, int x, int y, int place_above_cursor)
|
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;
|
struct menu_item *menu;
|
||||||
int tabs;
|
int tabs;
|
||||||
#ifdef CONFIG_BOOKMARKS
|
#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)) {
|
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_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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_location(ses))
|
if (have_location(ses)) {
|
||||||
add_uri_command_to_menu(&menu, PASS_URI_TAB);
|
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 */
|
/* Adjust the menu position taking the menu frame into account */
|
||||||
if (place_above_cursor) {
|
if (place_above_cursor) {
|
||||||
@ -869,37 +872,30 @@ pass_uri_to_command(struct session *ses, struct document_view *doc_view,
|
|||||||
return FRAME_EVENT_OK;
|
return FRAME_EVENT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The caller provides the text of the menu item, so that it can
|
||||||
|
* choose an available accelerator key. */
|
||||||
void
|
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 list_head *tree = get_opt_tree("document.uri_passing");
|
||||||
struct option *option;
|
struct option *option;
|
||||||
int commands = 0;
|
int commands = 0;
|
||||||
enum menu_item_flags flags = NO_FLAG;
|
enum menu_item_flags flags = NO_FLAG;
|
||||||
action_id_T action_id;
|
action_id_T action_id;
|
||||||
unsigned char *text;
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PASS_URI_FRAME:
|
case PASS_URI_FRAME:
|
||||||
/* [gettext_accelerator_context(tab_menu.uri_frame)] */
|
|
||||||
action_id = ACT_MAIN_FRAME_EXTERNAL_COMMAND;
|
action_id = ACT_MAIN_FRAME_EXTERNAL_COMMAND;
|
||||||
text = N_("~Pass frame URI to external command");
|
|
||||||
/* [gettext_accelerator_context()] */
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PASS_URI_LINK:
|
case PASS_URI_LINK:
|
||||||
/* [gettext_accelerator_context(tab_menu.uri_link)] */
|
|
||||||
action_id = ACT_MAIN_LINK_EXTERNAL_COMMAND;
|
action_id = ACT_MAIN_LINK_EXTERNAL_COMMAND;
|
||||||
text = N_("Pass link URI to e~xternal command");
|
|
||||||
/* [gettext_accelerator_context()] */
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case PASS_URI_TAB:
|
case PASS_URI_TAB:
|
||||||
/* [gettext_accelerator_context(tab_menu.uri_tab)] */
|
|
||||||
action_id = ACT_MAIN_TAB_EXTERNAL_COMMAND;
|
action_id = ACT_MAIN_TAB_EXTERNAL_COMMAND;
|
||||||
text = N_("Pass tab URI to e~xternal command");
|
|
||||||
/* [gettext_accelerator_context()] */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (option, *tree) {
|
foreach (option, *tree) {
|
||||||
|
@ -51,7 +51,7 @@ enum pass_uri_type {
|
|||||||
PASS_URI_TAB,
|
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);
|
enum frame_event_status pass_uri_to_command(struct session *ses, struct document_view *doc_view, int /* enum pass_uri_type */ type);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1254,7 +1254,8 @@ link_menu(struct terminal *term, void *xxx, void *ses_)
|
|||||||
add_menu_action(&mi, N_("~Add link to bookmarks"),
|
add_menu_action(&mi, N_("~Add link to bookmarks"),
|
||||||
ACT_MAIN_ADD_BOOKMARK_LINK);
|
ACT_MAIN_ADD_BOOKMARK_LINK);
|
||||||
#endif
|
#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()] */
|
/* [gettext_accelerator_context()] */
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user