Merge lp:~mitya57/indicator-session/multiple-names-in-current-desktop into lp:indicator-session/15.04

Proposed by Dmitry Shachnev
Status: Merged
Approved by: Charles Kerr
Approved revision: 461
Merged at revision: 461
Proposed branch: lp:~mitya57/indicator-session/multiple-names-in-current-desktop
Merge into: lp:indicator-session/15.04
Diff against target: 31 lines (+18/-2)
1 file modified
src/backend-dbus/actions.c (+18/-2)
To merge this branch: bzr merge lp:~mitya57/indicator-session/multiple-names-in-current-desktop
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Alberts Muktupāvels Approve
Ted Gould Pending
Indicator Applet Developers Pending
Review via email: mp+243234@code.launchpad.net

Commit message

Support multiple desktop names in XDG_CURRENT_DESKTOP.

Description of the change

The Desktop Entry Specification says:

If $XDG_CURRENT_DESKTOP is set then it contains a colon-separated list of strings. In order, each string is considered.

In GNOME Flashback session, we currently have:

  dmitry@dmitry-HP-ProBook-6560b:~$ echo $XDG_CURRENT_DESKTOP
  GNOME-Flashback:Unity

… and we still want to use unity-control-center. This branch makes it work again for us.

To post a comment you must log in.
Revision history for this message
Alberts Muktupāvels (muktupavels) :
Revision history for this message
Alberts Muktupāvels (muktupavels) wrote :

Sorry, looks like this is wrong too. We should not pass NULL to g_strsplit...

const gchar *current_desktop;

current_desktop = g_getenv("XDG_CURRENT_DESKTOP");
if (!current_desktop)
    current_desktop = "";

desktop_names = g_strsplit (current_desktop, ":", 0);
for (i = 0; desktop_names[i]; ++i)
  ...

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Should be better now.

Revision history for this message
Alberts Muktupāvels (muktupavels) wrote :

Replace second g_getenv with xdg_current_desktop.

review: Approve
461. By Dmitry Shachnev

Support multiple names in XDG_CURRENT_DESKTOP.

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Done.

Revision history for this message
Charles Kerr (charlesk) wrote :

LGTM. Thanks for the patch!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/backend-dbus/actions.c'
2--- src/backend-dbus/actions.c 2014-08-31 10:39:30 +0000
3+++ src/backend-dbus/actions.c 2014-11-30 16:59:20 +0000
4@@ -831,9 +831,25 @@
5 have_unity_control_center (void)
6 {
7 gchar *path;
8+ const gchar *xdg_current_desktop;
9+ gchar **desktop_names;
10 gboolean have_ucc;
11-
12- if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") != 0)
13+ gboolean is_unity;
14+ int i;
15+
16+ is_unity = FALSE;
17+ xdg_current_desktop = g_getenv ("XDG_CURRENT_DESKTOP");
18+ if (xdg_current_desktop != NULL) {
19+ desktop_names = g_strsplit (xdg_current_desktop, ":", 0);
20+ for (i = 0; desktop_names[i]; ++i) {
21+ if (!g_strcmp0 (desktop_names[i], "Unity")) {
22+ is_unity = TRUE;
23+ }
24+ }
25+ g_strfreev (desktop_names);
26+ }
27+
28+ if (!is_unity)
29 return FALSE;
30
31 path = g_find_program_in_path ("unity-control-center");

Subscribers

People subscribed via source and target branches