From 9d1becb0ddaa3fd2b9e313c4eea72aac038d1a79 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 22 Jan 2019 10:19:35 +0100 Subject: [PATCH] clients/secret-agent: embed private data in NMSecretAgentSimple class --- clients/common/nm-secret-agent-simple.c | 13 ++++++++++--- clients/common/nm-secret-agent-simple.h | 9 ++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/clients/common/nm-secret-agent-simple.c b/clients/common/nm-secret-agent-simple.c index f89d225902..e2502768d7 100644 --- a/clients/common/nm-secret-agent-simple.c +++ b/clients/common/nm-secret-agent-simple.c @@ -70,9 +70,18 @@ typedef struct { gboolean enabled; } NMSecretAgentSimplePrivate; +struct _NMSecretAgentSimple { + NMSecretAgentOld parent; + NMSecretAgentSimplePrivate _priv; +}; + +struct _NMSecretAgentSimpleClass { + NMSecretAgentOldClass parent; +}; + G_DEFINE_TYPE (NMSecretAgentSimple, nm_secret_agent_simple, NM_TYPE_SECRET_AGENT_OLD) -#define NM_SECRET_AGENT_SIMPLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SECRET_AGENT_SIMPLE, NMSecretAgentSimplePrivate)) +#define NM_SECRET_AGENT_SIMPLE_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMSecretAgentSimple, NM_IS_SECRET_AGENT_SIMPLE, NMSecretAgentOld) /*****************************************************************************/ @@ -1160,8 +1169,6 @@ nm_secret_agent_simple_class_init (NMSecretAgentSimpleClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); NMSecretAgentOldClass *agent_class = NM_SECRET_AGENT_OLD_CLASS (klass); - g_type_class_add_private (klass, sizeof (NMSecretAgentSimplePrivate)); - gobject_class->finalize = nm_secret_agent_simple_finalize; agent_class->get_secrets = nm_secret_agent_simple_get_secrets; diff --git a/clients/common/nm-secret-agent-simple.h b/clients/common/nm-secret-agent-simple.h index 0ad57a0531..89e4cf3ccf 100644 --- a/clients/common/nm-secret-agent-simple.h +++ b/clients/common/nm-secret-agent-simple.h @@ -51,13 +51,8 @@ typedef struct { #define NM_SECRET_AGENT_SIMPLE_REQUEST_SECRETS "request-secrets" -typedef struct { - NMSecretAgentOld parent; -} NMSecretAgentSimple; - -typedef struct { - NMSecretAgentOldClass parent; -} NMSecretAgentSimpleClass; +typedef struct _NMSecretAgentSimple NMSecretAgentSimple; +typedef struct _NMSecretAgentSimpleClass NMSecretAgentSimpleClass; GType nm_secret_agent_simple_get_type (void);