Remove deprecated g_type_class_add_private()

Use `G_ADD_PRIVATE()` or its shorthand when defining a type using
`G_DEFINE_TYPE_WITH_PRIVATE()`
This commit is contained in:
Niels De Graef 2019-01-24 00:07:33 +01:00
parent 5f24b4521b
commit 950b22bab6
4 changed files with 8 additions and 15 deletions

View File

@ -119,6 +119,7 @@ static void secret_collection_initable_iface (GInitableIface *iface);
static void secret_collection_async_initable_iface (GAsyncInitableIface *iface);
G_DEFINE_TYPE_WITH_CODE (SecretCollection, secret_collection, G_TYPE_DBUS_PROXY,
G_ADD_PRIVATE (SecretCollection)
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, secret_collection_initable_iface);
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, secret_collection_async_initable_iface);
);
@ -133,8 +134,7 @@ items_table_new (void)
static void
secret_collection_init (SecretCollection *self)
{
self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SECRET_TYPE_COLLECTION,
SecretCollectionPrivate);
self->pv = secret_collection_get_instance_private (self);
g_mutex_init (&self->pv->mutex);
self->pv->cancellable = g_cancellable_new ();
@ -503,8 +503,6 @@ secret_collection_class_init (SecretCollectionClass *klass)
g_object_class_install_property (gobject_class, PROP_MODIFIED,
g_param_spec_uint64 ("modified", "Modified", "Item modified date",
0UL, G_MAXUINT64, 0UL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_type_class_add_private (gobject_class, sizeof (SecretCollectionPrivate));
}
static gboolean

View File

@ -114,6 +114,7 @@ static void secret_item_initable_iface (GInitableIface *iface);
static void secret_item_async_initable_iface (GAsyncInitableIface *iface);
G_DEFINE_TYPE_WITH_CODE (SecretItem, secret_item, G_TYPE_DBUS_PROXY,
G_ADD_PRIVATE (SecretItem)
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, secret_item_initable_iface);
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, secret_item_async_initable_iface);
);
@ -121,7 +122,7 @@ G_DEFINE_TYPE_WITH_CODE (SecretItem, secret_item, G_TYPE_DBUS_PROXY,
static void
secret_item_init (SecretItem *self)
{
self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SECRET_TYPE_ITEM, SecretItemPrivate);
self->pv = secret_item_get_instance_private (self);
g_mutex_init (&self->pv->mutex);
}
@ -403,8 +404,6 @@ secret_item_class_init (SecretItemClass *klass)
g_object_class_install_property (gobject_class, PROP_MODIFIED,
g_param_spec_uint64 ("modified", "Modified", "Item modified date",
0UL, G_MAXUINT64, 0UL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_type_class_add_private (gobject_class, sizeof (SecretItemPrivate));
}
typedef struct {

View File

@ -59,19 +59,17 @@ struct _SecretPromptPrivate {
gint prompted;
};
G_DEFINE_TYPE (SecretPrompt, secret_prompt, G_TYPE_DBUS_PROXY);
G_DEFINE_TYPE_WITH_PRIVATE (SecretPrompt, secret_prompt, G_TYPE_DBUS_PROXY);
static void
secret_prompt_init (SecretPrompt *self)
{
self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SECRET_TYPE_PROMPT,
SecretPromptPrivate);
self->pv = secret_prompt_get_instance_private (self);
}
static void
secret_prompt_class_init (SecretPromptClass *klass)
{
g_type_class_add_private (klass, sizeof (SecretPromptPrivate));
}
typedef struct {

View File

@ -140,6 +140,7 @@ static void secret_service_initable_iface (GInitableIface *iface);
static void secret_service_async_initable_iface (GAsyncInitableIface *iface);
G_DEFINE_TYPE_WITH_CODE (SecretService, secret_service, G_TYPE_DBUS_PROXY,
G_ADD_PRIVATE (SecretService)
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, secret_service_initable_iface);
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, secret_service_async_initable_iface);
);
@ -225,8 +226,7 @@ service_cache_instance (SecretService *instance)
static void
secret_service_init (SecretService *self)
{
self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SECRET_TYPE_SERVICE,
SecretServicePrivate);
self->pv = secret_service_get_instance_private (self);
g_mutex_init (&self->pv->mutex);
self->pv->cancellable = g_cancellable_new ();
@ -557,8 +557,6 @@ secret_service_class_init (SecretServiceClass *klass)
g_param_spec_boxed ("collections", "Collections", "Secret Service Collections",
_secret_list_get_type (), G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_type_class_add_private (klass, sizeof (SecretServicePrivate));
/* Initialize this error domain, registers dbus errors */
_secret_error_quark = secret_error_get_quark ();
}