After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 338933 - Ignore .desktop files with OnlyShowIn != GNOME
Ignore .desktop files with OnlyShowIn != GNOME
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: File and Folder Operations
2.21.x
Other All
: Normal major
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-04-18 19:47 UTC by Federico Mena Quintero
Modified: 2009-01-31 19:07 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments
Patch from SLED 10 - nautilus-158158-ignore-foreign-desktop-files.diff (1.98 KB, patch)
2006-04-18 19:56 UTC, Federico Mena Quintero
none Details | Review
nautilus-338933-ignore-foreign-desktop-files.diff (2.49 KB, patch)
2006-08-14 20:25 UTC, Federico Mena Quintero
none Details | Review
Patch to ignore these files, but only in the desktop directory (2.82 KB, patch)
2008-01-05 17:06 UTC, Julian Andres Klode
none Details | Review
nautilus-bnc366100-bgo338933-ignore-foreign-desktop-files.diff (9.24 KB, patch)
2008-03-27 05:08 UTC, Federico Mena Quintero
none Details | Review
hide foreign files only on desktop (first try) (11.60 KB, patch)
2008-06-03 05:36 UTC, Jared Moore
none Details | Review

Description Federico Mena Quintero 2006-04-18 19:47:39 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".
Comment 1 Federico Mena Quintero 2006-04-18 19:56:59 UTC
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.
Comment 2 Federico Mena Quintero 2006-08-14 20:25:14 UTC
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.
Comment 3 Federico Mena Quintero 2006-10-25 17:02:40 UTC
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.
Comment 4 Josselin Mouette 2007-05-07 07:44:01 UTC
This was also reported as http://bugs.debian.org/422570
Comment 5 Julian Andres Klode 2008-01-05 17:06:54 UTC
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.
Comment 6 Josselin Mouette 2008-01-05 17:57:38 UTC
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.
Comment 7 Federico Mena Quintero 2008-03-27 03:19:35 UTC
For reference, the super-short mailing list thread on this is http://mail.gnome.org/archives/nautilus-list/2006-April/msg00015.html
Comment 8 Federico Mena Quintero 2008-03-27 05:08:50 UTC
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?
Comment 9 Jared Moore 2008-06-03 05:36:54 UTC
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?
Comment 10 Pacho Ramos 2009-01-31 09:38:57 UTC
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 :-)
Comment 11 Cosimo Cecchi 2009-01-31 19:07:52 UTC
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).