summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/lang/english.lang16
-rw-r--r--apps/onplay.c14
-rw-r--r--apps/plugin.c2
-rw-r--r--apps/plugin.h4
-rw-r--r--apps/plugins/SOURCES1
-rw-r--r--apps/plugins/viewers.config1
-rw-r--r--apps/tree.c9
-rw-r--r--apps/tree.h2
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 @@
<voice>
*: ""
</voice>
-</phrase> \ No newline at end of file
+</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>
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)
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)
{
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 = {
screen_clear_area,
#endif
led,
+ set_current_file,
+ set_dirfilter,
};
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 @@
#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 */
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
rockblox.c
rockbox_flash.c
search.c
+shortcuts.c
snow.c
sort.c
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
zzz,viewers/properties,-
colours,rocks/text_editor,11
ssg,rocks/superdom,-
+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)
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;
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 {
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);