[gnome-mahjongg/gnome-3-14] Correctly check XDG_CURRENT_DESKTOP environment variable.
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-mahjongg/gnome-3-14] Correctly check XDG_CURRENT_DESKTOP environment variable.
- Date: Mon, 3 Nov 2014 21:54:00 +0000 (UTC)
commit 6d80e7fded01a881660f28d8c9f93ae41fd2061e
Author: Robert Ancell <robert ancell canonical com>
Date: Tue Nov 4 10:10:06 2014 +1300
Correctly check XDG_CURRENT_DESKTOP environment variable.
The XDG_CURRENT_DESKTOP environment variable can contain a list of desktop names.
The existing code assumed it could only contain one name.
https://bugzilla.gnome.org/show_bug.cgi?id=739592
src/gnome-mahjongg.vala | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-mahjongg.vala b/src/gnome-mahjongg.vala
index e3942ce..3c83ec6 100644
--- a/src/gnome-mahjongg.vala
+++ b/src/gnome-mahjongg.vala
@@ -172,7 +172,7 @@ public class Mahjongg : Gtk.Application
header_bar.pack_end (pause_button);
var desktop = Environment.get_variable ("XDG_CURRENT_DESKTOP");
- if (desktop == null || desktop != "Unity")
+ if (!is_desktop ("Unity"))
{
header_bar.set_show_close_button (true);
window.set_titlebar (header_bar);
@@ -182,7 +182,6 @@ public class Mahjongg : Gtk.Application
vbox.pack_start (header_bar, false, false, 0);
}
-
vbox.pack_start (game_view, true, true, 0);
window.add (vbox);
@@ -199,6 +198,19 @@ public class Mahjongg : Gtk.Application
tick_cb ();
}
+ private bool is_desktop (string name)
+ {
+ var desktop_name_list = Environment.get_variable ("XDG_CURRENT_DESKTOP");
+ if (desktop_name_list == null)
+ return false;
+
+ foreach (var n in desktop_name_list.split (":"))
+ if (n == name)
+ return true;
+
+ return false;
+ }
+
private bool window_configure_event_cb (Gdk.EventConfigure event)
{
if (!is_maximized)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]