diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-08-05 12:14:07 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-08-05 12:14:07 +0000 |
commit | ef815729b6c2732a4ccc530402c4336a5a3e83b9 (patch) | |
tree | 399f3aec796764ae8fcf4bae3c6573e510becb82 /apps | |
parent | f8c6801fdd74b0d2a8d6143c455b61e33306a794 (diff) | |
download | rockbox-ef815729b6c2732a4ccc530402c4336a5a3e83b9.tar.gz rockbox-ef815729b6c2732a4ccc530402c4336a5a3e83b9.zip |
Accept FS#7486 - shortcuts plugin.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14191 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lang/english.lang | 16 | ||||
-rw-r--r-- | apps/onplay.c | 14 | ||||
-rw-r--r-- | apps/plugin.c | 2 | ||||
-rw-r--r-- | apps/plugin.h | 4 | ||||
-rw-r--r-- | apps/plugins/SOURCES | 1 | ||||
-rw-r--r-- | apps/plugins/viewers.config | 1 | ||||
-rw-r--r-- | apps/tree.c | 9 | ||||
-rw-r--r-- | apps/tree.h | 2 |
8 files changed, 44 insertions, 5 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index dcace6db8c..b66b7f8362 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -11067,4 +11067,18 @@ | |||
11067 | <voice> | 11067 | <voice> |
11068 | *: "" | 11068 | *: "" |
11069 | </voice> | 11069 | </voice> |
11070 | </phrase> \ No newline at end of file | 11070 | </phrase> |
11071 | <phrase> | ||
11072 | id: LANG_ADD_TO_FAVES | ||
11073 | desc: | ||
11074 | user: | ||
11075 | <source> | ||
11076 | *: "Add to shortcuts" | ||
11077 | </source> | ||
11078 | <dest> | ||
11079 | *: "Add to shortcuts" | ||
11080 | </dest> | ||
11081 | <voice> | ||
11082 | *: "Add to shortcuts" | ||
11083 | </voice> | ||
11084 | </phrase> | ||
diff --git a/apps/onplay.c b/apps/onplay.c index f09913e312..eb03b0781b 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -1077,7 +1077,15 @@ static bool set_recdir(void) | |||
1077 | MENUITEM_FUNCTION(set_recdir_item, 0, ID2P(LANG_SET_AS_REC_DIR), | 1077 | MENUITEM_FUNCTION(set_recdir_item, 0, ID2P(LANG_SET_AS_REC_DIR), |
1078 | set_recdir, NULL, clipboard_callback, Icon_Recording); | 1078 | set_recdir, NULL, clipboard_callback, Icon_Recording); |
1079 | #endif | 1079 | #endif |
1080 | 1080 | static bool add_to_faves(void) | |
1081 | { | ||
1082 | if(PLUGIN_USB_CONNECTED == filetype_load_plugin("shortcuts", | ||
1083 | selected_file)) | ||
1084 | onplay_result = ONPLAY_RELOAD_DIR; | ||
1085 | return false; | ||
1086 | } | ||
1087 | MENUITEM_FUNCTION(add_to_faves_item, 0, ID2P(LANG_ADD_TO_FAVES), | ||
1088 | add_to_faves, NULL, clipboard_callback, Icon_NOICON); | ||
1081 | 1089 | ||
1082 | 1090 | ||
1083 | static int clipboard_callback(int action,const struct menu_item_ex *this_item) | 1091 | static int clipboard_callback(int action,const struct menu_item_ex *this_item) |
@@ -1096,7 +1104,8 @@ static int clipboard_callback(int action,const struct menu_item_ex *this_item) | |||
1096 | (this_item == &properties_item) || | 1104 | (this_item == &properties_item) || |
1097 | (this_item == &rename_file_item) || | 1105 | (this_item == &rename_file_item) || |
1098 | (this_item == &clipboard_cut_item) || | 1106 | (this_item == &clipboard_cut_item) || |
1099 | (this_item == &clipboard_copy_item) | 1107 | (this_item == &clipboard_copy_item) || |
1108 | (this_item == &add_to_faves_item) | ||
1100 | ) | 1109 | ) |
1101 | { | 1110 | { |
1102 | /* always visible */ | 1111 | /* always visible */ |
@@ -1177,6 +1186,7 @@ MAKE_ONPLAYMENU( tree_onplay_menu, ID2P(LANG_ONPLAY_MENU_TITLE), | |||
1177 | #ifdef HAVE_RECORDING | 1186 | #ifdef HAVE_RECORDING |
1178 | &set_recdir_item, | 1187 | &set_recdir_item, |
1179 | #endif | 1188 | #endif |
1189 | &add_to_faves_item, | ||
1180 | ); | 1190 | ); |
1181 | int onplay(char* file, int attr, int from) | 1191 | int onplay(char* file, int attr, int from) |
1182 | { | 1192 | { |
diff --git a/apps/plugin.c b/apps/plugin.c index 5028bfdd3c..20ecafb532 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -499,6 +499,8 @@ static const struct plugin_api rockbox_api = { | |||
499 | screen_clear_area, | 499 | screen_clear_area, |
500 | #endif | 500 | #endif |
501 | led, | 501 | led, |
502 | set_current_file, | ||
503 | set_dirfilter, | ||
502 | }; | 504 | }; |
503 | 505 | ||
504 | int plugin_load(const char* plugin, void* parameter) | 506 | int plugin_load(const char* plugin, void* parameter) |
diff --git a/apps/plugin.h b/apps/plugin.h index 61cfe96e8d..c3febf3243 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -112,7 +112,7 @@ | |||
112 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 112 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
113 | 113 | ||
114 | /* increase this every time the api struct changes */ | 114 | /* increase this every time the api struct changes */ |
115 | #define PLUGIN_API_VERSION 69 | 115 | #define PLUGIN_API_VERSION 70 |
116 | 116 | ||
117 | /* update this to latest version if a change to the api struct breaks | 117 | /* update this to latest version if a change to the api struct breaks |
118 | backwards compatibility (and please take the opportunity to sort in any | 118 | backwards compatibility (and please take the opportunity to sort in any |
@@ -620,6 +620,8 @@ struct plugin_api { | |||
620 | int width, int height); | 620 | int width, int height); |
621 | #endif | 621 | #endif |
622 | void (*led)(bool on); | 622 | void (*led)(bool on); |
623 | void (*set_current_file)(char* path); | ||
624 | void (*set_dirfilter)(int l_dirfilter); | ||
623 | }; | 625 | }; |
624 | 626 | ||
625 | /* plugin header */ | 627 | /* plugin header */ |
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 31d94d5811..23d3e6becc 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -13,6 +13,7 @@ random_folder_advance_config.c | |||
13 | rockblox.c | 13 | rockblox.c |
14 | rockbox_flash.c | 14 | rockbox_flash.c |
15 | search.c | 15 | search.c |
16 | shortcuts.c | ||
16 | snow.c | 17 | snow.c |
17 | sort.c | 18 | sort.c |
18 | stats.c | 19 | stats.c |
diff --git a/apps/plugins/viewers.config b/apps/plugins/viewers.config index 0f70dc737d..80ebe43334 100644 --- a/apps/plugins/viewers.config +++ b/apps/plugins/viewers.config | |||
@@ -36,3 +36,4 @@ z80,viewers/zxbox,12 | |||
36 | zzz,viewers/properties,- | 36 | zzz,viewers/properties,- |
37 | colours,rocks/text_editor,11 | 37 | colours,rocks/text_editor,11 |
38 | ssg,rocks/superdom,- | 38 | ssg,rocks/superdom,- |
39 | link,rocks/shortcuts,- | ||
diff --git a/apps/tree.c b/apps/tree.c index 5a4292d34c..9341f81421 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -454,8 +454,15 @@ void get_current_file(char* buffer, int buffer_len) | |||
454 | tc.dirlength ? e->name : ""); | 454 | tc.dirlength ? e->name : ""); |
455 | } | 455 | } |
456 | 456 | ||
457 | /* Allow apps to change our dirfilter directly (required for sub browsers) | ||
458 | if they're suddenly going to become a file browser for example */ | ||
459 | void set_dirfilter(int l_dirfilter) | ||
460 | { | ||
461 | *tc.dirfilter = l_dirfilter; | ||
462 | } | ||
463 | |||
457 | /* Selects a file and update tree context properly */ | 464 | /* Selects a file and update tree context properly */ |
458 | static void set_current_file(char *path) | 465 | void set_current_file(char *path) |
459 | { | 466 | { |
460 | char *name; | 467 | char *name; |
461 | int i; | 468 | int i; |
diff --git a/apps/tree.h b/apps/tree.h index 96cb712a1a..e49ac722b9 100644 --- a/apps/tree.h +++ b/apps/tree.h | |||
@@ -70,6 +70,8 @@ struct tree_context { | |||
70 | void tree_mem_init(void); | 70 | void tree_mem_init(void); |
71 | void tree_gui_init(void); | 71 | void tree_gui_init(void); |
72 | void get_current_file(char* buffer, int buffer_len); | 72 | void get_current_file(char* buffer, int buffer_len); |
73 | void set_dirfilter(int l_dirfilter); | ||
74 | void set_current_file(char *path); | ||
73 | int rockbox_browse(const char *root, int dirfilter); | 75 | int rockbox_browse(const char *root, int dirfilter); |
74 | bool create_playlist(void); | 76 | bool create_playlist(void); |
75 | void resume_directory(const char *dir); | 77 | void resume_directory(const char *dir); |