[gnome-control-center] color: Use g_clear_object() in more places



commit b641acbf44290a339aa1b85189f89bdfd64854f5
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jan 4 08:48:52 2013 +0000

    color: Use g_clear_object() in more places

 panels/color/cc-color-panel.c |   37 +++++++------------------------------
 1 files changed, 7 insertions(+), 30 deletions(-)
---
diff --git a/panels/color/cc-color-panel.c b/panels/color/cc-color-panel.c
index 8f42d43..cd73995 100644
--- a/panels/color/cc-color-panel.c
+++ b/panels/color/cc-color-panel.c
@@ -2331,37 +2331,14 @@ cc_color_panel_dispose (GObject *object)
 {
   CcColorPanelPrivate *priv = CC_COLOR_PANEL (object)->priv;
 
-  if (priv->settings)
-    {
-      g_object_unref (priv->settings);
-      priv->settings = NULL;
-    }
   if (priv->cancellable != NULL)
-    {
-      g_cancellable_cancel (priv->cancellable);
-      g_object_unref (priv->cancellable);
-      priv->cancellable = NULL;
-    }
-  if (priv->builder != NULL)
-    {
-      g_object_unref (priv->builder);
-      priv->builder = NULL;
-    }
-  if (priv->client != NULL)
-    {
-      g_object_unref (priv->client);
-      priv->client = NULL;
-    }
-  if (priv->current_device != NULL)
-    {
-      g_object_unref (priv->current_device);
-      priv->current_device = NULL;
-    }
-  if (priv->sensor != NULL)
-    {
-      g_object_unref (priv->sensor);
-      priv->sensor = NULL;
-    }
+    g_cancellable_cancel (priv->cancellable);
+  g_clear_object (&priv->settings);
+  g_clear_object (&priv->cancellable);
+  g_clear_object (&priv->builder);
+  g_clear_object (&priv->client);
+  g_clear_object (&priv->current_device);
+  g_clear_object (&priv->sensor);
 
   G_OBJECT_CLASS (cc_color_panel_parent_class)->dispose (object);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]