Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix icon sizing issues #45

Merged
merged 1 commit into from Aug 9, 2017
Merged

Fix icon sizing issues #45

merged 1 commit into from Aug 9, 2017

Conversation

andreldm
Copy link
Owner

@andreldm andreldm commented Aug 2, 2017

Fixes #38.
Please check differences between icon themes and the gtk2 version.

@alexxcons
Copy link
Collaborator

The size now is correct for all icon-themes I have installed ( Adwaita, Faba, Faenza, Gnome, HighContrast, Moka, Tango )
In thunar/gtk2 for the themes "Gnome" and "Adwaita" the home-folder did not resize at all, but this seems to be fixed for thunar/gtk3 with your patch --> good work!

@andreldm
Copy link
Owner Author

andreldm commented Aug 4, 2017

Adwaita icon theme shows a strange behavior:
image

Loaded icons in gtk2:

/usr/share/icons/Adwaita/32x32/places/user-desktop.png
/usr/share/icons/Adwaita/32x32/places/folder-download.png
/usr/share/icons/Adwaita/32x32/places/folder.png

/usr/share/icons/Adwaita/512x512/places/user-desktop.png
/usr/share/icons/Adwaita/512x512/places/folder-download.png
/usr/share/icons/Adwaita/512x512/places/folder.png

Loaded icons in gtk3:

/usr/share/icons/Adwaita/32x32/places/user-desktop.png
/usr/share/icons/Adwaita/32x32/places/folder-download.png
/usr/share/icons/gnome/32x32/places/inode-directory.png

/usr/share/icons/Adwaita/512x512/places/user-desktop.png
/usr/share/icons/Adwaita/512x512/places/folder-download.png
/usr/share/icons/gnome/256x256/places/inode-directory.png

Trouble is that now Thunar asks for inode-directory instead of folder. Using this dirty hack:
if (g_strcmp0 (name, "inode-directory") == 0) name = "folder"; before gtk_icon_theme_lookup_iconresults in the correct icon loading. Of course, I'm not proposing this as a fix.

To summarize: is Thunar requesting the wrong icon or is Adwaita missing this icon?

@alexxcons
Copy link
Collaborator

alexxcons commented Aug 6, 2017

I dont get these special-folders at all. Screenshot while using the patch:
thunar
.. no matter which theme I pick, no matter which icon-size.
The icons exist in /usr/share/icons
Not sure why they are not loaded for me.

It's true that Adwaita has no "inode-directory.png" ( At least I did not find any in /usr/share/icons/Adwaita. All other themes seem to provide it )
So it seems like the icon is picket from the default-theme, which is "gnome".
I think we could say "it's a bug in Adwaita" --> missing icon.

@andreldm
Copy link
Owner Author

andreldm commented Aug 7, 2017

Try xdg-user-dirs-update --force to restore PLACES_XDG_DIRs.

Running strace -f -e trace=open -o process.trace <thunar|nautilus> I can confirm nautilus doesn't read inode-directory.png.
Surprisingly enough, it seems nautilus has some special handling for inode-directory icon:
https://github.com/GNOME/nautilus/blob/a9412a1a10104d448ba9a0985084ffa17381c9f7/src/nautilus-file.c#L5265

I'm almost convinced that the dirty hack mentioned above is the official fix...

More references:
https://bugzilla.gnome.org/show_bug.cgi?id=740025
https://git.gnome.org/browse/glib/tree/gio/glocalfileinfo.c#n1659

@alexxcons
Copy link
Collaborator

alexxcons commented Aug 7, 2017

Thanks, I will take a try next evening and check the links you provided.

I wonder from where in thunar the string "inode-directory" for the icon-name is comming. Yesterday I searched all the code, but failed to find the origin of this icon-name. Probably best would be to fix the use of "inode-directory" in the first place, before is used at all.

@andreldm
Copy link
Owner Author

andreldm commented Aug 8, 2017

I was able to trace from where the "inode-directory" string comes from:
In thunar-file.c:thunar_file_get_icon_name, g_themed_icon_get_names returns ["inode-directory", "folder"] in both versions, but gtk_icon_theme_has_icon (icon_theme, "inode-directory") returns TRUE only in gtk3, so icon_name is set and doesn't fallback to "folder". This function has changed a bit [1][2] but I can't tell if that's the reason for gtk_icon_theme_has_icon behavior change.

1 - https://github.com/GNOME/gtk/blob/gtk-2-24/gtk/gtkicontheme.c#L1579
2 - https://github.com/GNOME/gtk/blob/gtk-3-22/gtk/gtkicontheme.c#L2429

@andreldm
Copy link
Owner Author

andreldm commented Aug 8, 2017

xfdesktop displays the correct folder icon because it uses g_file_info_get_icon. I tried to remove the if (G_IS_THEMED_ICON (icon)) block to force thunar to use g_file_icon_get_file, it works but themed icons (home, downloads...) are displayed as plain folders 😞

@alexxcons
Copy link
Collaborator

alexxcons commented Aug 9, 2017

xdg-user-dirs-update worked perfectly, thanks !

The fact that gtk_icon_theme_has_icon return TRUE for "inode-directory" in Adwaita
sounds like another gtk3-bug. 😞 At least for me that icon does not exist in Adwaita

How about using the dirty hack for now, open a gtk3-bug and a linked thunar-bug for later ?

@andreldm
Copy link
Owner Author

andreldm commented Aug 9, 2017

Agreed, one more item to 'Known Issues'.
I'll craft another commit later tonight to using the dirty hack (and explaining the motivation).

@andreldm andreldm merged commit 8f51176 into gtk3 Aug 9, 2017
@andreldm andreldm deleted the fix-icon-sizing branch August 9, 2017 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants