Shortcuts.c -- Update

Fix returns from shortcuts -- should now run plugins
Fix formatting of file names to remove path from browser shortcuts

Change-Id: I46e337110d04b84bedcb0c2945d5dd29a1860847
This commit is contained in:
William Wilgus 2021-03-07 10:07:49 -05:00
parent 0dce973729
commit 9712d375ce
7 changed files with 51 additions and 22 deletions

View file

@ -395,8 +395,6 @@ static const char * shortcut_menu_get_name(int selected_item, void * data,
char * buffer, size_t buffer_len)
{
(void)data;
(void)buffer;
(void)buffer_len;
struct shortcut *sc = get_shortcut(selected_item);
if (!sc)
return "";
@ -409,6 +407,16 @@ static const char * shortcut_menu_get_name(int selected_item, void * data,
/* No translation support as only soft_shutdown has LANG_SHUTDOWN defined */
return type_strings[SHORTCUT_SHUTDOWN];
}
else if (sc->type == SHORTCUT_BROWSER && (sc->u.path)[0] != '\0')
{
char* pos;
if (path_basename(sc->u.path, (const char **)&pos) > 0)
{
if (snprintf(buffer, buffer_len, "%s (%s)", pos, sc->u.path) < (int)buffer_len)
return buffer;
}
}
return sc->name[0] ? sc->name : sc->u.path;
}
@ -609,7 +617,6 @@ int do_shortcut_menu(void *ignored)
/* else fall through */
case SHORTCUT_BROWSER:
{
if(open_plugin_add_path(ID2P(LANG_SHORTCUTS), sc->u.path, NULL) != 0)
{
done = GO_TO_PLUGIN;