Merge lp:~robert-ancell/unity-settings-daemon/xdg-current-desktop into lp:unity-settings-daemon

Proposed by Robert Ancell
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 4133
Merged at revision: 4133
Proposed branch: lp:~robert-ancell/unity-settings-daemon/xdg-current-desktop
Merge into: lp:unity-settings-daemon
Diff against target: 42 lines (+24/-1)
1 file modified
plugins/xsettings/gsd-xsettings-manager.c (+24/-1)
To merge this branch: bzr merge lp:~robert-ancell/unity-settings-daemon/xdg-current-desktop
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Review via email: mp+289105@code.launchpad.net

Commit message

Correctly check value of XDG_CURRENT_DESKTOP.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

great

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/xsettings/gsd-xsettings-manager.c'
2--- plugins/xsettings/gsd-xsettings-manager.c 2016-02-09 09:56:17 +0000
3+++ plugins/xsettings/gsd-xsettings-manager.c 2016-03-15 20:36:25 +0000
4@@ -434,6 +434,29 @@
5 return dpi * factor;
6 }
7
8+static gboolean
9+in_desktop (const gchar *name)
10+{
11+ const gchar *desktop_name_list;
12+ gchar **names;
13+ gboolean in_list = FALSE;
14+ gint i;
15+
16+ desktop_name_list = g_getenv ("XDG_CURRENT_DESKTOP");
17+ if (!desktop_name_list)
18+ return FALSE;
19+
20+ names = g_strsplit (desktop_name_list, ":", -1);
21+ for (i = 0; names[i] && !in_list; i++)
22+ if (strcmp (names[i], name) == 0) {
23+ in_list = TRUE;
24+ break;
25+ }
26+ g_strfreev (names);
27+
28+ return in_list;
29+}
30+
31 static int
32 get_window_scale (GnomeXSettingsManager *manager)
33 {
34@@ -453,7 +476,7 @@
35 window_scale = 1;
36
37 /* Under Unity let the shell handle the scaling */
38- if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0)
39+ if (in_desktop ("Unity"))
40 goto out;
41
42 display = gdk_display_get_default ();

Subscribers

People subscribed via source and target branches