#/bin/bash # # Script to import GNOME 3 thumbnailers into GConf. # Workaround for bug lp:864615. # https://bugs.launchpad.net/ubuntu/+source/gconf2/+bug/864615 # (c) 2011 Patrick Ulbrich # THUMBNAILER_DIR=/usr/share/thumbnailers GCONF_PATH=/desktop/gnome/thumbnailers if [ $(gconftool-2 --all-dirs $GCONF_PATH | wc -l) -gt 0 ]; then echo "Thumbnailers are available in GConf. Import not necessary." exit fi if [ ! -d $THUMBNAILER_DIR ]; then echo "Error: Can't import - directory '$THUMBNAILER_DIR' not found." exit fi echo "Importing thumbnailers into GConf..." cnt=0 commands= mimetypes= for f in $(ls $THUMBNAILER_DIR); do echo "* Importing $f" cmd=$(grep -w Exec "$THUMBNAILER_DIR/$f" | cut -d '=' -f2) mimestr=$(grep -w MimeType "$THUMBNAILER_DIR/$f" | cut -d '=' -f2) for m in $( echo $mimestr | tr ";" "\n"); do commands[$cnt]=$cmd mimetypes[$cnt]=$(echo $m | tr "/" "@" | tr "+" "@") ((cnt++)) done done echo "* Writing to GConf" entries= for (( i = 0 ; i < ${#mimetypes[@]} ; i++ )); do read -d '' entry < ${mimetypes[$i]}/command /schemas$GCONF_PATH/${mimetypes[$i]}/command ${commands[$i]} ${mimetypes[$i]}/enable /schemas$GCONF_PATH/${mimetypes[$i]}/enable true EOF entries=$entries$entry done read -d '' xml < disable_all /schemas$GCONF_PATH/disable_all false $entries EOF echo $xml | gconftool-2 --load - echo "Done."