After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763147 - Trash: be more semantic
Trash: be more semantic
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Trash
unspecified
Other All
: Normal enhancement
: 3.24
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-03-05 19:37 UTC by Miguel Vaello Martínez
Modified: 2016-11-02 13:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
New empty trash concept (56.95 KB, image/png)
2016-03-05 19:37 UTC, Miguel Vaello Martínez
  Details
window-slot: remove the trash bar when the trash is empty (1.23 KB, patch)
2016-03-09 09:56 UTC, Akilan Elango
needs-work Details | Review
files-view: better empty state for Trash (4.97 KB, patch)
2016-09-21 14:10 UTC, Mohammed Sadiq
none Details | Review
window-slot: hide trashbar if Trash is empty (1.21 KB, patch)
2016-09-21 14:26 UTC, Mohammed Sadiq
none Details | Review
files-view: better empty state for Trash (5.51 KB, patch)
2016-09-21 14:42 UTC, Mohammed Sadiq
committed Details | Review
window-slot: hide trashbar if Trash is empty (3.18 KB, patch)
2016-09-21 15:45 UTC, Mohammed Sadiq
none Details | Review
window-slot: hide trashbar if Trash is empty (4.05 KB, patch)
2016-09-21 16:17 UTC, Mohammed Sadiq
none Details | Review
window-slot: hide trashbar if Trash is empty (3.60 KB, patch)
2016-09-21 16:50 UTC, Mohammed Sadiq
committed Details | Review

Description Miguel Vaello Martínez 2016-03-05 19:37:38 UTC
Created attachment 323161 [details]
New empty trash concept

Taking a look to the last changes in Nautilus, I noticed that the look and semantic of the trash folder could be polished a bit and, in my opinion, improve the user experience at the same time.

I think that the 'NautilusTrashBar' is useless when the trash is empty because you cannot run any action because, obviously, the buttons are disabled. Therefore, if there is no elements inside the trash folder, the blue bar should stay hidden.

Of course, in order to keep the user informed of the current trash state, the symbolic folder icon could be replaced by the 'user-trash-symbolic', the same icon wich already it's used in the left list and of course replace the label text written below the icon.

This attached screenshoot shows a possible concept/final result. Sorry, I have no patch for that but if you are agree I could try to craft one.

Thanks!
Comment 1 Carlos Soriano 2016-03-06 21:14:33 UTC
This is awesome!

