1
0
mirror of https://gitlab.gnome.org/GNOME/nautilus synced 2024-07-07 10:51:36 +00:00

files-view: Say "Trash is Empty" only in trash:///

Empty trash widget is displaying for empty folder inside trash
instead of Empty folder widget.

`eel_uri_is_trash` only checks whether the URI starts with "trash:",
that's why it also returns true for empty folders inside trash.

Create `eel_uri_is_trash_root` to distinguish trash root (trash:///)
from empty folder inside trash (trash:///emptyfolder)

Closes https://gitlab.gnome.org/GNOME/nautilus/issues/1367
This commit is contained in:
Abdul Rauf 2020-02-09 20:27:22 +05:00
parent 65d9ef8d05
commit 2a741d9617
No known key found for this signature in database
GPG Key ID: 745ACC1E494D2C9E
3 changed files with 10 additions and 1 deletions

View File

@ -43,12 +43,20 @@ eel_uri_is_starred (const gchar *uri)
return g_str_has_prefix (uri, "starred:");
}
/* It also matches trashed folders inside Trash,
* use `eel_uri_is_trash_root` if that's not desirable. */
gboolean
eel_uri_is_trash (const char *uri)
{
return g_str_has_prefix (uri, "trash:");
}
gboolean
eel_uri_is_trash_root (const char *uri)
{
return g_strcmp0 (uri, "trash:///") == 0;
}
gboolean
eel_uri_is_recent (const char *uri)
{

View File

@ -35,6 +35,7 @@ G_BEGIN_DECLS
gboolean eel_uri_is_starred (const char *uri);
gboolean eel_uri_is_trash (const char *uri);
gboolean eel_uri_is_trash_root (const char *uri);
gboolean eel_uri_is_search (const char *uri);
gboolean eel_uri_is_other_locations (const char *uri);
gboolean eel_uri_is_recent (const char *uri);

View File

@ -3628,7 +3628,7 @@ real_check_empty_states (NautilusFilesView *view)
{
gtk_widget_show (priv->no_search_results_widget);
}
else if (eel_uri_is_trash (uri))
else if (eel_uri_is_trash_root (uri))
{
gtk_widget_show (priv->trash_is_empty_widget);
}