! 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 !
Missing Notifications during unmount
Status:
RESOLVED: FIXED

Comments

Description ToZ editbugs 2018-07-26 00:35:13 CEST
As of recently, unmount notifications are missing (or possibly displayed/dismissed very quickly) when unmounting a device. Possibly related to: https://bugzilla.xfce.org/show_bug.cgi?id=10792.

As per a discussion at: https://forum.xfce.org/viewtopic.php?pid=49058#p49058, downgrading thunar to 1.6.15 and xfdesktop to 4.12.4 makes notifications appear again.

Arch bug report located here: https://bugs.archlinux.org/task/59452.
Comment 1 Andre Miranda editbugs 2018-08-24 02:37:35 CEST
Created attachment 7903 
notifications

I cannot reproduce, just like you, I get very quick notifications.
I'm using both Thunar and xfdesktop from git master, although I don't see how xfdesktop could interfere.
Comment 2 ToZ editbugs 2018-08-24 03:44:51 CEST
Just had a closer look. Here is what I think is happening:

In thunar-notify.c, thunar_notify_show(), the notification timeout is set to NOTIFY_EXPIRES_NEVER. And then later in thunar_notify_finish(), the notification is force closed. The problem, I believe, exists when the eject action in the system happens quickly. The notification is then shown and closed in rapid succession.

To test this, I set NOTIFY_EXPIRES_DEFAULT and commented out the force close. Unfortunately, during an eject, the notification stayed on the screen indefinitely.

I think the solution may be to program in a minimum time to display a notification (say 1 second) so that it doesn't disappear quickly in situations such as above. I'm not sure how to do that though.
Comment 3 ToZ editbugs 2018-08-24 03:57:33 CEST
Indeed, injecting a "sleep (1);" command just prior to the close call results in the notification staying open and visible for one second. On calls that take more than one second, it will add an extra second to display time.
Comment 4 Andre Miranda editbugs 2018-08-24 04:50:20 CEST
Created attachment 7904 
patch

The attached patch accomplishes what you suggest and possibly fixes bug 10792.
However, I'm not sure it fixes the problem reported in the forums, it could be quickly dismissed notifications or another completely problem.

Let me know if the patch works for you.
Comment 5 Andre Miranda editbugs 2018-08-24 04:54:09 CEST
By the way, I get the same almost non-visible notifications with 1.6.15.
Comment 6 ToZ editbugs 2018-08-24 12:22:14 CEST
Thanks. Patch works well. Will you back-port the patch to the 1.6 branch as well?

I'll post back in the forum thread about the patch and see if they can test it to make determination.
Comment 7 Andre Miranda editbugs 2018-08-24 14:47:04 CEST
On a second thought, I wonder if this is the "right fix". The only indication the operation (mount/eject) has been completed is the notification being dismissed, I don't think this is clear enough. Instead we can dismiss the current notification (as it is already) and send another one telling the operation has been completed (5s timeout).

Note to myself: check notify_notification_set_timeout (notification, 2000) instead of g_timeout_add_seconds on thunar_notify_finish.
Comment 8 Andre Miranda editbugs 2018-08-24 14:48:46 CEST
Or replace the current notification with notify_notification_update and set a timeout for it.
Comment 9 ToZ editbugs 2018-08-25 13:48:28 CEST
Created attachment 7908 
[PATCH] Safe device removal notification

An attempt at a patch. This closes off the "writing to the device" notification and then displays a new one that states the device can be safely removed.
Comment 10 alexxcons editbugs 2018-08-25 21:42:33 CEST
Just tested both patches

@ToZ
Nice, just IMO one thing missing:
The notification should disappear on it's own after some seconds. As a user I dont want to click on a notification after each unmount.

@Andre Miranda
Yes, sending the message after the operation would be slightly better.
The problem case "ongoing file copy" first made me struggle a bit, but actually that seems to be unrelated, since unmount during file copy will span alot of other windows which clearly show all options.
Comment 11 Andre Miranda editbugs 2018-08-25 22:34:07 CEST
Created attachment 7910 
Update notification

@ToZ this is a simplified version of your patch, instead of creating a new notification, we just update the existing one and thunar_notify_finish is kept as generic as possible.
In any case, the message only makes sense for ejecting devices, but it is also shown while unmounting non-removable devices and when the device operation was cancelled.

We could send appropriate messages for each case, but I don't know how to get the operation type(unmount or eject) or if it was cancelled from thunar_device_operation_finish.
Comment 12 Andre Miranda editbugs 2018-08-25 22:40:44 CEST
Created attachment 7911 
Delayed dismiss

This is a simpler implementation of my first patch to delay the removal of the notification.
Comment 13 ToZ editbugs 2018-08-25 23:28:10 CEST
Patch confirmed to work. Thanks.
Comment 14 Git Bot editbugs 2018-08-28 04:25:01 CEST
Andre Miranda referenced this bugreport in commit 27d020375719b0b4cc89348ff9d9948a411c2bdd

Add a small delay when dismissing notifications (Bug #14552)

https://git.xfce.org/xfce/thunar/commit?id=27d020375719b0b4cc89348ff9d9948a411c2bdd
Comment 15 Andre Miranda editbugs 2018-08-28 04:27:15 CEST
I pushed the simpler fix to master, we can revisit the improvement to inform users the operation has been completed in the future (please file a bug if interested). Thanks for reporting and testing.

Bug #14552

Reported by:
ToZ
Reported on: 2018-07-26
Last modified on: 2018-08-28

People

Assignee:
Xfce Bug Triage
CC List:
4 users

Version

Attachments

notifications (43.88 KB, image/png)
2018-08-24 02:37 CEST , Andre Miranda
no flags
patch (1.00 KB, patch)
2018-08-24 04:50 CEST , Andre Miranda
no flags
[PATCH] Safe device removal notification (1.80 KB, patch)
2018-08-25 13:48 CEST , ToZ
no flags
Update notification (2.53 KB, patch)
2018-08-25 22:34 CEST , Andre Miranda
no flags
Delayed dismiss (680 bytes, patch)
2018-08-25 22:40 CEST , Andre Miranda
no flags

Additional information