summaryrefslogtreecommitdiff
path: root/eel
diff options
context:
space:
mode:
authorAbdul Rauf <abdulraufmujahid@gmail.com>2020-02-09 20:27:22 +0500
committerAbdul Rauf <abdulraufmujahid@gmail.com>2020-02-15 14:16:03 +0500
commit2a741d961750d3785cc5bf65db1775f52cae2285 (patch)
treeaa4367a4a0d9bc517b0c19099435b238365b19f7 /eel
parent65d9ef8d055ac4e1b3a22a43ec9791aeedf0c02c (diff)
downloadnautilus-2a741d961750d3785cc5bf65db1775f52cae2285.tar.gz
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
Diffstat (limited to 'eel')
-rw-r--r--eel/eel-vfs-extensions.c8
-rw-r--r--eel/eel-vfs-extensions.h1
2 files changed, 9 insertions, 0 deletions
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,6 +43,8 @@ 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)
{
@@ -50,6 +52,12 @@ eel_uri_is_trash (const char *uri)
}
gboolean
+eel_uri_is_trash_root (const char *uri)
+{
+ return g_strcmp0 (uri, "trash:///") == 0;
+}
+
+gboolean
eel_uri_is_recent (const char *uri)
{
return g_str_has_prefix (uri, "recent:");
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);