[gnome-sudoku/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-sudoku/gnome-3-14] Correctly check XDG_CURRENT_DESKTOP environment variable
- Date: Mon, 3 Nov 2014 21:58:17 +0000 (UTC)
commit e08719c1de8c2e3cf3c86fc50923ed1a5137013b
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 2501edd..ad3e6fc 100644
--- a/src/gnome-sudoku.vala
+++ b/src/gnome-sudoku.vala
@@ -107,6 +107,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 ();
@@ -166,8 +179,7 @@ public class Sudoku : Gtk.Application
print_action = (SimpleAction) lookup_action ("print");
print_multiple_action = (SimpleAction) lookup_action ("print-multiple");
- 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]