%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Key aliases for file browser (v3i) in server mode
%
% v3i = v3 with icons
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% FBROWSER v.3i

[Protocol]=Server

FBROWSER_IC_FILL_DIR=\
	ExecAndSet(iconlist,add,SAME,cd "`cat $HOME/.anyRemote/ar_storedir.tmp`";ls -F --quoting-style=shell|sed 's/\*//;s/,/\r/g;s/@//;s/$/,/'|grep '/'| xargs -d '\n' -i echo "folder:"{});

FBROWSER_IC_FILL_FILE=\
	ExecAndSet(iconlist,add,SAME,cd "`cat $HOME/.anyRemote/ar_storedir.tmp`";ls -F --quoting-style=shell|sed 's/\*//;s/,/\r/g;s/@//;s/$/,/'|grep -v '/'| xargs -d '\n' -i echo "file:"{});

FBROWSER_IC_FILL_LIST=\
	Set(popup,show,Please wait);\
	Set(iconlist,replace,Files,folder:..);\
	Macro(FBROWSER_IC_FILL_DIR);\
        Macro(FBROWSER_IC_FILL_FILE);\
	Set(popup,hide);

FBROWSER_IC_GO_TO=\
	Set(popup,show,Please wait);\
	Make(var,goto,by_value,$(Param));\
	ExecAndSet(iconlist,replace,Files,cd "`cat $HOME/.anyRemote/ar_storedir.tmp`";if [ -d $(goto) ]; then cd $(goto);fi;pwd>$HOME/.anyRemote/ar_storedir.tmp;echo "folder:..");\
	Macro(FBROWSER_IC_FILL_DIR);\
        Macro(FBROWSER_IC_FILL_FILE);\
	Set(popup,hide);

FBROWSER_IC_GO_HOME=\
	Set(popup,show,Please wait);\
	ExecAndSet(iconlist,replace,Files,cd;pwd>$HOME/.anyRemote/ar_storedir.tmp;echo "folder:..");\
	Macro(FBROWSER_IC_FILL_DIR);\
        Macro(FBROWSER_IC_FILL_FILE);\
	Set(popup,hide);

Push($$)=\
	Macro(FBROWSER_IC_GO_TO);


%
% It needs to define $(app_manage_mode) variable before, like this:
% ...
% Make(var,app_manage_mode,by_value,amarok);
%
[Mode]=simple_file_manager

(EnterMode)=\
	Macro(FBROWSER_IC_FILL_LIST);\
	Macro(UpdateMenu);
	
GoTo($$)=\
	Macro(FBROWSER_IC_GO_TO);
	
Go Home($$)=\
	Macro(FBROWSER_IC_GO_HOME);
	
% Use clear+add to remove Back menu item
UpdateMenu=\
	Set(menu,clear);\
	Set(menu,add,GoTo,Open,Go Home,Disconnect,Exit);\
	Macro(ALLIN1MENU);

Open($$)=\
	Set(list,close);\
	Make(var,open_file,by_value,$(Param));\
	Make(mode,$(app_manage_mode));

Exit($$)=\
	Exit;
	
Disconnect($$)=\
	Set(disconnect);

[ModeEnd]

[End]
