[gnome-sudoku] Correctly check XDG_CURRENT_DESKTOP environment variable
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku] Correctly check XDG_CURRENT_DESKTOP environment variable
- Date: Mon, 3 Nov 2014 21:57:29 +0000 (UTC)
commit 9f397f2e3383aba5bd5643b06c411cf28f07bff7
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Nov 3 15:56:03 2014 -0600
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."
Solution by Robert Ancell
https://bugzilla.gnome.org/show_bug.cgi?id=739592
src/gnome-sudoku.vala | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-sudoku.vala b/src/gnome-sudoku.vala
index 8353af8..57921fc 100644
--- a/src/gnome-sudoku.vala
+++ b/src/gnome-sudoku.vala
@@ -112,6 +112,19 @@ public class Sudoku : Gtk.Application
return -1;
}
+ 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;
+ }
+
protected override void startup ()
{
base.startup ();
@@ -167,8 +180,7 @@ public class Sudoku : Gtk.Application
print_multiple_action = (SimpleAction) lookup_action ("print-multiple");
pause_action = (SimpleAction) lookup_action ("pause");
- var desktop = Environment.get_variable ("XDG_CURRENT_DESKTOP");
- if (desktop == null || desktop != "Unity")
+ if (!is_desktop ("Unity"))
{
headerbar.show_close_button = true;
window.set_titlebar (headerbar);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]