[eog] EogWindow: Correctly check the value of XDG_CURRENT_DESKTOP
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] EogWindow: Correctly check the value of XDG_CURRENT_DESKTOP
- Date: Thu, 10 Mar 2016 04:01:54 +0000 (UTC)
commit b874815a09d4385065f19a650e7b5e06c7e6fa5f
Author: Robert Ancell <robert ancell canonical com>
Date: Thu Mar 10 16:55:24 2016 +1300
EogWindow: Correctly check the value of XDG_CURRENT_DESKTOP
XDG_CURRENT_DESKTOP is a list of desktop names, check if any value matches Unity.
src/eog-window.c | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/src/eog-window.c b/src/eog-window.c
index eef981f..e6bc460 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -2556,6 +2556,29 @@ eog_window_action_show_hide_bar (GSimpleAction *action,
}
}
+static gboolean
+in_desktop (const gchar *name)
+{
+ const gchar *desktop_name_list;
+ gchar **names;
+ gboolean in_list = FALSE;
+ gint i;
+
+ desktop_name_list = g_getenv ("XDG_CURRENT_DESKTOP");
+ if (!desktop_name_list)
+ return FALSE;
+
+ names = g_strsplit (desktop_name_list, ":", -1);
+ for (i = 0; names[i] && !in_list; i++)
+ if (strcmp (names[i], name) == 0) {
+ in_list = TRUE;
+ break;
+ }
+ g_strfreev (names);
+
+ return in_list;
+}
+
static void
wallpaper_info_bar_response (GtkInfoBar *bar, gint response, EogWindow *window)
{
@@ -2565,7 +2588,7 @@ wallpaper_info_bar_response (GtkInfoBar *bar, gint response, EogWindow *window)
GError *error = NULL;
path = g_find_program_in_path ("unity-control-center");
- if (path && g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0)
+ if (path && in_desktop ("Unity"))
app_info = g_app_info_create_from_commandline ("unity-control-center appearance",
"System Settings",
G_APP_INFO_CREATE_NONE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]