Created attachment 2861 Wrong icon! On the desktop when Trash has files/folders in it which makes it render a full trash icon, the menu item does not reflect this change, thus right click and empty trash show an empty trash can rather than a full one.
Created attachment 4019 Added a check to see if the user can delete files in their trash before counting it against them. Also added code to load the correct trash icon based on the trash_item_count. This patch sets it up so xfdesktop will display the correct icon on the desktop and in the menu based on the trash_item_count. This patch also fixes a different issue, just checking the G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT isn't enough because the user may have files they can't currently delete. This can happen in the user trashed some files on a removable drive and then unmounted that drive. This patch checks the files in the trash for G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE before incrementing the trash_item_count. This prevents a trashcan from always saying it is full.
Created attachment 4022 Check if icon exists before loading. Also corrects trash count. Fixes bug 6256. This patch improves and supersedes the last patch. It checks if the icon is in the theme before attempting to load it, rather than loading the icon and checking to see if that worked. This mirrors how the menu code is built so it will be consistent with which icon is shown for the trash.
"user-trash" and "user-trash-full" are the default icon names, so only use those. The trash_item_count variables is a gboolean, make this a gint (i know gboolean is a gint, but this is confusing). I'm not sure re-counting the items is a good idea, but I guess it's fine. However, put this in a single function.
Created attachment 4115 [PATCH] Display correct trash icon on menu & desktop I didn't even catch that trash_item_count was a gboolean, fixed. Moved the counting code to a single function. I can remove the trash counting code, but it seems a little odd to empty trash and not have it show as empty or show why it's not, especially for files the user can't delete.
I haven't spotted this before, but it is better to not use gtk_icon_theme_has_icon with gtk_image_new_from_icon_name, better a missing-image icon then nothing.
Created attachment 4118 [PATCH] Display correct trash icon on menu & desktop Removed the calls to gtk_icon_theme_has_icon. Also cleaned up xfdesktop_special_file_icon_peek_pixbuf... I've probably stepped through xfdesktop_file_utils_get_icon a dozen times and still missed it.