[gnome-control-center/gnome-3-28] night-light-dialog: Ignore G_IO_ERROR_CANCELLED errors



commit 475548d0c9ea5814d8aabc11317466011146c767
Author: Andrea Azzarone <azzaronea gmail com>
Date:   Mon May 7 17:01:20 2018 +0200

    night-light-dialog: Ignore G_IO_ERROR_CANCELLED errors
    
    We should ignore G_IO_ERROR_CANCELLED errors and avoid displaying useless
    warnings. Also use g_clear_object instead of g_object_unref.
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/87

 panels/display/cc-night-light-dialog.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/panels/display/cc-night-light-dialog.c b/panels/display/cc-night-light-dialog.c
index 6f7fdb613..cea704a66 100644
--- a/panels/display/cc-night-light-dialog.c
+++ b/panels/display/cc-night-light-dialog.c
@@ -77,11 +77,11 @@ cc_night_light_dialog_finalize (GObject *object)
       self->main_window = NULL;
     }
 
-  g_object_unref (self->builder);
-  g_object_unref (self->proxy_color);
-  g_object_unref (self->proxy_color_props);
-  g_object_unref (self->settings_display);
-  g_object_unref (self->settings_clock);
+  g_clear_object (&self->builder);
+  g_clear_object (&self->proxy_color);
+  g_clear_object (&self->proxy_color_props);
+  g_clear_object (&self->settings_display);
+  g_clear_object (&self->settings_clock);
   if (self->timer_id > 0)
     g_source_remove (self->timer_id);
 
@@ -390,7 +390,8 @@ dialog_got_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_da
   proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
   if (proxy == NULL)
     {
-      g_warning ("failed to connect to g-s-d: %s", error->message);
+      if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+        g_warning ("failed to connect to g-s-d: %s", error->message);
       return;
     }
 
@@ -412,7 +413,8 @@ dialog_got_proxy_props_cb (GObject *source_object, GAsyncResult *res, gpointer u
   proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
   if (proxy == NULL)
     {
-      g_warning ("failed to connect to g-s-d: %s", error->message);
+      if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+        g_warning ("failed to connect to g-s-d: %s", error->message);
       return;
     }
 


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