Also intended for newcomers with some experience of gtk+, look how do we check for empty states in nautilus-files-view.c
Comment 2 Miguel Vaello Martínez 2016-03-06 22:26:58 UTC
(In reply to Carlos Soriano from comment #1)
> This is awesome!
> 
> Also intended for newcomers with some experience of gtk+, look how do we
> check for empty states in nautilus-files-view.c

Thanks Carlos! 

I'm thinking about how to add that feature, does not looks very hard, thanks for the hint.
Comment 3 Akilan Elango 2016-03-09 09:56:06 UTC
Created attachment 323484 [details] [review]
window-slot: remove the trash bar when the trash is empty

The trash bar is shown if and only if the trash is not empty.
Comment 4 Carlos Soriano 2016-03-09 10:18:08 UTC
Review of attachment 323484 [details] [review]:

Hey thanks for the patch!

It adds a bar when it's not really necesary. Why creating and adding an info bar in the first place if you are not going to show it anyway?
Also, if the trash changes while you are looking at it the info bar doesn't appear. You will need to track the trash status.
Comment 5 Mohammed Sadiq 2016-09-21 14:10:21 UTC
Created attachment 336001 [details] [review]
files-view: better empty state for Trash

Implement better empty state for Trash as per new design.
Comment 6 Mohammed Sadiq 2016-09-21 14:26:23 UTC
Created attachment 336002 [details] [review]
window-slot: hide trashbar if Trash is empty

There is no use for trashbar if the Trash is empty.
So don't show trashbar if Trash is empty.
Comment 7 Carlos Soriano 2016-09-21 14:29:54 UTC
Review of attachment 336001 [details] [review]:

Excellent, thanks for looking into this!

Add the .ui files to POTFILES, so translators can translate it.

::: src/nautilus-files-view.c
@@ +3350,3 @@
 real_check_empty_states (NautilusFilesView *view)
 {
+    gchar *uri;

use g_autofree (I know that probably you did it in this way for consistency, but in the case of smart pointers we want to slowly transition on using them)
Comment 8 Carlos Soriano 2016-09-21 14:38:35 UTC
Review of attachment 336002 [details] [review]:

Nice, there is just a small problem. The bar doesn't hide if the trash was not empty and the user empty it while in the trash. For that, connect to the trash monitor and update the "extra location widgets" in the window-slot when the monitor changes.
Comment 9 Carlos Soriano 2016-09-21 14:40:10 UTC
Also please obsolete the patches that are not valid anymore. In this case, the first patch that was not provided by you. To obsolete it go to the "details" and then to "edit details" and mark "obsolete". In this way the patches in the bug report are organised, and can be applied automatically with git bz.
Comment 10 Mohammed Sadiq 2016-09-21 14:42:23 UTC
Created attachment 336004 [details] [review]
files-view: better empty state for Trash

Implement better empty state for Trash as per new design.
Comment 11 Mohammed Sadiq 2016-09-21 15:45:51 UTC
Created attachment 336011 [details] [review]
window-slot: hide trashbar if Trash is empty

There is no use for trashbar if the Trash is empty.
So don't show trashbar if Trash is empty.

Also, if user sets the trash empty, withdraw the trashbar if
already present.

Hope I haven't complicated things much. :)
Comment 12 Carlos Soriano 2016-09-21 15:52:15 UTC
Review of attachment 336011 [details] [review]:

Almost there, you got the way to do it :)

::: src/nautilus-window-slot.c
@@ +892,3 @@
     app = g_application_get_default ();
 
+    g_signal_connect (nautilus_trash_monitor_get (),

every time you connect to a signal you need to disconnect when the object is destroyed.
This is because, if you don't do it, what happens if the object is destroyed and the trash changes? it will call the callback and crash because it will try to access and already freed object. For this, we disconnect signals on finalize() or destroy()

@@ +2338,3 @@
+        nautilus_trash_monitor_is_empty ())
+    {
+    if (location == NULL)

4 spaces.

@@ +2348,3 @@
     NautilusView *view;
 
+    if (nautilus_trash_monitor_is_empty ())

Sorry I didn't catch this before. The semantic of the function is "show the trash bar", not "show the trash bar if necessary", the name should be different. So, the pattern is to check whether to call this function or not depending on if the trash is empty or not, so the caller should check this, instead of making the show_trash_bar "smart".
Comment 13 Carlos Soriano 2016-09-21 15:53:42 UTC
Review of attachment 336004 [details] [review]:

Perfect, thanks!

Since we didn't branch yet for 3.22, I won't commit this until I create a branch for the new master. That would be around the time we release 3.22.1.
Comment 14 Miguel Vaello Martínez 2016-09-21 15:56:38 UTC
I'm glad to see this has been done :-). Thanks!
Comment 15 Mohammed Sadiq 2016-09-21 16:17:34 UTC
Created attachment 336013 [details] [review]
window-slot: hide trashbar if Trash is empty

There is no use for trashbar if the Trash is empty.
So don't show trashbar if Trash is empty.

Also, if user sets the trash empty, withdraw the trashbar if
already present.
Comment 16 Carlos Soriano 2016-09-21 16:37:12 UTC
Review of attachment 336013 [details] [review]:

last nit pick:

::: src/nautilus-window-slot.c
@@ +2691,3 @@
+    if (priv->trash_signal_id != 0)
+    {
+        g_signal_handler_disconnect (nautilus_trash_monitor_get (),

there is an easier way to deal with this, so we can avoid more private data.
You can use g_signal_handlers_disconnect_by_data (nautilus_trash_monitor_get(), self);
Comment 17 Mohammed Sadiq 2016-09-21 16:50:10 UTC
Created attachment 336014 [details] [review]
window-slot: hide trashbar if Trash is empty


There is no use for trashbar if the Trash is empty.
So don't show trashbar if Trash is empty.

Also, if user sets the trash empty, withdraw the trashbar if
already present.
Comment 18 Carlos Soriano 2016-09-21 16:59:37 UTC
Review of attachment 336014 [details] [review]:

now is perfect, thanks!
Comment 19 Razvan Chitu 2016-11-02 13:53:21 UTC
Attachment 336004 [details] pushed as eb66cf9 - files-view: better empty state for Trash
Attachment 336014 [details] pushed as c03c867 - window-slot: hide trashbar if Trash is empty