public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Changes to make_desktop_entry in eutils.eclass
@ 2010-02-24  1:26 Jonathan Callen
  2010-02-24 18:16 ` Pacho Ramos
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Callen @ 2010-02-24  1:26 UTC (permalink / raw
  To: gentoo-dev; +Cc: base-system


[-- 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 --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] Changes to make_desktop_entry in eutils.eclass
  2010-02-24  1:26 [gentoo-dev] Changes to make_desktop_entry in eutils.eclass Jonathan Callen
@ 2010-02-24 18:16 ` Pacho Ramos
  2010-02-24 18:40   ` Ulrich Mueller
  2010-02-24 19:53   ` [gentoo-dev] " Jonathan Callen
  0 siblings, 2 replies; 11+ messages in thread
From: Pacho Ramos @ 2010-02-24 18:16 UTC (permalink / raw
  To: gentoo-dev; +Cc: base-system

[-- Attachment #1: Type: text/plain, Size: 575 bytes --]

El mar, 23-02-2010 a las 20:26 -0500, Jonathan Callen escribió:
> 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).

Would be nice if you would have time to look at the following old
make_desktop_entry bug:
http://bugs.gentoo.org/show_bug.cgi?id=191000

Thanks a lot :-D

[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] Changes to make_desktop_entry in eutils.eclass
  2010-02-24 18:16 ` 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 19:53   ` [gentoo-dev] " Jonathan Callen
  1 sibling, 2 replies; 11+ messages in thread
From: Ulrich Mueller @ 2010-02-24 18:40 UTC (permalink / raw
  To: gentoo-dev

>>>>> On Wed, 24 Feb 2010, Pacho Ramos wrote:

> Would be nice if you would have time to look at the following old
> make_desktop_entry bug:
> http://bugs.gentoo.org/show_bug.cgi?id=191000

Why should "Science" be a sub-category of "Education"?
That doesn't make sense to me.

Ulrich



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] Changes to make_desktop_entry in eutils.eclass
  2010-02-24 18:40   ` Ulrich Mueller
@ 2010-02-24 18:53     ` Samuli Suominen
  2010-02-24 18:55     ` Pacho Ramos
  1 sibling, 0 replies; 11+ messages in thread
From: Samuli Suominen @ 2010-02-24 18:53 UTC (permalink / raw
  To: gentoo-dev

On 02/24/2010 08:40 PM, Ulrich Mueller wrote:
>>>>>> On Wed, 24 Feb 2010, Pacho Ramos wrote:
> 
>> Would be nice if you would have time to look at the following old
>> make_desktop_entry bug:
>> http://bugs.gentoo.org/show_bug.cgi?id=191000
> 
> Why should "Science" be a sub-category of "Education"?
> That doesn't make sense to me.
> 
> Ulrich
> 

http://standards.freedesktop.org/menu-spec/latest/apa.html

Main Category:        Education;
Additional Category:  Education;Science;

( If you don't like it, you need to get a new spec. revision from
upstream, so such discussion belongs to freedesktop mailinglist, it's
not for distributions to change on their own )

So let's keep this about making make_desktop_entry respect the given
spec....

-Samuli



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] Changes to make_desktop_entry in eutils.eclass
  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
  1 sibling, 2 replies; 11+ messages in thread
From: Pacho Ramos @ 2010-02-24 18:55 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 781 bytes --]

El mié, 24-02-2010 a las 19:40 +0100, Ulrich Mueller escribió:
> >>>>> On Wed, 24 Feb 2010, Pacho Ramos wrote:
> 
> > Would be nice if you would have time to look at the following old
> > make_desktop_entry bug:
> > http://bugs.gentoo.org/show_bug.cgi?id=191000
> 
> Why should "Science" be a sub-category of "Education"?
> That doesn't make sense to me.
> 
> Ulrich
> 
> 

I agree with you bad, sadly, spec states it's a sub-category:
http://standards.freedesktop.org/menu-spec/latest/apa.html

and, for now, we need to use "Education,Science" if we don't want to see
that menu entries showing up in "Others" menu :-(.

This bug is interesting, but I don't think it will be fixed soon :-/
https://bugs.freedesktop.org/show_bug.cgi?id=20186

Best regards

[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] Changes to make_desktop_entry in eutils.eclass
  2010-02-24 18:55     ` Pacho Ramos
@ 2010-02-24 18:57       ` Pacho Ramos
  2010-02-24 19:33       ` Ulrich Mueller
  1 sibling, 0 replies; 11+ messages in thread
From: Pacho Ramos @ 2010-02-24 18:57 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 129 bytes --]

El mié, 24-02-2010 a las 19:55 +0100, Pacho Ramos escribió:
> 
> I agree with you bad...

bad -> but (sorry for the typo)

[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] Changes to make_desktop_entry in eutils.eclass
  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
  1 sibling, 1 reply; 11+ messages in thread
From: Ulrich Mueller @ 2010-02-24 19:33 UTC (permalink / raw
  To: gentoo-dev

>>>>> On Wed, 24 Feb 2010, Pacho Ramos wrote:

>> Why should "Science" be a sub-category of "Education"?
>> That doesn't make sense to me.

> I agree with you bad, sadly, spec states it's a sub-category:
> http://standards.freedesktop.org/menu-spec/latest/apa.html

Where does it say that Science is a sub-category of Education? It only
says: "Additional Categories should always be used in combination with
*one*of*the Main Categories." and "The Related Categories column lists
one or more categories that are *suggested* to be used in conjunction
with the Additional Category." (my emphasis)

> and, for now, we need to use "Education,Science" if we don't want to
> see that menu entries showing up in "Others" menu :-(.

I don't think that using another main category together with Science
is forbidden.

> This bug is interesting, but I don't think it will be fixed soon :-/
> https://bugs.freedesktop.org/show_bug.cgi?id=20186

So they are aware that their classification is stupid. ;-)

Ulrich



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] Changes to make_desktop_entry in eutils.eclass
  2010-02-24 19:33       ` Ulrich Mueller
@ 2010-02-24 19:44         ` Pacho Ramos
  0 siblings, 0 replies; 11+ messages in thread
