5 ## @brief Insert updated menu "Valid sections" list into the desktop template file.
7 ## This needs to be run only when the menus have changed.
10 tmp_file=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
11 path=$(dirname "$(realpath "$0")")
12 srcpath=$(dirname "$path")/src/ui/menu-classic.ui
13 templatepath=$(dirname "$path")/plugins/org.geeqie.template.desktop.in
15 awk -v src_path="$srcpath" 'BEGIN {
23 {while ((getline line < src_path) > 0 )
29 if (line == "<\047ui>")
35 gsub(/\047|"|\/|<|>/, "", line)
36 split(line, lineArr, "=")
38 if (index(lineArr[1], "menu action") > 0)
44 print "# " menu[1] "/" menu[2] "/" lineArr[2]
48 print "# " menu[1] "/" lineArr[2]
55 if (index(lineArr[1], "placeholder name"))
59 print "# " menu[1] "/" menu[2] "/" lineArr[2]
63 print "# " menu[1] "/" lineArr[2]
71 if (lineArr[2] == "PluginsMenu")
80 /Valid sections/ {template_flag = 1; print; get_menus()}
81 /For other keys/ {template_flag = 0; print ""}
82 (template_flag == 0) {print}
83 ' "$templatepath" > "$tmp_file"
88 if diff --unified=0 "./plugins/org.geeqie.template.desktop.in" "$tmp_file" | zenity --title="Plugin template update" --text-info --width=700 --height=400
90 mv "$tmp_file" "$templatepath"