[nautilus/gnome-3-8] file: simplify logic to filter out foreign desktop files



commit 6a61d3245e8e933aea8668acc63803b8a387790a
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Apr 10 16:47:35 2013 -0400

    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.

 libnautilus-private/nautilus-file.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 35235e1..8974a87 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -3334,8 +3334,9 @@ nautilus_file_is_hidden_file (NautilusFile *file)
 
 /**
  * nautilus_file_should_show:
- * @file: the file to check.
- * @show_hidden: whether we want to show hidden files or not.
+ * @file: the file to check
+ * @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
  * a trash directory, this function will always return %TRUE. 
@@ -3350,10 +3351,17 @@ nautilus_file_should_show (NautilusFile *file,
        /* Never hide any files in trash. */
        if (nautilus_file_is_in_trash (file)) {
                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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]