4 ## @brief Merge the keyword tree of one Geeqie configuration file into another.
6 ## The keyword trees are simply concatenated. When Geeqie loads
7 ## the resulting configuration file, any duplicates are discarded.
9 ## There is no error checking.
15 while read -r line_merge
19 if [ "$line_merge" != "${line_merge%<keyword_tree>*}" ]
24 if [ "$line_merge" != "${line_merge%<keyword_tree>*}" ]
28 printf '%s\n' "$line_merge" >> "$2"
36 zenity --info --text="This script will merge the keywords from one Geeqie\nconfiguration file into another.\n\n\The command format is:\nkeyword_merge.sh {config. file to merge into} {config. file to merge from}\n\nIf you do not supply parameters, you are prompted.\n\nYou are given the option to backup the main config. file before it is overwritten with the merged data.\n\nEnsure that Geeqie is not running." --title="Geeqie merge keywords" --width=400 --height=200
45 zenity --error --text "Too many parameters"
49 config_main=$(zenity --file-selection --file-filter="geeqierc.xml" --file-filter="*.xml" --file-filter="*" --title="Select main configuration file")
54 config_merge=$(zenity --file-selection --file-filter="geeqierc.xml" --file-filter="*.xml" --file-filter="*"-- title="Select configuration file to merge from")
61 config_merge=$(zenity --file-selection --file-filter="geeqierc.xml" --file-filter="*.xml" --file-filter="*" --title="Select configuration file to merge from")
68 tmp_file=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
70 while read -r line_main
72 if [ "$line_main" != "${line_merge%<keyword_tree>*}" ]
74 merge_file "$config_merge" "$tmp_file"
76 printf '%s\n' "$line_main" >> "$tmp_file"
80 if zenity --question --text="Backup configuration file before overwriting?"
82 cp "$config_main" "$config_main.$(date +%Y%m%d%H%M%S)"
85 mv "$tmp_file" "$config_main"