Magellan Linux

Diff of /trunk/include/xdg.sminc

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

trunk/core/include/xdg.sminc revision 1934 by niro, Wed Jun 10 17:02:30 2009 UTC trunk/include/xdg.sminc revision 12527 by niro, Wed Jun 6 19:55:06 2012 UTC
# Line 64  minstall_desktop_icon() Line 64  minstall_desktop_icon()
64   --categories|-c) shift; categories="$1" ;;   --categories|-c) shift; categories="$1" ;;
65   --vendor|-v) shift; vendor="$1" ;;   --vendor|-v) shift; vendor="$1" ;;
66   --mimetypes|-x) shift; mimetypes="$1" ;;   --mimetypes|-x) shift; mimetypes="$1" ;;
67     --source|-s) shift; source="$1" ;;
68   esac   esac
69   shift   shift
70   done   done
# Line 122  Type=Application" > ${SRCDIR}/${file} Line 123  Type=Application" > ${SRCDIR}/${file}
123  # minstallxdg {-s} srcname destname {/path/to}  # minstallxdg {-s} srcname destname {/path/to}
124  minstallxdg()  minstallxdg()
125  {  {
126     local i
127   local file   local file
128   local destdir   local destdir
129   local destfile   local destfile
130     local prefix
131     local modify="0"
132     local comment
133     local exec
134     local icon
135     local terminal
136     local notify
137     local categories
138     local vendor
139     local all_categories
140     local mimetypes
141     local cmdline
142    
143     for i in $*
144     do
145     case $1 in
146     --srcdir|-s) prefix="${SOURCEDIR}/${PNAME}/" ;;
147     --name|-n) shift; name="$1"; modify="1" ;;
148     --comment|-m) shift; comment="$1"; modify="1" ;;
149     --exec|-e) shift; exec="$1"; modify="1" ;;
150     --icon|-i) shift; icon="$1"; modify="1" ;;
151     --terminal|-t) terminal="true"; modify="1" ;;
152     --no-notify|-y) notify="false"; modify="1" ;;
153     --categories|-c) shift; categories="$1"; modify="1" ;;
154     --vendor|-v) shift; vendor="$1"; modify="1" ;;
155     --mimetypes|-x) shift; mimetypes="$1"; modify="1" ;;
156     --file|-f) shift; file="$1" ;;
157     --destination-file|-df) shift; destfile="$1" ;;
158     --destination-dir|-d) shift; destdir="$1" ;;
159     esac
160     shift
161     done
162    
163   [[ -z "$1" ]] && die "No xdg desktop file given"   [[ ! -z ${prefix} ]] && file="${prefix}${file}"
164    
165   # if no fullpath given use file from sourcedir   [[ -z ${destfile} ]] && destfile="$(basename ${file})"
166   if [[ $1 = -s ]]   [[ -z ${destdir} ]] && destdir="/usr/share/applications"
167   then   [[ -z ${file} ]] && die "No xdg desktop file given"
168   file="${SOURCEDIR}/${PNAME}/$2"  
169   destfile="$3"   # needed directory
170     minstalldir ${destdir} || die
  else  
  file="$1"  
  fi  
171    
172   if [[ $1 = -s ]]   if [[ ${modify} = 1 ]]
173   then   then
174   file="${SOURCEDIR}/${PNAME}/$2"   [[ ! -z ${name} ]] && cmdline+=" --set-name=\"${name}\""
175   if [[ -n "$3" ]]   [[ ! -z ${comment} ]] && cmdline+=" --set-comment=\"${comment}\""
176     [[ ! -z ${exec} ]] && cmdline+=" --set-key=Exec --set-value=\"${exec}\""
177     [[ ! -z ${icon} ]] && cmdline+=" --set-icon=\"${icon}\""
178     [[ ! -z ${terminal} ]] && cmdline+=" --set-key=Terminal --set-value=false"
179     [[ ! -z ${notify} ]] && cmdline+=" --set-key=StartupNotify --set-value=false"
180     [[ ! -z ${vendor} ]] && cmdline+=" --vendor \"${vendor}\""
181    
182     if [[ ! -z ${categories} ]]
183   then   then
184   destfile="$3"   # get all categories
185   else   for i in $(echo ${categories} | sed "s:,:\ :g")
186   destfile="$(basename ${file})"   do
187     cmdline+=" --add-category ${i}"
188     done
189   fi   fi
190    
191   if [[ -n "$4" ]]   # get all mimetypes
192     if [[ ! -z ${mimetypes} ]]
193   then   then
194   destdir="$4"   for i in $(echo ${mimetypes} | sed "s:,:\ :g")
195   else   do
196   destdir="/usr/share/applications"   cmdline+=" --add-mime-type ${i}"
197     done
198   fi   fi
199    
200     desktop-file-install \
201     --dir ${BINDIR}/${destdir} \
202     --add-category X-Magellan-Application \
203     ${cmdline} \
204     ${file} \
205     || die
206   else   else
207   file="$1"   # install our xdg
208   if [[ -n "$2" ]]   minstallfile ${file} ${destdir}/${destfile} || die
  then  
  destfile="$2"  
  else  
  destfile="$(basename ${file})"  
  fi  
   
  if [[ -n "$3" ]]  
  then  
  destdir="$3"  
  else  
  destdir="/usr/share/applications"  
  fi  
209   fi   fi
   
  # needed directory  
  minstalldir ${destdir} || die  
   
  # install our xdg  
  minstallfile ${file} ${BINDIR}/${destdir}/${destfile} || die  
210  }  }

Legend:
Removed from v.1934  
changed lines
  Added in v.12527