[libgweather/ebassi/gtk4: 48/56] Use G_DEFINE_BOXED_TYPE for GWeatherLocation




commit 2fe31c284db3183650fbc1661512a0408de45477
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Oct 12 18:04:16 2021 +0100

    Use G_DEFINE_BOXED_TYPE for GWeatherLocation
    
    Instead of writing the get_type() function ourselves.

 libgweather/gweather-location.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
---
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index 47c402fa..1d499db0 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -128,12 +128,14 @@ _gweather_location_reset_world (void)
        }
 }
 
+G_DEFINE_BOXED_TYPE (GWeatherLocation, gweather_location, gweather_location_ref, gweather_location_unref)
+
 /**
  * gweather_location_get_world:
  *
  * Obtains the shared #GWeatherLocation of type %GWEATHER_LOCATION_WORLD,
  * representing a hierarchy containing all of the locations from
- * Locations.xml.
+ * `Locations.xml`.
  *
  * Prior to version 40 no reference was returned.
  *
@@ -263,21 +265,6 @@ gweather_location_unref (GWeatherLocation *loc)
     g_slice_free (GWeatherLocation, loc);
 }
 
-GType
-gweather_location_get_type (void)
-{
-    static gsize type_volatile = 0;
-
-    if (g_once_init_enter (&type_volatile)) {
-       GType type = g_boxed_type_register_static (
-           g_intern_static_string ("GWeatherLocation"),
-           (GBoxedCopyFunc) gweather_location_ref,
-           (GBoxedFreeFunc) gweather_location_unref);
-       g_once_init_leave (&type_volatile, type);
-    }
-    return type_volatile;
-}
-
 /**
  * gweather_location_get_name:
  * @loc: a #GWeatherLocation


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