]> git.0d.be Git - empathy.git/commitdiff
avatar-chooser: use tp_clear_*
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 26 May 2011 08:07:28 +0000 (10:07 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 1 Jun 2011 09:55:22 +0000 (11:55 +0200)
libempathy-gtk/empathy-avatar-chooser.c

index 585b0469fd3332e05fa63e80be99b58d016329f1..2ea91ef8fa7dbee9d685d4978e3cd64b2207008c 100644 (file)
@@ -270,11 +270,9 @@ avatar_chooser_finalize (GObject *object)
        avatar_chooser_set_connection (EMPATHY_AVATAR_CHOOSER (object), NULL);
        g_assert (self->priv->connection == NULL);
 
-       if (self->priv->avatar != NULL) {
-               empathy_avatar_unref (self->priv->avatar);
-       }
+       tp_clear_pointer (&self->priv->avatar, empathy_avatar_unref);
 
-       g_object_unref (self->priv->gsettings_ui);
+       tp_clear_object (&self->priv->gsettings_ui);
 
        G_OBJECT_CLASS (empathy_avatar_chooser_parent_class)->finalize (object);
 }
@@ -283,10 +281,7 @@ static void
 avatar_chooser_set_connection (EmpathyAvatarChooser *self,
                               TpConnection         *connection)
 {
-       if (self->priv->connection != NULL) {
-               g_object_unref (self->priv->connection);
-               self->priv->connection = NULL;
-       }
+       tp_clear_object (&self->priv->connection);
 
        if (connection != NULL) {
                GQuark features[] = { TP_CONNECTION_FEATURE_AVATAR_REQUIREMENTS, 0 };
@@ -591,10 +586,7 @@ avatar_chooser_clear_image (EmpathyAvatarChooser *self)
 {
        GtkWidget *image;
 
-       if (self->priv->avatar != NULL) {
-               empathy_avatar_unref (self->priv->avatar);
-               self->priv->avatar = NULL;
-       }
+       tp_clear_pointer (&self->priv->avatar, empathy_avatar_unref);
 
        image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_AVATAR_DEFAULT,
                GTK_ICON_SIZE_DIALOG);
@@ -690,9 +682,7 @@ avatar_chooser_set_image (EmpathyAvatarChooser *self,
                avatar = conv;
        }
 
-       if (self->priv->avatar != NULL) {
-               empathy_avatar_unref (self->priv->avatar);
-       }
+       tp_clear_pointer (&self->priv->avatar, empathy_avatar_unref);
        self->priv->avatar = avatar;
 
        pixbuf_view = empathy_pixbuf_scale_down_if_necessary (pixbuf, AVATAR_SIZE_VIEW);