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 4144 by niro, Thu Nov 26 11:00:10 2009 UTC trunk/include/xdg.sminc revision 12533 by niro, Wed Jun 6 20:49:47 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     local name
143    
144     for i in $*
145     do
146     case $1 in
147     --srcdir|-s) prefix="${SOURCEDIR}/${PNAME}/" ;;
148     --name|-n) shift; name="$1"; modify="1" ;;
149     --comment|-m) shift; comment="$1"; modify="1" ;;
150     --exec|-e) shift; exec="$1"; modify="1" ;;
151     --icon|-i) shift; icon="$1"; modify="1" ;;
152     --terminal|-t) terminal="true"; modify="1" ;;
153     --no-notify|-y) notify="false"; modify="1" ;;
154     --categories|-c) shift; categories="$1"; modify="1" ;;
155     --vendor|-v) shift; vendor="$1"; modify="1" ;;
156     --mimetypes|-x) shift; mimetypes="$1"; modify="1" ;;
157     --file|-f) shift; file="$1" ;;
158     --destination-file|-df) shift; destfile="$1" ;;
159     --destination-dir|-d) shift; destdir="$1" ;;
160     esac
161     shift
162     done
163    
164   [[ -z "$1" ]] && die "No xdg desktop file given"   [[ ! -z ${prefix} ]] && file="${prefix}${file}"
165    
166   # if no fullpath given use file from sourcedir   [[ -z ${destfile} ]] && destfile="$(basename ${file})"
167   if [[ $1 = -s ]]   [[ -z ${destdir} ]] && destdir="/usr/share/applications"
168   then   [[ -z ${file} ]] && die "No xdg desktop file given"
169   file="${SOURCEDIR}/${PNAME}/$2"  
170   destfile="$3"   # needed directory
171     minstalldir ${destdir} || die
  else  
  file="$1"  
  fi  
172    
173   if [[ $1 = -s ]]   if [[ ${modify} = 1 ]]
174   then   then
175   file="${SOURCEDIR}/${PNAME}/$2"   [[ ! -z ${name} ]] && cmdline+=" --set-name=\"${name}\""
176   if [[ -n "$3" ]]   [[ ! -z ${comment} ]] && cmdline+=" --set-comment=\"${comment}\""
177     [[ ! -z ${exec} ]] && cmdline+=" --set-key=Exec --set-value=\"${exec}\""
178     [[ ! -z ${icon} ]] && cmdline+=" --set-icon=\"${icon}\""
179     [[ ! -z ${terminal} ]] && cmdline+=" --set-key=Terminal --set-value=false"
180     [[ ! -z ${notify} ]] && cmdline+=" --set-key=StartupNotify --set-value=false"
181     [[ ! -z ${vendor} ]] && cmdline+=" --vendor \"${vendor}\""
182    
183     if [[ ! -z ${categories} ]]
184   then   then
185   destfile="$3"   # get all categories
186   else   for i in $(echo ${categories} | sed "s:,:\ :g")
187   destfile="$(basename ${file})"   do
188     cmdline+=" --add-category ${i}"
189     done
190   fi   fi
191    
192   if [[ -n "$4" ]]   # get all mimetypes
193     if [[ ! -z ${mimetypes} ]]
194   then   then
195   destdir="$4"   for i in $(echo ${mimetypes} | sed "s:,:\ :g")
196   else   do
197   destdir="/usr/share/applications"   cmdline+=" --add-mime-type ${i}"
198     done
199   fi   fi
200    
201     eval desktop-file-install \
202     --dir ${BINDIR}/${destdir} \
203     --add-category X-Magellan-Application \
204     ${cmdline} \
205     ${file} \
206     || die
207   else   else
208   file="$1"   # install our xdg
209   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  
210   fi   fi
   
  # needed directory  
  minstalldir ${destdir} || die  
   
  # install our xdg  
  minstallfile ${file} ${destdir}/${destfile} || die  
211  }  }

Legend:
Removed from v.4144  
changed lines
  Added in v.12533