/[gentoo-x86]/eclass/eutils.eclass
Gentoo

Diff of /eclass/eutils.eclass

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

Revision 1.340 Revision 1.341
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.340 2010/03/07 03:00:08 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.341 2010/03/23 03:40:18 vapier Exp $
4 4
5# @ECLASS: eutils.eclass 5# @ECLASS: eutils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: many extra (but common) functions that are used in ebuilds 8# @BLURB: many extra (but common) functions that are used in ebuilds
856 856
857# Make a desktop file ! 857# Make a desktop file !
858# Great for making those icons in kde/gnome startmenu ! 858# Great for making those icons in kde/gnome startmenu !
859# Amaze your friends ! Get the women ! Join today ! 859# Amaze your friends ! Get the women ! Join today !
860# 860#
861# make_desktop_entry(<command>, [name], [icon], [type], [path]) 861# make_desktop_entry(<command>, [name], [icon], [type], [fields])
862# 862#
863# binary: what command does the app run with ? 863# binary: what command does the app run with ?
864# name: the name that will show up in the menu 864# name: the name that will show up in the menu
865# icon: give your little like a pretty little icon ... 865# icon: give your little like a pretty little icon ...
866# this can be relative (to /usr/share/pixmaps) or 866# this can be relative (to /usr/share/pixmaps) or
867# a full path to an icon 867# a full path to an icon
868# type: what kind of application is this ? for categories: 868# type: what kind of application is this ? for categories:
869# http://standards.freedesktop.org/menu-spec/latest/apa.html 869# http://standards.freedesktop.org/menu-spec/latest/apa.html
870# path: if your app needs to startup in a specific dir 870# fields: extra fields to append to the desktop file; a printf string
871make_desktop_entry() { 871make_desktop_entry() {
872 [[ -z $1 ]] && eerror "make_desktop_entry: You must specify the executable" && return 1 872 [[ -z $1 ]] && die "make_desktop_entry: You must specify the executable"
873 873
874 local exec=${1} 874 local exec=${1}
875 local name=${2:-${PN}} 875 local name=${2:-${PN}}
876 local icon=${3:-${PN}} 876 local icon=${3:-${PN}}
877 local type=${4} 877 local type=${4}
878 local path=${5} 878 local fields=${5}
879 879
880 if [[ -z ${type} ]] ; then 880 if [[ -z ${type} ]] ; then
881 local catmaj=${CATEGORY%%-*} 881 local catmaj=${CATEGORY%%-*}
882 local catmin=${CATEGORY##*-} 882 local catmin=${CATEGORY##*-}
883 case ${catmaj} in 883 case ${catmaj} in
1026 TryExec=${exec%% *} 1026 TryExec=${exec%% *}
1027 Icon=${icon} 1027 Icon=${icon}
1028 Categories=${type} 1028 Categories=${type}
1029 EOF 1029 EOF
1030 1030
1031 [[ ${path} ]] && echo "Path=${path}" >> "${desktop}" 1031 if [[ ${fields:-=} != *=* ]] ; then
1032 # 5th arg used to be value to Path=
1033 ewarn "make_desktop_entry: update your 5th arg to read Path=${fields}"
1034 fields="Path=${fields}"
1035 fi
1036 [[ -n ${fields} ]] && printf "${fields}\n" >> "${desktop}"
1032 1037
1033 ( 1038 (
1034 # wrap the env here so that the 'insinto' call 1039 # wrap the env here so that the 'insinto' call
1035 # doesn't corrupt the env of the caller 1040 # doesn't corrupt the env of the caller
1036 insinto /usr/share/applications 1041 insinto /usr/share/applications

Legend:
Removed from v.1.340  
changed lines
  Added in v.1.341

  ViewVC Help
Powered by ViewVC 1.1.20