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

% FBROWSER v.3i

[Protocol]=Server

FBROWSER_IC_INIT=\
        Make(var,fbrowser_dir,cat $(TmpDir)/ar_storedir.tmp);

FBROWSER_IC_EXIT=\
        Exec(echo "$(fbrowser_dir)" > $(TmpDir)/ar_storedir.tmp);

FBROWSER_IC_FILL_LIST=\
	Set(popup,show,Please wait);\
	Set(iconlist,replace,Files,folder:..);\
	ExecAndSet(iconlist,add,SAME,\
	           cd "$(fbrowser_dir)";\
		   ls -F --quoting-style=shell|sed 's/\*//;s/,/\r/g;s/@//;s/$/,/'|grep '/'| xargs -d '\n' -i echo "folder:"{});\
	ExecAndSet(iconlist,add,SAME,\
	           cd "$(fbrowser_dir)";\
		   ls -F --quoting-style=shell|sed 's/\*//;s/,/\r/g;s/@//;s/$/,/'|grep -v '/'| xargs -d '\n' -i echo "file:"{});\
	Set(popup,hide);

FBROWSER_IC_GO_TO=\
	Make(var,goto,by_value,$(Param));\
	Make(var,fbrowser_dir,cd "$(fbrowser_dir)";if [ -d $(goto) ]; then cd $(goto);fi;pwd);\
        Macro(FBROWSER_IC_FILL_LIST);

FBROWSER_IC_GO_HOME=\
	Make(var,fbrowser_dir,cd;pwd);\
	Macro(FBROWSER_IC_FILL_LIST);

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);\
	Macro(MEDIACENTER_MENU);

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

Exit($$)=\
    Macro(FBROWSER_IC_EXIT);\
	Make(exit);
	
Disconnect($$)=\
	Set(disconnect);

[ModeEnd]

[End]
