#!/bin/bash

if [ -z $1 ]; then
	echo -e "\n* AddDict utility - tool for adding dictionaries to GConf *\n"
	echo -e "Usage:\n\n./add_dict <dictionary_file> <name_of_dictionary>\n"
	
else
	if [ -z $2 ]; then
		echo "Dictionary name wasn't specified. Run without parameters to get help."
	else
		if [ -e $1 ]; then
			gconftool-2 --type string --set /apps/maemo/mdictionary/dictionaries/$2/name "$2"
			gconftool-2 --type string --set /apps/maemo/mdictionary/dictionaries/$2/path "`pwd`/$1"
			gconftool-2 --type boolean --set /apps/maemo/mdictionary/dictionaries/$2/active false
			gconftool-2 --type boolean --set /apps/maemo/mdictionary/dictionaries/$2/optimized false
			gconftool-2 -R /apps/maemo/mdictionary/dictionaries/$2
		else
			echo "Dictionary file couldn't be found. Run without parameters to get help."
			
		fi
		
	fi
fi
