diff options
| author | Jeffrey Goode <jeffg7@gmail.com> | 2010-04-11 00:32:16 +0000 |
|---|---|---|
| committer | Jeffrey Goode <jeffg7@gmail.com> | 2010-04-11 00:32:16 +0000 |
| commit | ef30d7ef712faf1c98ccc8289dc64854994f0397 (patch) | |
| tree | c440c6150ebc774b5cbf52540b77905c0bd9b683 | |
| parent | 66fa12726212c5b597b44bfb5654312f0580953f (diff) | |
| download | rockbox-ef30d7ef712faf1c98ccc8289dc64854994f0397.zip rockbox-ef30d7ef712faf1c98ccc8289dc64854994f0397.tar.gz rockbox-ef30d7ef712faf1c98ccc8289dc64854994f0397.tar.bz2 rockbox-ef30d7ef712faf1c98ccc8289dc64854994f0397.tar.xz | |
FS#11195, plus. Simplified hotkey struct, thanks alle!
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25581 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/menus/settings_menu.c | 4 | ||||
| -rw-r--r-- | apps/onplay.c | 30 | ||||
| -rw-r--r-- | apps/onplay.h | 2 |
3 files changed, 14 insertions, 22 deletions
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 53c5972..db2ad78 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -414,9 +414,9 @@ static void view_hotkey_info(void) info.hide_selection = true; info.scroll_all = true; simplelist_addline(SIMPLELIST_ADD_LINE, str(LANG_HOTKEY_VIEW_WPS), - str(get_hotkey_desc_id(global_settings.hotkey_wps))); + get_hotkey_desc(global_settings.hotkey_wps)); simplelist_addline(SIMPLELIST_ADD_LINE, str(LANG_HOTKEY_VIEW_FILE_BROWSER), - str(get_hotkey_desc_id(global_settings.hotkey_tree))); + get_hotkey_desc(global_settings.hotkey_tree)); simplelist_show_list(&info); } diff --git a/apps/onplay.c b/apps/onplay.c index 27a3196..8747495 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -1218,8 +1218,7 @@ struct hotkey_assignment { int item; /* Bit or'd hotkey_action and HOTKEY_CTX_x */ struct menu_func func; /* Function to run if this entry is selected */ int return_code; /* What to return after the function is run */ - const struct menu_item_ex *menu_addr; - int lang_id; /* How to present the item to the user */ + const struct menu_item_ex *menu_addr; /* Must be a MENUITEM_FUNCTION */ }; #define HOTKEY_FUNC(func, param) {{(void *)func}, param} @@ -1228,49 +1227,42 @@ struct hotkey_assignment { static struct hotkey_assignment hotkey_items[] = { { HOTKEY_VIEW_PLAYLIST | HOTKEY_CTX_WPS, HOTKEY_FUNC(NULL, NULL), - ONPLAY_PLAYLIST, &view_cur_playlist, - LANG_VIEW_DYNAMIC_PLAYLIST }, + ONPLAY_PLAYLIST, &view_cur_playlist }, { HOTKEY_SHOW_TRACK_INFO| HOTKEY_CTX_WPS, HOTKEY_FUNC(browse_id3, NULL), - ONPLAY_RELOAD_DIR, &browse_id3_item, - LANG_MENU_SHOW_ID3_INFO }, + ONPLAY_RELOAD_DIR, &browse_id3_item }, #ifdef HAVE_PITCHSCREEN { HOTKEY_PITCHSCREEN | HOTKEY_CTX_WPS, HOTKEY_FUNC(gui_syncpitchscreen_run, NULL), - ONPLAY_RELOAD_DIR, &pitch_screen_item, - LANG_PITCH }, + ONPLAY_RELOAD_DIR, &pitch_screen_item }, #endif { HOTKEY_OPEN_WITH | HOTKEY_CTX_WPS | HOTKEY_CTX_TREE, HOTKEY_FUNC(open_with, NULL), - ONPLAY_RELOAD_DIR, &list_viewers_item, - LANG_ONPLAY_OPEN_WITH }, + ONPLAY_RELOAD_DIR, &list_viewers_item }, { HOTKEY_DELETE | HOTKEY_CTX_WPS | HOTKEY_CTX_TREE, HOTKEY_FUNC(delete_item, NULL), - ONPLAY_RELOAD_DIR, &delete_file_item, - LANG_DELETE }, + ONPLAY_RELOAD_DIR, &delete_file_item }, { HOTKEY_DELETE | HOTKEY_CTX_TREE, HOTKEY_FUNC(delete_item, NULL), - ONPLAY_RELOAD_DIR, &delete_dir_item, - LANG_DELETE }, + ONPLAY_RELOAD_DIR, &delete_dir_item }, { HOTKEY_INSERT | HOTKEY_CTX_TREE, HOTKEY_FUNC(playlist_insert_func, (intptr_t*)PLAYLIST_INSERT), - ONPLAY_START_PLAY, &i_pl_item, - LANG_INSERT }, + ONPLAY_START_PLAY, &i_pl_item }, }; static const int num_hotkey_items = sizeof(hotkey_items) / sizeof(hotkey_items[0]); /* Return the language ID for the input function */ -int get_hotkey_desc_id(int hk_func) +char* get_hotkey_desc(int hk_func) { int i; for (i = 0; i < num_hotkey_items; i++) { if ((hotkey_items[i].item & HOTKEY_ACTION_MASK) == hk_func) - return hotkey_items[i].lang_id; + return P2STR(hotkey_items[i].menu_addr->callback_and_desc->desc); } - return LANG_HOTKEY_NOT_SET; + return str(LANG_HOTKEY_NOT_SET); } /* Execute the hotkey function, if listed for this screen */ diff --git a/apps/onplay.h b/apps/onplay.h index 027dded..a5a5a5f 100644 --- a/apps/onplay.h +++ b/apps/onplay.h @@ -32,7 +32,7 @@ enum { }; #ifdef HAVE_HOTKEY -int get_hotkey_desc_id(int hk_func); +char* get_hotkey_desc(int hk_func); #endif #endif |