Annotation of /mcore-src/trunk/mcore-tools/src/modules/idesk/idesk-generate-icon-info.in
Parent Directory | Revision Log
Revision 2404 -
(hide annotations)
(download)
Mon Aug 31 08:57:10 2015 UTC (8 years, 8 months ago) by niro
File size: 2109 byte(s)
Mon Aug 31 08:57:10 2015 UTC (8 years, 8 months ago) by niro
File size: 2109 byte(s)
-renamed icon position variables from {x,y}res to {x,y}pos
1 | niro | 2358 | #!/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 | niro | 2360 | die() { echo "ERROR: $@"; exit 1; } |
14 | |||
15 | niro | 2358 | # very basic getops |
16 | for i in $* | ||
17 | do | ||
18 | case $1 in | ||
19 | niro | 2369 | --add|--del|--print) method="${1//--}" ;; |
20 | niro | 2358 | --name|-n) shift; name="$1" ;; |
21 | --command|-c) shift; command="$1" ;; | ||
22 | --icon|-i) shift; icon="$1" ;; | ||
23 | --filename|-f) shift; filename="$1" ;; | ||
24 | niro | 2404 | --xpos|-x) shift; xpos="$1" ;; |
25 | --ypos|-y) shift; ypos="$1" ;; | ||
26 | niro | 2358 | --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 | niro | 2369 | [[ -z ${method} ]] && die "No method given" |
35 | niro | 2358 | |
36 | niro | 2369 | 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 | niro | 2358 | |
42 | niro | 2369 | [[ -z ${filename} ]] && filename="${name}" |
43 | niro | 2358 | |
44 | niro | 2404 | # use some defaults for icon, dest, {x,y}pos |
45 | [[ -z ${xpos} ]] && xpos=50 | ||
46 | [[ -z ${ypos} ]] && ypos=50 | ||
47 | niro | 2369 | 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 | niro | 2358 | |
54 | niro | 2369 | CONFIG="${ICON_INFO_PATH}/${filename}.${ICON_INFO_SUFFIX}" |
55 | clearconfig | ||
56 | niro | 2358 | |
57 | niro | 2369 | addconfig "name=\"${name}\"" |
58 | addconfig "filename=\"${filename}\"" | ||
59 | addconfig "command=\"${command}\"" | ||
60 | addconfig "icon=\"${icon}\"" | ||
61 | addconfig "deficon=\"${deficon}\"" | ||
62 | niro | 2404 | addconfig "xpos=\"${xpos}\"" |
63 | addconfig "ypos=\"${ypos}\"" | ||
64 | niro | 2369 | if [[ ! -z ${iwidth} ]] |
65 | then | ||
66 | addconfig "iwidth=\"${iwidth}\"" | ||
67 | fi | ||
68 | niro | 2358 | |
69 | niro | 2369 | 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 |