diff --git a/loudmouth/lm-asyncns-resolver.c b/loudmouth/lm-asyncns-resolver.c index 10043b1..17893f1 100644 --- a/loudmouth/lm-asyncns-resolver.c +++ b/loudmouth/lm-asyncns-resolver.c @@ -38,10 +38,10 @@ #include "lm-misc.h" #include "lm-asyncns-resolver.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_ASYNCNS_RESOLVER, LmAsyncnsResolverPriv)) +#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_ASYNCNS_RESOLVER, LmAsyncnsResolverPrivate)) -typedef struct LmAsyncnsResolverPriv LmAsyncnsResolverPriv; -struct LmAsyncnsResolverPriv { +typedef struct LmAsyncnsResolverPrivate LmAsyncnsResolverPrivate; +struct LmAsyncnsResolverPrivate { GSource *watch_resolv; asyncns_query_t *resolv_query; asyncns_t *asyncns_ctx; @@ -53,7 +53,7 @@ static void asyncns_resolver_lookup (LmResolver *resolver); static void asyncns_resolver_cleanup (LmResolver *resolver); static void asyncns_resolver_cancel (LmResolver *resolver); -G_DEFINE_TYPE (LmAsyncnsResolver, lm_asyncns_resolver, LM_TYPE_RESOLVER) +G_DEFINE_TYPE_WITH_PRIVATE (LmAsyncnsResolver, lm_asyncns_resolver, LM_TYPE_RESOLVER) static void lm_asyncns_resolver_class_init (LmAsyncnsResolverClass *class) @@ -65,8 +65,6 @@ lm_asyncns_resolver_class_init (LmAsyncnsResolverClass *class) resolver_class->lookup = asyncns_resolver_lookup; resolver_class->cancel = asyncns_resolver_cancel; - - g_type_class_add_private (object_class, sizeof (LmAsyncnsResolverPriv)); } static void @@ -87,7 +85,7 @@ asyncns_resolver_dispose (GObject *object) static void asyncns_resolver_cleanup (LmResolver *resolver) { - LmAsyncnsResolverPriv *priv = GET_PRIV (resolver); + LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver); if (priv->resolv_channel != NULL) { g_io_channel_unref (priv->resolv_channel); @@ -110,7 +108,7 @@ asyncns_resolver_cleanup (LmResolver *resolver) static void asyncns_resolver_done (LmResolver *resolver) { - LmAsyncnsResolverPriv *priv = GET_PRIV (resolver); + LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver); struct addrinfo *ans; int err; @@ -142,7 +140,7 @@ asyncns_resolver_io_cb (GSource *source, GIOCondition condition, LmResolver *resolver) { - LmAsyncnsResolverPriv *priv = GET_PRIV (resolver); + LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver); LmAsyncnsResolverCallback func; asyncns_wait (priv->asyncns_ctx, FALSE); @@ -159,7 +157,7 @@ asyncns_resolver_io_cb (GSource *source, static gboolean asyncns_resolver_prep (LmResolver *resolver, GError **error) { - LmAsyncnsResolverPriv *priv = GET_PRIV (resolver); + LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver); GMainContext *context; if (priv->asyncns_ctx) { @@ -193,7 +191,7 @@ asyncns_resolver_prep (LmResolver *resolver, GError **error) static void asyncns_resolver_lookup_host (LmResolver *resolver) { - LmAsyncnsResolverPriv *priv = GET_PRIV (resolver); + LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver); gchar *host; struct addrinfo req; @@ -226,7 +224,7 @@ asyncns_resolver_lookup_host (LmResolver *resolver) static void asyncns_resolver_srv_done (LmResolver *resolver) { - LmAsyncnsResolverPriv *priv = GET_PRIV (resolver); + LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver); unsigned char *srv_ans; int srv_len; gboolean result = FALSE; @@ -281,7 +279,7 @@ asyncns_resolver_srv_done (LmResolver *resolver) static void asyncns_resolver_lookup_service (LmResolver *resolver) { - LmAsyncnsResolverPriv *priv = GET_PRIV (resolver); + LmAsyncnsResolverPrivate *priv = GET_PRIV (resolver); gchar *domain; gchar *service; gchar *protocol; @@ -348,7 +346,7 @@ asyncns_resolver_lookup (LmResolver *resolver) static void asyncns_resolver_cancel (LmResolver *resolver) { - LmAsyncnsResolverPriv *priv; + LmAsyncnsResolverPrivate *priv; g_return_if_fail (LM_IS_ASYNCNS_RESOLVER (resolver)); diff --git a/loudmouth/lm-dummy.c b/loudmouth/lm-dummy.c index 54f30d6..59b15e8 100644 --- a/loudmouth/lm-dummy.c +++ b/loudmouth/lm-dummy.c @@ -21,10 +21,10 @@ #include "lm-marshal.h" #include "lm-dummy.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_DUMMY, LmDummyPriv)) +#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_DUMMY, LmDummyPrivate)) -typedef struct LmDummyPriv LmDummyPriv; -struct LmDummyPriv { +typedef struct LmDummyPrivate LmDummyPrivate; +struct LmDummyPrivate { gint my_prop; }; @@ -38,7 +38,7 @@ static void dummy_set_property (GObject *object, const GValue *value, GParamSpec *pspec); -G_DEFINE_TYPE (LmDummy, lm_dummy, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (LmDummy, lm_dummy, G_TYPE_OBJECT) enum { PROP_0, @@ -78,8 +78,6 @@ lm_dummy_class_init (LmDummyClass *class) _lm_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); - - g_type_class_add_private (object_class, sizeof (LmDummyPriv)); } static void @@ -102,7 +100,7 @@ dummy_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - LmDummyPriv *priv; + LmDummyPrivate *priv; priv = GET_PRIV (object); @@ -122,7 +120,7 @@ dummy_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - LmDummyPriv *priv; + LmDummyPrivate *priv; priv = GET_PRIV (object); diff --git a/loudmouth/lm-simple-io.c b/loudmouth/lm-simple-io.c index 80e3259..a8aba84 100644 --- a/loudmouth/lm-simple-io.c +++ b/loudmouth/lm-simple-io.c @@ -22,10 +22,10 @@ #include "lm-xmpp-writer.h" #include "lm-simple-io.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_SIMPLE_IO, LmSimpleIOPriv)) +#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_SIMPLE_IO, LmSimpleIOPrivate)) -typedef struct LmSimpleIOPriv LmSimpleIOPriv; -struct LmSimpleIOPriv { +typedef struct LmSimpleIOPrivate LmSimpleIOPrivate; +struct LmSimpleIOPrivate { gint my_prop; }; @@ -46,6 +46,7 @@ static void simple_io_send_text (LmXmppWriter *writer, gsize len); G_DEFINE_TYPE_WITH_CODE (LmSimpleIO, lm_simple_io, G_TYPE_OBJECT, + G_ADD_PRIVATE (LmSimpleIO) G_IMPLEMENT_INTERFACE (LM_TYPE_XMPP_WRITER, simple_io_writer_iface_init)) @@ -70,8 +71,6 @@ lm_simple_io_class_init (LmSimpleIOClass *class) "My Property", NULL, G_PARAM_READWRITE)); - - g_type_class_add_private (object_class, sizeof (LmSimpleIOPriv)); } static void @@ -101,7 +100,7 @@ simple_io_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - LmSimpleIOPriv *priv; + LmSimpleIOPrivate *priv; priv = GET_PRIV (object); @@ -121,7 +120,7 @@ simple_io_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - LmSimpleIOPriv *priv; + LmSimpleIOPrivate *priv; priv = GET_PRIV (object);