#!/usr/sbin/install-menu

compat="menu-1";
!include menu.h

compat="menu-2";

onlyrunasroot=true;

# choose a terminal program here:
  function term_prog()="Eterm";
  #function term_prog()="rxvt";
  #function term_prog()="xterm";

treewalk=c(m);
rootprefix="/etc/X11/enlightenment/menus/";
mainmenutitle="ALTLinux Menu";

function menu_sh() = prefix() "altlinux_menu_sh";
prerun="set -e; rm -f " prefix() "altlinux*menu/" menu_sh();
postrun="set -e; cat " menu_sh() "| sh; rm -f " menu_sh();

function quote($text)= "\"" $text "\"";
function tick($text)= "\'" $text "\'";

function space()= "   ";

function newline()="\n";

function ltitle()=translate(lang(),title());

function findicon($filename)=ifelse($filename,
                                    ifelsefile("/usr/share/icons/mini/" $filename,
                                               "/usr/share/icons/mini/" $filename,
                                               $filename),
                                    "NULL");

function entry($com)= quote(esc(ltitle(),"\"")) space() 
                      quote(findicon(icon())) space() 
		      quote("exec") space() 
		      $com;

function term($com)= term_prog() " -T " tick(ltitle()) " -e " $com;

supported;
  wm=         entry(quote("eesh -e " tick("restart_wm " $command)) newline());
  x11=        entry(quote($command) newline());
  text=       entry(quote(term($command)) newline());
endsupported;

function etitle()= tolower(replacewith(replacewith($section,"/","_")," ","_") ".menu");

startmenu= "cat > " prefix() etitle() " << END" newline() quote(ltitle()) newline();

endmenu= "END" newline() newline();

submenutitle="\"" ltitle() "\"  NULL   menu \"" prefix() etitle() "\"\n";

genmenu="altlinux_menu_sh";
rootsection="ALTLinux";
