[empathy] avatar-chooser: use tp_clear_*
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] avatar-chooser: use tp_clear_*
- Date: Wed, 1 Jun 2011 10:01:55 +0000 (UTC)
commit f7986cc0f08137246c406d85235b3f5cd77f951d
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Thu May 26 10:07:28 2011 +0200
avatar-chooser: use tp_clear_*
libempathy-gtk/empathy-avatar-chooser.c | 20 +++++---------------
1 files changed, 5 insertions(+), 15 deletions(-)
---
diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c
index 585b046..2ea91ef 100644
--- a/libempathy-gtk/empathy-avatar-chooser.c
+++ b/libempathy-gtk/empathy-avatar-chooser.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]