aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2007-12-13 00:00:16 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-12-13 00:00:16 +0800
commit02f27e70cf032fb8b5879e49148e192cb9fe688b (patch)
treeaa74bd539ba34c8c41fb7a36a2562d782f8f69f6
parent0b4abd3ca3f42267963cf570a7161c4f5dced537 (diff)
downloadgsoc2013-empathy-02f27e70cf032fb8b5879e49148e192cb9fe688b.tar.gz
gsoc2013-empathy-02f27e70cf032fb8b5879e49148e192cb9fe688b.tar.zst
gsoc2013-empathy-02f27e70cf032fb8b5879e49148e192cb9fe688b.zip
Correctly store/restore presence when NM state changes
svn path=/trunk/; revision=473
-rw-r--r--libempathy/empathy-idle.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c
index 6ef72609e..0239d144e 100644
--- a/libempathy/empathy-idle.c
+++ b/libempathy/empathy-idle.c
@@ -574,7 +574,8 @@ idle_nm_state_change_cb (DBusGProxy *proxy,
EmpathyIdle *idle)
{
EmpathyIdlePriv *priv;
- gboolean nm_connected;
+ gboolean old_nm_connected;
+ gboolean new_nm_connected;
priv = GET_PRIV (idle);
@@ -585,23 +586,25 @@ idle_nm_state_change_cb (DBusGProxy *proxy,
return;
}
- nm_connected = !(state == NM_STATE_CONNECTING ||
- state == NM_STATE_DISCONNECTED);
+ old_nm_connected = priv->nm_connected;
+ new_nm_connected = !(state == NM_STATE_CONNECTING ||
+ state == NM_STATE_DISCONNECTED);
+ priv->nm_connected = TRUE; /* To be sure _set_state will work */
- if (priv->nm_connected && !nm_connected) {
+ if (old_nm_connected && !new_nm_connected) {
/* We are no more connected */
idle_ext_away_stop (idle);
priv->nm_saved_state = priv->state;
empathy_idle_set_state (idle, MC_PRESENCE_OFFLINE);
}
- else if (!priv->nm_connected && nm_connected) {
+ else if (!old_nm_connected && new_nm_connected) {
/* We are now connected */
- priv->nm_saved_state = MC_PRESENCE_UNSET;
empathy_idle_set_state (idle, priv->nm_saved_state);
+ priv->nm_saved_state = MC_PRESENCE_UNSET;
}
- priv->nm_connected = nm_connected;
+ priv->nm_connected = new_nm_connected;
}
static void