#! /bin/sh
set -e

# Create pictures from the GNOME icon theme
test -f img/n.png
COMPOSE='composite -gravity SouthEast -compose src-over'

# connect.png is the default icon in the notification area
convert -resize 16x16 img/n.png img/connect.png

# disconnect.png is the notification area icon when the connection fails
convert -resize 8x8 /usr/share/icons/gnome/16x16/emblems/emblem-unreadable.png img/fail.png
$COMPOSE img/fail.png img/connect.png img/disconnect.png
rm -f img/fail.png


# away2.png is the notification area icon when the user is away
convert -resize 12x12 /usr/share/icons/gnome/16x16/status/appointment-soon.png img/clock.png
$COMPOSE img/clock.png img/connect.png img/away2.png
rm -f img/clock.png

# hilite2.png is for when you get some notification
cp /usr/share/icons/gnome/16x16/status/info.png img/hilite.png
convert -resize 12x12 img/hilite.png img/bulb.png
$COMPOSE img/bulb.png img/connect.png img/hilite2.png
rm -f img/bulb.png
rm -f img/*.ico
cat >> img/README << EOF
NOTE FOR THE DEBIAN PACKAGE
===========================
All icons coming from Silk were removed, and replaced by icons from the 
default GNOME icon theme (GPL v2). The script used to create them is in 
debian/nicotine-rm-non-free.
EOF

# Re-encode pictures
python tools/encode_bitmaps.py

# Remove generated .mo files
rm -f `find languages/ -name \*.mo`

# Remove non-free sounds
rm -rf sounds

# Remove suspiciously licensed win32 code
rm -rf tools/win32-installer/
