#!/bin/sh

export TEXTDOMAIN=puppy

[ ! -d "$HOME/.jwm/tmp" ] && mkdir -p "$HOME/.jwm/tmp"

#        <button image-position="2">
#          <label>'$(gettext 'Corner action')'</label>
#          '"`/usr/lib/gtkdialog/xml_button-icon placement_corners.svg huge`"'
#          <action>/usr/local/jwm_config/corner &</action>
#        </button>

#        <togglebutton image-position="2">
#          <label>'$(gettext 'Applets')'</label>
#          '"`/usr/lib/gtkdialog/xml_button-icon clock.svg huge`"'
#          <sensitive>false</sensitive>
#          <action>if true show:VBOX_APPLETS</action>
#          <action>if false hide:VBOX_APPLETS</action>
#        </togglebutton>



echo '
<window title="'$(gettext 'Puppy Desktop')'" icon-name="gtk-preferences" default_width="500">
<vbox space-expand="true" space-fill="true">
  '"`/usr/lib/gtkdialog/xml_info fixed windows.svg 60 "$(gettext 'Please choose from the options below which aspect of the desktop you would like to change.')"`"'        
  <vbox space-expand="true" space-fill="true">
    <frame>
      <hbox spacing="10" homogeneous="true" space-expand="true" space-fill="true">
        <button image-position="2">
          <label>'$(gettext 'Tray')'</label>
          '"`/usr/lib/gtkdialog/xml_button-icon desktop_tray.svg huge`"'
          <action>cd /usr/local/jwm_config; ./tray &</action>
        </button>
        <button image-position="2">
          <label>'$(gettext 'Windows')'</label>
          '"`/usr/lib/gtkdialog/xml_button-icon windows.svg huge`"'
          <action>cd /usr/local/jwm_config; ./window &</action>
        </button>
        <button image-position="2">
          <label>'$(gettext 'Menu')'</label>
          '"`/usr/lib/gtkdialog/xml_button-icon menu.svg huge`"'
          <action>cd /usr/local/jwm_config; ./menu &</action>
        </button>
        <button image-position="2" tooltip-text="'$(gettext 'Define key combinations and mouse-clicks for actions')'">
          <label>'$(gettext 'Shortcuts')'</label>
          '"`/usr/lib/gtkdialog/xml_button-icon mouse_keyboard_shortcut.svg huge`"'
          <action>cd /usr/local/jwm_config; ./shortcuts &</action>
        </button>
      </hbox>

      <hbox spacing="10" homogeneous="true" space-expand="true" space-fill="true">
        <button image-position="2">
          <label>'$(gettext 'Wallpaper')'</label>
          '"`/usr/lib/gtkdialog/xml_button-icon wallpaper.svg huge`"'
          <action>/usr/local/apps/Wallpaper/AppRun &</action>' > $HOME/.jwm/tmp/pdesktop_xml
          [ ! "`which /usr/local/apps/Wallpaper/AppRun`" ] && echo '<sensitive>false</sensitive>' >> $HOME/.jwm/tmp/pdesktop_xml
        echo '</button>
        <button image-position="2">
          <label>'$(gettext 'Theming')'</label>
          '"`/usr/lib/gtkdialog/xml_button-icon puppy_theme.svg huge`"'' >> $HOME/.jwm/tmp/pdesktop_xml
          [ "`which ptheme`" ] && echo '<action>/usr/sbin/ptheme &</action>' >> $HOME/.jwm/tmp/pdesktop_xml || echo '<action>cd /usr/local/jwm_config; ./theme_switcher &</action><action>cd /usr/local/jwm_config; ./window_buttons &</action>' >> $HOME/.jwm/tmp/pdesktop_xml
        echo '</button>
        <button image-position="2">
          <label>'$(gettext 'Font')'</label>
          '"`/usr/lib/gtkdialog/xml_button-icon font.svg huge`"'
          <action>/usr/sbin/fontmanager &</action>' >> $HOME/.jwm/tmp/pdesktop_xml
          [ ! "`which fontmanager`" ] && echo '<sensitive>false</sensitive>' >> $HOME/.jwm/tmp/pdesktop_xml
        echo '</button>
        <togglebutton image-position="2">
          <label>'$(gettext 'Desktop Icons')'</label>
          '"`/usr/lib/gtkdialog/xml_button-icon desktop_icons.svg huge`"'
          <action>if true show:VBOX_ICONS</action>
          <action>if false hide:VBOX_ICONS</action>
        </togglebutton>
      </hbox>

     
    </frame>
  </vbox>
  <vbox visible="false">
    <frame '$(gettext 'Desktop icons')'>
      <hbox space-expand="true" space-fill="true">' >> $HOME/.jwm/tmp/pdesktop_xml
        [ "`which rox`" ] && echo '<button tooltip-text="'$(gettext 'Drag an application icon to the desktop to add it there')'">
          <label>" '$(gettext 'Add app')' "</label>
          '"`/usr/lib/gtkdialog/xml_button-icon add.svg big`"'
          <action>rox /usr/share/applications &</action>
        </button>' >> $HOME/.jwm/tmp/pdesktop_xml
        [ "`which eventmanager`" ] && echo '<button tooltip-text="'$(gettext 'Manage which drive icons will appear on the desktop and in what position')'">
          <label>" '$(gettext 'Drives')' "</label>
          '"`/usr/lib/gtkdialog/xml_button-icon harddisk.svg big`"'
          <action>eventmanager desktop &</action>
        </button>' >> $HOME/.jwm/tmp/pdesktop_xml
        if [ "`which ptheme_roxpin`" ]; then echo '<button tooltip-text="'$(gettext 'Choose how many application icons will be on the desktop')'">
          <label>" '$(gettext 'Arrangement')' "</label>
          '"`/usr/lib/gtkdialog/xml_button-icon desktop_icons.svg big`"'
          <action>ptheme_roxpin &</action>
        </button>' >> $HOME/.jwm/tmp/pdesktop_xml
        else echo '
        <text><label>""</label></text>' >> $HOME/.jwm/tmp/pdesktop_xml
        fi 
        if [ "`which icon_switcher`" ]; then echo '<button tooltip-text="'$(gettext 'Choose theme for the desktop icons')'">
          <label>" '$(gettext 'Theme')' "</label>
          '"`/usr/lib/gtkdialog/xml_button-icon desktop_icons.svg big`"'
          <action>icon_switcher &</action>
        </button>' >> $HOME/.jwm/tmp/pdesktop_xml
        else echo '
        <text><label>""</label></text>' >> $HOME/.jwm/tmp/pdesktop_xml
        fi #just to be sure the <hbox> won't be empty in case no tools are found
      echo '</hbox>
    </frame>
    <variable>VBOX_ICONS</variable>
  </vbox>
  <vbox visible="false">
    <frame '$(gettext 'Stick applets to your desktop')'>
      <hbox space-expand="true" space-fill="true">
        <vbox space-expand="true" space-fill="true">
          <text xalign="0" use-markup="true" space-expand="true" space-fill="true"><label>"'$(gettext 'Click to start applet. Move it to position with mouse <b>while pressing Alt-button</b>. The applets will show up at given position at next boot.')'"</label></text>
          <hbox space-expand="true" space-fill="true">
            <button tooltip-text="'$(gettext 'Calendar with notetaking features')'">
              '"`/usr/lib/gtkdialog/xml_button-icon calendar.svg big`"'
              <label>"'$(gettext 'Calendar')'"</label>
              <action>/usr/lib/gtkdialog/box_calendar -w 250 -t desklet &</action>
            </button>
            <button tooltip-text="'$(gettext 'Analog clock')'">
              <label>"'$(gettext 'Clock')'"</label>
              '"`/usr/lib/gtkdialog/xml_button-icon clock.svg big`"'
              <action>/usr/lib/gtkdialog/box_analogclock -w 250 -t desklet &</action>
            </button>
          </hbox>
        </vbox>
      </hbox>
    </frame>
    <variable>VBOX_APPLETS</variable>
  </vbox>
  <hbox space-expand="false" space-fill="false"> 
    <button space-expand="false" space-fill="false">
      <label>'$(gettext 'Quit')'</label>
      '"`/usr/lib/gtkdialog/xml_button-icon quit`"'
      <action>EXIT:ok</action>
    </button>
  </hbox>
</vbox>
</window>' >> $HOME/.jwm/tmp/pdesktop_xml

. /usr/lib/gtkdialog/xml_info gtk #build bg_pixmap for gtk-theme
gtkdialog -f $HOME/.jwm/tmp/pdesktop_xml




