[nautilus] Look at XDG_CURRENT_DESKTOP to decide if a link is foreign



commit 37e379a5a484b604bd25f0b4cb3269f6e4c942ba
Author: Michael Terry <michael terry canonical com>
Date:   Wed Jun 29 16:56:31 2011 +0100

    Look at XDG_CURRENT_DESKTOP to decide if a link is foreign
    
    https://bugzilla.gnome.org/show_bug.cgi?id=653660

 libnautilus-private/nautilus-link.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/libnautilus-private/nautilus-link.c b/libnautilus-private/nautilus-link.c
index 2c56c0f..339a1b4 100644
--- a/libnautilus-private/nautilus-link.c
+++ b/libnautilus-private/nautilus-link.c
@@ -554,6 +554,21 @@ string_array_contains (char **array,
 	return FALSE;
 }
 
+static const gchar *
+get_session (void)
+{
+	const gchar * session;
+
+	session = g_getenv ("XDG_CURRENT_DESKTOP");
+
+	if (session == NULL || session[0] == 0) {
+		/* historic behavior */
+		session = "GNOME";
+	}
+
+	return session;
+}
+
 void
 nautilus_link_get_link_info_given_file_contents (const char  *file_contents,
 						 int          link_file_size,
@@ -568,7 +583,9 @@ nautilus_link_get_link_info_given_file_contents (const char  *file_contents,
 	char *type;
 	char **only_show_in;
 	char **not_show_in;
+	const gchar *session;
 
+	session = get_session ();
 	key_file = g_key_file_new ();
 	if (!g_key_file_load_from_data (key_file,
 					file_contents,
@@ -594,14 +611,14 @@ nautilus_link_get_link_info_given_file_contents (const char  *file_contents,
 	*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")) {
+	if (session && only_show_in && !string_array_contains (only_show_in, session)) {
 		*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")) {
+	if (session && not_show_in && string_array_contains (not_show_in, session)) {
 		*is_foreign = TRUE;
 	}
 	g_strfreev (not_show_in);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]