diff options
author | Travis Reitter <treitter@gmail.com> | 2010-07-08 11:16:46 +0800 |
---|---|---|
committer | Travis Reitter <treitter@gmail.com> | 2010-07-21 07:12:36 +0800 |
commit | cb703ba93de027d1b62b1a9716ca7d9c0d90133b (patch) | |
tree | a7c99918b291ae9abc500d0c5928641d8cc84423 | |
parent | df6ea1a0a3bdef9fc134bfaaa02ca3614398ca16 (diff) | |
download | gsoc2013-empathy-cb703ba93de027d1b62b1a9716ca7d9c0d90133b.tar gsoc2013-empathy-cb703ba93de027d1b62b1a9716ca7d9c0d90133b.tar.gz gsoc2013-empathy-cb703ba93de027d1b62b1a9716ca7d9c0d90133b.tar.bz2 gsoc2013-empathy-cb703ba93de027d1b62b1a9716ca7d9c0d90133b.tar.lz gsoc2013-empathy-cb703ba93de027d1b62b1a9716ca7d9c0d90133b.tar.xz gsoc2013-empathy-cb703ba93de027d1b62b1a9716ca7d9c0d90133b.tar.zst gsoc2013-empathy-cb703ba93de027d1b62b1a9716ca7d9c0d90133b.zip |
Take advantage of the tp_clear_* utility functions.
-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 | ||||
-rw-r--r-- | libempathy/empathy-individual-manager.c | 7 |
4 files changed, 16 insertions, 60 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); } diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c index 183996a3d..a86ec0147 100644 --- a/libempathy/empathy-individual-manager.c +++ b/libempathy/empathy-individual-manager.c @@ -121,11 +121,8 @@ individual_manager_finalize (GObject *object) { EmpathyIndividualManagerPriv *priv = GET_PRIV (object); - if (priv->contact_manager != NULL) - g_object_unref (priv->contact_manager); - - if (priv->aggregator != NULL) - g_object_unref (priv->aggregator); + tp_clear_object (&priv->contact_manager); + tp_clear_object (&priv->aggregator); } static GObject * |