#!/bin/sh
# No panel is currently set up. Create a new one.

SESSION="$1"
MYCHOICES="$2"

if [ -z "$MYCHOICES" ]; then
  echo Usage: SetupPanel /path/ROX-Session /path/Choices >&2
  exit 1
fi

PANEL="$MYCHOICES/rox.sourceforge.net/ROX-Filer/pan_Default"

if [ -f "$PANEL" ]; then
  echo "SetupPanel -- $PANEL already exists!" >&2
  exit 1
fi

mkdir "$MYCHOICES" 2> /dev/null
mkdir "$MYCHOICES/rox.sourceforge.net" 2> /dev/null
mkdir "$MYCHOICES/rox.sourceforge.net/ROX-Filer" 2> /dev/null
DRIVES=""
if [ -d "/mnt" ]; then
for DRIVE in /floppy /cdrom /zip /mnt/*; do
  LEAF=`basename "$DRIVE"`
  [ -d "$DRIVE" ] && DRIVES="$DRIVES<icon label='$LEAF'>$DRIVE</icon>"
done

if [ -d /uri/0install/rox.sourceforge.net ]; then
  EDIT_PATH=/uri/0install/rox.sourceforge.net/apps/Edit
  0refresh rox.sourceforge.net/apps/Edit 2004-03-01
  EDIT="<icon label='Edit'>$EDIT_PATH</icon>"
  APPS=/uri/0install/rox.sourceforge.net/apps
else
  EDIT=""
  APPS=`dirname "$1"`
fi

cat > "$PANEL" << EOF
<?xml version="1.0"?>
<panel>
<start>
<icon label="Home">~</icon>
$DRIVES
</start>
<end>
$EDIT
</end>
</panel>
EOF
fi

