GNOME Bugzilla – Bug 587806
The file selector should honor .hidden files
Last modified: 2013-04-27 22:45:01 UTC
Please describe the problem: In Nautilus it is possible to hide files and folders by listing the files in a .hidden file in the directory where they reside. This feature is very useful for sysadmins that want to reduce information overflow for ordinary users, by only show files and folders on a need to know basis. The problem is that the hidden files are still listed in file dialogs. Here the problem with too much information is even bigger than in Nautilus windows as the file dialog often is smaller, and the chance that the user have to resort to time consuming scrolling to find the file he needs is higher. So please support hiding of files listed in the .hidden filein file selection dialogs as well as in Nautilus windows. BTW: .hidden files is also by MacOS-X. Supporting the .hidden file would increase the compatiblility with filesystems exported from MacOS-X. Steps to reproduce: 1. 2. 3. Actual results: Expected results: Does this happen every time? Other information: This is a clone of http://bugzilla.gnome.org/show_bug.cgi?id=314280 which was closed as obsolete... :-( Unfortunately this issue is still present for me.
Created attachment 148290 [details] [review] [PATCH] glocalfile: Support for .hidden files this adds code to check the '.hidden' file and sets the standard::is-hidden property for local files
I don't like the dependency on the mainloop to free the cache. That won't work for e.g. commandline apps. We should probably invalidate old caches in the file_is_hidden() call too (at least some times).
Also, of the readdir() case we should use GLocalParentFileInfo to avoid looking up the .hidden cache all the time
*** Bug 629870 has been marked as a duplicate of this bug. ***
This could potentially make use of glib's worker thread somehow...
*** Bug 596234 has been marked as a duplicate of this bug. ***
Created attachment 230138 [details] [review] Support for .hidden files This patch is just Ryans patch adapted to use Glibs internal worker thread rather than the using the mainloop. I'm not sure I understand Alexanders other comments. I'm not sure what logic should be used to decided to invalidate old caches in file_is_hidden() rather than using the thread. And I'm not sure what he means by the readdir() case.
This patch looks just right. I think it addresses Alex's concern about non-mainloop apps. I'm not sure what he meant by the readdir() comment. As far as I'm concerned this could go in now (assuming you've tested it). I'd like to wait for Alex's review first, though.
Just noticed your comment looks like I forgot to cc myself. Yes I've tested the patch with a small .hidden file. Haven't done any testing with large list but I would assume its should work ok.
What i mean by the readdir case is GLocalFileEnumerator enumerating an entire directory, wanting is_hidden info for each file. When getting the information for each child in the directory there is some data that depends on information from the parent directory. Like say if its sticky, etc. Instead of reading this for every file we do it once in _g_local_file_info_get_parent_info () which we pass into _g_local_file_info_get(). I'm just saying that it would perhaps be nice to look up the hidden cache once for the parent dir and then just pass it via the parent info to all info_get() call rather than constructing the parent dir and looking it up for each file.
Anyway, that is not so important. The patch looks good as is.
Comment on attachment 230138 [details] [review] Support for .hidden files Committed this to master after talking to Alex on IRC since the patch in bug 689800 is related. http://git.gnome.org/browse/glib/commit/?id=510ba9b4efe1813e24c6dfa7405c3547bf9efdd7
Note, follow up patch in https://bugzilla.gnome.org/show_bug.cgi?id=691558
Thanks. :-)