[gnome-control-center] network: Use g_clear_object where appropriate



commit 75e74cc09b5965ff80f41c25458ff24b6e333891
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jun 13 23:18:39 2012 -0400

    network: Use g_clear_object where appropriate
    
    Signed-off-by: Richard Hughes <richard hughsie com>

 panels/network/cc-network-panel.c |   33 ++++++++++-----------------------
 1 files changed, 10 insertions(+), 23 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index c7727f4..0d000de 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -197,30 +197,17 @@ cc_network_panel_dispose (GObject *object)
 {
         CcNetworkPanelPrivate *priv = CC_NETWORK_PANEL (object)->priv;
 
-        if (priv->proxy_settings) {
-                g_object_unref (priv->proxy_settings);
-                priv->proxy_settings = NULL;
-        }
-        if (priv->cancellable != NULL) {
+        g_clear_object (&priv->proxy_settings);
+
+        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->remote_settings != NULL) {
-                g_object_unref (priv->remote_settings);
-                priv->remote_settings = NULL;
-        }
-        if (priv->kill_switch_header != NULL) {
-                g_clear_object (&priv->kill_switch_header);
-        }
+
+        g_clear_object (&priv->cancellable);
+        g_clear_object (&priv->builder);
+        g_clear_object (&priv->client);
+        g_clear_object (&priv->remote_settings);
+        g_clear_object (&priv->kill_switch_header);
+
         if (priv->refresh_idle != 0) {
                 g_source_remove (priv->refresh_idle);
                 priv->refresh_idle = 0;



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