GNOME Bugzilla – Bug 338933
Ignore .desktop files with OnlyShowIn != GNOME
Last modified: 2009-01-31 19:07:52 UTC
Desktop files support "OnlyShowIn=foo" to say that they are specific to a certain desktop environment. Right now we don't pay attention to this property, and so display desktop items which are undesired. We should ignore .desktop files which have "OnlyShowIn=foo" for "foo" != "GNOME".
Created attachment 63823 [details] [review] Patch from SLED 10 - nautilus-158158-ignore-foreign-desktop-files.diff This is the patch I'm using at Novell.
Created attachment 70890 [details] [review] nautilus-338933-ignore-foreign-desktop-files.diff Fixes a silly bug in the previous patch; OnlyShowIn can contain a list of strings.
The original bug from Novell was something like "KDE drops some .desktop files in ~/Desktop, and tags them with OnlyShowIn=KDE. However, they still show up in GNOME and they shouldn't be visible". The patch in comment #2 ignores the OnlyShowIn .desktop files at a very low level (nautilus-directory-async.c), and so does it for all directories. It should probably only ignore them when showing ~/Desktop. Marking the patch as needs-work.
This was also reported as http://bugs.debian.org/422570
Created attachment 102217 [details] [review] Patch to ignore these files, but only in the desktop directory This patch is the same as nautilus-338933-ignore-foreign-desktop-files.diff, but foreign desktop files are only ignored when they are in the Desktop directory.
The problem with the latest patch is that those .desktop files won’t show up even when browsing ~/Desktop, and not only on the desktop itself.
For reference, the super-short mailing list thread on this is http://mail.gnome.org/archives/nautilus-list/2006-April/msg00015.html
Created attachment 108100 [details] [review] nautilus-bnc366100-bgo338933-ignore-foreign-desktop-files.diff Totally untested patch --- but does this seem like a better approach than shoehorning things into the "load a directory" code path?
Created attachment 112016 [details] [review] hide foreign files only on desktop (first try) Federico, your patch seems to work quite nicely in my limited testing. Attached patch builds on that by hiding foreign files only on the desktop. The basic idea is to add a new argument, show_foreign, to nautilus_file_should_show, and this argument is set to true everywhere except for within a FMDesktopIconView instance. (sorry, that's kinda worded badly...) This implementation using the new method "fm_directory_view_set_show_foreign" is kinda dodgy. If I were doing this in Java/C++, I would make show_foreign_files (in FMDirectoryViewDetails) a protected field. Is there any nice way to do this in GObject?
Any news on this one, there are still people "suffering" KDE specific folders in their gnome desktop directory because of have used kde before. Also, seems that it is working ok on opensuse, that is already applying this patch Thanks a lot :-)
Thanks for the patches, I committed a slightly modified version of the latest patch by Jared to trunk, adapting it to use GKeyFiles instead of GnomeDesktopItems. Closing as FIXED. 2009-01-31 Cosimo Cecchi <cosimoc@gnome.org> * libnautilus-private/nautilus-directory-async.c (lacks_link_info), (monitor_includes_file), (link_info_done), (link_info_got_data), (link_info_start): * libnautilus-private/nautilus-file-private.h: * libnautilus-private/nautilus-file.c (nautilus_file_clear_info), (nautilus_file_should_show), (filter_hidden_and_backup_partition_callback), (nautilus_file_is_foreign_link): * libnautilus-private/nautilus-file.h: * libnautilus-private/nautilus-link.c (string_array_contains), (nautilus_link_get_link_info_given_file_contents): * libnautilus-private/nautilus-link.h: * src/file-manager/fm-desktop-icon-view.c (fm_desktop_icon_view_init): * src/file-manager/fm-directory-view.c (fm_directory_view_init), (fm_directory_view_should_show_file), (fm_directory_view_set_show_foreign): * src/file-manager/fm-directory-view.h: * src/file-manager/fm-tree-model.c (should_show_file): Follow the "OnlyShowIn" and "NotShowIn" == GNOME keys for .desktop files, when they are put on the desktop. Thanks to Federico Mena Quintero and Jared Moore (#338933).