From: Pacho Ramos @ 2010-02-24 19:44 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1824 bytes --]

El mié, 24-02-2010 a las 20:33 +0100, Ulrich Mueller escribió:
> >>>>> On Wed, 24 Feb 2010, Pacho Ramos wrote:
> 
> >> Why should "Science" be a sub-category of "Education"?
> >> That doesn't make sense to me.
> 
> > I agree with you bad, sadly, spec states it's a sub-category:
> > http://standards.freedesktop.org/menu-spec/latest/apa.html
> 
> Where does it say that Science is a sub-category of Education? It only
> says: "Additional Categories should always be used in combination with
> *one*of*the Main Categories." and "The Related Categories column lists
> one or more categories that are *suggested* to be used in conjunction
> with the Additional Category." (my emphasis)
> 

Maybe I am failing to understand the spec (sorry, I am a bit tired just
now), but I am interpreting that "Science" is not a valid "Main
category" since it's not listed in the first table you can see in link
posted before. Also, "Science" is only listed as a "Subcategory" under
"Education" "main category" in the second table


> > and, for now, we need to use "Education,Science" if we don't want to
> > see that menu entries showing up in "Others" menu :-(.
> 
> I don't think that using another main category together with Science
> is forbidden.
> 

I cannot tell you if it's forbidden or not (since I don't know it :-)),
but it's currently not supported by, for example, gnome-menus (I don't
know about kde, xfce...):
https://bugzilla.gnome.org/show_bug.cgi?id=323603

> > This bug is interesting, but I don't think it will be fixed soon :-/
> > https://bugs.freedesktop.org/show_bug.cgi?id=20186
> 
> So they are aware that their classification is stupid. ;-)
> 

Yes, but it won't help as-is to solve current problem or sci-* menu
entries being shown in "Others" menu 

Best regards

[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-dev] Re: Changes to make_desktop_entry in eutils.eclass
  2010-02-24 18:16 ` Pacho Ramos
  2010-02-24 18:40   ` Ulrich Mueller
@ 2010-02-24 19:53   ` Jonathan Callen
  2010-02-24 20:00     ` Pacho Ramos
  2010-02-24 20:11     ` Ulrich Mueller
  1 sibling, 2 replies; 11+ messages in thread
From: Jonathan Callen @ 2010-02-24 19:53 UTC (permalink / raw
  To: gentoo-dev


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

On 02/24/2010 01:16 PM, Pacho Ramos wrote:
> El mar, 23-02-2010 a las 20:26 -0500, Jonathan Callen escribió:
>> 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).
> 
> Would be nice if you would have time to look at the following old
> make_desktop_entry bug:
> http://bugs.gentoo.org/show_bug.cgi?id=191000
> 
> Thanks a lot :-D

I edited the patch to include a fix for but 191000 as well.  See attached.

[-- Attachment #1.2: eutils.eclass.diff --]
[-- Type: text/plain, Size: 1513 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}"
@@ -979,7 +980,7 @@ make_desktop_entry() {
 					visual*) type=DataVisualization;;
 					*)		 type=;;
 				esac
-				type="Science;${type}"
+				type="Education;Science;${type}"
 				;;
 
 			sys)
@@ -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 --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] Re: Changes to make_desktop_entry in eutils.eclass
  2010-02-24 19:53   ` [gentoo-dev] " Jonathan Callen
@ 2010-02-24 20:00     ` Pacho Ramos
  2010-02-24 20:11     ` Ulrich Mueller
  1 sibling, 0 replies; 11+ messages in thread
From: Pacho Ramos @ 2010-02-24 20:00 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 828 bytes --]

El mié, 24-02-2010 a las 14:53 -0500, Jonathan Callen escribió:
> On 02/24/2010 01:16 PM, Pacho Ramos wrote:
> > El mar, 23-02-2010 a las 20:26 -0500, Jonathan Callen escribió:
> >> 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).
> > 
> > Would be nice if you would have time to look at the following old
> > make_desktop_entry bug:
> > http://bugs.gentoo.org/show_bug.cgi?id=191000
> > 
> > Thanks a lot :-D
> 
> I edited the patch to include a fix for but 191000 as well.  See attached.

Thanks! :-)

[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-dev] Re: Changes to make_desktop_entry in eutils.eclass
  2010-02-24 19:53   ` [gentoo-dev] " Jonathan Callen
  2010-02-24 20:00     ` Pacho Ramos
@ 2010-02-24 20:11     ` Ulrich Mueller
  1 sibling, 0 replies; 11+ messages in thread
From: Ulrich Mueller @ 2010-02-24 20:11 UTC (permalink / raw
  To: gentoo-dev

>>>>> On Wed, 24 Feb 2010, Jonathan Callen wrote:

> +	# Don't append another ";" when a valid category value is provided.
> +	[[ -n ${type} && ${type} != *';' ]] && type+=";"

This can be shortened to:

    [[ -n ${type} ]] && type="${type%;};"

or even shorter:

    type="${type%;}${type:+;}"

Ulrich



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-02-24 20:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-24  1:26 [gentoo-dev] Changes to make_desktop_entry in eutils.eclass Jonathan Callen
2010-02-24 18:16 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox