diff options
Diffstat (limited to 'mate-session/gsm-logout-dialog.c')
-rw-r--r-- | mate-session/gsm-logout-dialog.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/mate-session/gsm-logout-dialog.c b/mate-session/gsm-logout-dialog.c index 1a79875..323f123 100644 --- a/mate-session/gsm-logout-dialog.c +++ b/mate-session/gsm-logout-dialog.c @@ -27,7 +27,9 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> +#ifdef HAVE_UPOWER #include <upower.h> +#endif #include "gsm-logout-dialog.h" #ifdef HAVE_SYSTEMD @@ -52,8 +54,9 @@ typedef enum { struct _GsmLogoutDialogPrivate { GsmDialogLogoutType type; - +#ifdef HAVE_UPOWER UpClient *up_client; +#endif #ifdef HAVE_SYSTEMD GsmSystemd *systemd; #endif @@ -147,9 +150,9 @@ gsm_logout_dialog_init (GsmLogoutDialog *logout_dialog) gtk_window_set_skip_taskbar_hint (GTK_WINDOW (logout_dialog), TRUE); gtk_window_set_keep_above (GTK_WINDOW (logout_dialog), TRUE); gtk_window_stick (GTK_WINDOW (logout_dialog)); - +#ifdef HAVE_UPOWER logout_dialog->priv->up_client = up_client_new (); - +#endif #ifdef HAVE_SYSTEMD if (LOGIND_RUNNING()) logout_dialog->priv->systemd = gsm_get_systemd (); @@ -176,12 +179,12 @@ gsm_logout_dialog_destroy (GsmLogoutDialog *logout_dialog, g_source_remove (logout_dialog->priv->timeout_id); logout_dialog->priv->timeout_id = 0; } - +#ifdef HAVE_UPOWER if (logout_dialog->priv->up_client) { g_object_unref (logout_dialog->priv->up_client); logout_dialog->priv->up_client = NULL; } - +#endif #ifdef HAVE_SYSTEMD if (logout_dialog->priv->systemd) { g_object_unref (logout_dialog->priv->systemd); @@ -201,13 +204,17 @@ static gboolean gsm_logout_supports_system_suspend (GsmLogoutDialog *logout_dialog) { gboolean ret; + ret = FALSE; #ifdef HAVE_SYSTEMD if (LOGIND_RUNNING()) ret = gsm_systemd_can_suspend (logout_dialog->priv->systemd); +#endif +#if defined(HAVE_SYSTEMD) && defined(HAVE_UPOWER) else #endif +#ifdef HAVE_UPOWER ret = up_client_get_can_suspend (logout_dialog->priv->up_client); - +#endif return ret; } @@ -215,13 +222,17 @@ static gboolean gsm_logout_supports_system_hibernate (GsmLogoutDialog *logout_dialog) { gboolean ret; + ret = FALSE; #ifdef HAVE_SYSTEMD if (LOGIND_RUNNING()) ret = gsm_systemd_can_hibernate (logout_dialog->priv->systemd); +#endif +#if defined(HAVE_SYSTEMD) && defined(HAVE_UPOWER) else #endif +#ifdef HAVE_UPOWER ret = up_client_get_can_hibernate (logout_dialog->priv->up_client); - +#endif return ret; } |