[totem/gkarsay/totem-master: 1/2] plugins: Replace deprecated g_type_class_add_private()



commit 4ac31d6c7cfb4b9307debe83bb3c87501fd87d71
Author: Gabor Karsay <gabor karsay gmx at>
Date:   Thu Sep 26 11:34:11 2019 +0200

    plugins: Replace deprecated g_type_class_add_private()
    
    g_type_class_add_private has been deprecated since GObject 2.58.

 src/plugins/totem-plugin.h         | 4 ++--
 src/plugins/totem-plugins-engine.c | 7 ++-----
 2 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/src/plugins/totem-plugin.h b/src/plugins/totem-plugin.h
index 19c320aa2..a5d331dd2 100644
--- a/src/plugins/totem-plugin.h
+++ b/src/plugins/totem-plugin.h
@@ -69,6 +69,7 @@ G_BEGIN_DECLS
                                        type_name,                              \
                                        PEAS_TYPE_EXTENSION_BASE,               \
                                        0,                                      \
+                                       G_ADD_PRIVATE_DYNAMIC(TypeName)         \
                                        G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE, \
                                                                       peas_activatable_iface_init) \
                                        TYPE_CODE)                              \
@@ -119,7 +120,6 @@ G_BEGIN_DECLS
                object_class->get_property = get_property;                      \
                                                                                \
                g_object_class_override_property (object_class, PROP_OBJECT, "object"); \
-               g_type_class_add_private (klass, sizeof (TypeName##Private));   \
        }                                                                       \
        static void                                                             \
        type_name##_class_finalize (TypeName##Class *klass)                     \
@@ -128,7 +128,7 @@ G_BEGIN_DECLS
        static void                                                             \
        type_name##_init (TypeName *plugin)                                     \
        {                                                                       \
-               plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin, TYPE_NAME, TypeName##Private); \
+               plugin->priv = type_name##_get_instance_private (plugin);       \
        }                                                                       \
        G_MODULE_EXPORT void                                                    \
        peas_register_types (PeasObjectModule *module)                          \
diff --git a/src/plugins/totem-plugins-engine.c b/src/plugins/totem-plugins-engine.c
index 77750d74c..b3c8926b6 100644
--- a/src/plugins/totem-plugins-engine.c
+++ b/src/plugins/totem-plugins-engine.c
@@ -49,7 +49,7 @@ typedef struct _TotemPluginsEnginePrivate{
        guint garbage_collect_id;
 } _TotemPluginsEnginePrivate;
 
-G_DEFINE_TYPE(TotemPluginsEngine, totem_plugins_engine, PEAS_TYPE_ENGINE)
+G_DEFINE_TYPE_WITH_PRIVATE (TotemPluginsEngine, totem_plugins_engine, PEAS_TYPE_ENGINE)
 
 static void totem_plugins_engine_dispose (GObject *object);
 
@@ -67,7 +67,6 @@ totem_plugins_engine_class_init (TotemPluginsEngineClass *klass)
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
        object_class->dispose = totem_plugins_engine_dispose;
-       g_type_class_add_private (klass, sizeof (TotemPluginsEnginePrivate));
 }
 
 static void
@@ -178,9 +177,7 @@ totem_plugins_engine_shut_down (TotemPluginsEngine *self)
 static void
 totem_plugins_engine_init (TotemPluginsEngine *engine)
 {
-       engine->priv = G_TYPE_INSTANCE_GET_PRIVATE (engine,
-                                                   TOTEM_TYPE_PLUGINS_ENGINE,
-                                                   TotemPluginsEnginePrivate);
+       engine->priv = totem_plugins_engine_get_instance_private (engine);
 
        engine->priv->settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
 


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