Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/idesk/idesk-generate-icon-info.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2358 by niro, Tue Aug 25 09:51:46 2015 UTC revision 2551 by niro, Wed Sep 16 13:28:56 2015 UTC
# Line 10  LOCAL_PIXMAPS_PATH="${MCORE_CONFIG_PATH} Line 10  LOCAL_PIXMAPS_PATH="${MCORE_CONFIG_PATH}
10  ICON_INFO_PATH="${MCORE_CONFIG_PATH}/icons/info"  ICON_INFO_PATH="${MCORE_CONFIG_PATH}/icons/info"
11  ICON_INFO_SUFFIX="@@ICON_INFO_SUFFIX@@"  ICON_INFO_SUFFIX="@@ICON_INFO_SUFFIX@@"
12    
13    die() { echo "ERROR: $@"; exit 1; }
14    
15  # very basic getops  # very basic getops
16  for i in $*  for i in $*
17  do  do
18   case $1 in   case $1 in
19     --add|--del|--print) method="${1//--}" ;;
20   --name|-n) shift; name="$1" ;;   --name|-n) shift; name="$1" ;;
21   --command|-c) shift; command="$1" ;;   --command|-c) shift; command="$1" ;;
22   --icon|-i) shift; icon="$1" ;;   --icon|-i) shift; icon="$1" ;;
23   --filename|-f) shift; filename="$1" ;;   --filename|-f) shift; filename="$1" ;;
24   --xres|-x) shift; xres="$1" ;;   --xpos|-x) shift; xpos="$1" ;;
25   --yres|-y) shift; yres="$1" ;;   --ypos|-y) shift; ypos="$1" ;;
26   --icon-width|-w) shift; iwidth="$1" ;;   --icon-width|-w) shift; iwidth="$1" ;;
27   --icon-height|-h) shift; iheight="$1" ;;   --icon-height|-h) shift; iheight="$1" ;;
28   --default-icon) shift; deficon="$1" ;;   --default-icon) shift; deficon="$1" ;;
# Line 28  do Line 31  do
31  done  done
32    
33  # some sanity checks:  # some sanity checks:
34    [[ -z ${method} ]] && die "No method given"
35    
36  # abort if name or command not given  case ${method} in
37  [[ -z ${name} ]] && die "No name given"   add)
38  [[ -z ${command} ]] && die "No command given"   # abort if name or command not given
39     [[ -z ${name} ]] && die "No name given"
40  [[ -z ${filename} ]] && filename="${name}"   [[ -z ${command} ]] && die "No command given"
41    
42  # use some defaults for icon, dest, {x,y}res   [[ -z ${filename} ]] && filename="${name}"
43  [[ -z ${xres} ]] && xres=50  
44  [[ -z ${yres} ]] && xres=50   # use some defaults for icon, dest, {x,y}pos
45  if [[ -z ${icon} ]]   [[ -z ${xpos} ]] && xpos=50
46  then   [[ -z ${ypos} ]] && ypos=50
47   # if no default icon is given use default.png   # try to find an existing icon with the same name first
48   [[ -z ${deficon} ]] && deficon="default.png"   if [[ -z ${icon} ]]
49   icon="${deficon}"   then
50  fi   [[ -f ${GLOBAL_PIXMAPS_PATH}/${name}.png ]] && icon="${name}.png"
51     fi
52  CONFIG="${ICON_INFO_PATH}/${filename}.${ICON_INFO_SUFFIX}"   if [[ -z ${icon} ]]
53  clearconfig   then
54     # if no default icon is given use default.png
55  addconfig "name=\"${name}\""   [[ -z ${deficon} ]] && deficon="default.png"
56  addconfig "command=\"${command}\""   icon="${deficon}"
57  addconfig "icon=\"${icon}\""   fi
58  addconfig "deficon=\"${deficon}\""  
59  addconfig "xres=\"${xres}\""   CONFIG="${ICON_INFO_PATH}/${filename}.${ICON_INFO_SUFFIX}"
60  addconfig "yres=\"${yres}\""   clearconfig
61  if [[ -z ${iwidth} ]]  
62  then   addconfig "name=\"${name}\""
63   addconfig "iwidth=0"   addconfig "filename=\"${filename}\""
64  else   addconfig "command=\"${command}\""
65   addconfig "iwidth=\"${iwidth}\""   addconfig "icon=\"${icon}\""
66  fi   addconfig "deficon=\"${deficon}\""
67     addconfig "xpos=\"${xpos}\""
68  if [[ ! -z ${iheight} ]]   addconfig "ypos=\"${ypos}\""
69  then   if [[ ! -z ${iwidth} ]]
70   addconfig="iheight=0"   then
71  else   addconfig "iwidth=\"${iwidth}\""
72   addconfig "iheight=\"${iheight}\""   fi
73  fi  
74     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

Legend:
Removed from v.2358  
changed lines
  Added in v.2551