From 1cfcab42033de14bfd286a54dbc6d224e534ad27 Mon Sep 17 00:00:00 2001 From: Davyd Madeley Date: Tue, 10 Feb 2009 20:52:36 +0000 Subject: Save status message on NetworkManager disconnect and restore on reconnect From: Davyd Madeley svn path=/trunk/; revision=2432 --- libempathy/empathy-idle.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c index f9dd4fca8..178134738 100644 --- a/libempathy/empathy-idle.c +++ b/libempathy/empathy-idle.c @@ -53,6 +53,7 @@ typedef struct { McPresence away_saved_state; McPresence nm_saved_state; + gchar *nm_saved_status; gboolean is_idle; gboolean nm_connected; @@ -242,15 +243,23 @@ idle_nm_state_change_cb (DBusGProxy *proxy, if (old_nm_connected && !new_nm_connected) { /* We are no more connected */ - DEBUG ("Disconnected: Save state %d", priv->state); + DEBUG ("Disconnected: Save state %d (%s)", + priv->state, priv->status); priv->nm_saved_state = priv->state; + g_free (priv->nm_saved_status); + priv->nm_saved_status = g_strdup (priv->status); empathy_idle_set_state (idle, MC_PRESENCE_OFFLINE); } else if (!old_nm_connected && new_nm_connected) { /* We are now connected */ - DEBUG ("Reconnected: Restore state %d", priv->nm_saved_state); - empathy_idle_set_state (idle, priv->nm_saved_state); + DEBUG ("Reconnected: Restore state %d (%s)", + priv->nm_saved_state, priv->nm_saved_status); + empathy_idle_set_presence (idle, + priv->nm_saved_state, + priv->nm_saved_status); priv->nm_saved_state = MC_PRESENCE_UNSET; + g_free (priv->nm_saved_status); + priv->nm_saved_status = NULL; } priv->nm_connected = new_nm_connected; -- cgit v1.2.3