Move away from g_type_class_add_private()
g_type_class_add_private() will be deprecated in GLib 2.58. Replace:
- g_type_class_add_private() with G_DEFINE_TYPE_WITH_PRIVATE()
- G_TYPE_INSTANCE_GET_PRIVATE() with *_get_instance_private()
--- a/loudmouth/lm-blocking-resolver.c Wed Sep 26 21:45:08 2018 +0200
+++ b/loudmouth/lm-blocking-resolver.c Thu Sep 27 21:38:25 2018 +0200
@@ -38,10 +38,10 @@
#define SRV_LEN 8192
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_BLOCKING_RESOLVER, LmBlockingResolverPriv))
+#define GET_PRIV(obj) (lm_blocking_resolver_get_instance_private (LM_BLOCKING_RESOLVER(obj)))
-typedef struct LmBlockingResolverPriv LmBlockingResolverPriv;
-struct LmBlockingResolverPriv {
+typedef struct LmBlockingResolverPrivate LmBlockingResolverPrivate;
+struct LmBlockingResolverPrivate {
GSource *idle_source;
};
@@ -49,7 +49,7 @@
static void blocking_resolver_lookup (LmResolver *resolver);
static void blocking_resolver_cancel (LmResolver *resolver);
-G_DEFINE_TYPE (LmBlockingResolver, lm_blocking_resolver, LM_TYPE_RESOLVER)
+G_DEFINE_TYPE_WITH_PRIVATE (LmBlockingResolver, lm_blocking_resolver, LM_TYPE_RESOLVER)
static void
lm_blocking_resolver_class_init (LmBlockingResolverClass *class)
@@ -61,9 +61,6 @@
resolver_class->lookup = blocking_resolver_lookup;
resolver_class->cancel = blocking_resolver_cancel;
-
- g_type_class_add_private (object_class,
- sizeof (LmBlockingResolverPriv));
}
static void
@@ -191,7 +188,7 @@
static gboolean
blocking_resolver_idle_lookup (LmBlockingResolver *resolver)
{
- LmBlockingResolverPriv *priv = GET_PRIV (resolver);
+ LmBlockingResolverPrivate *priv = GET_PRIV (resolver);
gint type;
/* Start the DNS querying */
@@ -216,7 +213,7 @@
static void
blocking_resolver_lookup (LmResolver *resolver)
{
- LmBlockingResolverPriv *priv;
+ LmBlockingResolverPrivate *priv;
GMainContext *context;
g_return_if_fail (LM_IS_BLOCKING_RESOLVER (resolver));
@@ -233,7 +230,7 @@
static void
blocking_resolver_cancel (LmResolver *resolver)
{
- LmBlockingResolverPriv *priv;
+ LmBlockingResolverPrivate *priv;
g_return_if_fail (LM_IS_BLOCKING_RESOLVER (resolver));
--- a/loudmouth/lm-feature-ping.c Wed Sep 26 21:45:08 2018 +0200
+++ b/loudmouth/lm-feature-ping.c Thu Sep 27 21:38:25 2018 +0200
@@ -28,10 +28,10 @@
#define XMPP_NS_PING "urn:xmpp:ping"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_FEATURE_PING, LmFeaturePingPriv))
+#define GET_PRIV(obj) (lm_feature_ping_get_instance_private (LM_FEATURE_PING(obj)))
-typedef struct LmFeaturePingPriv LmFeaturePingPriv;
-struct LmFeaturePingPriv {
+typedef struct LmFeaturePingPrivate LmFeaturePingPrivate;
+struct LmFeaturePingPrivate {
LmConnection *connection;
guint keep_alive_rate;
GSource *keep_alive_source;
@@ -55,7 +55,7 @@
gpointer user_data);
static gboolean feature_ping_send_keep_alive (LmFeaturePing *fp);
-G_DEFINE_TYPE (LmFeaturePing, lm_feature_ping, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (LmFeaturePing, lm_feature_ping, G_TYPE_OBJECT)
enum {
PROP_0,
@@ -103,8 +103,6 @@
NULL, NULL,
_lm_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
- g_type_class_add_private (object_class, sizeof (LmFeaturePingPriv));
}
static void
@@ -127,7 +125,7 @@
GValue *value,
GParamSpec *pspec)
{
- LmFeaturePingPriv *priv;
+ LmFeaturePingPrivate *priv;
priv = GET_PRIV (object);
@@ -147,7 +145,7 @@
const GValue *value,
GParamSpec *pspec)
{
- LmFeaturePingPriv *priv;
+ LmFeaturePingPrivate *priv;
priv = GET_PRIV (object);
@@ -171,7 +169,7 @@
LmMessage *m,
gpointer user_data)
{
- LmFeaturePingPriv *priv;
+ LmFeaturePingPrivate *priv;
priv = GET_PRIV (user_data);
@@ -183,7 +181,7 @@
static gboolean
feature_ping_send_keep_alive (LmFeaturePing *fp)
{
- LmFeaturePingPriv *priv;
+ LmFeaturePingPrivate *priv;
LmMessage *ping;
LmMessageNode *ping_node;
LmMessageHandler *keep_alive_handler;
@@ -237,7 +235,7 @@
void
lm_feature_ping_start (LmFeaturePing *fp)
{
- LmFeaturePingPriv *priv;
+ LmFeaturePingPrivate *priv;
g_return_if_fail (LM_IS_FEATURE_PING (fp));
@@ -260,7 +258,7 @@
void
lm_feature_ping_stop (LmFeaturePing *fp)
{
- LmFeaturePingPriv *priv;
+ LmFeaturePingPrivate *priv;
g_return_if_fail (LM_IS_FEATURE_PING (fp));
--- a/loudmouth/lm-resolver.c Wed Sep 26 21:45:08 2018 +0200
+++ b/loudmouth/lm-resolver.c Thu Sep 27 21:38:25 2018 +0200
@@ -36,10 +36,10 @@
#include "lm-marshal.h"
#include "lm-resolver.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_RESOLVER, LmResolverPriv))
+#define GET_PRIV(obj) (lm_resolver_get_instance_private (LM_RESOLVER(obj)))
-typedef struct LmResolverPriv LmResolverPriv;
-struct LmResolverPriv {
+typedef struct LmResolverPrivate LmResolverPrivate;
+struct LmResolverPrivate {
GMainContext *context;
LmResolverCallback callback;
@@ -72,7 +72,7 @@
const GValue *value,
GParamSpec *pspec);
-G_DEFINE_TYPE (LmResolver, lm_resolver, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (LmResolver, lm_resolver, G_TYPE_OBJECT)
enum {
PROP_0,
@@ -153,8 +153,6 @@
"Protocol for SRV lookup",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
- g_type_class_add_private (object_class, sizeof (LmResolverPriv));
}
static void
@@ -165,7 +163,7 @@
static void
resolver_dispose (GObject *object)
{
- LmResolverPriv *priv = GET_PRIV (object);
+ LmResolverPrivate *priv = GET_PRIV (object);
if (priv->context) {
g_main_context_unref (priv->context);
@@ -178,7 +176,7 @@
static void
resolver_finalize (GObject *object)
{
- LmResolverPriv *priv;
+ LmResolverPrivate *priv;
priv = GET_PRIV (object);
@@ -200,7 +198,7 @@
GValue *value,
GParamSpec *pspec)
{
- LmResolverPriv *priv;
+ LmResolverPrivate *priv;
priv = GET_PRIV (object);
@@ -238,7 +236,7 @@
const GValue *value,
GParamSpec *pspec)
{
- LmResolverPriv *priv;
+ LmResolverPrivate *priv;
priv = GET_PRIV (object);
@@ -311,7 +309,7 @@
gpointer user_data)
{
LmResolver *resolver;
- LmResolverPriv *priv;
+ LmResolverPrivate *priv;
g_return_val_if_fail (host != NULL, NULL);
g_return_val_if_fail (callback != NULL, NULL);
@@ -337,7 +335,7 @@
gpointer user_data)
{
LmResolver *resolver;
- LmResolverPriv *priv;
+ LmResolverPrivate *priv;
g_return_val_if_fail (domain != NULL, NULL);
g_return_val_if_fail (service != NULL, NULL);
@@ -383,7 +381,7 @@
struct addrinfo *
lm_resolver_results_get_next (LmResolver *resolver)
{
- LmResolverPriv *priv;
+ LmResolverPrivate *priv;
struct addrinfo *ret_val;
g_return_val_if_fail (LM_IS_RESOLVER (resolver), NULL);
@@ -411,7 +409,7 @@
void
lm_resolver_results_reset (LmResolver *resolver)
{
- LmResolverPriv *priv;
+ LmResolverPrivate *priv;
g_return_if_fail (LM_IS_RESOLVER (resolver));
@@ -437,7 +435,7 @@
LmResolverResult result,
struct addrinfo *results)
{
- LmResolverPriv *priv;
+ LmResolverPrivate *priv;
g_return_if_fail (LM_IS_RESOLVER (resolver));