186 lines
5.4 KiB
Diff
186 lines
5.4 KiB
Diff
http://bugzilla.gnome.org/show_bug.cgi?id=338933
|
|
|
|
Don't show .desktop files which are specific to other desktop
|
|
environments ("OnlyShowIn=foo" where foo != GNOME).
|
|
|
|
This patch ignores those files at a very low level
|
|
(NautilusDirectoryAsync), and for all directories. It should probably
|
|
only do it for ~/Desktop: the original bug is about not wanting to
|
|
show the .desktop files which KDE drops in your ~/Desktop (those files
|
|
do have OnlyShowIn=KDE).
|
|
|
|
2006-05-22 Federico Mena Quintero <federico@novell.com>
|
|
|
|
* libnautilus-private/nautilus-directory-async.c
|
|
(is_foreign_desktop_file): Argh, check that the OnlyShowIn /
|
|
NotShowIn strings exist before testing their contents. Fixes
|
|
https://bugzilla.novell.com/show_bug.cgi?id=177777; this was
|
|
filtering all .desktop files!
|
|
|
|
2006-05-16 Federico Mena Quintero <federico@novell.com>
|
|
|
|
* libnautilus-private/nautilus-directory-async.c
|
|
(is_foreign_desktop_file): Split the contents of the OnlyShowIn
|
|
key; it can be a list of strings. Also consider the NotShowIn
|
|
key. Fixes https://bugzilla.novell.com/show_bug.cgi?id=176123
|
|
|
|
2006-04-18 Federico Mena Quintero <federico@novell.com>
|
|
|
|
Skip .desktop files which are specific to other desktop
|
|
environments ("OnlyShowIn=foo"). Fixes these bugs:
|
|
http://bugzilla.gnome.org/show_bug.cgi?id=338933
|
|
https://bugzilla.novell.com/show_bug.cgi?id=158158
|
|
|
|
* libnautilus-private/nautilus-directory-async.c
|
|
(is_foreign_desktop_file): New helper function: returns TRUE if
|
|
it gets a .desktop file with "OnlyShowIn=" not for GNOME.
|
|
(directory_load_one): Use is_foreign_desktop_file(), and skip
|
|
.desktop files which belong to other desktop environments.
|
|
|
|
* src/nautilus-application.c (remove_desktop_dot_hidden):
|
|
Unlink ~/Desktop/.hidden, which was a Suse hack.
|
|
(finish_startup): Call remove_desktop_dot_hidden().
|
|
|
|
================================================================================
|
|
--- nautilus-2.15.4/libnautilus-private/nautilus-directory-async.c
|
|
+++ nautilus-2.15.4/libnautilus-private/nautilus-directory-async.c
|
|
@@ -939,12 +939,79 @@
|
|
}
|
|
}
|
|
|
|
+static gboolean
|
|
+string_array_contains (char **array,
|
|
+ const char *str)
|
|
+{
|
|
+ char **p;
|
|
+
|
|
+ if (!array)
|
|
+ return FALSE;
|
|
+
|
|
+ for (p = array; *p; p++)
|
|
+ if (g_ascii_strcasecmp (*p, str) == 0) {
|
|
+ return TRUE;
|
|
+ }
|
|
+
|
|
+ return FALSE;
|
|
+}
|
|
+
|
|
+static gboolean
|
|
+is_foreign_desktop_file (NautilusDirectory *directory,
|
|
+ GnomeVFSFileInfo *info)
|
|
+{
|
|
+ const char *mime_type;
|
|
+ char *uri;
|
|
+ GnomeDesktopItem *ditem;
|
|
+ gboolean retval;
|
|
+
|
|
+ if (!(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE)) {
|
|
+ return FALSE;
|
|
+ }
|
|
+
|
|
+ mime_type = gnome_vfs_file_info_get_mime_type (info);
|
|
+ if (g_ascii_strcasecmp (mime_type, "application/x-desktop") != 0) {
|
|
+ return FALSE;
|
|
+ }
|
|
+
|
|
+ uri = nautilus_directory_get_file_uri (directory, info->name);
|
|
+
|
|
+ /* NULL GError */
|
|
+ ditem = gnome_desktop_item_new_from_uri (uri, 0, NULL);
|
|
+
|
|
+ retval = FALSE;
|
|
+
|
|
+ if (ditem) {
|
|
+ char **only_show_in;
|
|
+ char **not_show_in;
|
|
+
|
|
+ only_show_in = gnome_desktop_item_get_strings (ditem, GNOME_DESKTOP_ITEM_ONLY_SHOW_IN);
|
|
+ if (only_show_in && !string_array_contains (only_show_in, "GNOME")) {
|
|
+ retval = TRUE;
|
|
+ }
|
|
+ g_strfreev (only_show_in);
|
|
+
|
|
+ not_show_in = gnome_desktop_item_get_strings (ditem, "NotShowIn");
|
|
+ if (not_show_in && string_array_contains (not_show_in, "GNOME")) {
|
|
+ retval = TRUE;
|
|
+ }
|
|
+ g_strfreev (not_show_in);
|
|
+
|
|
+ gnome_desktop_item_unref (ditem);
|
|
+ }
|
|
+
|
|
+ g_free (uri);
|
|
+
|
|
+ return retval;
|
|
+}
|
|
+
|
|
static void
|
|
directory_load_one (NautilusDirectory *directory,
|
|
GnomeVFSFileInfo *info)
|
|
{
|
|
if (info == NULL || info->name == NULL ||
|
|
- is_dot_or_dot_dot (info->name)) {
|
|
+ is_dot_or_dot_dot (info->name) ||
|
|
+ is_foreign_desktop_file (directory, info)) {
|
|
return;
|
|
}
|
|
|
|
--- nautilus-2.15.4/src/nautilus-application.c
|
|
+++ nautilus-2.15.4/src/nautilus-application.c
|
|
@@ -384,6 +384,45 @@
|
|
nautilus_module_extension_list_free (providers);
|
|
}
|
|
|
|
+/* Suse had a hack in Nautilus (dot-hidden.dif) that would create a
|
|
+ * ~/Desktop/hidden file with the following entries, in order to skip
|
|
+ * launchers created by KDE:
|
|
+ *
|
|
+ * myComputer.desktop
|
|
+ * Printer.desktop
|
|
+ * Network.desktop
|
|
+ * SuSE.desktop
|
|
+ * MozillaFirefox.desktop
|
|
+ * Office.desktop
|
|
+ * trash.desktop
|
|
+ *
|
|
+ * This was a hack around https://bugzilla.novell.com/show_bug.cgi?id=58875, but
|
|
+ * it creates problems: people like to drag a MozillaFirefox.desktop to their
|
|
+ * desktop, and it would be ignored due to that patch.
|
|
+ *
|
|
+ * So, now we unlink() the ~/Desktop/.hidden file under the rationale that that
|
|
+ * folder is under your complete control --- if you don't want to see a file in
|
|
+ * there, you can just delete it.
|
|
+ *
|
|
+ * The .desktop files for KDE launchers should have "OnlyShowIn=KDE" in them;
|
|
+ * now we support this properly. See
|
|
+ * https://bugzilla.novell.com/show_bug.cgi?id=158158 for this.
|
|
+ */
|
|
+static void
|
|
+remove_desktop_dot_hidden (void)
|
|
+{
|
|
+ char *desktop_dir;
|
|
+ char *dot_hidden;
|
|
+
|
|
+ desktop_dir = nautilus_get_desktop_directory ();
|
|
+ dot_hidden = g_build_filename (desktop_dir, ".hidden", NULL);
|
|
+
|
|
+ unlink (dot_hidden);
|
|
+
|
|
+ g_free (desktop_dir);
|
|
+ g_free (dot_hidden);
|
|
+}
|
|
+
|
|
static void
|
|
finish_startup (NautilusApplication *application)
|
|
{
|
|
@@ -401,6 +440,9 @@
|
|
/* Make the desktop work with old Nautilus. */
|
|
migrate_old_nautilus_files ();
|
|
|
|
+ /* Remove artifact from the old dot-hidden.dif patch in Suse */
|
|
+ remove_desktop_dot_hidden ();
|
|
+
|
|
/* Initialize the desktop link monitor singleton */
|
|
nautilus_desktop_link_monitor_get ();
|
|
}
|