#!/usr/bin/env bash
#winezgui-shortcuts
winezgui-shortcuts()
{
  HEADER="$(basename ${0}): ${FUNCNAME[0]}"
  
  SOURCE "script-check-variables-loaded-or-not"
  script-check-variables-loaded-or-not
  dbug "I: $(basename ${0}): Launched ${FUNCNAME[0]}"
  unset SELECT_SHORTCUT

  # For Zenity 4
  ZENITY_VERSION=$(${ZENITY_CMD} --version|cut -f1 -d ".")
  if [ "${ZENITY_VERSION}" -eq 4 ]; then
       WINDOW_HEIGHT=300
       WINDOW_WIDTH=500
  else
       WINDOW_HEIGHT=240
       WINDOW_WIDTH=360
  fi

  SELECT_SHORTCUT=$( ${ZENITY_CMD} --title "${APP_WITH_VER} - Shortcuts" \
                     --list   --hide-header                              \
                     --width=${WINDOW_WIDTH}                             \
                     --height=${WINDOW_HEIGHT}                           \
                     --radiolist --column " "                            \
                     --column "Action"                                   \
                         TRUE "Clean up..."                              \
                            0 "Create..."                                \
                            0 "Delete..."                                \
                            0 "Restore..."                               \
                     --text   "Shortcuts <b>${Shortcuts_NAME}</b> in use")

  # Exit if Cancel is clicked
  if [ -z "${SELECT_SHORTCUT}" ]; then
       dbug "I: Shortcuts: Cancel Selected!"
       return 1
  fi
 
  dbug "I: ${HEADER}: Selected ${SELECT_SHORTCUT}!"
 
  if  [ "${SELECT_SHORTCUT}" = "Clean up..." ]; then
        SOURCE "winezgui-shortcuts-clean-up"
        winezgui-shortcuts-clean-up
 
 elif [ "${SELECT_SHORTCUT}" = "Create..." ]; then
        SOURCE "winezgui-shortcuts-create"
        winezgui-shortcuts-create
 
 elif [ "${SELECT_SHORTCUT}" = "Delete..." ]; then
        SOURCE "winezgui-shortcuts-delete"
        echo "Launching delete Shortcuts!!!"
        winezgui-shortcuts-delete

 elif [ "${SELECT_SHORTCUT}" = "Restore..." ]; then
        SOURCE "winezgui-shortcuts-restore"
        echo "Launching delete Shortcuts!!!"
        winezgui-shortcuts-restore
  fi
  return 0
}
