[gnome-control-center] info: Use g_clear_* in finalize()



commit c395e9ac232e92a80b51b93f4654270cfb88712b
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Oct 15 18:51:13 2012 +0200

    info: Use g_clear_* in finalize()

 panels/info/cc-info-panel.c |   26 ++++----------------------
 1 files changed, 4 insertions(+), 22 deletions(-)
---
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index c3dd0b5..dacd918 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -535,32 +535,14 @@ cc_info_panel_finalize (GObject *object)
 {
   CcInfoPanelPrivate *priv = CC_INFO_PANEL (object)->priv;
 
-  if (priv->cancellable != NULL)
-    {
-      g_cancellable_cancel (priv->cancellable);
-      priv->cancellable = NULL;
-    }
+  g_clear_pointer (&priv->cancellable, g_cancellable_cancel);
   g_free (priv->gnome_version);
   g_free (priv->gnome_date);
   g_free (priv->gnome_distributor);
 
-  if (priv->hostnamed_proxy != NULL)
-    {
-      g_object_unref (priv->hostnamed_proxy);
-      priv->hostnamed_proxy = NULL;
-    }
-
-  if (priv->media_settings != NULL)
-    {
-      g_object_unref (priv->media_settings);
-      priv->media_settings = NULL;
-    }
-
-  if (priv->session_settings != NULL)
-    {
-      g_object_unref (priv->session_settings);
-      priv->session_settings = NULL;
-    }
+  g_clear_object (&priv->hostnamed_proxy);
+  g_clear_object (&priv->media_settings);
+  g_clear_object (&priv->session_settings);
 
   G_OBJECT_CLASS (cc_info_panel_parent_class)->finalize (object);
 }



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