Contents of /mcore-src/trunk/mcore-tools/src/modules/idesk/idesk-generate-icon-info.in
Parent Directory | Revision Log
Revision 2369 -
(show annotations)
(download)
Wed Aug 26 11:03:13 2015 UTC (8 years, 10 months ago) by niro
File size: 2109 byte(s)
Wed Aug 26 11:03:13 2015 UTC (8 years, 10 months ago) by niro
File size: 2109 byte(s)
-added add,del,print support
1 | #!/bin/bash |
2 | |
3 | MCORE_LIBDIR="@@MCORE_LIBDIR@@" |
4 | source @@SYSCONFDIR@@/mcore/mcore.conf |
5 | source ${MCORE_LIBDIR}/include/common.global.class |
6 | |
7 | GLOBAL_PIXMAPS_PATH="@@GLOBAL_PIXMAPS_PATH@@" |
8 | LOCAL_PIXMAPS_PATH="${MCORE_CONFIG_PATH}/icons/default" |
9 | |
10 | ICON_INFO_PATH="${MCORE_CONFIG_PATH}/icons/info" |
11 | ICON_INFO_SUFFIX="@@ICON_INFO_SUFFIX@@" |
12 | |
13 | die() { echo "ERROR: $@"; exit 1; } |
14 | |
15 | # very basic getops |
16 | for i in $* |
17 | do |
18 | case $1 in |
19 | --add|--del|--print) method="${1//--}" ;; |
20 | --name|-n) shift; name="$1" ;; |
21 | --command|-c) shift; command="$1" ;; |
22 | --icon|-i) shift; icon="$1" ;; |
23 | --filename|-f) shift; filename="$1" ;; |
24 | --xres|-x) shift; xres="$1" ;; |
25 | --yres|-y) shift; yres="$1" ;; |
26 | --icon-width|-w) shift; iwidth="$1" ;; |
27 | --icon-height|-h) shift; iheight="$1" ;; |
28 | --default-icon) shift; deficon="$1" ;; |
29 | esac |
30 | shift |
31 | done |
32 | |
33 | # some sanity checks: |
34 | [[ -z ${method} ]] && die "No method given" |
35 | |
36 | case ${method} in |
37 | add) |
38 | # abort if name or command not given |
39 | [[ -z ${name} ]] && die "No name given" |
40 | [[ -z ${command} ]] && die "No command given" |
41 | |
42 | [[ -z ${filename} ]] && filename="${name}" |
43 | |
44 | # use some defaults for icon, dest, {x,y}res |
45 | [[ -z ${xres} ]] && xres=50 |
46 | [[ -z ${yres} ]] && yres=50 |
47 | if [[ -z ${icon} ]] |
48 | then |
49 | # if no default icon is given use default.png |
50 | [[ -z ${deficon} ]] && deficon="default.png" |
51 | icon="${deficon}" |
52 | fi |
53 | |
54 | CONFIG="${ICON_INFO_PATH}/${filename}.${ICON_INFO_SUFFIX}" |
55 | clearconfig |
56 | |
57 | addconfig "name=\"${name}\"" |
58 | addconfig "filename=\"${filename}\"" |
59 | addconfig "command=\"${command}\"" |
60 | addconfig "icon=\"${icon}\"" |
61 | addconfig "deficon=\"${deficon}\"" |
62 | addconfig "xres=\"${xres}\"" |
63 | addconfig "yres=\"${yres}\"" |
64 | if [[ ! -z ${iwidth} ]] |
65 | then |
66 | addconfig "iwidth=\"${iwidth}\"" |
67 | fi |
68 | |
69 | if [[ ! -z ${iheight} ]] |
70 | then |
71 | addconfig "iheight=\"${iheight}\"" |
72 | fi |
73 | ;; |
74 | |
75 | del) |
76 | [[ -z ${name} ]] && die "No name given" |
77 | [[ -z ${filename} ]] && filename="${name}" |
78 | |
79 | if [[ -f ${ICON_INFO_PATH}/${filename}.${ICON_INFO_SUFFIX} ]] |
80 | then |
81 | rm "${ICON_INFO_PATH}/${filename}.${ICON_INFO_SUFFIX}" |
82 | fi |
83 | ;; |
84 | |
85 | print) |
86 | list_files_in_directory "${ICON_INFO_PATH}" |
87 | ;; |
88 | esac |