[nautilus] files-view: Say "Trash is Empty" only in trash:///
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] files-view: Say "Trash is Empty" only in trash:///
- Date: Sat, 15 Feb 2020 12:22:58 +0000 (UTC)
commit 2a741d961750d3785cc5bf65db1775f52cae2285
Author: Abdul Rauf <abdulraufmujahid gmail com>
Date: Sun Feb 9 20:27:22 2020 +0500
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
eel/eel-vfs-extensions.c | 8 ++++++++
eel/eel-vfs-extensions.h | 1 +
src/nautilus-files-view.c | 2 +-
3 files changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/eel/eel-vfs-extensions.c b/eel/eel-vfs-extensions.c
index 382863ff9..afdf0621a 100644
--- a/eel/eel-vfs-extensions.c
+++ b/eel/eel-vfs-extensions.c
@@ -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)
{
diff --git a/eel/eel-vfs-extensions.h b/eel/eel-vfs-extensions.h
index b2687af26..b90fc696a 100644
--- a/eel/eel-vfs-extensions.h
+++ b/eel/eel-vfs-extensions.h
@@ -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);
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index ab54906ea..427ac08c5 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]