[gnome-settings-daemon] color: Use gnome-session's SessionIsActive property
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] color: Use gnome-session's SessionIsActive property
- Date: Mon, 12 Nov 2012 09:22:36 +0000 (UTC)
commit bc9b2afeb650e47aa6d311c4e8c19d8cfa9243d8
Author: Bastien Nocera <hadess hadess net>
Date: Mon Nov 12 10:11:37 2012 +0100
color: Use gnome-session's SessionIsActive property
Rather than gnome-settings-daemon's libsystemd-login
dependent code.
https://bugzilla.gnome.org/show_bug.cgi?id=686650
plugins/power/gsd-power-manager.c | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 26ac236..2fb18fb 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -162,7 +162,7 @@ typedef enum {
struct GsdPowerManagerPrivate
{
- GnomeSettingsSession *session;
+ GDBusProxy *session;
gboolean lid_is_closed;
GSettings *settings;
GSettings *settings_screensaver;
@@ -2858,7 +2858,8 @@ idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode)
GError *error = NULL;
gint idle_percentage;
GsdPowerActionType action_type;
- GnomeSettingsSessionState state;
+ GVariant *active_v;
+ gboolean is_active = FALSE;
if (mode == manager->priv->current_idle_mode)
return;
@@ -2869,8 +2870,14 @@ idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode)
return;
/* ensure we're still on an active console */
- state = gnome_settings_session_get_state (manager->priv->session);
- if (state == GNOME_SETTINGS_SESSION_STATE_INACTIVE) {
+ active_v = g_dbus_proxy_get_cached_property (manager->priv->session_proxy,
+ "SessionIsActive");
+ if (active_v) {
+ is_active = g_variant_get_boolean (active_v);
+ g_variant_unref (active_v);
+ }
+
+ if (!is_active) {
g_debug ("ignoring state transition to %s as inactive",
idle_mode_to_string (mode));
return;
@@ -3476,8 +3483,9 @@ engine_settings_key_changed_cb (GSettings *settings,
}
static void
-engine_session_active_changed_cb (GnomeSettingsSession *session,
- GParamSpec *pspec,
+engine_session_active_changed_cb (GDBusProxy *session,
+ GVariant *changed,
+ char **invalidated,
GsdPowerManager *manager)
{
/* when doing the fast-user-switch into a new account,
@@ -3914,8 +3922,8 @@ gsd_power_manager_start (GsdPowerManager *manager,
inhibit_suspend (manager);
/* track the active session */
- manager->priv->session = gnome_settings_session_new ();
- g_signal_connect (manager->priv->session, "notify::state",
+ manager->priv->session = gnome_settings_session_get_session_proxy ();
+ g_signal_connect (manager->priv->session, "g-properties-changed",
G_CALLBACK (engine_session_active_changed_cb),
manager);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]