From 489436385f6f4543c3bc7e2d4c945f2440a611bb Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 11 Dec 2011 10:27:14 +0000 Subject: [PATCH] Add talk support to the shortcuts menu. 'talkclip: ' in the [shortcut] will cause the list to .talk the file specified. (.talk files are the same filetype as gets talked by the file listing... hopefully we can add rbutil support to generate these) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31210 a1c6a512-1295-4272-9138-f99709370657 --- apps/shortcuts.c | 18 ++++++++++++++++++ manual/main_menu/main.tex | 1 + 2 files changed, 19 insertions(+) diff --git a/apps/shortcuts.c b/apps/shortcuts.c index e8ea1df0d9..75e005b166 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c @@ -43,6 +43,7 @@ #include "shortcuts.h" #include "onplay.h" #include "screens.h" +#include "talk.h" #define MAX_SHORTCUT_NAME 32 @@ -61,6 +62,7 @@ static const char * const type_strings[SHORTCUT_TYPE_COUNT] = { struct shortcut { enum shortcut_type type; char name[MAX_SHORTCUT_NAME]; + char talk_clip[MAX_PATH]; int icon; union { char path[MAX_PATH]; @@ -161,6 +163,7 @@ static void init_shortcut(struct shortcut* sc) sc->type = SHORTCUT_UNDEFINED; sc->name[0] = '\0'; sc->u.path[0] = '\0'; + sc->talk_clip[0] = '\0'; sc->icon = Icon_NOICON; } @@ -296,6 +299,10 @@ int readline_cb(int n, char *buf, void *parameters) sc->icon = atoi(value); } } + else if (!strcmp(name, "talkclip")) + { + strlcpy(sc->talk_clip, value, MAX_PATH); + } } return 0; } @@ -381,6 +388,15 @@ static enum themable_icons shortcut_menu_get_icon(int selected_item, void * data return sc->icon; } +int shortcut_menu_speak_item(int selected_item, void * data) +{ + (void)data; + struct shortcut *sc = get_shortcut(selected_item); + if (sc && sc->talk_clip[0]) + talk_file(NULL, NULL, sc->talk_clip, NULL, NULL, false); + return 0; +} + void talk_timedate(void); const char* sleep_timer_formatter(char* buffer, size_t buffer_size, int value, const char* unit); @@ -399,6 +415,8 @@ int do_shortcut_menu(void *ignored) if (global_settings.show_icons) list.get_icon = shortcut_menu_get_icon; list.title_icon = Icon_Bookmark; + if (global_settings.talk_menu) + list.get_talk = shortcut_menu_speak_item; push_current_activity(ACTIVITY_SHORTCUTSMENU); diff --git a/manual/main_menu/main.tex b/manual/main_menu/main.tex index 41e16ba1b5..33e64c12fe 100644 --- a/manual/main_menu/main.tex +++ b/manual/main_menu/main.tex @@ -298,6 +298,7 @@ each item to be displayed. Each shortcut looks like the following: data: name: icon: + talkclip: \end{example} Only ``type'' and ``data'' are required (except if type is ``separator'' in which case