! 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 !
Thunar shows empty trash on new session
Status:
RESOLVED: FIXED

Comments

Description frenchy82 2012-11-18 08:47:07 CET
With Thunar 1.5.2 from PPA, if you put a file in the trash, then trash is not empty and you can empty the trash.

But if you close the session et open it then thunar shows an empty trash and you can't empty it
Comment 1 Nick Schermer editbugs 2012-12-02 21:31:44 CET
Fixed in 60e9680.
Comment 2 b3nmore 2012-12-05 09:47:32 CET
Still an issue here with 1.6.0.

Closing all thunar windows and then opening a new one corrects the trash state. Alternatively calling 'gvfs-ls trash:' before opening thunar the first time also sets the correct trash state.
Comment 3 frenchy82 2012-12-05 19:44:47 CET
Still have this problem too with thuanr 1.6.0
Comment 4 Nick Schermer editbugs 2012-12-06 12:40:49 CET
Its a race, but the gvfs-trash daemon does not send a file-changed signal. With the idle it looked like it was fixed, but i can delay it too.
Comment 5 Nick Schermer editbugs 2012-12-07 20:58:42 CET
Delayed check to 2 seconds. Can someone check if this works?
Comment 6 secipolla 2012-12-11 22:32:55 CET
Isn't working neither with xfdesktop nor with Thunar (1.6.1).
Comment 7 Nick Schermer editbugs 2012-12-27 13:20:27 CET
Code is checking for 15 seconds now with 3s intervals or files are found.
Comment 8 frenchy82 2012-12-28 14:29:43 CET
Sorry, but this is still not working with Thunar 1.6.2
But maybe this patch is not include in it
Comment 9 Thaddaeus Tintenfisch editbugs 2014-02-25 04:20:05 CET
*** Bug 10655 has been marked as a duplicate of this bug. ***
Comment 10 Thaddaeus Tintenfisch editbugs 2014-03-02 21:06:19 CET
I cannot reproduce this issue anymore after telling xfdesktop(!) to display the trash icon on the desktop.
Comment 11 Harald Judt editbugs 2015-05-13 20:50:15 CEST
Is this still an issue? If it is, please reopen.
Comment 12 b3nmore 2015-05-14 12:10:36 CEST
(In reply to Harald Judt from comment #11)
> Is this still an issue? If it is, please reopen.

Yes, it is. Thunar build from git (afe91e9).

As Thaddaeus Tintenfisch said in #10, it works fine, *if* xfdesktop is configured to show the trash icon on the desktop. For all desktop configurations not enabling the desktop trash icon, thunar shows always an empty trash on startup after a fresh login. So do all further thunar instances started later. To get the correct status, one must delete a file/folder or close all open thunar windows. The next thunar window will then show the correct status.

Btw. my workaround for this issue is to create a autostart entry calling "gvfs-ls trash > /dev/null". So my guess is, that calling "gvfs-ls trash" initializes something thunar is relying on to determine the trash status.
Comment 13 Harald Judt editbugs 2015-05-15 10:23:58 CEST
I've been looking into this a bit.

As some have observed, it happens when the gvfsd-trash daemon has not spawned and thunar accesses the trash for the first time (yet causing it to spawn). So for the trash bin having the correct state it is necessary that the daemon has already spawned when reading the info. The gvfs-trash ls command or any other application accessing the gvfs trash does this.

To reproduce this more easily, simply kill thunar and gvfsd-trash and start a new instance of thunar (daemon or window shouldn't matter).

The code added to thunar-session-client.c could work, but it never gets called on my machine, presumably because I do not start thunar with the session manager. If that is true, all people with a similar setup will suffer from this too. Also the thunar trash panel plugin could exhibit the same problem.
Comment 14 Harald Judt editbugs 2015-05-15 10:57:08 CEST
Created attachment 6251 
fix-loading-the-trash-bin-status-at-startup-bug-9513.patch

Attached is a patch which fixes the issue for me. Please try it and report back if it fixes the issue for _you_ too. At the moment, I cannot think of a better solution. I hope it does not produce crashes. Maybe someone else has a better idea and can comment on this.

The first reload (in idle without timeout) fixes the shortcut/treeview status icon, but it needs at least a second reload (after two seconds) to fix the "go to" menu item entry. That symbol always shows "full" initially (though strangely thunar_file_get_item_count tells 0). The third reload is there just to be safe. Reloading the trash shouldn't be a very expensive operation.

Please check the behaviour with and without this patch.
Comment 15 Harald Judt editbugs 2015-05-15 13:26:52 CEST
Created attachment 6252 
fix-loading-the-trash-bin-status-at-startup-bug-9513.patch

This is probably a better version of the patch. Instead of putting the checks into thunar_file_get, which could be called quite often for folders that contain a lot of files, put it into the main function which gets called only once per thunar instance.
Comment 16 b3nmore 2015-05-15 17:31:00 CEST
(In reply to Harald Judt from comment #15)
> Created attachment 6252 
> fix-loading-the-trash-bin-status-at-startup-bug-9513.patch
> 
> This is probably a better version of the patch. Instead of putting the
> checks into thunar_file_get, which could be called quite often for folders
> that contain a lot of files, put it into the main function which gets called
> only once per thunar instance.

Applied the second version of the patch and it fixes the issue for me. No side effects so far.
Comment 18 Harald Judt editbugs 2015-05-21 16:08:50 CEST
The patch that I pushed to master and is included in thunar-1.6.9 has caused issues for other people (see bug #11913). I have pushed further patches to fix this, which should be included in the next bugfix release thunar-1.6.10. Could you please apply try these patches on thunar-1.6.9 in this order to see if you can find any issues?

Revert patch: http://git.xfce.org/xfce/thunar/commit/?id=e3b65ff628499248dadfe7cbdb027e17b7db03c2

Fix reload return type: http://git.xfce.org/xfce/thunar/commit/?id=9bf051a0005cef3d661493a44e7de911868cf5e7

Fix trash status: http://git.xfce.org/xfce/thunar/commit/?id=6010f71d865b624f5f58b81405764c4ce6b2afc4

Alternatively, you can build thunar-git of course.
Comment 19 b3nmore 2015-05-22 13:47:55 CEST
Build thunar from current master (6010f71). Trash status works fine and I haven't found any regressions so far. Admittedly I've looked primarily at the 'empty trash after first start'-issue.
Comment 20 Harald Judt editbugs 2015-05-22 14:37:31 CEST
Thanks for your report and test, so I will close this bug again.

Bug #9513

Reported by:
frenchy82
Reported on: 2012-11-18
Last modified on: 2015-05-22
Duplicates (1):
  • 10655 Thunar reports Trash Empty when it is not

People

Assignee:
Harald Judt
CC List:
7 users

Version

Attachments

Additional information