Magellan Linux

Diff of /trunk/include/xdg.sminc

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

revision 6654 by niro, Tue Sep 14 16:46:32 2010 UTC revision 9702 by niro, Thu Jan 5 15:20:14 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) shift; 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     esac
157     shift
158     done
159    
160     file="${prefix}$1"
161    
162     if [[ -n "$2" ]]
163     then
164     destfile="$2"
165     else
166     destfile="$(basename ${file})"
167     fi
168    
169     if [[ -n "$3" ]]
170     then
171     destdir="$3"
172     else
173     destdir="/usr/share/applications"
174     fi
175    
176   [[ -z "$1" ]] && die "No xdg desktop file given"   [[ -z ${file} ]] && die "No xdg desktop file given"
177    
178   # if -s given use file from sourcedir   # needed directory
179   if [[ $1 = -s ]]   minstalldir ${destdir} || die
180    
181     if [[ ${modify} = 1 ]]
182   then   then
183   file="${SOURCEDIR}/${PNAME}/$2"   [[ ! -z ${name} ]] && cmdline+=" --set-name=\"${name}\""
184   if [[ -n "$3" ]]   [[ ! -z ${comment} ]] && cmdline+=" --set-comment=\"${comment}\""
185     [[ ! -z ${exec} ]] && cmdline+=" --set-key=Exec --set-value=\"${exec}\""
186     [[ ! -z ${icon} ]] && cmdline+=" --set-icon=\"${icon}\""
187     [[ ! -z ${terminal} ]] && cmdline+=" --set-key=Terminal --set-value=false"
188     [[ ! -z ${notify} ]] && cmdline+=" --set-key=StartupNotify --set-value=false"
189     [[ ! -z ${vendor} ]] && cmdline+=" --vendor \"${vendor}\""
190    
191     if [[ ! -z ${categories} ]]
192   then   then
193   destfile="$3"   # get all categories
194   else   for i in $(echo ${categories} | sed "s:,:\ :g")
195   destfile="$(basename ${file})"   do
196     cmdline+=" --add-category ${i}"
197     done
198   fi   fi
199    
200   if [[ -n "$4" ]]   # get all mimetypes
201     if [[ ! -z ${mimetypes} ]]
202   then   then
203   destdir="$4"   for i in $(echo ${mimetypes} | sed "s:,:\ :g")
204   else   do
205   destdir="/usr/share/applications"   cmdline+=" --add-mime-type ${i}"
206     done
207   fi   fi
208    
209     desktop-file-install \
210     --dir ${destdir} \
211     --add-category X-Magellan-Application \
212     ${cmdline} \
213     ${file} \
214     || die
215   else   else
216   file="$1"   # install our xdg
217   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  
218   fi   fi
   
  # needed directory  
  minstalldir ${destdir} || die  
   
  # install our xdg  
  minstallfile ${file} ${destdir}/${destfile} || die  
219  }  }

Legend:
Removed from v.6654  
changed lines
  Added in v.9702