diff options
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-individual-store.c | 28 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-view.c | 37 | ||||
-rw-r--r-- | libempathy-gtk/empathy-ui-utils.c | 4 |
3 files changed, 14 insertions, 55 deletions
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c index 87fa80083..4a3b68653 100644 --- a/libempathy-gtk/empathy-individual-store.c +++ b/libempathy-gtk/empathy-individual-store.c @@ -269,10 +269,7 @@ individual_store_find_contact_foreach (GtkTreeModel *model, fc->iters = g_list_append (fc->iters, gtk_tree_iter_copy (iter)); } - if (individual != NULL) - { - g_object_unref (individual); - } + tp_clear_object (&individual); return FALSE; } @@ -1271,16 +1268,8 @@ individual_store_state_sort_func (GtkTreeModel *model, free_and_out: g_free (name_a); g_free (name_b); - - if (individual_a) - { - g_object_unref (individual_a); - } - - if (individual_b) - { - g_object_unref (individual_b); - } + tp_clear_object (&individual_a); + tp_clear_object (&individual_b); return ret_val; } @@ -1314,15 +1303,8 @@ individual_store_name_sort_func (GtkTreeModel *model, else ret_val = individual_store_contact_sort (individual_a, individual_b); - if (individual_a) - { - g_object_unref (individual_a); - } - - if (individual_b) - { - g_object_unref (individual_b); - } + tp_clear_object (&individual_a); + tp_clear_object (&individual_b); return ret_val; } diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c index dc9099018..bab8b1dfd 100644 --- a/libempathy-gtk/empathy-individual-view.c +++ b/libempathy-gtk/empathy-individual-view.c @@ -1011,10 +1011,7 @@ individual_view_pixbuf_cell_data_func (GtkTreeViewColumn *tree_column, "pixbuf", pixbuf, NULL); - if (pixbuf != NULL) - { - g_object_unref (pixbuf); - } + tp_clear_object (&pixbuf); individual_view_cell_set_background (view, cell, is_group, is_active); } @@ -1054,8 +1051,7 @@ out: "pixbuf", pixbuf, NULL); - if (pixbuf != NULL) - g_object_unref (pixbuf); + tp_clear_object (&pixbuf); g_free (name); } @@ -1108,10 +1104,7 @@ individual_view_avatar_cell_data_func (GtkTreeViewColumn *tree_column, "pixbuf", pixbuf, NULL); - if (pixbuf) - { - g_object_unref (pixbuf); - } + tp_clear_object (&pixbuf); individual_view_cell_set_background (view, cell, is_group, is_active); } @@ -1683,26 +1676,10 @@ individual_view_dispose (GObject *object) EmpathyIndividualView *view = EMPATHY_INDIVIDUAL_VIEW (object); EmpathyIndividualViewPriv *priv = GET_PRIV (view); - if (priv->store != NULL) - { - g_object_unref (priv->store); - priv->store = NULL; - } - if (priv->filter != NULL) - { - g_object_unref (priv->filter); - priv->filter = NULL; - } - if (priv->tooltip_widget != NULL) - { - gtk_widget_destroy (priv->tooltip_widget); - priv->tooltip_widget = NULL; - } - if (priv->file_targets != NULL) - { - gtk_target_list_unref (priv->file_targets); - priv->file_targets = NULL; - } + tp_clear_object (&priv->store); + tp_clear_object (&priv->filter); + tp_clear_pointer (&priv->tooltip_widget, gtk_widget_destroy); + tp_clear_pointer (&priv->file_targets, gtk_target_list_unref); empathy_individual_view_set_live_search (view, NULL); diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 9b984a7ce..15b5871c6 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -39,6 +39,7 @@ #include <gtk/gtk.h> #include <gio/gio.h> +#include <telepathy-glib/util.h> #include <folks/folks.h> #include "empathy-ui-utils.h" @@ -606,8 +607,7 @@ avatar_file_load_contents_cb (GObject *object, out: g_clear_error (&error); g_free (data); - if (loader != NULL) - g_object_unref (loader); + tp_clear_object (&loader); pixbuf_avatar_from_individual_closure_free (closure); } |