summaryrefslogtreecommitdiff
path: root/apps/shortcuts.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2011-12-05 19:23:46 +0000
committerNils Wallménius <nils@rockbox.org>2011-12-05 19:23:46 +0000
commita0377bd500bc3185f840a67b4ee82ddaf7eaa5ab (patch)
tree857a878b0e8c34b87a339cc24f9ed99185a79447 /apps/shortcuts.c
parent906905aa43566c16913238a71ccc13d438af1702 (diff)
downloadrockbox-a0377bd500bc3185f840a67b4ee82ddaf7eaa5ab.tar.gz
rockbox-a0377bd500bc3185f840a67b4ee82ddaf7eaa5ab.zip
Sprinkle around some static and const.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31153 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/shortcuts.c')
-rw-r--r--apps/shortcuts.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/apps/shortcuts.c b/apps/shortcuts.c
index 8ded75c1f2..3943a6a56a 100644
--- a/apps/shortcuts.c
+++ b/apps/shortcuts.c
@@ -42,10 +42,9 @@
42#include "onplay.h" 42#include "onplay.h"
43 43
44 44
45
46#define MAX_SHORTCUT_NAME 32 45#define MAX_SHORTCUT_NAME 32
47#define SHORTCUTS_FILENAME ROCKBOX_DIR "/shortcuts.txt" 46#define SHORTCUTS_FILENAME ROCKBOX_DIR "/shortcuts.txt"
48char *type_strings[SHORTCUT_TYPE_COUNT] = { 47static char * const type_strings[SHORTCUT_TYPE_COUNT] = {
49 [SHORTCUT_SETTING] = "setting", 48 [SHORTCUT_SETTING] = "setting",
50 [SHORTCUT_FILE] = "file", 49 [SHORTCUT_FILE] = "file",
51 [SHORTCUT_DEBUGITEM] = "debug", 50 [SHORTCUT_DEBUGITEM] = "debug",
@@ -53,7 +52,6 @@ char *type_strings[SHORTCUT_TYPE_COUNT] = {
53 [SHORTCUT_PLAYLISTMENU] = "playlist menu", 52 [SHORTCUT_PLAYLISTMENU] = "playlist menu",
54 [SHORTCUT_SEPARATOR] = "separator", 53 [SHORTCUT_SEPARATOR] = "separator",
55}; 54};
56
57 55
58struct shortcut { 56struct shortcut {
59 enum shortcut_type type; 57 enum shortcut_type type;
@@ -124,7 +122,7 @@ static struct shortcut* get_shortcut(int index)
124 return &h->shortcuts[handle_index]; 122 return &h->shortcuts[handle_index];
125} 123}
126 124
127bool verify_shortcut(struct shortcut* sc) 125static bool verify_shortcut(struct shortcut* sc)
128{ 126{
129 switch (sc->type) 127 switch (sc->type)
130 { 128 {
@@ -152,7 +150,8 @@ static void init_shortcut(struct shortcut* sc)
152 sc->name[0] = '\0'; 150 sc->name[0] = '\0';
153 sc->u.path[0] = '\0'; 151 sc->u.path[0] = '\0';
154 sc->icon = Icon_NOICON; 152 sc->icon = Icon_NOICON;
155} 153}
154
156static int first_idx_to_writeback = -1; 155static int first_idx_to_writeback = -1;
157void shortcuts_ata_idle_callback(void* data) 156void shortcuts_ata_idle_callback(void* data)
158{ 157{
@@ -192,7 +191,8 @@ void shortcuts_ata_idle_callback(void* data)
192 } 191 }
193 first_idx_to_writeback = -1; 192 first_idx_to_writeback = -1;
194} 193}
195void shortcuts_add(enum shortcut_type type, char* value) 194
195void shortcuts_add(enum shortcut_type type, const char* value)
196{ 196{
197 struct shortcut* sc = get_shortcut(shortcut_count++); 197 struct shortcut* sc = get_shortcut(shortcut_count++);
198 if (!sc) 198 if (!sc)
@@ -275,6 +275,7 @@ int readline_cb(int n, char *buf, void *parameters)
275 } 275 }
276 return 0; 276 return 0;
277} 277}
278
278void shortcuts_init(void) 279void shortcuts_init(void)
279{ 280{
280 int fd; 281 int fd;
@@ -296,8 +297,8 @@ void shortcuts_init(void)
296 shortcut_count++; 297 shortcut_count++;
297} 298}
298 299
299const char * shortcut_menu_get_name(int selected_item, void * data, 300static const char * shortcut_menu_get_name(int selected_item, void * data,
300 char * buffer, size_t buffer_len) 301 char * buffer, size_t buffer_len)
301{ 302{
302 (void)data; 303 (void)data;
303 (void)buffer; 304 (void)buffer;
@@ -312,14 +313,15 @@ const char * shortcut_menu_get_name(int selected_item, void * data,
312 return sc->name[0] ? sc->name : sc->u.path; 313 return sc->name[0] ? sc->name : sc->u.path;
313} 314}
314 315
315int shortcut_menu_get_action(int action, struct gui_synclist *lists) 316static int shortcut_menu_get_action(int action, struct gui_synclist *lists)
316{ 317{
317 (void)lists; 318 (void)lists;
318 if (action == ACTION_STD_OK) 319 if (action == ACTION_STD_OK)
319 return ACTION_STD_CANCEL; 320 return ACTION_STD_CANCEL;
320 return action; 321 return action;
321} 322}
322enum themable_icons shortcut_menu_get_icon(int selected_item, void * data) 323
324static enum themable_icons shortcut_menu_get_icon(int selected_item, void * data)
323{ 325{
324 (void)data; 326 (void)data;
325 struct shortcut *sc = get_shortcut(selected_item); 327 struct shortcut *sc = get_shortcut(selected_item);