123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #!/bin/bash
- #this generates xml code for a gtkdialog gui.
- #it is NOT a standalone window
- #
- #the reason for using this template is to control icon-height for all buttons in all apps by setting HEIGHT here
- #
- #usage :
- # xml_button-icon ICON SIZE
- #
- # ICON can either be a gtk stock icon, a normal raster/vector file or no icon. if no path is set, /usr/share/pixmaps/puppy/ is used
- # SIZE can be popup, mini, big or huge. Anything else sets size to buttonsize
- #
- #Sigmund Berglund, dec 2013
- #GPL
- #either use Puppy-stock icons (puppy) or Gtk-stock icons (gtk)
- STOCK=puppy
- #STOCK=gtk
- #define icon
- case $1 in
- /*svg)
- #icon from svg file
- ICON="<input file>${1}</input>"
- ;;
- *.svg)
- #icon from puppy stock
- ICON="<input file>/usr/share/pixmaps/puppy/${1}</input>"
- ;;
- /*)
- #icon from file
- ICON="<input file>${1}</input>"
- ;;
- 0|none|' '|'')
- ICON=""
- ;;
- *)
- #stock icon - use either Gtk-stock or Pyppy-stock
- if [ "$STOCK" = "puppy" ] && [ -s "/usr/share/pixmaps/puppy/${1}.svg" ]; then
- ICON="<input file>/usr/share/pixmaps/puppy/${1}.svg</input>"
- else
- ICON="<input file stock=\"gtk-${1}\"></input>"
- fi
- esac
- #read config if exist
- [ -s $HOME/.config/ptheme/gtkdialog_active ] && . $HOME/.config/ptheme/gtkdialog_active
- [ ! "$XML_BUTTON_ICON_HEIGHT_HUGE" ] && XML_BUTTON_ICON_HEIGHT_HUGE=60
- [ ! "$XML_BUTTON_ICON_HEIGHT_BIG" ] && XML_BUTTON_ICON_HEIGHT_BIG=35
- [ ! "$XML_BUTTON_ICON_HEIGHT_MINI" ] && XML_BUTTON_ICON_HEIGHT_MINI=16
- [ ! "$XML_BUTTON_ICON_HEIGHT_NORMAL" ] && XML_BUTTON_ICON_HEIGHT_NORMAL=20
- if [ "$ICON" ]; then
- case $2 in
- huge)
- HEIGHT="<height>${XML_BUTTON_ICON_HEIGHT_HUGE}</height>"
- ;;
- big)
- HEIGHT="<height>${XML_BUTTON_ICON_HEIGHT_BIG}</height>"
- ;;
- mini)
- HEIGHT="<height>${XML_BUTTON_ICON_HEIGHT_MINI}</height>"
- ;;
- *)
- HEIGHT="<height>${XML_BUTTON_ICON_HEIGHT_NORMAL}</height>"
- ;;
- esac
- fi
-
- #generate XML code
- echo "$ICON $HEIGHT"
|