public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Jonathan Callen <abcd@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: base-system@gentoo.org
Subject: [gentoo-dev] Changes to make_desktop_entry in eutils.eclass
Date: Tue, 23 Feb 2010 20:26:13 -0500	[thread overview]
Message-ID: <4B848035.7000703@gentoo.org> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 338 bytes --]

Attached is a patch to properly comply with the part of the FDO Desktop
Menu Specification pertaining to Categories (namely, always ensuring
that the list ends in a ";") and the part of the FDO Desktop Entry
Specification and Icon Theme Specification pertaining to icons (namely,
that non-absolute paths MUST NOT have an extension).

[-- Attachment #1.2: eutils.eclass.diff --]
[-- Type: text/plain, Size: 1362 bytes --]

--- eutils.eclass
+++ eutils.eclass.new
@@ -961,6 +961,7 @@ make_desktop_entry() {
 					news)	type=News;;
 					nntp)	type=News;;
 					p2p)	type=FileTransfer;;
+					voip)	type=Telephony;;
 					*)		type=;;
 				esac
 				type="Network;${type}"
@@ -991,7 +992,7 @@ make_desktop_entry() {
 					client) type=WebBrowser;;
 					*)		type=;;
 				esac
-				type="Network"
+				type="Network;${type}"
 				;;
 
 			*)
@@ -1007,6 +1008,17 @@ make_desktop_entry() {
 	local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop"
 	#local desktop=${T}/${exec%% *:-${desktop_name}}.desktop
 
+	# Don't append another ";" when a valid category value is provided.
+	[[ -n ${type} && ${type} != *';' ]] && type+=";"
+
+	eshopts_push -s extglob
+	if [[ -n ${icon} && ${icon} != /* && ${icon} == *.@(xpm|png|svg) ]]; then
+		ewarn "As described in the Icon Theme Specification, icon file extensions are not"
+		ewarn "allowed in .desktop files if the value is not an absolute path."
+		icon=${icon%.@(xpm|png|svg)}
+	fi
+	eshopts_pop
+
 	cat <<-EOF > "${desktop}"
 	[Desktop Entry]
 	Name=${name}
@@ -1015,7 +1027,7 @@ make_desktop_entry() {
 	Exec=${exec}
 	TryExec=${exec%% *}
 	Icon=${icon}
-	Categories=${type};
+	Categories=${type}
 	EOF
 
 	[[ ${path} ]] && echo "Path=${path}" >> "${desktop}"

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

             reply	other threads:[~2010-02-24  1:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-24  1:26 Jonathan Callen [this message]
2010-02-24 18:16 ` [gentoo-dev] Changes to make_desktop_entry in eutils.eclass Pacho Ramos
2010-02-24 18:40   ` Ulrich Mueller
2010-02-24 18:53     ` Samuli Suominen
2010-02-24 18:55     ` Pacho Ramos
2010-02-24 18:57       ` Pacho Ramos
2010-02-24 19:33       ` Ulrich Mueller
2010-02-24 19:44         ` Pacho Ramos
2010-02-24 19:53   ` [gentoo-dev] " Jonathan Callen
2010-02-24 20:00     ` Pacho Ramos
2010-02-24 20:11     ` Ulrich Mueller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B848035.7000703@gentoo.org \
    --to=abcd@gentoo.org \
    --cc=base-system@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox