! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
broken icon support in xfdesktop 4.11.7
Status:
RESOLVED: FIXED
Product:
Xfdesktop
Component:
General

Comments

Description Yves-Alexis Perez editbugs 2014-08-11 13:36:16 CEST
Hi,

ae4013a095820417b090db14a6d037e8956fb67c actually broke support for extension-less icons (when only the icon name is given).

An example is the .desktop file created by chromium when creating an “application shortcut”
Comment 1 Matias De lellis 2014-08-12 00:59:52 CEST
Hi, transcribe talked by mail. Perhaps it is useful ;)

Original report:
> Yves-Alexis Perez:
> >  - Matias De lellis: Fix display desktop file that include extension
> >    in icon name
>
> Seems that this actually broke icon support, at least for the .desktop
> files created by chromium.
>
> For example, I have:
>
> #!/usr/bin/env xdg-open
> [Desktop Entry]
> Version=1.0
> Terminal=false
> Type=Application
> Name=Google+
> Exec=/usr/bin/chromium --user-data-dir=/home/corsac/.config/chromium-gplus --app=https://plus.google.com/
> Icon=chrome-https___plus.google.com_
> StartupWMClass=plus.google.com
>
> Notice there's no icon extension, the icon itself is
> ~/.local/share/icons/hicolor/32x32/apps/chrome-https___plus.google.com_.png and it's not displayed in xfdesktop4.
>
> I'll report a bug to bugzilla.
>
> Regards,

First Response:
> Matias De lellis:
> Hi,
> Thanks for report it.
> You're right, this is probably related to the change..
>
> Unfortunately my laptop died and I can not see it until a few days. but we can do a quick analysis of the problem. ;)
>
> This is the icon ??
> > ~/.local/share/icons/hicolor/
32x32/apps/chrome-https___plus.google.com_.png
>
> Worked before? Thunar work?
> Now I doubt due just is the part of code that was not changed.
>
> See:
> > http://git.xfce.org/xfce/xfdesktop/tree/src/xfdesktop-regular-file-icon.c?id=ae4013a095820417b090db14a6d037e8956fb67c#n388
>
> If it was the icons the "if(g_file_test())" is true (Assuming that the file exists), so, xfdesktop construct the icon using:
>
> > gicon = g_file_icon_new(g_file_new_for_path(icon_name));
>
> I do not change this code.. You should confirm that the icon actually exists. ;)
>
> But, If the file does not exist, xfdesktop try to create it with:
>
> > gicon = g_themed_icon_new(icon_name);
>
> So, xfdesktop could not create the file, showing an ugly icon.. :S
>
> Whell, also please report on bugzilla!.
> Today, more than this can not contribute. Sorry.. :S
> 
> Regards,
> Matias.

Last responce after created this bug report:
> Yves-Alexis Perez:
> > This is the icon ??
> > > ~/.local/share/icons/hicolor/
> > 32x32/apps/chrome-https___plus.google.com_.png
>
> Yup.
> >
> > Worked before? Thunar work?
> 
> Worked before, but Thunar doesn't show it either.

Saludos!.
Comment 2 Eric Koegel editbugs 2014-09-08 13:40:04 CEST
Created attachment 5640 
Fix icon loading for .desktop files

This code now checks multiple different ways that an icon can be
declared in a desktop file. It checks the absolute path, if it's
in the icon theme, if it's in the icon theme without an extension,
and finally if the icon is in the pixmaps folder.

I also tried to make the function have less depth in the if-else stuff so it's (hopefully) easier to follow.

Let me know if I succeeded with either attempt :)
Comment 3 Yves-Alexis Perez editbugs 2014-09-08 21:36:52 CEST
(In reply to Eric Koegel from comment #2)
> Created attachment 5640 
> Fix icon loading for .desktop files
> 
> This code now checks multiple different ways that an icon can be
> declared in a desktop file. It checks the absolute path, if it's
> in the icon theme, if it's in the icon theme without an extension,
> and finally if the icon is in the pixmaps folder.
> 
> I also tried to make the function have less depth in the if-else stuff so
> it's (hopefully) easier to follow.
> 
> Let me know if I succeeded with either attempt :)

Seems to work just fine here, thanks.
Comment 4 Matias De lellis 2014-09-08 22:26:46 CEST
Hey,
I could not test it, but it looks good. Thank you Eric!.

Perhaps we should propose a similar patch to thunar. ;)
Comment 5 Eric Koegel editbugs 2014-09-09 18:26:13 CEST
Thanks to both of you for either testing or reviewing :) Pushed to master:
commit 2f212e306f269aa984f522497578380239f24369
Author: Eric Koegel <eric.koegel@gmail.com>
Date:   Mon Sep 8 14:28:26 2014 +0300

    Fix icon loading for .desktop files (Bug 11078)
    
    This code now checks multiple different ways that an icon can be
    declared in a desktop file. It checks the absolute path, if it's
    in the icon theme, if it's in the icon theme without an extension,
    and finally if the icon is in the pixmaps folder.
http://git.xfce.org/xfce/xfdesktop/commit/?id=2f212e306f269aa984f522497578380239f24369

Indeed we can, do you want to write it up or me? We'll still have to get a thunar dev to review/commit it.

Marking this bug resolved.

Bug #11078

Reported by:
Yves-Alexis Perez
Reported on: 2014-08-11
Last modified on: 2014-09-09

People

Assignee:
Eric Koegel
CC List:
2 users

Version

Version:
4.10.0

Attachments

Additional information