! 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 !
Empty trash menu option on desktop displays "wrong" icon.
Status:
RESOLVED: FIXED
Product:
Xfdesktop
Component:
General

Comments

Description j 2010-02-26 08:39:48 CET
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.
Comment 1 Eric Koegel editbugs 2011-12-10 15:45:47 CET
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.
Comment 2 Eric Koegel editbugs 2011-12-12 19:03:08 CET
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.
Comment 3 Nick Schermer editbugs 2012-01-18 15:30:25 CET
"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.
Comment 4 Eric Koegel editbugs 2012-01-20 13:48:40 CET
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.
Comment 5 Nick Schermer editbugs 2012-01-20 14:09:33 CET
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.
Comment 6 Eric Koegel editbugs 2012-01-20 20:35:09 CET
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.

Bug #6256

Reported by:
j
Reported on: 2010-02-26
Last modified on: 2012-02-13

People

Assignee:
Brian J. Tarricone (not reading bugmail)
CC List:
2 users

Version

Attachments

Additional information