Accept FS#7486 - shortcuts plugin.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14191 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2007-08-05 12:14:07 +00:00
parent f8c6801fdd
commit ef815729b6
8 changed files with 44 additions and 5 deletions

View file

@ -11067,4 +11067,18 @@
<voice>
*: ""
</voice>
</phrase>
</phrase>
<phrase>
id: LANG_ADD_TO_FAVES
desc:
user:
<source>
*: "Add to shortcuts"
</source>
<dest>
*: "Add to shortcuts"
</dest>
<voice>
*: "Add to shortcuts"
</voice>
</phrase>

View file

@ -1077,7 +1077,15 @@ static bool set_recdir(void)
MENUITEM_FUNCTION(set_recdir_item, 0, ID2P(LANG_SET_AS_REC_DIR),
set_recdir, NULL, clipboard_callback, Icon_Recording);
#endif
static bool add_to_faves(void)
{
if(PLUGIN_USB_CONNECTED == filetype_load_plugin("shortcuts",
selected_file))
onplay_result = ONPLAY_RELOAD_DIR;
return false;
}
MENUITEM_FUNCTION(add_to_faves_item, 0, ID2P(LANG_ADD_TO_FAVES),
add_to_faves, NULL, clipboard_callback, Icon_NOICON);
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)
(this_item == &properties_item) ||
(this_item == &rename_file_item) ||
(this_item == &clipboard_cut_item) ||
(this_item == &clipboard_copy_item)
(this_item == &clipboard_copy_item) ||
(this_item == &add_to_faves_item)
)
{
/* always visible */
@ -1177,6 +1186,7 @@ MAKE_ONPLAYMENU( tree_onplay_menu, ID2P(LANG_ONPLAY_MENU_TITLE),
#ifdef HAVE_RECORDING
&set_recdir_item,
#endif
&add_to_faves_item,
);
int onplay(char* file, int attr, int from)
{

View file

@ -499,6 +499,8 @@ static const struct plugin_api rockbox_api = {
screen_clear_area,
#endif
led,
set_current_file,
set_dirfilter,
};
int plugin_load(const char* plugin, void* parameter)

View file

@ -112,7 +112,7 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 69
#define PLUGIN_API_VERSION 70
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
@ -620,6 +620,8 @@ struct plugin_api {
int width, int height);
#endif
void (*led)(bool on);
void (*set_current_file)(char* path);
void (*set_dirfilter)(int l_dirfilter);
};
/* plugin header */

View file

@ -13,6 +13,7 @@ random_folder_advance_config.c
rockblox.c
rockbox_flash.c
search.c
shortcuts.c
snow.c
sort.c
stats.c

View file

@ -36,3 +36,4 @@ z80,viewers/zxbox,12
zzz,viewers/properties,-
colours,rocks/text_editor,11
ssg,rocks/superdom,-
link,rocks/shortcuts,-

View file

@ -454,8 +454,15 @@ void get_current_file(char* buffer, int buffer_len)
tc.dirlength ? e->name : "");
}
/* Allow apps to change our dirfilter directly (required for sub browsers)
if they're suddenly going to become a file browser for example */
void set_dirfilter(int l_dirfilter)
{
*tc.dirfilter = l_dirfilter;
}
/* Selects a file and update tree context properly */
static void set_current_file(char *path)
void set_current_file(char *path)
{
char *name;
int i;

View file

@ -70,6 +70,8 @@ struct tree_context {
void tree_mem_init(void);
void tree_gui_init(void);
void get_current_file(char* buffer, int buffer_len);
void set_dirfilter(int l_dirfilter);
void set_current_file(char *path);
int rockbox_browse(const char *root, int dirfilter);
bool create_playlist(void);
void resume_directory(const char *dir);