[gnome-initial-setup/wjt/gweather-autoptr: 4/4] timezone: Use g_autoptr(GWeatherLocation)




commit ba38e60c1ba841e7db493360ec3dcc63146e32d4
Author: Will Thompson <wjt endlessos org>
Date:   Tue Jan 12 20:34:58 2021 +0000

    timezone: Use g_autoptr(GWeatherLocation)
    
    This was introduced in libgweather 40.alpha.

 gnome-initial-setup/meson.build                        | 2 +-
 gnome-initial-setup/pages/timezone/gis-timezone-page.c | 7 ++-----
 2 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/gnome-initial-setup/meson.build b/gnome-initial-setup/meson.build
index 75c44831..82fdac22 100644
--- a/gnome-initial-setup/meson.build
+++ b/gnome-initial-setup/meson.build
@@ -33,7 +33,7 @@ dependencies = [
     dependency ('gnome-desktop-3.0', version: '>= 3.7.5'),
     dependency ('gsettings-desktop-schemas', version: '>= 3.37.1'),
     dependency ('fontconfig'),
-    dependency ('gweather-3.0'),
+    dependency ('gweather-3.0', version: '>= 40.alpha'),
     dependency ('goa-1.0'),
     dependency ('goa-backend-1.0'),
     dependency ('gtk+-3.0', version: '>= 3.11.3'),
diff --git a/gnome-initial-setup/pages/timezone/gis-timezone-page.c 
b/gnome-initial-setup/pages/timezone/gis-timezone-page.c
index e1882083..a37ee3a4 100644
--- a/gnome-initial-setup/pages/timezone/gis-timezone-page.c
+++ b/gnome-initial-setup/pages/timezone/gis-timezone-page.c
@@ -158,7 +158,7 @@ on_location_notify (GClueSimple *simple,
   GisTimezonePagePrivate *priv = gis_timezone_page_get_instance_private (page);
   GClueLocation *location;
   gdouble latitude, longitude;
-  GWeatherLocation *glocation = NULL;
+  g_autoptr(GWeatherLocation) glocation = NULL;
 
   location = gclue_simple_get_location (simple);
 
@@ -169,7 +169,6 @@ on_location_notify (GClueSimple *simple,
   priv->in_geoclue_callback = TRUE;
   set_location (page, glocation);
   priv->in_geoclue_callback = FALSE;
-  gweather_location_unref (glocation);
 }
 
 static void
@@ -234,7 +233,7 @@ entry_location_changed (GObject *object, GParamSpec *param, GisTimezonePage *pag
 {
   GisTimezonePagePrivate *priv = gis_timezone_page_get_instance_private (page);
   GWeatherLocationEntry *entry = GWEATHER_LOCATION_ENTRY (object);
-  GWeatherLocation *location;
+  g_autoptr(GWeatherLocation) location = NULL;
 
   location = gweather_location_entry_get_location (entry);
   if (!location)
@@ -243,8 +242,6 @@ entry_location_changed (GObject *object, GParamSpec *param, GisTimezonePage *pag
   priv->in_search = TRUE;
   set_location (page, location);
   priv->in_search = FALSE;
-
-  gweather_location_unref (location);
 }
 
 #define GETTEXT_PACKAGE_TIMEZONES "gnome-control-center-2.0-timezones"


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