[geocode-glib/bilelmoussaoui/deprecated-api: 1/2] stop using g_type_class_add_private
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geocode-glib/bilelmoussaoui/deprecated-api: 1/2] stop using g_type_class_add_private
- Date: Fri, 14 Jan 2022 14:08:03 +0000 (UTC)
commit f5c80bb0207970ec52b2863c67e335c594ee6d95
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Fri Jan 14 15:05:08 2022 +0100
stop using g_type_class_add_private
It was deprecated, replace it with using G_DEFINE_TYPE_WITH_CODE macro
geocode-glib/geocode-bounding-box.c | 8 ++------
geocode-glib/geocode-forward.c | 7 ++-----
geocode-glib/geocode-location.c | 9 ++-------
geocode-glib/geocode-place.c | 8 ++------
geocode-glib/geocode-reverse.c | 6 ++----
5 files changed, 10 insertions(+), 28 deletions(-)
---
diff --git a/geocode-glib/geocode-bounding-box.c b/geocode-glib/geocode-bounding-box.c
index 2dd99de..a72577f 100644
--- a/geocode-glib/geocode-bounding-box.c
+++ b/geocode-glib/geocode-bounding-box.c
@@ -47,7 +47,8 @@ enum {
PROP_RIGHT
};
-G_DEFINE_TYPE (GeocodeBoundingBox, geocode_bounding_box, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (GeocodeBoundingBox, geocode_bounding_box, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GeocodeBoundingBox))
static void
geocode_bounding_box_get_property (GObject *object,
@@ -173,8 +174,6 @@ geocode_bounding_box_class_init (GeocodeBoundingBoxClass *klass)
gbbox_class->get_property = geocode_bounding_box_get_property;
gbbox_class->set_property = geocode_bounding_box_set_property;
- g_type_class_add_private (klass, sizeof (GeocodeBoundingBoxPrivate));
-
/**
* GeocodeBoundingBox:top:
*
@@ -244,9 +243,6 @@ geocode_bounding_box_class_init (GeocodeBoundingBoxClass *klass)
static void
geocode_bounding_box_init (GeocodeBoundingBox *bbox)
{
- bbox->priv = G_TYPE_INSTANCE_GET_PRIVATE ((bbox),
- GEOCODE_TYPE_BOUNDING_BOX,
- GeocodeBoundingBoxPrivate);
}
/**
diff --git a/geocode-glib/geocode-forward.c b/geocode-glib/geocode-forward.c
index 43ea4ad..558e859 100644
--- a/geocode-glib/geocode-forward.c
+++ b/geocode-glib/geocode-forward.c
@@ -58,7 +58,8 @@ enum {
PROP_BOUNDED
};
-G_DEFINE_TYPE (GeocodeForward, geocode_forward, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (GeocodeForward, geocode_forward, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GeocodeForward))
static void
geocode_forward_get_property (GObject *object,
@@ -143,9 +144,6 @@ geocode_forward_class_init (GeocodeForwardClass *klass)
gforward_class->get_property = geocode_forward_get_property;
gforward_class->set_property = geocode_forward_set_property;
-
- g_type_class_add_private (klass, sizeof (GeocodeForwardPrivate));
-
/**
* GeocodeForward:answer-count:
*
@@ -203,7 +201,6 @@ free_value (GValue *value)
static void
geocode_forward_init (GeocodeForward *forward)
{
- forward->priv = G_TYPE_INSTANCE_GET_PRIVATE ((forward), GEOCODE_TYPE_FORWARD, GeocodeForwardPrivate);
forward->priv->ht = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free,
(GDestroyNotify) free_value);
diff --git a/geocode-glib/geocode-location.c b/geocode-glib/geocode-location.c
index 70a94c1..a60bfe9 100644
--- a/geocode-glib/geocode-location.c
+++ b/geocode-glib/geocode-location.c
@@ -60,7 +60,8 @@ enum {
PROP_CRS,
};
-G_DEFINE_TYPE (GeocodeLocation, geocode_location, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (GeocodeLocation, geocode_location, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GeocodeLocation))
static void
geocode_location_get_property (GObject *object,
@@ -543,8 +544,6 @@ geocode_location_class_init (GeocodeLocationClass *klass)
glocation_class->set_property = geocode_location_set_property;
glocation_class->constructed = geocode_location_constructed;
- g_type_class_add_private (klass, sizeof (GeocodeLocationPrivate));
-
/**
* GeocodeLocation:description:
*
@@ -660,10 +659,6 @@ geocode_location_class_init (GeocodeLocationClass *klass)
static void
geocode_location_init (GeocodeLocation *location)
{
- location->priv = G_TYPE_INSTANCE_GET_PRIVATE ((location),
- GEOCODE_TYPE_LOCATION,
- GeocodeLocationPrivate);
-
location->priv->altitude = GEOCODE_LOCATION_ALTITUDE_UNKNOWN;
location->priv->accuracy = GEOCODE_LOCATION_ACCURACY_UNKNOWN;
location->priv->crs = GEOCODE_LOCATION_CRS_WGS84;
diff --git a/geocode-glib/geocode-place.c b/geocode-glib/geocode-place.c
index 1d4760c..f64fd61 100644
--- a/geocode-glib/geocode-place.c
+++ b/geocode-glib/geocode-place.c
@@ -84,7 +84,8 @@ enum {
PROP_OSM_TYPE
};
-G_DEFINE_TYPE (GeocodePlace, geocode_place, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (GeocodePlace, geocode_place, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GeocodePlace))
static void
geocode_place_get_property (GObject *object,
@@ -324,8 +325,6 @@ geocode_place_class_init (GeocodePlaceClass *klass)
gplace_class->get_property = geocode_place_get_property;
gplace_class->set_property = geocode_place_set_property;
- g_type_class_add_private (klass, sizeof (GeocodePlacePrivate));
-
/**
* GeocodePlace:name:
*
@@ -580,9 +579,6 @@ geocode_place_class_init (GeocodePlaceClass *klass)
static void
geocode_place_init (GeocodePlace *place)
{
- place->priv = G_TYPE_INSTANCE_GET_PRIVATE ((place),
- GEOCODE_TYPE_PLACE,
- GeocodePlacePrivate);
place->priv->bbox = NULL;
place->priv->osm_type = GEOCODE_PLACE_OSM_TYPE_UNKNOWN;
}
diff --git a/geocode-glib/geocode-reverse.c b/geocode-glib/geocode-reverse.c
index 4bfe0ea..bdc5e5e 100644
--- a/geocode-glib/geocode-reverse.c
+++ b/geocode-glib/geocode-reverse.c
@@ -47,7 +47,8 @@ struct _GeocodeReversePrivate {
GeocodeBackend *backend;
};
-G_DEFINE_TYPE (GeocodeReverse, geocode_reverse, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (GeocodeReverse, geocode_reverse, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GeocodeReverse))
static void
geocode_reverse_finalize (GObject *gobject)
@@ -69,14 +70,11 @@ geocode_reverse_class_init (GeocodeReverseClass *klass)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
gobject_class->finalize = geocode_reverse_finalize;
-
- g_type_class_add_private (klass, sizeof (GeocodeReversePrivate));
}
static void
geocode_reverse_init (GeocodeReverse *object)
{
- object->priv = G_TYPE_INSTANCE_GET_PRIVATE ((object), GEOCODE_TYPE_REVERSE, GeocodeReversePrivate);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]