[gnome-calendar] Debarshi's suggestion about g_clear_object use.



commit 1062d3e43553de2e4058841ed2ce3258a1b2de5d
Author: Erick PÃrez Castellanos <erick red gmail com>
Date:   Tue Nov 20 22:05:48 2012 -0500

    Debarshi's suggestion about g_clear_object use.
    
    Removed if (pointer != null) condition when using
    g_clear_object.

 src/gcal-application.c |   11 +++++------
 src/gcal-manager.c     |    3 +--
 src/gcal-toolbar.c     |   17 ++++++-----------
 3 files changed, 12 insertions(+), 19 deletions(-)
---
diff --git a/src/gcal-application.c b/src/gcal-application.c
index 49b23f3..6638107 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -2,17 +2,17 @@
 /*
  * gcal-application.c
  * Copyright (C) 2012 Erick PÃrez Castellanos <erickpc gnome org>
- * 
+ *
  * gnome-calendar is free software: you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
  * Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
- * 
+ *
  * gnome-calendar is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * See the GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -96,8 +96,7 @@ gcal_application_finalize (GObject *object)
   g_return_if_fail (GCAL_IS_APPLICATION (object));
   priv = GCAL_APPLICATION (object)->priv;
 
-  if (priv->settings != NULL)
-    g_clear_object (&(priv->settings));
+  g_clear_object (&(priv->settings));
 
   if (G_OBJECT_CLASS (gcal_application_parent_class)->finalize != NULL)
     G_OBJECT_CLASS (gcal_application_parent_class)->finalize (object);
@@ -166,7 +165,7 @@ gcal_application_startup (GApplication *app)
   gcal_application_set_app_menu (app);
 }
 
-static void 
+static void
 gcal_application_set_app_menu (GApplication *app)
 {
   GcalApplicationPrivate *priv;
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index f27d1da..cc4ba52 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -613,8 +613,7 @@ gcal_manager_reload_view (GcalManager     *manager,
   g_return_if_fail (priv->query != NULL);
 
   /* stopping */
-  if (unit->view != NULL)
-    g_clear_object (&(unit->view));
+  g_clear_object (&(unit->view));
 
   error = NULL;
   if (e_cal_client_get_view_sync (unit->client,
diff --git a/src/gcal-toolbar.c b/src/gcal-toolbar.c
index 0e44773..8cfe4d4 100644
--- a/src/gcal-toolbar.c
+++ b/src/gcal-toolbar.c
@@ -246,17 +246,12 @@ gcal_toolbar_finalize (GObject *object)
   g_return_if_fail (GCAL_IS_TOOLBAR (object));
   priv = GCAL_TOOLBAR (object)->priv;
 
-  if (priv->add_button != NULL)
-    g_clear_object (&(priv->add_button));
-  if (priv->views_box != NULL)
-    g_clear_object (&(priv->views_box));
-  if (priv->right_box != NULL)
-    g_clear_object (&(priv->right_box));
-
-  if (priv->back_button)
-    g_clear_object (&(priv->back_button));
-  if (priv->edit_button)
-    g_clear_object (&(priv->edit_button));
+  g_clear_object (&(priv->add_button));
+  g_clear_object (&(priv->views_box));
+  g_clear_object (&(priv->right_box));
+
+  g_clear_object (&(priv->back_button));
+  g_clear_object (&(priv->edit_button));
 
   G_OBJECT_CLASS (gcal_toolbar_parent_class)->finalize (object);
 }



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