Annotation of /mcore-src/trunk/mcore-tools/src/modules/idesk/idesk-generate-icon-info.in
Parent Directory | Revision Log
Revision 2551 -
(hide annotations)
(download)
Wed Sep 16 13:28:56 2015 UTC (8 years, 7 months ago) by niro
File size: 2270 byte(s)
Wed Sep 16 13:28:56 2015 UTC (8 years, 7 months ago) by niro
File size: 2270 byte(s)
-try to find an existing icon with the same name first
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 | 2551 | # try to find an existing icon with the same name first |
48 | niro | 2369 | if [[ -z ${icon} ]] |
49 | then | ||
50 | niro | 2551 | [[ -f ${GLOBAL_PIXMAPS_PATH}/${name}.png ]] && icon="${name}.png" |
51 | fi | ||
52 | if [[ -z ${icon} ]] | ||
53 | then | ||
54 | niro | 2369 | # if no default icon is given use default.png |
55 | [[ -z ${deficon} ]] && deficon="default.png" | ||
56 | icon="${deficon}" | ||
57 | fi | ||
58 | niro | 2358 | |
59 | niro | 2369 | CONFIG="${ICON_INFO_PATH}/${filename}.${ICON_INFO_SUFFIX}" |
60 | clearconfig | ||
61 | niro | 2358 | |
62 | niro | 2369 | addconfig "name=\"${name}\"" |
63 | addconfig "filename=\"${filename}\"" | ||
64 | addconfig "command=\"${command}\"" | ||
65 | addconfig "icon=\"${icon}\"" | ||
66 | addconfig "deficon=\"${deficon}\"" | ||
67 | niro | 2404 | addconfig "xpos=\"${xpos}\"" |
68 | addconfig "ypos=\"${ypos}\"" | ||
69 | niro | 2369 | if [[ ! -z ${iwidth} ]] |
70 | then | ||
71 | addconfig "iwidth=\"${iwidth}\"" | ||
72 | fi | ||
73 | niro | 2358 | |
74 | niro | 2369 | if [[ ! -z ${iheight} ]] |
75 | then | ||
76 | addconfig "iheight=\"${iheight}\"" | ||
77 | fi | ||
78 | ;; | ||
79 | |||
80 | del) | ||
81 | [[ -z ${name} ]] && die "No name given" | ||
82 | [[ -z ${filename} ]] && filename="${name}" | ||
83 | |||
84 | if [[ -f ${ICON_INFO_PATH}/${filename}.${ICON_INFO_SUFFIX} ]] | ||
85 | then | ||
86 | rm "${ICON_INFO_PATH}/${filename}.${ICON_INFO_SUFFIX}" | ||
87 | fi | ||
88 | ;; | ||
89 | |||
90 | print) | ||
91 | list_files_in_directory "${ICON_INFO_PATH}" | ||
92 | ;; | ||
93 | esac |