[rhythmbox] podcast: use g_clear_object and g_clear_handle_id
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] podcast: use g_clear_object and g_clear_handle_id
- Date: Sun, 6 Mar 2022 12:00:27 +0000 (UTC)
commit 3aea8a72021f45c605663be5b77a44b6dc7e84d8
Author: Jonathan Matthew <jonathan d14n org>
Date: Mon Feb 7 21:40:12 2022 +1000
podcast: use g_clear_object and g_clear_handle_id
podcast/rb-podcast-add-dialog.c | 10 ++--------
podcast/rb-podcast-main-source.c | 6 ++----
podcast/rb-podcast-manager.c | 33 ++++++---------------------------
podcast/rb-podcast-properties-dialog.c | 9 ++-------
4 files changed, 12 insertions(+), 46 deletions(-)
---
diff --git a/podcast/rb-podcast-add-dialog.c b/podcast/rb-podcast-add-dialog.c
index 4b8d15d03..9d5ff841f 100644
--- a/podcast/rb-podcast-add-dialog.c
+++ b/podcast/rb-podcast-add-dialog.c
@@ -886,14 +886,8 @@ impl_dispose (GObject *object)
{
RBPodcastAddDialog *dialog = RB_PODCAST_ADD_DIALOG (object);
- if (dialog->priv->podcast_mgr != NULL) {
- g_object_unref (dialog->priv->podcast_mgr);
- dialog->priv->podcast_mgr = NULL;
- }
- if (dialog->priv->db != NULL) {
- g_object_unref (dialog->priv->db);
- dialog->priv->db = NULL;
- }
+ g_clear_object (&dialog->priv->podcast_mgr);
+ g_clear_object (&dialog->priv->db);
G_OBJECT_CLASS (rb_podcast_add_dialog_parent_class)->dispose (object);
}
diff --git a/podcast/rb-podcast-main-source.c b/podcast/rb-podcast-main-source.c
index 28ffbc0a4..316bbf777 100644
--- a/podcast/rb-podcast-main-source.c
+++ b/podcast/rb-podcast-main-source.c
@@ -405,10 +405,8 @@ impl_dispose (GObject *object)
RBPodcastMainSource *source;
source = RB_PODCAST_MAIN_SOURCE (object);
- if (source->priv->config_widget != NULL) {
- g_object_unref (source->priv->config_widget);
- source->priv->config_widget = NULL;
- }
+
+ g_clear_object (&source->priv->config_widget);
G_OBJECT_CLASS (rb_podcast_main_source_parent_class)->dispose (object);
}
diff --git a/podcast/rb-podcast-manager.c b/podcast/rb-podcast-manager.c
index 2d02f1cd5..118ea2f72 100644
--- a/podcast/rb-podcast-manager.c
+++ b/podcast/rb-podcast-manager.c
@@ -304,30 +304,12 @@ rb_podcast_manager_dispose (GObject *object)
pd = RB_PODCAST_MANAGER (object);
g_return_if_fail (pd->priv != NULL);
- if (pd->priv->source_sync != 0) {
- g_source_remove (pd->priv->source_sync);
- pd->priv->source_sync = 0;
- }
+ g_clear_handle_id (&pd->priv->source_sync, g_source_remove);
- if (pd->priv->db != NULL) {
- g_object_unref (pd->priv->db);
- pd->priv->db = NULL;
- }
-
- if (pd->priv->settings != NULL) {
- g_object_unref (pd->priv->settings);
- pd->priv->settings = NULL;
- }
-
- if (pd->priv->timestamp_file != NULL) {
- g_object_unref (pd->priv->timestamp_file);
- pd->priv->timestamp_file = NULL;
- }
-
- if (pd->priv->art_store != NULL) {
- g_object_unref (pd->priv->art_store);
- pd->priv->art_store = NULL;
- }
+ g_clear_object (&pd->priv->db);
+ g_clear_object (&pd->priv->settings);
+ g_clear_object (&pd->priv->timestamp_file);
+ g_clear_object (&pd->priv->art_store);
G_OBJECT_CLASS (rb_podcast_manager_parent_class)->dispose (object);
}
@@ -585,10 +567,7 @@ rb_podcast_manager_start_update_timer (RBPodcastManager *pd)
g_return_if_fail (RB_IS_PODCAST_MANAGER (pd));
- if (pd->priv->source_sync != 0) {
- g_source_remove (pd->priv->source_sync);
- pd->priv->source_sync = 0;
- }
+ g_clear_handle_id (&pd->priv->source_sync, g_source_remove);
if (pd->priv->timestamp_file == NULL) {
rb_debug ("unable to record podcast update time, so periodic updates are disabled");
diff --git a/podcast/rb-podcast-properties-dialog.c b/podcast/rb-podcast-properties-dialog.c
index 423ff505f..328f4c80e 100644
--- a/podcast/rb-podcast-properties-dialog.c
+++ b/podcast/rb-podcast-properties-dialog.c
@@ -375,10 +375,7 @@ rb_podcast_properties_dialog_dispose (GObject *object)
g_return_if_fail (dialog->priv != NULL);
- if (dialog->priv->db != NULL) {
- g_object_unref (dialog->priv->db);
- dialog->priv->db = NULL;
- }
+ g_clear_object (&dialog->priv->db);
G_OBJECT_CLASS (rb_podcast_properties_dialog_parent_class)->dispose (object);
}
@@ -402,9 +399,7 @@ static void
rb_podcast_properties_dialog_set_entry_view (RBPodcastPropertiesDialog *dialog,
RBEntryView *view)
{
- if (dialog->priv->db != NULL) {
- g_object_unref (dialog->priv->db);
- }
+ g_clear_object (&dialog->priv->db);
dialog->priv->entry_view = view;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]