[gnome-photos] Use g_clear_object wherever applicable
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] Use g_clear_object wherever applicable
- Date: Mon, 10 Dec 2012 10:11:35 +0000 (UTC)
commit 665a2634d093b880691e0da8b91a83a20ccde20a
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Dec 10 15:40:24 2012 +0530
Use g_clear_object wherever applicable
src/photos-application.c | 13 ++-----------
src/photos-base-manager.c | 3 +--
src/photos-embed.c | 8 +-------
src/photos-main-toolbar.c | 14 ++------------
src/photos-main-window.c | 7 +------
src/photos-organize-collection-model.c | 6 +-----
src/photos-organize-collection-view.c | 6 +-----
src/photos-query.c | 3 +--
src/photos-selection-toolbar.c | 7 +------
9 files changed, 11 insertions(+), 56 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 7db7327..84a26da 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -183,17 +183,8 @@ photos_application_dispose (GObject *object)
priv->resource = NULL;
}
- if (priv->fs_action != NULL)
- {
- g_object_unref (priv->fs_action);
- priv->fs_action = NULL;
- }
-
- if (priv->mode_cntrlr != NULL)
- {
- g_object_unref (priv->mode_cntrlr);
- priv->mode_cntrlr = NULL;
- }
+ g_clear_object (&priv->fs_action);
+ g_clear_object (&priv->mode_cntrlr);
G_OBJECT_CLASS (photos_application_parent_class)
->dispose (object);
diff --git a/src/photos-base-manager.c b/src/photos-base-manager.c
index 07a0564..6ff7049 100644
--- a/src/photos-base-manager.c
+++ b/src/photos-base-manager.c
@@ -60,8 +60,7 @@ photos_base_manager_default_set_active_object (PhotosBaseManager *self, GObject
if (object == priv->active_object)
return FALSE;
- if (priv->active_object != NULL)
- g_object_unref (priv->active_object);
+ g_clear_object (&priv->active_object);
if (object != NULL)
g_object_ref (object);
diff --git a/src/photos-embed.c b/src/photos-embed.c
index ac3822e..ca591fd 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -293,13 +293,7 @@ photos_embed_dispose (GObject *object)
g_clear_object (&priv->loader_cancellable);
g_clear_object (&priv->indexing_ntfctn);
g_clear_object (&priv->item_mngr);
-
- if (priv->mode_cntrlr != NULL)
- {
- g_object_unref (priv->mode_cntrlr);
- priv->mode_cntrlr = NULL;
- }
-
+ g_clear_object (&priv->mode_cntrlr);
g_clear_object (&priv->offset_cntrlr);
g_clear_object (&priv->monitor);
g_clear_object (&priv->trk_cntrlr);
diff --git a/src/photos-main-toolbar.c b/src/photos-main-toolbar.c
index 54fc5c9..c5e5b18 100644
--- a/src/photos-main-toolbar.c
+++ b/src/photos-main-toolbar.c
@@ -353,18 +353,8 @@ photos_main_toolbar_dispose (GObject *object)
g_clear_object (&priv->col_mngr);
g_clear_object (&priv->item_mngr);
g_clear_object (&priv->src_mngr);
-
- if (priv->mode_cntrlr != NULL)
- {
- g_object_unref (priv->mode_cntrlr);
- priv->mode_cntrlr = NULL;
- }
-
- if (priv->sel_cntrlr != NULL)
- {
- g_object_unref (priv->sel_cntrlr);
- priv->sel_cntrlr = NULL;
- }
+ g_clear_object (&priv->mode_cntrlr);
+ g_clear_object (&priv->sel_cntrlr);
G_OBJECT_CLASS (photos_main_toolbar_parent_class)->dispose (object);
}
diff --git a/src/photos-main-window.c b/src/photos-main-window.c
index b5bc62d..a9de360 100644
--- a/src/photos-main-window.c
+++ b/src/photos-main-window.c
@@ -231,12 +231,7 @@ photos_main_window_dispose (GObject *object)
g_clear_object (&priv->settings);
g_clear_object (&priv->item_mngr);
-
- if (priv->controller != NULL)
- {
- g_object_unref (priv->controller);
- priv->controller = NULL;
- }
+ g_clear_object (&priv->controller);
if (priv->configure_id != 0)
{
diff --git a/src/photos-organize-collection-model.c b/src/photos-organize-collection-model.c
index 752042b..6e688e6 100644
--- a/src/photos-organize-collection-model.c
+++ b/src/photos-organize-collection-model.c
@@ -59,11 +59,7 @@ photos_organize_collection_model_dispose (GObject *object)
PhotosOrganizeCollectionModel *self = PHOTOS_ORGANIZE_COLLECTION_MODEL (object);
PhotosOrganizeCollectionModelPrivate *priv = self->priv;
- if (priv->manager != NULL)
- {
- g_object_unref (priv->manager);
- priv->manager = NULL;
- }
+ g_clear_object (&priv->manager);
G_OBJECT_CLASS (photos_organize_collection_model_parent_class)->dispose (object);
}
diff --git a/src/photos-organize-collection-view.c b/src/photos-organize-collection-view.c
index eaceb5f..f24af3b 100644
--- a/src/photos-organize-collection-view.c
+++ b/src/photos-organize-collection-view.c
@@ -112,11 +112,7 @@ photos_organize_collection_view_dispose (GObject *object)
PhotosOrganizeCollectionView *self = PHOTOS_ORGANIZE_COLLECTION_VIEW (object);
PhotosOrganizeCollectionViewPrivate *priv = self->priv;
- if (priv->model != NULL)
- {
- g_object_unref (priv->model);
- priv->model = NULL;
- }
+ g_clear_object (&priv->model);
G_OBJECT_CLASS (photos_organize_collection_view_parent_class)->dispose (object);
}
diff --git a/src/photos-query.c b/src/photos-query.c
index f4339ee..26cf4cc 100644
--- a/src/photos-query.c
+++ b/src/photos-query.c
@@ -53,8 +53,7 @@ photos_query_new (gchar *sparql)
void
photos_query_free (PhotosQuery *query)
{
- if (query->source != NULL)
- g_object_unref (query->source);
+ g_clear_object (&query->source);
g_free (query->sparql);
g_slice_free (PhotosQuery, query);
}
diff --git a/src/photos-selection-toolbar.c b/src/photos-selection-toolbar.c
index 39efa66..b5b2cb6 100644
--- a/src/photos-selection-toolbar.c
+++ b/src/photos-selection-toolbar.c
@@ -456,12 +456,7 @@ photos_selection_toolbar_dispose (GObject *object)
}
g_clear_object (&priv->item_mngr);
-
- if (priv->sel_cntrlr != NULL)
- {
- g_object_unref (priv->sel_cntrlr);
- priv->sel_cntrlr = NULL;
- }
+ g_clear_object (&priv->sel_cntrlr);
G_OBJECT_CLASS (photos_selection_toolbar_parent_class)->dispose (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]