summaryrefslogtreecommitdiff
path: root/plugins/color/gsd-color-manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/color/gsd-color-manager.c')
-rw-r--r--plugins/color/gsd-color-manager.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/plugins/color/gsd-color-manager.c b/plugins/color/gsd-color-manager.c
index 999b88c4..df6d32ef 100644
--- a/plugins/color/gsd-color-manager.c
+++ b/plugins/color/gsd-color-manager.c
@@ -47,7 +47,7 @@
struct GsdColorManagerPrivate
{
- GnomeSettingsSession *session;
+ GDBusProxy *session;
CdClient *client;
GSettings *settings;
GcmProfileStore *profile_store;
@@ -55,7 +55,7 @@ struct GsdColorManagerPrivate
GnomeRRScreen *x11_screen;
GHashTable *edid_cache;
GdkWindow *gdk_window;
- GnomeSettingsSessionState session_state;
+ gboolean session_is_active;
GHashTable *device_assign_hash;
};
@@ -2213,17 +2213,26 @@ gcm_session_sensor_removed_cb (CdClient *client,
}
static void
-gcm_session_active_changed_cb (GnomeSettingsSession *session,
- GParamSpec *pspec,
+gcm_session_active_changed_cb (GDBusProxy *session,
+ GVariant *changed,
+ char **invalidated,
GsdColorManager *manager)
{
- GnomeSettingsSessionState state_new;
GsdColorManagerPrivate *priv = manager->priv;
+ GVariant *active_v = NULL;
+ gboolean is_active;
/* not yet connected to the daemon */
if (!cd_client_get_connected (priv->client))
return;
+ active_v = g_dbus_proxy_get_cached_property (session, "SessionIsActive");
+ if (!active_v)
+ return;
+
+ g_variant_get (active_v, "(b)", &is_active);
+ g_variant_unref (active_v);
+
/* When doing the fast-user-switch into a new account, load the
* new users chosen profiles.
*
@@ -2231,15 +2240,13 @@ gcm_session_active_changed_cb (GnomeSettingsSession *session,
* loaded, then we'll get a change from unknown to active
* and we want to avoid reprobing the devices for that.
*/
- state_new = gnome_settings_session_get_state (session);
- if (priv->session_state != GNOME_SETTINGS_SESSION_STATE_UNKNOWN &&
- state_new == GNOME_SETTINGS_SESSION_STATE_ACTIVE) {
+ if (is_active && !priv->session_is_active) {
g_warning ("Done switch to new account, reload devices");
cd_client_get_devices (manager->priv->client, NULL,
gcm_session_get_devices_cb,
manager);
}
- priv->session_state = state_new;
+ priv->session_is_active = is_active;
}
static void
@@ -2259,11 +2266,9 @@ gsd_color_manager_init (GsdColorManager *manager)
priv = manager->priv = GSD_COLOR_MANAGER_GET_PRIVATE (manager);
/* track the active session */
- priv->session = gnome_settings_session_new ();
- priv->session_state = gnome_settings_session_get_state (priv->session);
- g_signal_connect (priv->session, "notify::state",
- G_CALLBACK (gcm_session_active_changed_cb),
- manager);
+ priv->session = gnome_settings_session_get_session_proxy ();
+ g_signal_connect (priv->session, "g-properties-changed",
+ G_CALLBACK (gcm_session_active_changed_cb), manager);
/* set the _ICC_PROFILE atoms on the root screen */
priv->gdk_window = gdk_screen_get_root_window (gdk_screen_get_default ());