[libgweather/ebassi/gtk4: 2/28] Remove deprecated g_type_class_add_private()




commit 0578c2f3f6812649eec0f9c0c474004c314e9fb4
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Oct 5 17:38:24 2021 +0100

    Remove deprecated g_type_class_add_private()
    
    Use the G_DEFINE_TYPE_WITH_PRIVATE and the get_instance_private()
    function, available since GLib 2.38.

 libgweather/gweather-location-entry.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/libgweather/gweather-location-entry.c b/libgweather/gweather-location-entry.c
index 5f55f77e..70eeaa18 100644
--- a/libgweather/gweather-location-entry.c
+++ b/libgweather/gweather-location-entry.c
@@ -46,7 +46,7 @@ struct _GWeatherLocationEntryPrivate {
     GtkTreeModel     *model;
 };
 
-G_DEFINE_TYPE (GWeatherLocationEntry, gweather_location_entry, GTK_TYPE_SEARCH_ENTRY)
+G_DEFINE_TYPE_WITH_PRIVATE (GWeatherLocationEntry, gweather_location_entry, GTK_TYPE_SEARCH_ENTRY)
 
 enum {
     PROP_0,
@@ -108,7 +108,7 @@ gweather_location_entry_init (GWeatherLocationEntry *entry)
     GtkEntryCompletion *completion;
     GWeatherLocationEntryPrivate *priv;
 
-    priv = entry->priv = G_TYPE_INSTANCE_GET_PRIVATE (entry, GWEATHER_TYPE_LOCATION_ENTRY, 
GWeatherLocationEntryPrivate);
+    priv = entry->priv = gweather_location_entry_get_instance_private (entry);
 
     completion = gtk_entry_completion_new ();
 
@@ -245,8 +245,6 @@ gweather_location_entry_class_init (GWeatherLocationEntryClass *location_entry_c
                            "The selected GWeatherLocation",
                            GWEATHER_TYPE_LOCATION,
                            G_PARAM_READWRITE));
-
-    g_type_class_add_private (location_entry_class, sizeof (GWeatherLocationEntryPrivate));
 }
 
 static void


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