[gom] gom: repository: use G_ADD_PRIVATE for type definition
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gom] gom: repository: use G_ADD_PRIVATE for type definition
- Date: Tue, 18 Feb 2020 15:05:46 +0000 (UTC)
commit e56d36c285938d9825ffc5b3b8fe2d2b86b73346
Author: Victor Toso <me victortoso com>
Date: Mon Feb 17 23:57:49 2020 +0100
gom: repository: use G_ADD_PRIVATE for type definition
The G_DEFINE_TYPE_WITH_PRIVATE call was moved as it needs to know the
storage size of private structure.
gom/gom-repository.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gom/gom-repository.c b/gom/gom-repository.c
index 2f52ff7..0f765a2 100644
--- a/gom/gom-repository.c
+++ b/gom/gom-repository.c
@@ -22,13 +22,13 @@
#include "gom-error.h"
#include "gom-repository.h"
-G_DEFINE_TYPE(GomRepository, gom_repository, G_TYPE_OBJECT)
-
struct _GomRepositoryPrivate
{
GomAdapter *adapter;
};
+G_DEFINE_TYPE_WITH_PRIVATE(GomRepository, gom_repository, G_TYPE_OBJECT)
+
enum
{
PROP_0,
@@ -939,7 +939,6 @@ gom_repository_class_init (GomRepositoryClass *klass)
object_class->finalize = gom_repository_finalize;
object_class->get_property = gom_repository_get_property;
object_class->set_property = gom_repository_set_property;
- g_type_class_add_private(object_class, sizeof(GomRepositoryPrivate));
gParamSpecs[PROP_ADAPTER] =
g_param_spec_object("adapter",
@@ -960,8 +959,5 @@ gom_repository_class_init (GomRepositoryClass *klass)
static void
gom_repository_init (GomRepository *repository)
{
- repository->priv =
- G_TYPE_INSTANCE_GET_PRIVATE(repository,
- GOM_TYPE_REPOSITORY,
- GomRepositoryPrivate);
+ repository->priv = gom_repository_get_instance_private(repository);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]