[almanah/38-port-to-gtk4: 2/2] [events] Removed deprecated g_type_class_add_private




commit 08d1678664ff0fb5f56cc5c6edccdfc1f79e9931
Author: Álvaro Peña <alvaropg gmail com>
Date:   Wed Mar 23 21:38:08 2022 +0100

    [events] Removed deprecated g_type_class_add_private

 src/event-factory.c | 12 ++++--------
 src/event-factory.h |  3 ---
 2 files changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/src/event-factory.c b/src/event-factory.c
index 44a55e4..cb20ef4 100644
--- a/src/event-factory.c
+++ b/src/event-factory.c
@@ -2,7 +2,7 @@
 /*
  * Almanah
  * Copyright (C) Philip Withnall 2008-2009 <philip tecnocode co uk>
- * 
+ *
  * Almanah is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
@@ -24,9 +24,9 @@
 
 static void almanah_event_factory_get_property (GObject *object, guint property_id, GValue *value, 
GParamSpec *pspec);
 
-struct _AlmanahEventFactoryPrivate {
+typedef struct {
        GDate date;
-};
+} AlmanahEventFactoryPrivate;
 
 enum {
        PROP_TYPE_ID = 1
@@ -39,16 +39,13 @@ enum {
 
 static guint event_factory_signals[LAST_SIGNAL] = { 0, };
 
-G_DEFINE_ABSTRACT_TYPE (AlmanahEventFactory, almanah_event_factory, G_TYPE_OBJECT)
-#define ALMANAH_EVENT_FACTORY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), 
ALMANAH_TYPE_EVENT_FACTORY, AlmanahEventFactoryPrivate))
+G_DEFINE_ABSTRACT_TYPE_WITH_CODE(AlmanahEventFactory, almanah_event_factory, G_TYPE_OBJECT, 
G_ADD_PRIVATE(AlmanahEventFactory))
 
 static void
 almanah_event_factory_class_init (AlmanahEventFactoryClass *klass)
 {
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-       g_type_class_add_private (klass, sizeof (AlmanahEventFactoryPrivate));
-
        gobject_class->get_property = almanah_event_factory_get_property;
 
        g_object_class_install_property (gobject_class, PROP_TYPE_ID,
@@ -68,7 +65,6 @@ almanah_event_factory_class_init (AlmanahEventFactoryClass *klass)
 static void
 almanah_event_factory_init (AlmanahEventFactory *self)
 {
-       self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ALMANAH_TYPE_EVENT_FACTORY, 
AlmanahEventFactoryPrivate);
 }
 
 static void
diff --git a/src/event-factory.h b/src/event-factory.h
index 7939d01..2906a3a 100644
--- a/src/event-factory.h
+++ b/src/event-factory.h
@@ -38,11 +38,8 @@ typedef enum {
 #define ALMANAH_IS_EVENT_FACTORY_CLASS(k)      (G_TYPE_CHECK_CLASS_TYPE ((k), ALMANAH_TYPE_EVENT_FACTORY))
 #define ALMANAH_EVENT_FACTORY_GET_CLASS(o)     (G_TYPE_INSTANCE_GET_CLASS ((o), ALMANAH_TYPE_EVENT_FACTORY, 
AlmanahEventFactoryClass))
 
-typedef struct _AlmanahEventFactoryPrivate     AlmanahEventFactoryPrivate;
-
 typedef struct {
        GObject parent;
-       AlmanahEventFactoryPrivate *priv;
 } AlmanahEventFactory;
 
 typedef struct {


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