From 293948ad80f2f9dddf4af282e2b83b99b2e56014 Mon Sep 17 00:00:00 2001 From: rbuj Date: Sun, 24 Oct 2021 21:41:34 +0200 Subject: Use GLib's new g_clear_signal_handler() function to simplify code --- applets/clock/clock-location-tile.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'applets/clock') diff --git a/applets/clock/clock-location-tile.c b/applets/clock/clock-location-tile.c index b70f467c..4d0fc217 100644 --- a/applets/clock/clock-location-tile.c +++ b/applets/clock/clock-location-tile.c @@ -140,8 +140,16 @@ clock_location_tile_finalize (GObject *g_obj) priv = clock_location_tile_get_instance_private (this); if (priv->location) { - g_signal_handler_disconnect (priv->location, priv->location_weather_updated_id); - priv->location_weather_updated_id = 0; +#if GLIB_CHECK_VERSION(2,62,0) + g_clear_signal_handler (&priv->location_weather_updated_id, + priv->location); +#else + if (priv->location_weather_updated_id != 0) { + g_signal_handler_disconnect (priv->location, + priv->location_weather_updated_id); + priv->location_weather_updated_id = 0; + } +#endif g_clear_object (&priv->location); } -- cgit v1.2.1