aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-01-25 19:21:48 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-01-25 19:28:26 +0800
commit273fee5fe68846380765235aae3d9761c349f50c (patch)
tree01ee877485e116e3459d78527dcda73d91f34ada
parent1c3a8da098c9efdd7ece9c8375473f584a374aae (diff)
downloadgsoc2013-empathy-273fee5fe68846380765235aae3d9761c349f50c.tar
gsoc2013-empathy-273fee5fe68846380765235aae3d9761c349f50c.tar.gz
gsoc2013-empathy-273fee5fe68846380765235aae3d9761c349f50c.tar.bz2
gsoc2013-empathy-273fee5fe68846380765235aae3d9761c349f50c.tar.lz
gsoc2013-empathy-273fee5fe68846380765235aae3d9761c349f50c.tar.xz
gsoc2013-empathy-273fee5fe68846380765235aae3d9761c349f50c.tar.zst
gsoc2013-empathy-273fee5fe68846380765235aae3d9761c349f50c.zip
presence-manager: add a dispose function and use tp_clear_*
-rw-r--r--libempathy/empathy-presence-manager.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/libempathy/empathy-presence-manager.c b/libempathy/empathy-presence-manager.c
index 558421a88..48cf5a677 100644
--- a/libempathy/empathy-presence-manager.c
+++ b/libempathy/empathy-presence-manager.c
@@ -274,34 +274,42 @@ state_change_cb (EmpathyConnectivity *connectivity,
}
static void
-presence_manager_finalize (GObject *object)
+presence_manager_dispose (GObject *object)
{
EmpathyPresenceManager *self = (EmpathyPresenceManager *) object;
- g_free (self->priv->status);
- g_free (self->priv->requested_status_message);
-
- if (self->priv->gs_proxy)
- g_object_unref (self->priv->gs_proxy);
+ tp_clear_object (&self->priv->gs_proxy);
- g_signal_handler_disconnect (self->priv->connectivity,
- self->priv->state_change_signal_id);
- self->priv->state_change_signal_id = 0;
+ if (self->priv->state_change_signal_id != 0)
+ {
+ g_signal_handler_disconnect (self->priv->connectivity,
+ self->priv->state_change_signal_id);
+ self->priv->state_change_signal_id = 0;
+ }
if (self->priv->manager != NULL)
{
g_signal_handler_disconnect (self->priv->manager,
self->priv->most_available_presence_changed_id);
- g_object_unref (self->priv->manager);
+ tp_clear_object (&self->priv->manager);
}
- g_object_unref (self->priv->connectivity);
-
- g_hash_table_destroy (self->priv->connect_times);
- self->priv->connect_times = NULL;
+ tp_clear_object (&self->priv->connectivity);
+ tp_clear_pointer (&self->priv->connect_times, g_hash_table_unref);
next_away_stop (EMPATHY_PRESENCE_MANAGER (object));
+ G_OBJECT_CLASS (empathy_presence_manager_parent_class)->dispose (object);
+}
+
+static void
+presence_manager_finalize (GObject *object)
+{
+ EmpathyPresenceManager *self = (EmpathyPresenceManager *) object;
+
+ g_free (self->priv->status);
+ g_free (self->priv->requested_status_message);
+
G_OBJECT_CLASS (empathy_presence_manager_parent_class)->finalize (object);
}
@@ -398,6 +406,7 @@ empathy_presence_manager_class_init (EmpathyPresenceManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->dispose = presence_manager_dispose;
object_class->finalize = presence_manager_finalize;
object_class->constructor = presence_manager_constructor;
object_class->get_property = presence_manager_get_property;