[gnome-settings-daemon] orientation: Use g_clear_* helpers
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] orientation: Use g_clear_* helpers
- Date: Tue, 2 Jul 2013 12:00:08 +0000 (UTC)
commit bee535d980a53e9a7bbe4cf91c70957e8cb80da3
Author: Bastien Nocera <hadess hadess net>
Date: Tue Jul 2 13:34:51 2013 +0200
orientation: Use g_clear_* helpers
plugins/orientation/gsd-orientation-manager.c | 28 +++++-------------------
1 files changed, 6 insertions(+), 22 deletions(-)
---
diff --git a/plugins/orientation/gsd-orientation-manager.c b/plugins/orientation/gsd-orientation-manager.c
index 200dcd7..ad5b073 100644
--- a/plugins/orientation/gsd-orientation-manager.c
+++ b/plugins/orientation/gsd-orientation-manager.c
@@ -206,10 +206,9 @@ on_xrandr_action_call_finished (GObject *source_object,
variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
- g_object_unref (manager->priv->cancellable);
- manager->priv->cancellable = NULL;
+ g_clear_object (&manager->priv->cancellable);
- if (error != NULL) {
+ if (variant == NULL) {
g_warning ("Unable to call 'RotateTo': %s", error->message);
g_error_free (error);
} else {
@@ -481,25 +480,10 @@ gsd_orientation_manager_stop (GsdOrientationManager *manager)
g_debug ("Stopping orientation manager");
- if (p->settings) {
- g_object_unref (p->settings);
- p->settings = NULL;
- }
-
- if (p->sysfs_path) {
- g_free (p->sysfs_path);
- p->sysfs_path = NULL;
- }
-
- if (p->introspection_data) {
- g_dbus_node_info_unref (p->introspection_data);
- p->introspection_data = NULL;
- }
-
- if (p->client) {
- g_object_unref (p->client);
- p->client = NULL;
- }
+ g_clear_object (&p->settings);
+ g_clear_pointer (&p->sysfs_path, g_free);
+ g_clear_pointer (&p->introspection_data, g_dbus_node_info_unref);
+ g_clear_object (&p->client);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]