Commit 569bf215 authored by Cosimo Cecchi's avatar Cosimo Cecchi

file: simplify logic to filter out foreign desktop files

We don't need to check if the file is in the desktop, since the desktop
view will call in with show_foreign = FALSE already.
parent e0b864ee
...@@ -3334,8 +3334,9 @@ nautilus_file_is_hidden_file (NautilusFile *file) ...@@ -3334,8 +3334,9 @@ nautilus_file_is_hidden_file (NautilusFile *file)
/** /**
* nautilus_file_should_show: * nautilus_file_should_show:
* @file: the file to check. * @file: the file to check
* @show_hidden: whether we want to show hidden files or not. * @show_hidden: whether we want to show hidden files or not
* @show_foreign: whether we want to show foreign files or not
* *
* Determines if a #NautilusFile should be shown. Note that when browsing * Determines if a #NautilusFile should be shown. Note that when browsing
* a trash directory, this function will always return %TRUE. * a trash directory, this function will always return %TRUE.
...@@ -3350,10 +3351,17 @@ nautilus_file_should_show (NautilusFile *file, ...@@ -3350,10 +3351,17 @@ nautilus_file_should_show (NautilusFile *file,
/* Never hide any files in trash. */ /* Never hide any files in trash. */
if (nautilus_file_is_in_trash (file)) { if (nautilus_file_is_in_trash (file)) {
return TRUE; return TRUE;
} else {
return (show_hidden || !nautilus_file_is_hidden_file (file)) &&
(show_foreign || !(nautilus_file_is_in_desktop (file) && nautilus_file_is_foreign_link (file)));
} }
if (!show_hidden && nautilus_file_is_hidden_file (file)) {
return FALSE;
}
if (!show_foreign && nautilus_file_is_foreign_link (file)) {
return FALSE;
}
return TRUE;
} }
gboolean gboolean
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment