From 2026ee0ea8ea662c7fa9cef0d3a1bc043212f542 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 15 Mar 2018 22:33:44 +0100 Subject: src/utils.c: Add is_pantheon() function. --- src/utils.c | 21 +++++++++++++++++++++ src/utils.h | 1 + 2 files changed, 22 insertions(+) (limited to 'src') diff --git a/src/utils.c b/src/utils.c index ad6d510..f41b275 100644 --- a/src/utils.c +++ b/src/utils.c @@ -146,3 +146,24 @@ is_mate () } return FALSE; } + +gboolean +is_pantheon () +{ + const gchar *xdg_current_desktop; + gchar **desktop_names; + int i; + + xdg_current_desktop = g_getenv ("XDG_CURRENT_DESKTOP"); + if (xdg_current_desktop != NULL) { + desktop_names = g_strsplit (xdg_current_desktop, ":", 0); + for (i = 0; desktop_names[i]; ++i) { + if (!g_strcmp0 (desktop_names[i], "Pantheon")) { + g_strfreev (desktop_names); + return TRUE; + } + } + g_strfreev (desktop_names); + } + return FALSE; +} diff --git a/src/utils.h b/src/utils.h index 665008e..ad32aad 100644 --- a/src/utils.h +++ b/src/utils.h @@ -26,5 +26,6 @@ void utils_handle_settings_request(void); gboolean is_unity(); gboolean is_gnome(); gboolean is_mate(); +gboolean is_pantheon(); #endif /* __INDICATOR_POWER_UTILS_H__ */ -- cgit v1.2.3