diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-01-23 21:46:24 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-02-02 19:15:15 +0800 |
commit | 330028919295ad9d65334383e90b2432cb12e5fd (patch) | |
tree | d0a17b0a2b13bd0499280fbac9bdd6fc7ca0568b | |
parent | cdfd5215dfa3e7dfe1254f76a5eccf4b4356816d (diff) | |
download | gsoc2013-empathy-330028919295ad9d65334383e90b2432cb12e5fd.tar gsoc2013-empathy-330028919295ad9d65334383e90b2432cb12e5fd.tar.gz gsoc2013-empathy-330028919295ad9d65334383e90b2432cb12e5fd.tar.bz2 gsoc2013-empathy-330028919295ad9d65334383e90b2432cb12e5fd.tar.lz gsoc2013-empathy-330028919295ad9d65334383e90b2432cb12e5fd.tar.xz gsoc2013-empathy-330028919295ad9d65334383e90b2432cb12e5fd.tar.zst gsoc2013-empathy-330028919295ad9d65334383e90b2432cb12e5fd.zip |
presence-manager: stop watching connectivity changes
Mission-Control does it for us now (thanks Will!).
We don't remove empathy-connectivity yet because some Empathy components still
rely on it to display the status of the network. Ideally, this could be
exposed by MC as well (fdo #45126).
https://bugzilla.gnome.org/show_bug.cgi?id=668498
-rw-r--r-- | libempathy/empathy-presence-manager.c | 70 |
1 files changed, 3 insertions, 67 deletions
diff --git a/libempathy/empathy-presence-manager.c b/libempathy/empathy-presence-manager.c index 67867f96d..22af1ec7b 100644 --- a/libempathy/empathy-presence-manager.c +++ b/libempathy/empathy-presence-manager.c @@ -32,7 +32,6 @@ #include <telepathy-glib/util.h> #include "empathy-utils.h" -#include "empathy-connectivity.h" #define DEBUG_FLAG EMPATHY_DEBUG_OTHER #include "empathy-debug.h" @@ -47,7 +46,6 @@ struct _EmpathyPresenceManagerPrivate { DBusGProxy *gs_proxy; - EmpathyConnectivity *connectivity; gboolean ready; @@ -56,8 +54,6 @@ struct _EmpathyPresenceManagerPrivate gboolean auto_away; TpConnectionPresenceType away_saved_state; - TpConnectionPresenceType saved_state; - gchar *saved_status; gboolean is_idle; guint ext_away_timeout; @@ -175,9 +171,8 @@ session_status_changed_cb (DBusGProxy *gs_proxy, is_idle ? "yes" : "no"); if (!self->priv->auto_away || - (self->priv->saved_state == TP_CONNECTION_PRESENCE_TYPE_UNSET && - (self->priv->state <= TP_CONNECTION_PRESENCE_TYPE_OFFLINE || - self->priv->state == TP_CONNECTION_PRESENCE_TYPE_HIDDEN))) + (self->priv->state <= TP_CONNECTION_PRESENCE_TYPE_OFFLINE || + self->priv->state == TP_CONNECTION_PRESENCE_TYPE_HIDDEN)) { /* We don't want to go auto away OR we explicitely asked to be * offline, nothing to do here */ @@ -192,13 +187,7 @@ session_status_changed_cb (DBusGProxy *gs_proxy, ext_away_start (self); - if (self->priv->saved_state != TP_CONNECTION_PRESENCE_TYPE_UNSET) - /* We are disconnected, when coming back from away - * we want to restore the presence before the - * disconnection. */ - self->priv->away_saved_state = self->priv->saved_state; - else - self->priv->away_saved_state = self->priv->state; + self->priv->away_saved_state = self->priv->state; new_state = TP_CONNECTION_PRESENCE_TYPE_AWAY; if (self->priv->state == TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY) @@ -241,37 +230,6 @@ session_status_changed_cb (DBusGProxy *gs_proxy, } static void -state_change_cb (EmpathyConnectivity *connectivity, - gboolean new_online, - EmpathyPresenceManager *self) -{ - if (!new_online) - { - /* We are no longer connected */ - DEBUG ("Disconnected: Save state %d (%s)", - self->priv->state, self->priv->status); - self->priv->saved_state = self->priv->state; - g_free (self->priv->saved_status); - self->priv->saved_status = g_strdup (self->priv->status); - empathy_presence_manager_set_state (self, - TP_CONNECTION_PRESENCE_TYPE_OFFLINE); - } - else if (new_online - && self->priv->saved_state != TP_CONNECTION_PRESENCE_TYPE_UNSET) - { - /* We are now connected */ - DEBUG ("Reconnected: Restore state %d (%s)", - self->priv->saved_state, self->priv->saved_status); - empathy_presence_manager_set_presence (self, - self->priv->saved_state, - self->priv->saved_status); - self->priv->saved_state = TP_CONNECTION_PRESENCE_TYPE_UNSET; - g_free (self->priv->saved_status); - self->priv->saved_status = NULL; - } -} - -static void presence_manager_dispose (GObject *object) { EmpathyPresenceManager *self = (EmpathyPresenceManager *) object; @@ -279,7 +237,6 @@ presence_manager_dispose (GObject *object) tp_clear_object (&self->priv->gs_proxy); tp_clear_object (&self->priv->manager); - tp_clear_object (&self->priv->connectivity); tp_clear_pointer (&self->priv->connect_times, g_hash_table_unref); next_away_stop (EMPATHY_PRESENCE_MANAGER (object)); @@ -530,11 +487,6 @@ empathy_presence_manager_init (EmpathyPresenceManager *self) g_object_unref (dbus); - self->priv->connectivity = empathy_connectivity_dup_singleton (); - - tp_g_signal_connect_object (self->priv->connectivity, - "state-change", G_CALLBACK (state_change_cb), self, 0); - self->priv->connect_times = g_hash_table_new (g_direct_hash, g_direct_equal); } @@ -609,22 +561,6 @@ empathy_presence_manager_set_presence (EmpathyPresenceManager *self, if (!tp_strdiff (status, default_status)) status = NULL; - if (state != TP_CONNECTION_PRESENCE_TYPE_OFFLINE && - !empathy_connectivity_is_online (self->priv->connectivity)) - { - DEBUG ("Empathy is not online"); - - self->priv->saved_state = state; - if (tp_strdiff (self->priv->status, status)) - { - g_free (self->priv->saved_status); - self->priv->saved_status = NULL; - if (!EMP_STR_EMPTY (status)) - self->priv->saved_status = g_strdup (status); - } - return; - } - empathy_presence_manager_do_set_presence (self, state, status); } |