aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-05-25 16:07:45 +0200
committerRobert Tari <robert@tari.in>2021-05-25 16:07:45 +0200
commiteced932e2243a8906fdfccf55f0e6d695a4d59bf (patch)
treed3d33bf593dc9741135ac74825c1a028d3480035
parent3b9fe90ec0e7674126dd0e18d0ff1718b5b67133 (diff)
parent4a6696a9a28e4fa20e5d4c8ecbce527c13e6d1b8 (diff)
downloadayatana-indicator-session-eced932e2243a8906fdfccf55f0e6d695a4d59bf.tar.gz
ayatana-indicator-session-eced932e2243a8906fdfccf55f0e6d695a4d59bf.tar.bz2
ayatana-indicator-session-eced932e2243a8906fdfccf55f0e6d695a4d59bf.zip
Merge branch 'sunweaver-libayatana-common'
Attributes GH PR #35: https://github.com/AyatanaIndicators/ayatana-indicator-session/pull/35
-rw-r--r--CMakeLists.txt8
-rw-r--r--debian/control2
-rw-r--r--src/backend-dbus/actions.c393
-rw-r--r--src/service.c20
-rw-r--r--src/utils.c50
-rw-r--r--src/utils.h16
6 files changed, 90 insertions, 399 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9a76fb..3d43114 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,17 +31,11 @@ set (CMAKE_INSTALL_FULL_PKGLIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_
find_package (PkgConfig REQUIRED)
include (FindPkgConfig)
pkg_check_modules (SERVICE REQUIRED
+ libayatana-common>=0.9.2
glib-2.0>=2.36
gio-unix-2.0>=2.36)
include_directories (${SERVICE_INCLUDE_DIRS})
-set(URL_DISPATCHER_REQUIRED_VERSION 0)
-pkg_check_modules(
- URLDISPATCHER
- lomiri-url-dispatcher>=${URL_DISPATCHER_REQUIRED_VERSION}
-)
-include_directories(${URLDISPATCHER_INCLUDE_DIRS})
-
set (CC_WARNING_ARGS " -Wall -pedantic -Wextra -Wno-missing-field-initializers")
set (ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
diff --git a/debian/control b/debian/control
index a6ef0c0..8d43259 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ Build-Depends: cmake,
intltool,
libglib2.0-dev (>= 2.36),
libgtest-dev,
- liblomiri-url-dispatcher-dev (>= 0.1) | hello,
+ libayatana-common-dev (>= 0.9.2),
systemd [linux-any],
Standards-Version: 4.1.1
Homepage: https://github.com/AyatanaIndicators/ayatana-indicator-session
diff --git a/src/backend-dbus/actions.c b/src/backend-dbus/actions.c
index 429b5ec..c18ae72 100644
--- a/src/backend-dbus/actions.c
+++ b/src/backend-dbus/actions.c
@@ -20,9 +20,7 @@
#include <glib.h>
#include <glib/gi18n.h>
-#ifdef HAS_URLDISPATCHER
-# include <lomiri-url-dispatcher.h>
-#endif
+#include <ayatana/common/utils.h>
#include "dbus-end-session-dialog.h"
#include "dbus-login1-manager.h"
@@ -35,11 +33,6 @@
#include "../utils.h"
-/* some prototypes... */
-static char * find_browser ();
-static void run_outside_app (const char * cmd);
-static gboolean zenity_warning (const char * icon_name, const char * title, const char * text);
-
enum
{
END_SESSION_TYPE_LOGOUT = 0,
@@ -106,60 +99,6 @@ typedef enum
}
prompt_status_t;
-
-static gboolean
-have_gnome_program (const gchar *program)
-{
- g_auto(GStrv) desktop_names = NULL;
-
- if (is_gnome()) {
- g_autofree gchar *path = g_find_program_in_path (program);
- return path != NULL;
- }
-
- return FALSE;
-}
-
-static gboolean
-have_mate_program (const gchar *program)
-{
- g_auto(GStrv) desktop_names = NULL;
-
- if (is_mate()) {
- g_autofree gchar *path = g_find_program_in_path (program);
- return path != NULL;
- }
-
- return FALSE;
-}
-
-static gboolean have_budgie_program(const gchar *program)
-{
- g_auto(GStrv) desktop_names = NULL;
-
- if (is_budgie())
- {
- g_autofree gchar *path = g_find_program_in_path(program);
-
- return path != NULL;
- }
-
- return FALSE;
-}
-
-static gboolean
-have_xfce_program (const gchar *program)
-{
- g_auto(GStrv) desktop_names = NULL;
-
- if (is_xfce()) {
- g_autofree gchar *path = g_find_program_in_path (program);
- return path != NULL;
- }
-
- return FALSE;
-}
-
static prompt_status_t
get_prompt_status (IndicatorSessionActionsDbus * self)
{
@@ -169,17 +108,17 @@ get_prompt_status (IndicatorSessionActionsDbus * self)
if (!g_settings_get_boolean (p->indicator_settings, "suppress-logout-restart-shutdown"))
{
/* can we use the MATE prompt? */
- if ((prompt == PROMPT_NONE) && have_mate_program ("mate-session-save"))
+ if ((prompt == PROMPT_NONE) && ayatana_common_utils_have_mate_program ("mate-session-save"))
prompt = PROMPT_WITH_MATE;
// can we use the BUDGIE (currently GNOME) prompt?
- if ((prompt == PROMPT_NONE) && have_budgie_program("gnome-session-quit"))
+ if ((prompt == PROMPT_NONE) && ayatana_common_utils_have_budgie_program("gnome-session-quit"))
{
prompt = PROMPT_WITH_BUDGIE;
}
/* can we use the XFCE prompt? */
- if ((prompt == PROMPT_NONE) && have_xfce_program ("xfce4-session-logout"))
+ if ((prompt == PROMPT_NONE) && ayatana_common_utils_have_xfce_program ("xfce4-session-logout"))
prompt = PROMPT_WITH_XFCE;
/* can we use the Unity/Ayatana prompt? */
@@ -475,7 +414,7 @@ my_can_reboot (IndicatorSessionActions * actions)
/* Shutdown and Restart are the same dialog prompt in Unity,
so disable the redundant 'Restart' menuitem in that mode */
if (!g_settings_get_boolean (p->indicator_settings, "suppress-shutdown-menuitem"))
- if (is_unity())
+ if (ayatana_common_utils_is_unity())
return FALSE;
return TRUE;
@@ -799,84 +738,10 @@ zenity_question (IndicatorSessionActionsDbus * self,
static void
my_bug (IndicatorSessionActions * self G_GNUC_UNUSED)
{
- const char * bts_url = get_distro_bts_url();
- static char * browser = NULL;
-
-#ifdef HAS_URLDISPATCHER
- if (g_getenv ("MIR_SOCKET") != NULL)
- lomiri_url_dispatch_send(bts_url, NULL, NULL);
- else
-#endif
- {
-
- if (browser == NULL)
- browser = find_browser();
-
- if (browser != NULL)
- run_outside_app(g_strdup_printf("%s '%s'", browser, bts_url));
-
- else
- zenity_warning ("dialog-warning",
- _("Warning"),
- _("The operating system's bug tracker needs to be accessed with\na web browser.\n\nThe Ayatana Session Indicator could not find any web\nbrowser on your computer."));
-
- }
-}
-
-static gboolean
-zenity_warning (const char * icon_name,
- const char * title,
- const char * text)
-{
- char * command_line;
- int exit_status;
- GError * error;
- gboolean confirmed;
- char * zenity;
-
- confirmed = FALSE;
- zenity = g_find_program_in_path ("zenity");
-
- if (zenity)
- {
- command_line = g_strdup_printf ("%s"
- " --warning"
- " --icon-name=\"%s\""
- " --title=\"%s\""
- " --text=\"%s\""
- " --no-wrap",
- zenity,
- icon_name,
- title,
- text);
-
- /* Treat errors as user confirmation.
- Otherwise how will the user ever log out? */
- exit_status = -1;
- error = NULL;
- if (!g_spawn_command_line_sync (command_line, NULL, NULL, &exit_status, &error))
- {
- confirmed = TRUE;
- }
- else
- {
- confirmed = g_spawn_check_exit_status (exit_status, &error);
- }
-
- log_and_clear_error (&error, G_STRLOC, G_STRFUNC);
- g_free (command_line);
- }
- g_free (zenity);
- return confirmed;
-}
-
-static void
-run_outside_app (const char * cmd)
-{
- GError * err = NULL;
- g_debug ("%s calling \"%s\"", G_STRFUNC, cmd);
- g_spawn_command_line_async (cmd, &err);
- log_and_clear_error (&err, G_STRLOC, G_STRFUNC);
+ if (!ayatana_common_utils_open_url(get_distro_bts_url()))
+ ayatana_common_utils_zenity_warning ("dialog-warning",
+ _("Warning"),
+ _("The operating system's bug tracker needs to be accessed with\na web browser.\n\nThe Ayatana Session Indicator could not find any web\nbrowser on your computer."));
}
static void
@@ -892,16 +757,13 @@ my_logout (IndicatorSessionActions * actions)
case PROMPT_WITH_MATE:
/* --logout-dialog presents Logout and (if available) Switch User options */
- run_outside_app ("mate-session-save --logout-dialog");
+ ayatana_common_utils_execute_command ("mate-session-save --logout-dialog");
+ break;
+ case PROMPT_WITH_BUDGIE:
+ ayatana_common_utils_execute_command("gnome-session-quit --logout");
break;
- case PROMPT_WITH_BUDGIE:
- {
- run_outside_app("gnome-session-quit --logout");
-
- break;
- }
case PROMPT_WITH_XFCE:
- run_outside_app ("xfce4-session-logout");
+ ayatana_common_utils_execute_command ("xfce4-session-logout");
break;
case PROMPT_NONE:
@@ -943,16 +805,13 @@ my_reboot (IndicatorSessionActions * actions)
case PROMPT_WITH_MATE:
/* --shutdown-dialog presents Restart, Shutdown and (if available) Suspend options */
- run_outside_app ("mate-session-save --shutdown-dialog");
+ ayatana_common_utils_execute_command ("mate-session-save --shutdown-dialog");
+ break;
+ case PROMPT_WITH_BUDGIE:
+ ayatana_common_utils_execute_command("gnome-session-quit --reboot");
break;
- case PROMPT_WITH_BUDGIE:
- {
- run_outside_app("gnome-session-quit --reboot");
-
- break;
- }
case PROMPT_WITH_XFCE:
- run_outside_app ("xfce4-session-logout");
+ ayatana_common_utils_execute_command ("xfce4-session-logout");
break;
case PROMPT_NONE:
@@ -981,7 +840,7 @@ my_power_off (IndicatorSessionActions * actions)
case PROMPT_WITH_AYATANA:
/* NB: TYPE_REBOOT instead of TYPE_SHUTDOWN because
the latter adds lock & logout options in Unity... */
- if (is_unity())
+ if (ayatana_common_utils_is_unity())
show_desktop_end_session_dialog (self, END_SESSION_TYPE_REBOOT);
else
show_desktop_end_session_dialog (self, END_SESSION_TYPE_SHUTDOWN);
@@ -989,16 +848,13 @@ my_power_off (IndicatorSessionActions * actions)
case PROMPT_WITH_MATE:
/* --shutdown-dialog presents Restart, Shutdown and (if available) Suspend options */
- run_outside_app ("mate-session-save --shutdown-dialog");
+ ayatana_common_utils_execute_command ("mate-session-save --shutdown-dialog");
+ break;
+ case PROMPT_WITH_BUDGIE:
+ ayatana_common_utils_execute_command("gnome-session-quit --power-off");
break;
- case PROMPT_WITH_BUDGIE:
- {
- run_outside_app("gnome-session-quit --power-off");
-
- break;
- }
case PROMPT_WITH_XFCE:
- run_outside_app ("xfce4-session-logout");
+ ayatana_common_utils_execute_command ("xfce4-session-logout");
break;
case PROMPT_WITH_ZENITY:
@@ -1021,63 +877,23 @@ my_power_off (IndicatorSessionActions * actions)
****
***/
-static char *
-find_browser ()
-{
- static char * browser_path = NULL;
- char* tmp_browser_path;
- gchar **browser_names;
-
- int i;
-
- if (browser_path == NULL)
- {
-
- browser_names = g_strsplit ("x-www-browser,google-chrome,firefox,chromium", ",", 0);
-
- for (i = 0; browser_names[i]; ++i) {
-
- tmp_browser_path = g_find_program_in_path (browser_names[i]);
-
- if (tmp_browser_path) {
- browser_path = g_strdup (tmp_browser_path);
- g_free (tmp_browser_path);
- g_strfreev (browser_names);
- break;
- }
- }
- }
-
- return browser_path;
-
-}
-
static void
my_desktop_help (IndicatorSessionActions * self G_GNUC_UNUSED)
{
- static char * browser = NULL;
-
- if (have_budgie_program ("yelp"))
- {
- run_outside_app ("yelp help:gnome-user-guide");
- }
- else if (have_gnome_program ("yelp"))
- run_outside_app ("yelp help:gnome-user-guide");
- else if (have_mate_program ("yelp"))
- run_outside_app ("yelp help:mate-user-guide");
- else if (is_xfce())
- {
- if (browser == NULL)
- browser = find_browser();
- if (browser != NULL)
- run_outside_app(g_strdup_printf("%s '%s'", browser, "https://docs.xfce.org/"));
- else
- zenity_warning ("dialog-warning",
- _("Warning"),
- _("The XFCE desktop's user guide needs to be accessed with\na web browser.\n\nThe Ayatana Session Indicator could not find any web\nbrowser on your computer."));
- }
+ if (ayatana_common_utils_have_budgie_program ("yelp"))
+ ayatana_common_utils_execute_command ("yelp help:gnome-user-guide");
+ else if (ayatana_common_utils_have_gnome_program ("yelp"))
+ ayatana_common_utils_execute_command ("yelp help:gnome-user-guide");
+ else if (ayatana_common_utils_have_mate_program ("yelp"))
+ ayatana_common_utils_execute_command ("yelp help:mate-user-guide");
+ else if (ayatana_common_utils_is_xfce()) {
+ if (!ayatana_common_utils_open_url("https://docs.xfce.org/"))
+ ayatana_common_utils_zenity_warning ("dialog-warning",
+ _("Warning"),
+ _("The XFCE desktop's user guide needs to be accessed with\na web browser.\n\nThe Ayatana Session Indicator could not find any web\nbrowser on your computer."));
+ }
else
- zenity_warning ("dialog-warning",
+ ayatana_common_utils_zenity_warning ("dialog-warning",
_("Warning"),
_("The Ayatana Session Indicator does not know yet, how to show\nthe currently running desktop's user guide or help center.\n\nPlease report this to the developers at:\nhttps://github.com/ArcticaProject/ayatana-indicator-session/issues"));
}
@@ -1085,74 +901,27 @@ my_desktop_help (IndicatorSessionActions * self G_GNUC_UNUSED)
static void
my_distro_help (IndicatorSessionActions * self G_GNUC_UNUSED)
{
- static char * browser = NULL;
-
- if (browser == NULL)
- browser = find_browser();
-
- if (browser != NULL)
- run_outside_app(g_strdup_printf("%s '%s'", browser, get_distro_url()));
- else
- zenity_warning ("dialog-warning",
+ if (!ayatana_common_utils_open_url(get_distro_url()))
+ ayatana_common_utils_zenity_warning ("dialog-warning",
_("Warning"),
g_strdup_printf(_("Displaying information on %s requires\na web browser.\n\nThe Ayatana Session Indicator could not find any web\nbrowser on your computer."), get_distro_name()));
}
-
-static gboolean
-have_unity_control_center (void)
-{
- gchar *path;
- gboolean have_ucc;
-
- if (!is_unity())
- return FALSE;
-
- path = g_find_program_in_path ("unity-control-center");
- have_ucc = path != NULL;
- g_free (path);
-
- return have_ucc;
-}
-
-static gboolean
-have_gnome_control_center (void)
-{
- gchar *path;
- gboolean have_gcc;
-
- if (!is_gnome())
- return FALSE;
-
- path = g_find_program_in_path ("gnome-control-center");
- have_gcc = path != NULL;
- g_free (path);
-
- return have_gcc;
-}
-
static void
my_settings (IndicatorSessionActions * self G_GNUC_UNUSED)
{
-#ifdef HAS_URLDISPATCHER
- if (g_getenv ("MIR_SOCKET") != NULL)
- lomiri_url_dispatch_send("settings:///system", NULL, NULL);
- else
-#endif
- if (have_unity_control_center ())
- run_outside_app ("unity-control-center");
- else if (have_budgie_program("gnome-control-center"))
- {
- run_outside_app("gnome-control-center");
- }
- else if (have_gnome_control_center())
- run_outside_app ("gnome-control-center");
- else if (have_mate_program ("mate-control-center"))
- run_outside_app ("mate-control-center");
- else if (have_xfce_program ("xfce4-settings-manager"))
- run_outside_app ("xfce4-settings-manager");
+ if (ayatana_common_utils_is_lomiri())
+ ayatana_common_utils_open_url("settings:///system");
+ else if (ayatana_common_utils_have_unity_program("unity-control-center"))
+ ayatana_common_utils_execute_command ("unity-control-center");
+ else if (ayatana_common_utils_have_gnome_program("gnome-control-center"))
+ ayatana_common_utils_execute_command ("gnome-control-center");
+ else if (ayatana_common_utils_have_mate_program ("mate-control-center"))
+ ayatana_common_utils_execute_command ("mate-control-center");
+ else if (ayatana_common_utils_have_xfce_program ("xfce4-settings-manager"))
+ ayatana_common_utils_execute_command ("xfce4-settings-manager");
else
- zenity_warning ("dialog-warning",
+ ayatana_common_utils_zenity_warning ("dialog-warning",
_("Warning"),
_("The Ayatana Session Indicator does not support evoking the system\nsettings application for your desktop environment, yet.\n\nPlease report this to the developers at:\nhttps://github.com/ArcticaProject/ayatana-indicator-session/issues"));
}
@@ -1160,17 +929,14 @@ my_settings (IndicatorSessionActions * self G_GNUC_UNUSED)
static void
my_online_accounts (IndicatorSessionActions * self G_GNUC_UNUSED)
{
-#ifdef HAS_URLDISPATCHER
- if (g_getenv ("MIR_SOCKET") != NULL)
- lomiri_url_dispatch_send("settings:///system/online-accounts", NULL, NULL);
+ if (ayatana_common_utils_is_lomiri())
+ ayatana_common_utils_open_url("settings:///system/online-accounts");
+ else if (ayatana_common_utils_have_unity_program("unity-control-center"))
+ ayatana_common_utils_execute_command ("unity-control-center credentials");
+ else if (ayatana_common_utils_have_gnome_program("gnome-control-center"))
+ ayatana_common_utils_execute_command ("gnome-control-center credentials");
else
-#endif
- if (have_unity_control_center ())
- run_outside_app ("unity-control-center credentials");
- else if (have_gnome_control_center())
- run_outside_app ("gnome-control-center credentials");
- else
- zenity_warning ("dialog-warning",
+ ayatana_common_utils_zenity_warning ("dialog-warning",
_("Warning"),
_("The Ayatana Session Indicator does not support password changes\nfor your desktop environment, yet.\n\nPlease report this to the developers at:\nhttps://github.com/ArcticaProject/ayatana-indicator-session/issues"));
}
@@ -1178,25 +944,20 @@ my_online_accounts (IndicatorSessionActions * self G_GNUC_UNUSED)
static void
my_about (IndicatorSessionActions * self G_GNUC_UNUSED)
{
-#ifdef HAS_URLDISPATCHER
- if (g_getenv ("MIR_SOCKET") != NULL)
- lomiri_url_dispatch_send("settings:///system/about", NULL, NULL);
- else
-#endif
- if (have_unity_control_center ())
- run_outside_app ("unity-control-center info");
- else if (have_budgie_program("gnome-control-center"))
- {
- run_outside_app("gnome-control-center info-overview");
- }
- else if (have_gnome_control_center())
- run_outside_app ("gnome-control-center info");
- else if (have_mate_program ("mate-system-monitor"))
- run_outside_app ("mate-system-monitor --show-system-tab");
- else if (have_xfce_program ("xfce4-about"))
- run_outside_app ("xfce4-about");
+ if (ayatana_common_utils_is_lomiri())
+ ayatana_common_utils_open_url("settings:///system/about");
+ else if (ayatana_common_utils_have_unity_program("unity-control-center"))
+ ayatana_common_utils_execute_command ("unity-control-center info");
+ else if (ayatana_common_utils_have_budgie_program("gnome-control-center"))
+ ayatana_common_utils_execute_command ("gnome-control-center info-overview");
+ else if (ayatana_common_utils_have_gnome_program("gnome-control-center"))
+ ayatana_common_utils_execute_command ("gnome-control-center info");
+ else if (ayatana_common_utils_have_mate_program ("mate-system-monitor"))
+ ayatana_common_utils_execute_command ("mate-system-monitor --show-system-tab");
+ else if (ayatana_common_utils_have_xfce_program ("xfce4-about"))
+ ayatana_common_utils_execute_command ("xfce4-about");
else
- zenity_warning ("dialog-warning",
+ ayatana_common_utils_zenity_warning ("dialog-warning",
_("Warning"),
_("The Ayatana Session Indicator does not know yet, how to show\ninformation of the currently running desktop environment.\n\nPlease report this to the developers at:\nhttps://github.com/ArcticaProject/ayatana-indicator-session/issues"));
}
@@ -1221,17 +982,17 @@ lock_current_session (IndicatorSessionActions * self, gboolean immediate)
desktop_session_call_lock (p->desktop_session, p->cancellable, NULL, NULL);
}
}
- else if (have_mate_program ("mate-screensaver-command"))
+ else if (ayatana_common_utils_have_mate_program ("mate-screensaver-command"))
{
- run_outside_app ("mate-screensaver-command --lock");
+ ayatana_common_utils_execute_command ("mate-screensaver-command --lock");
}
- else if (have_budgie_program("gnome-screensaver-command"))
+ else if (ayatana_common_utils_have_budgie_program("gnome-screensaver-command"))
{
- run_outside_app("gnome-screensaver-command --lock");
+ ayatana_common_utils_execute_command("gnome-screensaver-command --lock");
}
- else if (have_xfce_program ("xflock4"))
+ else if (ayatana_common_utils_have_xfce_program ("xflock4"))
{
- run_outside_app ("xflock4");
+ ayatana_common_utils_execute_command ("xflock4");
}
else
{
diff --git a/src/service.c b/src/service.c
index c970c62..1d3115f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -19,11 +19,11 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
+#include <ayatana/common/utils.h>
#include "backend.h"
#include "recoverable-problem.h"
#include "service.h"
-
#include "utils.h"
#define BUS_NAME "org.ayatana.indicator.session"
@@ -1175,16 +1175,18 @@ indicator_session_service_init (IndicatorSessionService * self)
/* init our priv pointer */
p = indicator_session_service_get_instance_private (self);
p->indicator_settings = g_settings_new ("org.ayatana.indicator.session");
- if (is_mate())
- p->keybinding_settings = g_settings_new ("org.mate.SettingsDaemon.plugins.media-keys");
-
- else if (is_budgie())
+ if (ayatana_common_utils_is_mate())
{
- p->keybinding_settings = g_settings_new("org.gnome.settings-daemon.plugins.media-keys");
+ p->keybinding_settings = g_settings_new ("org.mate.SettingsDaemon.plugins.media-keys");
+ }
+ else if (ayatana_common_utils_is_budgie())
+ {
+ p->keybinding_settings = g_settings_new ("org.gnome.settings-daemon.plugins.media-keys");
+ }
+ else if (ayatana_common_utils_is_gnome() || ayatana_common_utils_is_unity())
+ {
+ p->keybinding_settings = g_settings_new ("org.gnome.settings-daemon.plugins.media-keys");
}
-
- else if (is_gnome() || is_unity())
- p->keybinding_settings = g_settings_new ("org.gnome.settings-daemon.plugins.media-keys");
self->priv = p;
diff --git a/src/utils.c b/src/utils.c
index 7e67bb2..991f4ec 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -16,56 +16,6 @@
#include "utils.h"
-static gboolean
-is_xdg_current_desktop (const gchar* desktop)
-{
- 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], desktop)) {
- g_strfreev (desktop_names);
- return TRUE;
- }
- }
- g_strfreev (desktop_names);
- }
- return FALSE;
-}
-
-gboolean
-is_gnome ()
-{
- return is_xdg_current_desktop(DESKTOP_GNOME);
-}
-
-gboolean
-is_unity ()
-{
- return is_xdg_current_desktop(DESKTOP_UNITY);
-}
-
-gboolean
-is_mate ()
-{
- return is_xdg_current_desktop(DESKTOP_MATE);
-}
-
-gboolean is_budgie()
-{
- return is_xdg_current_desktop(DESKTOP_BUDGIE);
-}
-
-gboolean
-is_xfce ()
-{
- return is_xdg_current_desktop(DESKTOP_XFCE);
-}
-
GHashTable*
get_os_release (void)
{
diff --git a/src/utils.h b/src/utils.h
index 47bb427..149087b 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -20,22 +20,6 @@
#include <glib.h>
#include <string.h>
-
-/* XDG_CURRENT_DESKTOP environment variable values
- * as set by well-known desktop environments
- */
-#define DESKTOP_UNITY "Unity"
-#define DESKTOP_MATE "MATE"
-#define DESKTOP_BUDGIE "Budgie:GNOME"
-#define DESKTOP_GNOME "GNOME"
-#define DESKTOP_XFCE "XFCE"
-
-gboolean is_unity();
-gboolean is_gnome();
-gboolean is_mate();
-gboolean is_budgie();
-gboolean is_xfce();
-
const char* get_distro_name();
const char* get_distro_url();
const char* get_distro_bts_url();