[gnome-settings-daemon] Trivial: use g_clear_object
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] Trivial: use g_clear_object
- Date: Fri, 29 Jun 2012 12:15:03 +0000 (UTC)
commit 91f8f01fc65d7f11966862c4e35d44bd63e6316c
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jun 28 21:17:27 2012 -0400
Trivial: use g_clear_object
Given the amound of objects here, this saves quite a few lines.
https://bugzilla.gnome.org/show_bug.cgi?id=679095
Signed-off-by: Richard Hughes <richard hughsie com>
plugins/updates/gsd-updates-manager.c | 65 +++++++--------------------------
1 files changed, 13 insertions(+), 52 deletions(-)
---
diff --git a/plugins/updates/gsd-updates-manager.c b/plugins/updates/gsd-updates-manager.c
index 42ac4ab..5c2fa37 100644
--- a/plugins/updates/gsd-updates-manager.c
+++ b/plugins/updates/gsd-updates-manager.c
@@ -1666,54 +1666,18 @@ gsd_updates_manager_stop (GsdUpdatesManager *manager)
{
g_debug ("Stopping updates manager");
- if (manager->priv->settings_proxy != NULL) {
- g_object_unref (manager->priv->settings_proxy);
- manager->priv->settings_proxy = NULL;
- }
- if (manager->priv->settings_http != NULL) {
- g_object_unref (manager->priv->settings_http);
- manager->priv->settings_http = NULL;
- }
- if (manager->priv->settings_ftp != NULL) {
- g_object_unref (manager->priv->settings_ftp);
- manager->priv->settings_ftp = NULL;
- }
- if (manager->priv->settings_gsd != NULL) {
- g_object_unref (manager->priv->settings_gsd);
- manager->priv->settings_gsd = NULL;
- }
- if (manager->priv->control != NULL) {
- g_object_unref (manager->priv->control);
- manager->priv->control = NULL;
- }
- if (manager->priv->task != NULL) {
- g_object_unref (manager->priv->task);
- manager->priv->task = NULL;
- }
- if (manager->priv->refresh != NULL) {
- g_object_unref (manager->priv->refresh);
- manager->priv->refresh = NULL;
- }
- if (manager->priv->firmware != NULL) {
- g_object_unref (manager->priv->firmware);
- manager->priv->firmware = NULL;
- }
- if (manager->priv->proxy_session != NULL) {
- g_object_unref (manager->priv->proxy_session);
- manager->priv->proxy_session = NULL;
- }
- if (manager->priv->volume_monitor != NULL) {
- g_object_unref (manager->priv->volume_monitor);
- manager->priv->volume_monitor = NULL;
- }
- if (manager->priv->cancellable != NULL) {
- g_object_unref (manager->priv->cancellable);
- manager->priv->cancellable = NULL;
- }
- if (manager->priv->introspection != NULL) {
- g_dbus_node_info_unref (manager->priv->introspection);
- manager->priv->introspection = NULL;
- }
+ g_clear_object (&manager->priv->settings_proxy);
+ g_clear_object (&manager->priv->settings_http);
+ g_clear_object (&manager->priv->settings_ftp);
+ g_clear_object (&manager->priv->settings_gsd);
+ g_clear_object (&manager->priv->control);
+ g_clear_object (&manager->priv->task);
+ g_clear_object (&manager->priv->refresh);
+ g_clear_object (&manager->priv->firmware);
+ g_clear_object (&manager->priv->proxy_session);
+ g_clear_object (&manager->priv->volume_monitor);
+ g_clear_object (&manager->priv->cancellable);
+ g_clear_pointer (&manager->priv->introspection, g_dbus_node_info_unref);
if (manager->priv->update_viewer_watcher_id != 0) {
g_bus_unwatch_name (manager->priv->update_viewer_watcher_id);
manager->priv->update_viewer_watcher_id = 0;
@@ -1726,10 +1690,7 @@ gsd_updates_manager_stop (GsdUpdatesManager *manager)
g_source_remove (manager->priv->offline_update_id);
manager->priv->offline_update_id = 0;
}
- if (manager->priv->offline_update_error != NULL) {
- g_object_unref (manager->priv->offline_update_error);
- manager->priv->offline_update_error = 0;
- }
+ g_clear_object (&manager->priv->offline_update_error);
}
static GObject *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]