summaryrefslogtreecommitdiff
path: root/apps/shortcuts.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-12-11 10:27:14 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-12-11 10:27:14 +0000
commit489436385f6f4543c3bc7e2d4c945f2440a611bb (patch)
tree9198629010184adaf2f56df9cee600f91568690f /apps/shortcuts.c
parentc2513580cbe8b94f9c229f8a8d518136ad75facc (diff)
Add talk support to the shortcuts menu.
'talkclip: <filename>' 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
Diffstat (limited to 'apps/shortcuts.c')
-rw-r--r--apps/shortcuts.c18
1 files changed, 18 insertions, 0 deletions
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);