diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2009-01-31 19:06:37 +0000 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@src.gnome.org> | 2009-01-31 19:06:37 +0000 |
commit | 8f976b5f28af9c9e6f3354f7596c1620fe512aff (patch) | |
tree | 0d25c42d48b09592daf26e1cd7faeedb5fe564b2 /libnautilus-private/nautilus-link.c | |
parent | 28f06e0a6b72763a16049c5fd52cfd08aad781c3 (diff) | |
download | nautilus-8f976b5f28af9c9e6f3354f7596c1620fe512aff.tar.gz |
Follow the "OnlyShowIn" and "NotShowIn" == GNOME keys for .desktop files,
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).
svn path=/trunk/; revision=14905
Diffstat (limited to 'libnautilus-private/nautilus-link.c')
-rw-r--r-- | libnautilus-private/nautilus-link.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/libnautilus-private/nautilus-link.c b/libnautilus-private/nautilus-link.c index 6f8b3cd7a..6686f9c8c 100644 --- a/libnautilus-private/nautilus-link.c +++ b/libnautilus-private/nautilus-link.c @@ -502,6 +502,23 @@ nautilus_link_local_get_link_uri (const char *uri) return retval; } +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; +} + void nautilus_link_get_link_info_given_file_contents (const char *file_contents, int link_file_size, @@ -509,10 +526,13 @@ nautilus_link_get_link_info_given_file_contents (const char *file_contents, char **uri, char **name, char **icon, - gboolean *is_launcher) + gboolean *is_launcher, + gboolean *is_foreign) { GKeyFile *key_file; char *type; + char **only_show_in; + char **not_show_in; if (!is_link_data (file_contents, link_file_size)) { return; @@ -539,6 +559,21 @@ nautilus_link_get_link_info_given_file_contents (const char *file_contents, *is_launcher = TRUE; } g_free (type); - + + *is_foreign = FALSE; + only_show_in = g_key_file_get_string_list (key_file, MAIN_GROUP, + "OnlyShowIn", NULL, NULL); + if (only_show_in && !string_array_contains (only_show_in, "GNOME")) { + *is_foreign = TRUE; + } + g_strfreev (only_show_in); + + not_show_in = g_key_file_get_string_list (key_file, MAIN_GROUP, + "NotShowIn", NULL, NULL); + if (not_show_in && string_array_contains (not_show_in, "GNOME")) { + *is_foreign = TRUE; + } + g_strfreev (not_show_in); + g_key_file_free (key_file); } |