diff options
Diffstat (limited to 'libempathy/empathy-idle.c')
-rw-r--r-- | libempathy/empathy-idle.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c index 7757b7bdf..5f38e941b 100644 --- a/libempathy/empathy-idle.c +++ b/libempathy/empathy-idle.c @@ -258,6 +258,22 @@ idle_state_change_cb (EmpathyConnectivity *connectivity, } static void +idle_use_conn_cb (GObject *object, + GParamSpec *pspec, + EmpathyIdle *idle) +{ + EmpathyIdlePriv *priv = GET_PRIV (idle); + + if (!empathy_connectivity_get_use_conn (priv->connectivity)) { + if (priv->saved_state != TP_CONNECTION_PRESENCE_TYPE_UNSET) { + empathy_idle_set_state (idle, priv->saved_state); + } + + priv->saved_state = TP_CONNECTION_PRESENCE_TYPE_UNSET; + } +} + +static void idle_finalize (GObject *object) { EmpathyIdlePriv *priv; @@ -271,6 +287,11 @@ idle_finalize (GObject *object) g_object_unref (priv->gs_proxy); } + g_signal_handlers_disconnect_by_func (priv->connectivity, + idle_state_change_cb, object); + g_signal_handlers_disconnect_by_func (priv->connectivity, + idle_use_conn_cb, object); + g_object_unref (priv->connectivity); idle_ext_away_stop (EMPATHY_IDLE (object)); @@ -430,22 +451,6 @@ empathy_idle_get_actual_presence (EmpathyIdle *idle, GError **error) } static void -idle_use_conn_cb (GObject *object, - GParamSpec *pspec, - EmpathyIdle *idle) -{ - EmpathyIdlePriv *priv = GET_PRIV (idle); - - if (!empathy_connectivity_get_use_conn (priv->connectivity)) { - if (priv->saved_state != TP_CONNECTION_PRESENCE_TYPE_UNSET) { - empathy_idle_set_state (idle, priv->saved_state); - } - - priv->saved_state = TP_CONNECTION_PRESENCE_TYPE_UNSET; - } -} - -static void empathy_idle_init (EmpathyIdle *idle) { GError *error = NULL; |