[nautilus] desktop-canvas-view: Support multiple desktop names in XDG_CURRENT_DESKTOP



commit c1f7d50f7ace6790169301d948b41efeb5ef63ca
Author: Dmitry Shachnev <mitya57 gmail com>
Date:   Sun Mar 22 18:40:55 2015 +0300

    desktop-canvas-view: Support multiple desktop names in XDG_CURRENT_DESKTOP
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746607

 src/nautilus-desktop-canvas-view.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-desktop-canvas-view.c b/src/nautilus-desktop-canvas-view.c
index fec4b48..6890743 100644
--- a/src/nautilus-desktop-canvas-view.c
+++ b/src/nautilus-desktop-canvas-view.c
@@ -493,13 +493,32 @@ get_control_center_command (const gchar ** params_out)
        gchar *path;
        const gchar *retval;
        const gchar *params;
+       const gchar *xdg_current_desktop;
+       gchar **desktop_names;
+       gboolean is_unity;
+       int i;
 
        path = NULL;
        retval = NULL;
        params = NULL;
 
+       xdg_current_desktop = g_getenv ("XDG_CURRENT_DESKTOP");
+
+       /* Detect the Unity-based environments */
+       is_unity = FALSE;
+       if (xdg_current_desktop != NULL) {
+               desktop_names = g_strsplit (xdg_current_desktop, ":", 0);
+               for (i = 0; desktop_names[i]; ++i) {
+                       if (!g_strcmp0 (desktop_names[i], "Unity")) {
+                               is_unity = TRUE;
+                               break;
+                       }
+               }
+               g_strfreev (desktop_names);
+       }
+
        /* In Unity look for unity-control-center */
-       if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0) {
+       if (is_unity) {
                path = g_find_program_in_path ("unity-control-center");
                if (path != NULL) {
                        retval = "unity-control-center";


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