Skip to content

Fix build dropping use of g_type_class_add_private()

Builds were failing with:

seaton-preference.c: In function ‘seaton_preference_class_init’:
seaton-preference.c:94:3: error: ‘g_type_class_add_private’ is deprecated [-Werror=deprecated-declarations]
   g_type_class_add_private (klass, sizeof (SeatonPreferencePrivate));
   ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/glib-2.0/gobject/gobject.h:24,
                 from /usr/include/glib-2.0/gobject/gbinding.h:29,
                 from /usr/include/glib-2.0/glib-object.h:23,
                 from seaton-preference.h:14,
                 from seaton-preference.c:22:
/usr/include/glib-2.0/gobject/gtype.h:1303:10: note: declared here
 void     g_type_class_add_private       (gpointer                    g_class,
          ^~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:505: libseaton_la-seaton-preference.lo] Error 1

Replace the use of the deprecated g_type_class_add_private() function by switching to the G_DEFINE_TYPE_WITH_PRIVATE() macro, moving the definition of the provate struct before the macro invocation.

Signed-off-by: Emanuele Aina emanuele.aina@collabora.com

Merge request reports