[libsoup/carlosgc/notify-by-pspec: 2/2] Use g_object_notify_by_pspec instead of g_object_notify
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/carlosgc/notify-by-pspec: 2/2] Use g_object_notify_by_pspec instead of g_object_notify
- Date: Tue, 4 May 2021 11:42:28 +0000 (UTC)
commit 24d9c48c5a6cf4cecb9b46762a2a0addf097f993
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Tue May 4 09:38:54 2021 +0200
Use g_object_notify_by_pspec instead of g_object_notify
libsoup/auth/soup-auth.c | 42 +++---
libsoup/cache/soup-cache.c | 40 ++---
libsoup/content-decoder/soup-converter-wrapper.c | 42 +++---
.../content-sniffer/soup-content-sniffer-stream.c | 16 +-
libsoup/cookies/soup-cookie-jar-db.c | 11 +-
libsoup/cookies/soup-cookie-jar-text.c | 11 +-
libsoup/cookies/soup-cookie-jar.c | 18 ++-
libsoup/hsts/soup-hsts-enforcer-db.c | 11 +-
libsoup/server/soup-auth-domain-basic.c | 20 +--
libsoup/server/soup-auth-domain-digest.c | 20 +--
libsoup/server/soup-auth-domain.c | 44 +++---
libsoup/server/soup-server.c | 27 ++--
libsoup/server/soup-socket.c | 63 ++++----
libsoup/soup-body-input-stream.c | 19 ++-
libsoup/soup-body-output-stream.c | 19 ++-
libsoup/soup-client-input-stream.c | 13 +-
libsoup/soup-connection.c | 52 +++----
libsoup/soup-io-stream.c | 19 ++-
libsoup/soup-logger-input-stream.c | 18 ++-
libsoup/soup-logger.c | 16 +-
libsoup/soup-message.c | 114 +++++++-------
libsoup/soup-multipart-input-stream.c | 14 +-
libsoup/soup-session.c | 86 +++++------
libsoup/websocket/soup-websocket-connection.c | 168 +++++++++++----------
24 files changed, 475 insertions(+), 428 deletions(-)
---
diff --git a/libsoup/auth/soup-auth.c b/libsoup/auth/soup-auth.c
index 7b1fb726..ff47113a 100644
--- a/libsoup/auth/soup-auth.c
+++ b/libsoup/auth/soup-auth.c
@@ -55,9 +55,11 @@ enum {
PROP_IS_AUTHENTICATED,
PROP_IS_CANCELLED,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
static void
soup_auth_init (SoupAuth *auth)
{
@@ -168,80 +170,76 @@ soup_auth_class_init (SoupAuthClass *auth_class)
*
* The authentication scheme name.
**/
- g_object_class_install_property (
- object_class, PROP_SCHEME_NAME,
+ properties[PROP_SCHEME_NAME] =
g_param_spec_string ("scheme-name",
"Scheme name",
"Authentication scheme name",
NULL,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupAuth:realm:
*
* The authentication realm.
**/
- g_object_class_install_property (
- object_class, PROP_REALM,
+ properties[PROP_REALM] =
g_param_spec_string ("realm",
"Realm",
"Authentication realm",
NULL,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupAuth:authority:
*
* The authority (host:port) being authenticated to.
**/
- g_object_class_install_property (
- object_class, PROP_AUTHORITY,
+ properties[PROP_AUTHORITY] =
g_param_spec_string ("authority",
"Authority",
"Authentication authority",
NULL,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupAuth:is-for-proxy:
*
* Whether or not the auth is for a proxy server.
**/
- g_object_class_install_property (
- object_class, PROP_IS_FOR_PROXY,
+ properties[PROP_IS_FOR_PROXY] =
g_param_spec_boolean ("is-for-proxy",
"For Proxy",
"Whether or not the auth is for a proxy server",
FALSE,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupAuth:is-authenticated:
*
* Whether or not the auth has been authenticated.
**/
- g_object_class_install_property (
- object_class, PROP_IS_AUTHENTICATED,
+ properties[PROP_IS_AUTHENTICATED] =
g_param_spec_boolean ("is-authenticated",
"Authenticated",
"Whether or not the auth is authenticated",
FALSE,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupAuth:is-cancelled:
*
* An alias for the #SoupAuth:is-cancelled property.
* (Whether or not the auth has been cancelled.)
**/
- g_object_class_install_property (
- object_class, PROP_IS_CANCELLED,
+ properties[PROP_IS_CANCELLED] =
g_param_spec_boolean ("is-cancelled",
"Cancelled",
"Whether or not the auth is cancelled",
FALSE,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
/**
@@ -351,7 +349,7 @@ soup_auth_update (SoupAuth *auth, SoupMessage *msg, const char *auth_header)
was_authenticated = soup_auth_is_authenticated (auth);
success = SOUP_AUTH_GET_CLASS (auth)->update (auth, msg, params);
if (was_authenticated != soup_auth_is_authenticated (auth))
- g_object_notify (G_OBJECT (auth), "is-authenticated");
+ g_object_notify_by_pspec (G_OBJECT (auth), properties[PROP_IS_AUTHENTICATED]);
soup_header_free_param_list (params);
return success;
}
@@ -382,7 +380,7 @@ soup_auth_authenticate (SoupAuth *auth, const char *username, const char *passwo
was_authenticated = soup_auth_is_authenticated (auth);
SOUP_AUTH_GET_CLASS (auth)->authenticate (auth, username, password);
if (was_authenticated != soup_auth_is_authenticated (auth))
- g_object_notify (G_OBJECT (auth), "is-authenticated");
+ g_object_notify_by_pspec (G_OBJECT (auth), properties[PROP_IS_AUTHENTICATED]);
}
/**
@@ -406,7 +404,7 @@ soup_auth_cancel (SoupAuth *auth)
return;
priv->cancelled = TRUE;
- g_object_notify (G_OBJECT (auth), "is-cancelled");
+ g_object_notify_by_pspec (G_OBJECT (auth), properties[PROP_IS_CANCELLED]);
}
/**
diff --git a/libsoup/cache/soup-cache.c b/libsoup/cache/soup-cache.c
index a33be803..2d78bfab 100644
--- a/libsoup/cache/soup-cache.c
+++ b/libsoup/cache/soup-cache.c
@@ -132,9 +132,13 @@ typedef struct {
enum {
PROP_0,
PROP_CACHE_DIR,
- PROP_CACHE_TYPE
+ PROP_CACHE_TYPE,
+
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
G_DEFINE_TYPE_WITH_CODE (SoupCache, soup_cache, G_TYPE_OBJECT,
G_ADD_PRIVATE (SoupCache)
G_IMPLEMENT_INTERFACE (SOUP_TYPE_SESSION_FEATURE,
@@ -1022,22 +1026,24 @@ soup_cache_class_init (SoupCacheClass *cache_class)
cache_class->get_cacheability = get_cacheability;
- g_object_class_install_property (gobject_class, PROP_CACHE_DIR,
- g_param_spec_string ("cache-dir",
- "Cache directory",
- "The directory to store the cache files",
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CACHE_TYPE,
- g_param_spec_enum ("cache-type",
- "Cache type",
- "Whether the cache is private or shared",
- SOUP_TYPE_CACHE_TYPE,
- SOUP_CACHE_SINGLE_USER,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ properties[PROP_CACHE_DIR] =
+ g_param_spec_string ("cache-dir",
+ "Cache directory",
+ "The directory to store the cache files",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_CACHE_TYPE] =
+ g_param_spec_enum ("cache-type",
+ "Cache type",
+ "Whether the cache is private or shared",
+ SOUP_TYPE_CACHE_TYPE,
+ SOUP_CACHE_SINGLE_USER,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (gobject_class, LAST_PROPERTY, properties);
}
/**
diff --git a/libsoup/content-decoder/soup-converter-wrapper.c
b/libsoup/content-decoder/soup-converter-wrapper.c
index 6e5bbdbe..9b0bf160 100644
--- a/libsoup/content-decoder/soup-converter-wrapper.c
+++ b/libsoup/content-decoder/soup-converter-wrapper.c
@@ -29,9 +29,13 @@
enum {
PROP_0,
PROP_BASE_CONVERTER,
- PROP_MESSAGE
+ PROP_MESSAGE,
+
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
struct _SoupConverterWrapper {
GObject parent;
};
@@ -136,24 +140,24 @@ soup_converter_wrapper_class_init (SoupConverterWrapperClass *klass)
gobject_class->get_property = soup_converter_wrapper_get_property;
gobject_class->set_property = soup_converter_wrapper_set_property;
- g_object_class_install_property (gobject_class,
- PROP_BASE_CONVERTER,
- g_param_spec_object ("base-converter",
- "Base GConverter",
- "GConverter to wrap",
- G_TYPE_CONVERTER,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class,
- PROP_MESSAGE,
- g_param_spec_object ("message",
- "Message",
- "Associated SoupMessage",
- SOUP_TYPE_MESSAGE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ properties[PROP_BASE_CONVERTER] =
+ g_param_spec_object ("base-converter",
+ "Base GConverter",
+ "GConverter to wrap",
+ G_TYPE_CONVERTER,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_MESSAGE] =
+ g_param_spec_object ("message",
+ "Message",
+ "Associated SoupMessage",
+ SOUP_TYPE_MESSAGE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (gobject_class, LAST_PROPERTY, properties);
}
GConverter *
diff --git a/libsoup/content-sniffer/soup-content-sniffer-stream.c
b/libsoup/content-sniffer/soup-content-sniffer-stream.c
index 242049e1..2cd054c9 100644
--- a/libsoup/content-sniffer/soup-content-sniffer-stream.c
+++ b/libsoup/content-sniffer/soup-content-sniffer-stream.c
@@ -19,8 +19,12 @@ enum {
PROP_SNIFFER,
PROP_MESSAGE,
+
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
struct _SoupContentSnifferStream {
GFilterInputStream parent_instance;
};
@@ -320,20 +324,20 @@ soup_content_sniffer_stream_class_init (SoupContentSnifferStreamClass *sniffer_c
input_stream_class->read_fn = soup_content_sniffer_stream_read;
input_stream_class->skip = soup_content_sniffer_stream_skip;
- g_object_class_install_property (
- object_class, PROP_SNIFFER,
+ properties[PROP_SNIFFER] =
g_param_spec_object ("sniffer",
"Sniffer",
"The stream's SoupContentSniffer",
SOUP_TYPE_CONTENT_SNIFFER,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_MESSAGE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+ properties[PROP_MESSAGE] =
g_param_spec_object ("message",
"Message",
"The stream's SoupMessage",
SOUP_TYPE_MESSAGE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
static void
diff --git a/libsoup/cookies/soup-cookie-jar-db.c b/libsoup/cookies/soup-cookie-jar-db.c
index 683ade31..cddce635 100644
--- a/libsoup/cookies/soup-cookie-jar-db.c
+++ b/libsoup/cookies/soup-cookie-jar-db.c
@@ -41,9 +41,11 @@ enum {
PROP_FILENAME,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
struct _SoupCookieJarDB {
SoupCookieJar parent;
};
@@ -337,12 +339,13 @@ soup_cookie_jar_db_class_init (SoupCookieJarDBClass *db_class)
object_class->set_property = soup_cookie_jar_db_set_property;
object_class->get_property = soup_cookie_jar_db_get_property;
- g_object_class_install_property (
- object_class, PROP_FILENAME,
+ properties[PROP_FILENAME] =
g_param_spec_string ("filename",
"Filename",
"Cookie-storage filename",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
diff --git a/libsoup/cookies/soup-cookie-jar-text.c b/libsoup/cookies/soup-cookie-jar-text.c
index e6f7f6c4..25625529 100644
--- a/libsoup/cookies/soup-cookie-jar-text.c
+++ b/libsoup/cookies/soup-cookie-jar-text.c
@@ -35,9 +35,11 @@ enum {
PROP_FILENAME,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
struct _SoupCookieJarText {
SoupCookieJar parent;
@@ -392,12 +394,13 @@ soup_cookie_jar_text_class_init (SoupCookieJarTextClass *text_class)
object_class->set_property = soup_cookie_jar_text_set_property;
object_class->get_property = soup_cookie_jar_text_get_property;
- g_object_class_install_property (
- object_class, PROP_FILENAME,
+ properties[PROP_FILENAME] =
g_param_spec_string ("filename",
"Filename",
"Cookie-storage filename",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
diff --git a/libsoup/cookies/soup-cookie-jar.c b/libsoup/cookies/soup-cookie-jar.c
index 8deccb0f..ad593b7d 100644
--- a/libsoup/cookies/soup-cookie-jar.c
+++ b/libsoup/cookies/soup-cookie-jar.c
@@ -52,9 +52,11 @@ enum {
PROP_READ_ONLY,
PROP_ACCEPT_POLICY,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
typedef struct {
gboolean constructed, read_only;
GHashTable *domains, *serials;
@@ -190,14 +192,13 @@ soup_cookie_jar_class_init (SoupCookieJarClass *jar_class)
SOUP_TYPE_COOKIE | G_SIGNAL_TYPE_STATIC_SCOPE,
SOUP_TYPE_COOKIE | G_SIGNAL_TYPE_STATIC_SCOPE);
- g_object_class_install_property (
- object_class, PROP_READ_ONLY,
+ properties[PROP_READ_ONLY] =
g_param_spec_boolean ("read-only",
"Read-only",
"Whether or not the cookie jar is read-only",
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupCookieJar:accept-policy:
@@ -205,15 +206,16 @@ soup_cookie_jar_class_init (SoupCookieJarClass *jar_class)
* The policy the jar should follow to accept or reject cookies
*
*/
- g_object_class_install_property (
- object_class, PROP_ACCEPT_POLICY,
+ properties[PROP_ACCEPT_POLICY] =
g_param_spec_enum ("accept-policy",
"Accept-policy",
"The policy the jar should follow to accept or reject cookies",
SOUP_TYPE_COOKIE_JAR_ACCEPT_POLICY,
SOUP_COOKIE_JAR_ACCEPT_ALWAYS,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
/**
@@ -1000,7 +1002,7 @@ soup_cookie_jar_set_accept_policy (SoupCookieJar *jar,
if (priv->accept_policy != policy) {
priv->accept_policy = policy;
- g_object_notify (G_OBJECT (jar), "accept-policy");
+ g_object_notify_by_pspec (G_OBJECT (jar), properties[PROP_ACCEPT_POLICY]);
}
}
diff --git a/libsoup/hsts/soup-hsts-enforcer-db.c b/libsoup/hsts/soup-hsts-enforcer-db.c
index 12733ce7..2a63df5b 100644
--- a/libsoup/hsts/soup-hsts-enforcer-db.c
+++ b/libsoup/hsts/soup-hsts-enforcer-db.c
@@ -37,9 +37,11 @@ enum {
PROP_FILENAME,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
struct _SoupHSTSEnforcerDB {
SoupHSTSEnforcer parent;
};
@@ -335,12 +337,13 @@ soup_hsts_enforcer_db_class_init (SoupHSTSEnforcerDBClass *db_class)
*
* The filename of the SQLite database where HSTS policies are stored.
**/
- g_object_class_install_property (
- object_class, PROP_FILENAME,
+ properties[PROP_FILENAME] =
g_param_spec_string ("filename",
"Filename",
"HSTS policy storage filename",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
diff --git a/libsoup/server/soup-auth-domain-basic.c b/libsoup/server/soup-auth-domain-basic.c
index ee0bb8ca..91594f5c 100644
--- a/libsoup/server/soup-auth-domain-basic.c
+++ b/libsoup/server/soup-auth-domain-basic.c
@@ -34,9 +34,11 @@ enum {
PROP_AUTH_CALLBACK,
PROP_AUTH_DATA,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
struct _SoupAuthDomainBasic {
SoupAuthDomain parent;
};
@@ -198,8 +200,8 @@ soup_auth_domain_basic_set_auth_callback (SoupAuthDomain *domain,
priv->auth_data = user_data;
priv->auth_dnotify = dnotify;
- g_object_notify (G_OBJECT (domain), "auth-callback");
- g_object_notify (G_OBJECT (domain), "auth-data");
+ g_object_notify_by_pspec (G_OBJECT (domain), properties[PROP_AUTH_CALLBACK]);
+ g_object_notify_by_pspec (G_OBJECT (domain), properties[PROP_AUTH_DATA]);
}
static void
@@ -323,23 +325,23 @@ soup_auth_domain_basic_class_init (SoupAuthDomainBasicClass *basic_class)
*
* The #SoupAuthDomainBasicAuthCallback
*/
- g_object_class_install_property (
- object_class, PROP_AUTH_CALLBACK,
+ properties[PROP_AUTH_CALLBACK] =
g_param_spec_pointer ("auth-callback",
"Authentication callback",
"Password-checking callback",
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupAuthDomainBasic:auth-data:
*
* The data to pass to the #SoupAuthDomainBasicAuthCallback
*/
- g_object_class_install_property (
- object_class, PROP_AUTH_DATA,
+ properties[PROP_AUTH_DATA] =
g_param_spec_pointer ("auth-data",
"Authentication callback data",
"Data to pass to authentication callback",
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
diff --git a/libsoup/server/soup-auth-domain-digest.c b/libsoup/server/soup-auth-domain-digest.c
index 73cbd261..f3740189 100644
--- a/libsoup/server/soup-auth-domain-digest.c
+++ b/libsoup/server/soup-auth-domain-digest.c
@@ -37,9 +37,11 @@ enum {
PROP_AUTH_CALLBACK,
PROP_AUTH_DATA,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
struct _SoupAuthDomainDigest {
SoupAuthDomain parent;
};
@@ -193,8 +195,8 @@ soup_auth_domain_digest_set_auth_callback (SoupAuthDomain *domain,
priv->auth_data = user_data;
priv->auth_dnotify = dnotify;
- g_object_notify (G_OBJECT (domain), "auth-callback");
- g_object_notify (G_OBJECT (domain), "auth-data");
+ g_object_notify_by_pspec (G_OBJECT (domain), properties[PROP_AUTH_CALLBACK]);
+ g_object_notify_by_pspec (G_OBJECT (domain), properties[PROP_AUTH_DATA]);
}
static gboolean
@@ -432,23 +434,23 @@ soup_auth_domain_digest_class_init (SoupAuthDomainDigestClass *digest_class)
*
* The #SoupAuthDomainDigestAuthCallback
*/
- g_object_class_install_property (
- object_class, PROP_AUTH_CALLBACK,
+ properties[PROP_AUTH_CALLBACK] =
g_param_spec_pointer ("auth-callback",
"Authentication callback",
"Password-finding callback",
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupAuthDomainDigest:auth-data:
*
* The data to pass to the #SoupAuthDomainDigestAuthCallback
*/
- g_object_class_install_property (
- object_class, PROP_AUTH_DATA,
+ properties[PROP_AUTH_DATA] =
g_param_spec_pointer ("auth-data",
"Authentication callback data",
"Data to pass to authentication callback",
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
diff --git a/libsoup/server/soup-auth-domain.c b/libsoup/server/soup-auth-domain.c
index 36dfdf5a..0e1c42b9 100644
--- a/libsoup/server/soup-auth-domain.c
+++ b/libsoup/server/soup-auth-domain.c
@@ -55,9 +55,11 @@ enum {
PROP_GENERIC_AUTH_CALLBACK,
PROP_GENERIC_AUTH_DATA,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
typedef struct {
char *realm;
gboolean proxy;
@@ -180,72 +182,68 @@ soup_auth_domain_class_init (SoupAuthDomainClass *auth_domain_class)
object_class->set_property = soup_auth_domain_set_property;
object_class->get_property = soup_auth_domain_get_property;
- g_object_class_install_property (
- object_class, PROP_REALM,
+ properties[PROP_REALM] =
g_param_spec_string ("realm",
"Realm",
"The realm of this auth domain",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (
- object_class, PROP_PROXY,
+ properties[PROP_PROXY] =
g_param_spec_boolean ("proxy",
"Proxy",
"Whether or not this is a proxy auth domain",
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupAuthDomain:filter: (type SoupAuthDomainFilter)
*
* The #SoupAuthDomainFilter for the domain.
*/
- g_object_class_install_property (
- object_class, PROP_FILTER,
+ properties[PROP_FILTER] =
g_param_spec_pointer ("filter",
"Filter",
"A filter for deciding whether or not to require authentication",
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupAuthDomain:filter-data:
*
* Data to pass to the #SoupAuthDomainFilter.
**/
- g_object_class_install_property (
- object_class, PROP_FILTER_DATA,
+ properties[PROP_FILTER_DATA] =
g_param_spec_pointer ("filter-data",
"Filter data",
"Data to pass to filter",
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupAuthDomain:generic-auth-callback: (type SoupAuthDomainGenericAuthCallback)
*
* The #SoupAuthDomainGenericAuthCallback.
**/
- g_object_class_install_property (
- object_class, PROP_GENERIC_AUTH_CALLBACK,
+ properties[PROP_GENERIC_AUTH_CALLBACK] =
g_param_spec_pointer ("generic-auth-callback",
"Generic authentication callback",
"An authentication callback that can be used with any SoupAuthDomain
subclass",
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupAuthDomain:generic-auth-data:
*
* The data to pass to the #SoupAuthDomainGenericAuthCallback.
**/
- g_object_class_install_property (
- object_class, PROP_GENERIC_AUTH_DATA,
+ properties[PROP_GENERIC_AUTH_DATA] =
g_param_spec_pointer ("generic-auth-data",
"Authentication callback data",
"Data to pass to auth callback",
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
/**
@@ -365,8 +363,8 @@ soup_auth_domain_set_filter (SoupAuthDomain *domain,
priv->filter_data = filter_data;
priv->filter_dnotify = dnotify;
- g_object_notify (G_OBJECT (domain), "filter");
- g_object_notify (G_OBJECT (domain), "filter-data");
+ g_object_notify_by_pspec (G_OBJECT (domain), properties[PROP_FILTER]);
+ g_object_notify_by_pspec (G_OBJECT (domain), properties[PROP_FILTER_DATA]);
}
/**
@@ -443,8 +441,8 @@ soup_auth_domain_set_generic_auth_callback (SoupAuthDomain *domain,
priv->auth_data = auth_data;
priv->auth_dnotify = dnotify;
- g_object_notify (G_OBJECT (domain), "generic-auth-callback");
- g_object_notify (G_OBJECT (domain), "generic-auth-data");
+ g_object_notify_by_pspec (G_OBJECT (domain), properties[PROP_GENERIC_AUTH_CALLBACK]);
+ g_object_notify_by_pspec (G_OBJECT (domain), properties[PROP_GENERIC_AUTH_DATA]);
}
gboolean
diff --git a/libsoup/server/soup-server.c b/libsoup/server/soup-server.c
index fbefdeae..25ae5924 100644
--- a/libsoup/server/soup-server.c
+++ b/libsoup/server/soup-server.c
@@ -187,9 +187,11 @@ enum {
PROP_RAW_PATHS,
PROP_SERVER_HEADER,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
G_DEFINE_TYPE_WITH_PRIVATE (SoupServer, soup_server, G_TYPE_OBJECT)
static void start_request (SoupServer *server,
@@ -437,21 +439,23 @@ soup_server_class_init (SoupServerClass *server_class)
* to have #SoupServer read in a a certificate from a file.
*
*/
- g_object_class_install_property (
- object_class, PROP_TLS_CERTIFICATE,
+ properties[PROP_TLS_CERTIFICATE] =
g_param_spec_object ("tls-certificate",
"TLS certificate",
"GTlsCertificate to use for https",
G_TYPE_TLS_CERTIFICATE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (
- object_class, PROP_RAW_PATHS,
+ properties[PROP_RAW_PATHS] =
g_param_spec_boolean ("raw-paths",
"Raw paths",
"If %TRUE, percent-encoding in the Request-URI path will not be
automatically decoded.",
FALSE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
/**
* SoupServer:server-header:
@@ -481,13 +485,16 @@ soup_server_class_init (SoupServerClass *server_class)
* "<literal>libsoup/2.3.2</literal>") to the end of the
* header for you.
**/
- g_object_class_install_property (
- object_class, PROP_SERVER_HEADER,
+ properties[PROP_SERVER_HEADER] =
g_param_spec_string ("server-header",
"Server header",
"Server header",
NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
/**
diff --git a/libsoup/server/soup-socket.c b/libsoup/server/soup-socket.c
index bfa5f5bb..208634cf 100644
--- a/libsoup/server/soup-socket.c
+++ b/libsoup/server/soup-socket.c
@@ -47,9 +47,11 @@ enum {
PROP_IPV6_ONLY,
PROP_TLS_CERTIFICATE,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
struct _SoupSocket {
GObject parent_instance;
};
@@ -307,67 +309,62 @@ soup_socket_class_init (SoupSocketClass *socket_class)
SOUP_TYPE_SOCKET);
/* properties */
- g_object_class_install_property (
- object_class, PROP_GSOCKET,
- g_param_spec_object ("gsocket",
- "GSocket",
- "The socket's underlying GSocket",
- G_TYPE_SOCKET,
- G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_IOSTREAM,
- g_param_spec_object ("iostream",
- "GIOStream",
- "The socket's underlying GIOStream",
- G_TYPE_IO_STREAM,
- G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (
- object_class, PROP_LOCAL_ADDRESS,
+ properties[PROP_GSOCKET] =
+ g_param_spec_object ("gsocket",
+ "GSocket",
+ "The socket's underlying GSocket",
+ G_TYPE_SOCKET,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_IOSTREAM] =
+ g_param_spec_object ("iostream",
+ "GIOStream",
+ "The socket's underlying GIOStream",
+ G_TYPE_IO_STREAM,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_LOCAL_ADDRESS] =
g_param_spec_object ("local-address",
"Local address",
"Address of local end of socket",
G_TYPE_INET_SOCKET_ADDRESS,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (
- object_class, PROP_REMOTE_ADDRESS,
+ properties[PROP_REMOTE_ADDRESS] =
g_param_spec_object ("remote-address",
"Remote address",
"Address of remote end of socket",
G_TYPE_SOCKET_ADDRESS,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (
- object_class, PROP_REMOTE_CONNECTABLE,
+ properties[PROP_REMOTE_CONNECTABLE] =
g_param_spec_object ("remote-connectable",
"Remote address",
"Address to connect to",
G_TYPE_SOCKET_CONNECTABLE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (
- object_class, PROP_IPV6_ONLY,
+ properties[PROP_IPV6_ONLY] =
g_param_spec_boolean ("ipv6-only",
"IPv6 only",
"IPv6 only",
FALSE,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (
- object_class, PROP_TLS_CERTIFICATE,
+ properties[PROP_TLS_CERTIFICATE] =
g_param_spec_object ("tls-certificate",
"TLS Certificate",
"The server TLS certificate",
G_TYPE_TLS_CERTIFICATE,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
static void
diff --git a/libsoup/soup-body-input-stream.c b/libsoup/soup-body-input-stream.c
index acf492ee..56363b5b 100644
--- a/libsoup/soup-body-input-stream.c
+++ b/libsoup/soup-body-input-stream.c
@@ -51,9 +51,13 @@ enum {
PROP_0,
PROP_ENCODING,
- PROP_CONTENT_LENGTH
+ PROP_CONTENT_LENGTH,
+
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
static void soup_body_input_stream_pollable_init (GPollableInputStreamInterface *pollable_interface,
gpointer interface_data);
static void soup_body_input_stream_seekable_init (GSeekableIface *seekable_interface);
@@ -390,21 +394,22 @@ soup_body_input_stream_class_init (SoupBodyInputStreamClass *stream_class)
NULL,
G_TYPE_NONE, 0);
- g_object_class_install_property (
- object_class, PROP_ENCODING,
+ properties[PROP_ENCODING] =
g_param_spec_enum ("encoding",
"Encoding",
"Message body encoding",
SOUP_TYPE_ENCODING,
SOUP_ENCODING_NONE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_CONTENT_LENGTH,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_CONTENT_LENGTH] =
g_param_spec_int64 ("content-length",
"Content-Length",
"Message body Content-Length",
-1, G_MAXINT64, -1,
- G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
static void
diff --git a/libsoup/soup-body-output-stream.c b/libsoup/soup-body-output-stream.c
index 58f8fd2f..464f2d97 100644
--- a/libsoup/soup-body-output-stream.c
+++ b/libsoup/soup-body-output-stream.c
@@ -41,9 +41,13 @@ enum {
PROP_0,
PROP_ENCODING,
- PROP_CONTENT_LENGTH
+ PROP_CONTENT_LENGTH,
+
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
enum {
WROTE_DATA,
@@ -366,23 +370,24 @@ soup_body_output_stream_class_init (SoupBodyOutputStreamClass *stream_class)
G_TYPE_UINT,
G_TYPE_BOOLEAN);
- g_object_class_install_property (
- object_class, PROP_ENCODING,
+ properties[PROP_ENCODING] =
g_param_spec_enum ("encoding",
"Encoding",
"Message body encoding",
SOUP_TYPE_ENCODING,
SOUP_ENCODING_NONE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_CONTENT_LENGTH,
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_CONTENT_LENGTH] =
g_param_spec_uint64 ("content-length",
"Content-Length",
"Message body Content-Length",
0, G_MAXUINT64, 0,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
static void
diff --git a/libsoup/soup-client-input-stream.c b/libsoup/soup-client-input-stream.c
index a95bfe41..e32b90f8 100644
--- a/libsoup/soup-client-input-stream.c
+++ b/libsoup/soup-client-input-stream.c
@@ -34,9 +34,13 @@ static guint signals[LAST_SIGNAL] = { 0 };
enum {
PROP_0,
- PROP_MESSAGE
+ PROP_MESSAGE,
+
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
static GPollableInputStreamInterface *soup_client_input_stream_parent_pollable_interface;
static void soup_client_input_stream_pollable_init (GPollableInputStreamInterface *pollable_interface,
gpointer interface_data);
@@ -279,14 +283,15 @@ soup_client_input_stream_class_init (SoupClientInputStreamClass *stream_class)
NULL,
G_TYPE_NONE, 0);
- g_object_class_install_property (
- object_class, PROP_MESSAGE,
+ properties[PROP_MESSAGE] =
g_param_spec_object ("message",
"Message",
"Message",
SOUP_TYPE_MESSAGE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
static void
diff --git a/libsoup/soup-connection.c b/libsoup/soup-connection.c
index 2f2a2a47..a7666246 100644
--- a/libsoup/soup-connection.c
+++ b/libsoup/soup-connection.c
@@ -66,9 +66,11 @@ enum {
PROP_TLS_CERTIFICATE,
PROP_TLS_CERTIFICATE_ERRORS,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
static void stop_idle_timer (SoupConnectionPrivate *priv);
/* Number of seconds after which we close a connection that hasn't yet
@@ -227,69 +229,63 @@ soup_connection_class_init (SoupConnectionClass *connection_class)
G_TYPE_NONE, 0);
/* properties */
- g_object_class_install_property (
- object_class, PROP_REMOTE_CONNECTABLE,
+ properties[PROP_REMOTE_CONNECTABLE] =
g_param_spec_object ("remote-connectable",
"Remote Connectable",
"Socket to connect to make outgoing connections on",
G_TYPE_SOCKET_CONNECTABLE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_REMOTE_ADDRESS,
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_REMOTE_ADDRESS] =
g_param_spec_object ("remote-address",
"Remote Address",
"Remote address of connection",
G_TYPE_SOCKET_ADDRESS,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_SOCKET_PROPERTIES,
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_SOCKET_PROPERTIES] =
g_param_spec_boxed ("socket-properties",
"Socket properties",
"Socket properties",
SOUP_TYPE_SOCKET_PROPERTIES,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_STATE,
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_STATE] =
g_param_spec_enum ("state",
"Connection state",
"Current state of connection",
SOUP_TYPE_CONNECTION_STATE, SOUP_CONNECTION_NEW,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_SSL,
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_SSL] =
g_param_spec_boolean ("ssl",
"Connection uses TLS",
"Whether the connection should use TLS",
FALSE,G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_ID,
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_ID] =
g_param_spec_uint64 ("id",
"Connection Identifier",
"Unique identifier for the connection",
0, G_MAXUINT64,
0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_TLS_CERTIFICATE,
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_TLS_CERTIFICATE] =
g_param_spec_object ("tls-certificate",
"TLS Certificate",
"The TLS certificate associated with the connection",
G_TYPE_TLS_CERTIFICATE,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_TLS_CERTIFICATE_ERRORS,
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_TLS_CERTIFICATE_ERRORS] =
g_param_spec_flags ("tls-certificate-errors",
"TLS Certificate Errors",
"The verification errors on the connections's TLS certificate",
G_TYPE_TLS_CERTIFICATE_FLAGS, 0,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
static void
@@ -461,7 +457,7 @@ tls_connection_accept_certificate (SoupConnection *conn,
static void
tls_connection_peer_certificate_changed (SoupConnection *conn)
{
- g_object_notify (G_OBJECT (conn), "tls-certificate");
+ g_object_notify_by_pspec (G_OBJECT (conn), properties[PROP_TLS_CERTIFICATE]);
}
static GTlsClientConnection *
@@ -509,7 +505,7 @@ soup_connection_connected (SoupConnection *conn,
g_clear_object (&priv->remote_address);
priv->remote_address = g_socket_get_remote_address (socket, NULL);
- g_object_notify (G_OBJECT (conn), "remote-address");
+ g_object_notify_by_pspec (G_OBJECT (conn), properties[PROP_REMOTE_ADDRESS]);
if (priv->remote_address && G_IS_PROXY_ADDRESS (priv->remote_address)) {
GProxyAddress *paddr = G_PROXY_ADDRESS (priv->remote_address);
@@ -1020,7 +1016,7 @@ soup_connection_set_state (SoupConnection *conn, SoupConnectionState state)
if (priv->state == SOUP_CONNECTION_IDLE)
start_idle_timer (conn);
- g_object_notify (G_OBJECT (conn), "state");
+ g_object_notify_by_pspec (G_OBJECT (conn), properties[PROP_STATE]);
}
g_object_thaw_notify (G_OBJECT (conn));
diff --git a/libsoup/soup-io-stream.c b/libsoup/soup-io-stream.c
index 4756c894..36ceb6d9 100644
--- a/libsoup/soup-io-stream.c
+++ b/libsoup/soup-io-stream.c
@@ -30,9 +30,13 @@ enum {
PROP_0,
PROP_BASE_IOSTREAM,
- PROP_CLOSE_ON_DISPOSE
+ PROP_CLOSE_ON_DISPOSE,
+
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
G_DEFINE_TYPE_WITH_PRIVATE (SoupIOStream, soup_io_stream, G_TYPE_IO_STREAM)
static void
@@ -204,24 +208,25 @@ soup_io_stream_class_init (SoupIOStreamClass *stream_class)
io_stream_class->close_async = soup_io_stream_close_async;
io_stream_class->close_finish = soup_io_stream_close_finish;
- g_object_class_install_property (
- object_class, PROP_BASE_IOSTREAM,
+ properties[PROP_BASE_IOSTREAM] =
g_param_spec_object ("base-iostream",
"Base IOStream",
"Base GIOStream",
G_TYPE_IO_STREAM,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_CLOSE_ON_DISPOSE,
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_CLOSE_ON_DISPOSE] =
g_param_spec_boolean ("close-on-dispose",
"Close base stream",
"Close base GIOStream when closing",
TRUE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
GIOStream *
diff --git a/libsoup/soup-logger-input-stream.c b/libsoup/soup-logger-input-stream.c
index 6b7c6100..bbc5f8ce 100644
--- a/libsoup/soup-logger-input-stream.c
+++ b/libsoup/soup-logger-input-stream.c
@@ -9,9 +9,15 @@
#include "soup.h"
enum {
- PROP_LOGGER = 1
+ PROP_0,
+
+ PROP_LOGGER,
+
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
enum {
READ_DATA,
LAST_SIGNAL
@@ -200,14 +206,16 @@ soup_logger_input_stream_class_init (SoupLoggerInputStreamClass *klass)
2,
G_TYPE_POINTER, G_TYPE_INT);
- g_object_class_install_property (
- object_class, PROP_LOGGER,
+ properties[PROP_LOGGER] =
g_param_spec_object ("logger",
"Logger",
"The stream's SoupLogger",
SOUP_TYPE_LOGGER,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
static void
diff --git a/libsoup/soup-logger.c b/libsoup/soup-logger.c
index dab00f55..0c56d797 100644
--- a/libsoup/soup-logger.c
+++ b/libsoup/soup-logger.c
@@ -127,9 +127,11 @@ enum {
PROP_LEVEL,
PROP_MAX_BODY_SIZE,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
static void body_ostream_done (gpointer data, GObject *bostream);
static void soup_logger_session_feature_init (SoupSessionFeatureInterface *feature_interface, gpointer
interface_data);
@@ -335,15 +337,14 @@ soup_logger_class_init (SoupLoggerClass *logger_class)
* The level of logging output
*
*/
- g_object_class_install_property (
- object_class, PROP_LEVEL,
+ properties[PROP_LEVEL] =
g_param_spec_enum ("level",
"Level",
"The level of logging output",
SOUP_TYPE_LOGGER_LOG_LEVEL,
SOUP_LOGGER_LOG_MINIMAL,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupLogger:max-body-size:
*
@@ -352,8 +353,7 @@ soup_logger_class_init (SoupLoggerClass *logger_class)
* (-1 means "no limit".)
*
**/
- g_object_class_install_property (
- object_class, PROP_MAX_BODY_SIZE,
+ properties[PROP_MAX_BODY_SIZE] =
g_param_spec_int ("max-body-size",
"Max Body Size",
"The maximum body size to output",
@@ -361,7 +361,9 @@ soup_logger_class_init (SoupLoggerClass *logger_class)
G_MAXINT,
-1,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
/**
diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c
index d29afe11..b5c177dd 100644
--- a/libsoup/soup-message.c
+++ b/libsoup/soup-message.c
@@ -145,9 +145,11 @@ enum {
PROP_IS_TOP_LEVEL_NAVIGATION,
PROP_IS_OPTIONS_PING,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
static void
soup_message_init (SoupMessage *msg)
{
@@ -609,56 +611,50 @@ soup_message_class_init (SoupMessageClass *message_class)
G_TYPE_NONE, 0);
/* properties */
- g_object_class_install_property (
- object_class, PROP_METHOD,
+ properties[PROP_METHOD] =
g_param_spec_string ("method",
"Method",
"The message's HTTP method",
SOUP_METHOD_GET,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_URI,
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_URI] =
g_param_spec_boxed ("uri",
"URI",
"The message's Request-URI",
G_TYPE_URI,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_HTTP_VERSION,
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_HTTP_VERSION] =
g_param_spec_enum ("http-version",
"HTTP Version",
"The HTTP protocol version to use",
SOUP_TYPE_HTTP_VERSION,
SOUP_HTTP_1_1,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_FLAGS,
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_FLAGS] =
g_param_spec_flags ("flags",
"Flags",
"Various message options",
SOUP_TYPE_MESSAGE_FLAGS,
0,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_STATUS_CODE,
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_STATUS_CODE] =
g_param_spec_uint ("status-code",
"Status code",
"The HTTP response status code",
0, 999, 0,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_REASON_PHRASE,
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_REASON_PHRASE] =
g_param_spec_string ("reason-phrase",
"Reason phrase",
"The HTTP response reason phrase",
NULL,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupMessage:first-party:
*
@@ -666,98 +662,90 @@ soup_message_class_init (SoupMessageClass *message_class)
* queued.
*
*/
- g_object_class_install_property (
- object_class, PROP_FIRST_PARTY,
+ properties[PROP_FIRST_PARTY] =
g_param_spec_boxed ("first-party",
"First party",
"The URI loaded in the application when the message was requested.",
G_TYPE_URI,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupMessage:site-for-cookkies:
*
* Site used to compare cookies against. Used for SameSite cookie support.
*
*/
- g_object_class_install_property (
- object_class, PROP_SITE_FOR_COOKIES,
+ properties[PROP_SITE_FOR_COOKIES] =
g_param_spec_boxed ("site-for-cookies",
"Site for cookies",
"The URI for the site to compare cookies against",
G_TYPE_URI,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE);
/**
* SoupMessage:is-top-level-navigation:
*
* Set when the message is navigating between top level domains.
*
*/
- g_object_class_install_property (
- object_class, PROP_IS_TOP_LEVEL_NAVIGATION,
+ properties[PROP_IS_TOP_LEVEL_NAVIGATION] =
g_param_spec_boolean ("is-top-level-navigation",
"Is top-level navigation",
"If the current messsage is navigating between top-levels",
FALSE,
- G_PARAM_READWRITE));
- g_object_class_install_property (
- object_class, PROP_REQUEST_HEADERS,
+ G_PARAM_READWRITE);
+ properties[PROP_REQUEST_HEADERS] =
g_param_spec_boxed ("request-headers",
"Request Headers",
"The HTTP request headers",
SOUP_TYPE_MESSAGE_HEADERS,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (
- object_class, PROP_RESPONSE_HEADERS,
+ G_PARAM_STATIC_STRINGS);
+ properties[PROP_RESPONSE_HEADERS] =
g_param_spec_boxed ("response-headers",
"Response Headers",
"The HTTP response headers",
SOUP_TYPE_MESSAGE_HEADERS,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupMessage:tls-peer-certificate:
*
* The peer's #GTlsCertificate associated with the message
*
*/
- g_object_class_install_property (
- object_class, PROP_TLS_PEER_CERTIFICATE,
+ properties[PROP_TLS_PEER_CERTIFICATE] =
g_param_spec_object ("tls-peer-certificate",
"TLS Peer Certificate",
"The TLS peer certificate associated with the message",
G_TYPE_TLS_CERTIFICATE,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupMessage:tls-peer-certificate-errors:
*
* The verification errors on #SoupMessage:tls-peer-certificate
*
*/
- g_object_class_install_property (
- object_class, PROP_TLS_PEER_CERTIFICATE_ERRORS,
+ properties[PROP_TLS_PEER_CERTIFICATE_ERRORS] =
g_param_spec_flags ("tls-peer-certificate-errors",
"TLS Peer Certificate Errors",
"The verification errors on the message's TLS peer certificate",
G_TYPE_TLS_CERTIFICATE_FLAGS, 0,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupMessage:remote-address:
*
* The remote #GSocketAddress of the connection associated with the message
*
*/
- g_object_class_install_property (
- object_class, PROP_REMOTE_ADDRESS,
+ properties[PROP_REMOTE_ADDRESS] =
g_param_spec_object ("remote-address",
"Remote Address",
"The remote address of the connection associated with the message",
G_TYPE_SOCKET_ADDRESS,
G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
SoupMessage:priority:
*
@@ -765,15 +753,14 @@ soup_message_class_init (SoupMessageClass *message_class)
* soup_message_set_priority() for further details.
*
**/
- g_object_class_install_property (
- object_class, PROP_PRIORITY,
+ properties[PROP_PRIORITY] =
g_param_spec_enum ("priority",
"Priority",
"The priority of the message",
SOUP_TYPE_MESSAGE_PRIORITY,
SOUP_MESSAGE_PRIORITY_NORMAL,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupMessage:is-options-ping:
@@ -783,14 +770,15 @@ soup_message_class_init (SoupMessageClass *message_class)
* path of #SoupMessage:uri will be ignored and
* #SoupMessage:method set to %SOUP_METHOD_OPTIONS.
*/
- g_object_class_install_property (
- object_class, PROP_IS_OPTIONS_PING,
+ properties[PROP_IS_OPTIONS_PING] =
g_param_spec_boolean ("is-options-ping",
"Is Options Ping",
"The message is an OPTIONS ping",
FALSE,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
@@ -1323,8 +1311,8 @@ soup_message_set_tls_peer_certificate (SoupMessage *msg,
g_clear_object (&priv->tls_peer_certificate);
priv->tls_peer_certificate = tls_certificate ? g_object_ref (tls_certificate) : NULL;
priv->tls_peer_certificate_errors = tls_errors;
- g_object_notify (G_OBJECT (msg), "tls-peer-certificate");
- g_object_notify (G_OBJECT (msg), "tls-peer-certificate-errors");
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_TLS_PEER_CERTIFICATE]);
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_TLS_PEER_CERTIFICATE_ERRORS]);
}
static void
@@ -1338,7 +1326,7 @@ soup_message_set_remote_address (SoupMessage *msg,
g_clear_object (&priv->remote_address);
priv->remote_address = address ? g_object_ref (address) : NULL;
- g_object_notify (G_OBJECT (msg), "remote-address");
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_REMOTE_ADDRESS]);
}
SoupConnection *
@@ -1536,7 +1524,7 @@ soup_message_set_flags (SoupMessage *msg, SoupMessageFlags flags)
return;
priv->msg_flags = flags;
- g_object_notify (G_OBJECT (msg), "flags");
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_FLAGS]);
}
/**
@@ -1638,7 +1626,7 @@ soup_message_set_http_version (SoupMessage *msg, SoupHTTPVersion version)
priv->http_version = version;
if (priv->status_code == SOUP_STATUS_NONE)
priv->orig_http_version = version;
- g_object_notify (G_OBJECT (msg), "http-version");
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_HTTP_VERSION]);
}
/**
@@ -1742,7 +1730,7 @@ soup_message_set_uri (SoupMessage *msg, GUri *uri)
}
priv->uri = normalized_uri;
- g_object_notify (G_OBJECT (msg), "uri");
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_URI]);
}
/**
@@ -1784,7 +1772,7 @@ soup_message_set_status (SoupMessage *msg,
if (priv->status_code != status_code) {
priv->status_code = status_code;
- g_object_notify (G_OBJECT (msg), "status-code");
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_STATUS_CODE]);
}
if (reason_phrase) {
@@ -1949,7 +1937,7 @@ soup_message_set_first_party (SoupMessage *msg,
}
priv->first_party = g_steal_pointer (&first_party_normalized);
- g_object_notify (G_OBJECT (msg), "first-party");
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_FIRST_PARTY]);
}
/**
@@ -2013,7 +2001,7 @@ soup_message_set_site_for_cookies (SoupMessage *msg,
}
priv->site_for_cookies = g_steal_pointer (&site_for_cookies_normalized);
- g_object_notify (G_OBJECT (msg), "site-for-cookies");
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_SITE_FOR_COOKIES]);
}
/**
@@ -2039,7 +2027,7 @@ soup_message_set_is_top_level_navigation (SoupMessage *msg,
return;
priv->is_top_level_navigation = is_top_level_navigation;
- g_object_notify (G_OBJECT (msg), "is-top-level-navigation");
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_IS_TOP_LEVEL_NAVIGATION]);
}
/**
@@ -2157,7 +2145,7 @@ soup_message_set_priority (SoupMessage *msg,
return;
priv->priority = priority;
- g_object_notify (G_OBJECT (msg), "priority");
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_PRIORITY]);
}
/**
@@ -2453,7 +2441,7 @@ soup_message_set_reason_phrase (SoupMessage *msg, const char *reason_phrase)
g_free (priv->reason_phrase);
priv->reason_phrase = g_strdup (reason_phrase);
- g_object_notify (G_OBJECT (msg), "reason-phrase");
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_REASON_PHRASE]);
}
void
@@ -2467,7 +2455,7 @@ soup_message_set_method (SoupMessage *msg,
return;
priv->method = new_method;
- g_object_notify (G_OBJECT (msg), "method");
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_METHOD]);
}
/**
@@ -2512,7 +2500,7 @@ soup_message_set_is_options_ping (SoupMessage *msg,
return;
priv->is_options_ping = is_options_ping;
- g_object_notify (G_OBJECT (msg), "is-options-ping");
+ g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_IS_OPTIONS_PING]);
if (priv->is_options_ping)
soup_message_set_method (msg, SOUP_METHOD_OPTIONS);
}
diff --git a/libsoup/soup-multipart-input-stream.c b/libsoup/soup-multipart-input-stream.c
index 8dce93a2..c50dd715 100644
--- a/libsoup/soup-multipart-input-stream.c
+++ b/libsoup/soup-multipart-input-stream.c
@@ -46,8 +46,12 @@ enum {
PROP_0,
PROP_MESSAGE,
+
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
struct _SoupMultipartInputStream {
GFilterInputStream parent_instance;
};
@@ -306,14 +310,16 @@ soup_multipart_input_stream_class_init (SoupMultipartInputStreamClass *multipart
input_stream_class->read_fn = soup_multipart_input_stream_read;
- g_object_class_install_property (
- object_class, PROP_MESSAGE,
+ properties[PROP_MESSAGE] =
g_param_spec_object ("message",
"Message",
"The SoupMessage",
SOUP_TYPE_MESSAGE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 5e1989f9..999b8306 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -176,9 +176,11 @@ enum {
PROP_LOCAL_ADDRESS,
PROP_TLS_INTERACTION,
- LAST_PROP
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
/**
* SOUP_SESSION_ERROR:
*
@@ -578,7 +580,7 @@ soup_session_set_proxy_resolver (SoupSession *session,
g_clear_object (&priv->proxy_resolver);
priv->proxy_resolver = proxy_resolver ? g_object_ref (proxy_resolver) : NULL;
socket_props_changed (session);
- g_object_notify (G_OBJECT (session), "proxy-resolver");
+ g_object_notify_by_pspec (G_OBJECT (session), properties[PROP_PROXY_RESOLVER]);
}
/**
@@ -627,7 +629,7 @@ soup_session_set_tls_database (SoupSession *session,
g_clear_object (&priv->tlsdb);
priv->tlsdb = tls_database ? g_object_ref (tls_database) : NULL;
socket_props_changed (session);
- g_object_notify (G_OBJECT (session), "tls-database");
+ g_object_notify_by_pspec (G_OBJECT (session), properties[PROP_TLS_DATABASE]);
}
/**
@@ -677,7 +679,7 @@ soup_session_set_tls_interaction (SoupSession *session,
g_clear_object (&priv->tls_interaction);
priv->tls_interaction = tls_interaction ? g_object_ref (tls_interaction) : NULL;
socket_props_changed (session);
- g_object_notify (G_OBJECT (session), "tls-interaction");
+ g_object_notify_by_pspec (G_OBJECT (session), properties[PROP_TLS_INTERACTION]);
}
/**
@@ -721,7 +723,7 @@ soup_session_set_timeout (SoupSession *session,
priv->io_timeout = timeout;
socket_props_changed (session);
- g_object_notify (G_OBJECT (session), "timeout");
+ g_object_notify_by_pspec (G_OBJECT (session), properties[PROP_TIMEOUT]);
}
/**
@@ -765,7 +767,7 @@ soup_session_set_idle_timeout (SoupSession *session,
priv->idle_timeout = timeout;
socket_props_changed (session);
- g_object_notify (G_OBJECT (session), "idle-timeout");
+ g_object_notify_by_pspec (G_OBJECT (session), properties[PROP_IDLE_TIMEOUT]);
}
/**
@@ -834,7 +836,7 @@ soup_session_set_user_agent (SoupSession *session,
priv->user_agent = g_strdup (user_agent);
}
- g_object_notify (G_OBJECT (session), "user-agent");
+ g_object_notify_by_pspec (G_OBJECT (session), properties[PROP_USER_AGENT]);
}
/**
@@ -882,8 +884,8 @@ soup_session_set_accept_language (SoupSession *session,
priv->accept_language_auto = FALSE;
g_object_freeze_notify (G_OBJECT (session));
- g_object_notify (G_OBJECT (session), "accept-language");
- g_object_notify (G_OBJECT (session), "accept-language-auto");
+ g_object_notify_by_pspec (G_OBJECT (session), properties[PROP_ACCEPT_LANGUAGE]);
+ g_object_notify_by_pspec (G_OBJECT (session), properties[PROP_ACCEPT_LANGUAGE_AUTO]);
g_object_thaw_notify (G_OBJECT (session));
}
@@ -934,8 +936,8 @@ soup_session_set_accept_language_auto (SoupSession *session,
priv->accept_language = soup_get_accept_languages_from_system ();
g_object_freeze_notify (G_OBJECT (session));
- g_object_notify (G_OBJECT (session), "accept-language");
- g_object_notify (G_OBJECT (session), "accept-language-auto");
+ g_object_notify_by_pspec (G_OBJECT (session), properties[PROP_ACCEPT_LANGUAGE]);
+ g_object_notify_by_pspec (G_OBJECT (session), properties[PROP_ACCEPT_LANGUAGE_AUTO]);
g_object_thaw_notify (G_OBJECT (session));
}
@@ -2584,21 +2586,19 @@ soup_session_class_init (SoupSessionClass *session_class)
* what proxies get used.
*
*/
- g_object_class_install_property (
- object_class, PROP_PROXY_RESOLVER,
+ properties[PROP_PROXY_RESOLVER] =
g_param_spec_object ("proxy-resolver",
"Proxy Resolver",
"The GProxyResolver to use for this session",
G_TYPE_PROXY_RESOLVER,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupSession:max-conns:
*
* The maximum number of connections that the session can open at once.
*/
- g_object_class_install_property (
- object_class, PROP_MAX_CONNS,
+ properties[PROP_MAX_CONNS] =
g_param_spec_int ("max-conns",
"Max Connection Count",
"The maximum number of connections that the session can open at once",
@@ -2607,15 +2607,14 @@ soup_session_class_init (SoupSessionClass *session_class)
SOUP_SESSION_MAX_CONNS_DEFAULT,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupSession:max-conns-per-host:
*
* The maximum number of connections that the session can open at once to a given host.
*/
- g_object_class_install_property (
- object_class, PROP_MAX_CONNS_PER_HOST,
+ properties[PROP_MAX_CONNS_PER_HOST] =
g_param_spec_int ("max-conns-per-host",
"Max Per-Host Connection Count",
"The maximum number of connections that the session can open at once to a
given host",
@@ -2624,7 +2623,7 @@ soup_session_class_init (SoupSessionClass *session_class)
SOUP_SESSION_MAX_CONNS_PER_HOST_DEFAULT,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupSession:idle-timeout:
*
@@ -2638,14 +2637,13 @@ soup_session_class_init (SoupSessionClass *session_class)
* this timeout value.
*
**/
- g_object_class_install_property (
- object_class, PROP_IDLE_TIMEOUT,
+ properties[PROP_IDLE_TIMEOUT] =
g_param_spec_uint ("idle-timeout",
"Idle Timeout",
"Connection lifetime when idle",
0, G_MAXUINT, 60,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupSession:tls-database:
@@ -2657,14 +2655,13 @@ soup_session_class_init (SoupSessionClass *session_class)
* used. See g_tls_backend_get_default_database().
*
**/
- g_object_class_install_property (
- object_class, PROP_TLS_DATABASE,
+ properties[PROP_TLS_DATABASE] =
g_param_spec_object ("tls-database",
"TLS Database",
"TLS database to use",
G_TYPE_TLS_DATABASE,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupSession:timeout:
@@ -2683,14 +2680,13 @@ soup_session_class_init (SoupSessionClass *session_class)
* the length of time that idle persistent connections will be
* kept open).
*/
- g_object_class_install_property (
- object_class, PROP_TIMEOUT,
+ properties[PROP_TIMEOUT] =
g_param_spec_uint ("timeout",
"Timeout value",
"Value in seconds to timeout a blocking I/O",
0, G_MAXUINT, 0,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupSession:user-agent:
@@ -2719,14 +2715,13 @@ soup_session_class_init (SoupSessionClass *session_class)
* (eg, "<literal>libsoup/2.3.2</literal>") to the end of the
* header for you.
**/
- g_object_class_install_property (
- object_class, PROP_USER_AGENT,
+ properties[PROP_USER_AGENT] =
g_param_spec_string ("user-agent",
"User-Agent string",
"User-Agent string",
NULL,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupSession:accept-language:
@@ -2737,14 +2732,13 @@ soup_session_class_init (SoupSessionClass *session_class)
* Setting this will disable #SoupSession:accept-language-auto.
*
**/
- g_object_class_install_property (
- object_class, PROP_ACCEPT_LANGUAGE,
+ properties[PROP_ACCEPT_LANGUAGE] =
g_param_spec_string ("accept-language",
"Accept-Language string",
"Accept-Language string",
NULL,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupSession:accept-language-auto:
@@ -2757,14 +2751,13 @@ soup_session_class_init (SoupSessionClass *session_class)
* #SoupSession:accept-language.
*
**/
- g_object_class_install_property (
- object_class, PROP_ACCEPT_LANGUAGE_AUTO,
+ properties[PROP_ACCEPT_LANGUAGE_AUTO] =
g_param_spec_boolean ("accept-language-auto",
"Accept-Language automatic mode",
"Accept-Language automatic mode",
FALSE,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupSession:remote-connectable:
@@ -2778,14 +2771,13 @@ soup_session_class_init (SoupSessionClass *session_class)
* a #GUnixSocketAddress can be passed to this function.
*
**/
- g_object_class_install_property (
- object_class, PROP_REMOTE_CONNECTABLE,
+ properties[PROP_REMOTE_CONNECTABLE] =
g_param_spec_object ("remote-connectable",
"Remote Connectable",
"Socket to connect to make outgoing connections on",
G_TYPE_SOCKET_CONNECTABLE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupSession:local-address:
@@ -2797,14 +2789,13 @@ soup_session_class_init (SoupSessionClass *session_class)
* local socket to a specific IP address.
*
**/
- g_object_class_install_property (
- object_class, PROP_LOCAL_ADDRESS,
+ properties[PROP_LOCAL_ADDRESS] =
g_param_spec_object ("local-address",
"Local address",
"Address of local end of socket",
G_TYPE_INET_SOCKET_ADDRESS,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
/**
* SoupSession:tls-interaction:
@@ -2814,14 +2805,15 @@ soup_session_class_init (SoupSessionClass *session_class)
* provide client-side certificates, for example.)
*
**/
- g_object_class_install_property (
- object_class, PROP_TLS_INTERACTION,
+ properties[PROP_TLS_INTERACTION] =
g_param_spec_object ("tls-interaction",
"TLS Interaction",
"TLS interaction to use",
G_TYPE_TLS_INTERACTION,
G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
}
diff --git a/libsoup/websocket/soup-websocket-connection.c b/libsoup/websocket/soup-websocket-connection.c
index a12b466e..de4ab4ea 100644
--- a/libsoup/websocket/soup-websocket-connection.c
+++ b/libsoup/websocket/soup-websocket-connection.c
@@ -83,9 +83,13 @@ enum {
PROP_STATE,
PROP_MAX_INCOMING_PAYLOAD_SIZE,
PROP_KEEPALIVE_INTERVAL,
- PROP_EXTENSIONS
+ PROP_EXTENSIONS,
+
+ LAST_PROPERTY
};
+static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
+
enum {
MESSAGE,
ERROR,
@@ -387,7 +391,7 @@ close_io_stream (SoupWebsocketConnection *self)
NULL, on_iostream_closed, g_object_ref (self));
}
- g_object_notify (G_OBJECT (self), "state");
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_STATE]);
}
static void
@@ -413,7 +417,7 @@ shutdown_wr_io_stream (SoupWebsocketConnection *self)
}
}
- g_object_notify (G_OBJECT (self), "state");
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_STATE]);
}
static gboolean
@@ -1484,14 +1488,14 @@ soup_websocket_connection_class_init (SoupWebsocketConnectionClass *klass)
* The input and output streams must be pollable streams.
*
*/
- g_object_class_install_property (gobject_class, PROP_IO_STREAM,
- g_param_spec_object ("io-stream",
- "I/O Stream",
- "Underlying I/O stream",
- G_TYPE_IO_STREAM,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ properties[PROP_IO_STREAM] =
+ g_param_spec_object ("io-stream",
+ "I/O Stream",
+ "Underlying I/O stream",
+ G_TYPE_IO_STREAM,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
/**
* SoupWebsocketConnection:connection-type:
@@ -1499,15 +1503,15 @@ soup_websocket_connection_class_init (SoupWebsocketConnectionClass *klass)
* The type of connection (client/server).
*
*/
- g_object_class_install_property (gobject_class, PROP_CONNECTION_TYPE,
- g_param_spec_enum ("connection-type",
- "Connection type",
- "Connection type (client/server)",
- SOUP_TYPE_WEBSOCKET_CONNECTION_TYPE,
- SOUP_WEBSOCKET_CONNECTION_UNKNOWN,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ properties[PROP_CONNECTION_TYPE] =
+ g_param_spec_enum ("connection-type",
+ "Connection type",
+ "Connection type (client/server)",
+ SOUP_TYPE_WEBSOCKET_CONNECTION_TYPE,
+ SOUP_WEBSOCKET_CONNECTION_UNKNOWN,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
/**
* SoupWebsocketConnection:uri:
@@ -1518,14 +1522,14 @@ soup_websocket_connection_class_init (SoupWebsocketConnectionClass *klass)
* and for clients it is the address connected to.
*
*/
- g_object_class_install_property (gobject_class, PROP_URI,
- g_param_spec_boxed ("uri",
- "URI",
- "The WebSocket URI",
- G_TYPE_URI,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ properties[PROP_URI] =
+ g_param_spec_boxed ("uri",
+ "URI",
+ "The WebSocket URI",
+ G_TYPE_URI,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
/**
* SoupWebsocketConnection:origin:
@@ -1533,14 +1537,14 @@ soup_websocket_connection_class_init (SoupWebsocketConnectionClass *klass)
* The client's Origin.
*
*/
- g_object_class_install_property (gobject_class, PROP_ORIGIN,
- g_param_spec_string ("origin",
- "Origin",
- "The WebSocket origin",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ properties[PROP_ORIGIN] =
+ g_param_spec_string ("origin",
+ "Origin",
+ "The WebSocket origin",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
/**
* SoupWebsocketConnection:protocol:
@@ -1549,14 +1553,14 @@ soup_websocket_connection_class_init (SoupWebsocketConnectionClass *klass)
* upon.
*
*/
- g_object_class_install_property (gobject_class, PROP_PROTOCOL,
- g_param_spec_string ("protocol",
- "Protocol",
- "The chosen WebSocket protocol",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ properties[PROP_PROTOCOL] =
+ g_param_spec_string ("protocol",
+ "Protocol",
+ "The chosen WebSocket protocol",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
/**
* SoupWebsocketConnection:state:
@@ -1564,14 +1568,14 @@ soup_websocket_connection_class_init (SoupWebsocketConnectionClass *klass)
* The current state of the WebSocket.
*
*/
- g_object_class_install_property (gobject_class, PROP_STATE,
- g_param_spec_enum ("state",
- "State",
- "State ",
- SOUP_TYPE_WEBSOCKET_STATE,
- SOUP_WEBSOCKET_STATE_OPEN,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ properties[PROP_STATE] =
+ g_param_spec_enum ("state",
+ "State",
+ "State ",
+ SOUP_TYPE_WEBSOCKET_STATE,
+ SOUP_WEBSOCKET_STATE_OPEN,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* SoupWebsocketConnection:max-incoming-payload-size:
@@ -1580,16 +1584,16 @@ soup_websocket_connection_class_init (SoupWebsocketConnectionClass *klass)
* or 0 to not limit it.
*
*/
- g_object_class_install_property (gobject_class, PROP_MAX_INCOMING_PAYLOAD_SIZE,
- g_param_spec_uint64 ("max-incoming-payload-size",
- "Max incoming payload size",
- "Max incoming payload size ",
- 0,
- G_MAXUINT64,
- MAX_INCOMING_PAYLOAD_SIZE_DEFAULT,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
+ properties[PROP_MAX_INCOMING_PAYLOAD_SIZE] =
+ g_param_spec_uint64 ("max-incoming-payload-size",
+ "Max incoming payload size",
+ "Max incoming payload size ",
+ 0,
+ G_MAXUINT64,
+ MAX_INCOMING_PAYLOAD_SIZE_DEFAULT,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS);
/**
* SoupWebsocketConnection:keepalive-interval:
@@ -1599,16 +1603,16 @@ soup_websocket_connection_class_init (SoupWebsocketConnectionClass *klass)
* disabled.
*
*/
- g_object_class_install_property (gobject_class, PROP_KEEPALIVE_INTERVAL,
- g_param_spec_uint ("keepalive-interval",
- "Keepalive interval",
- "Keepalive interval",
- 0,
- G_MAXUINT,
- 0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
+ properties[PROP_KEEPALIVE_INTERVAL] =
+ g_param_spec_uint ("keepalive-interval",
+ "Keepalive interval",
+ "Keepalive interval",
+ 0,
+ G_MAXUINT,
+ 0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS);
/**
* SoupWebsocketConnection:extensions:
@@ -1616,13 +1620,15 @@ soup_websocket_connection_class_init (SoupWebsocketConnectionClass *klass)
* List of #SoupWebsocketExtension objects that are active in the connection.
*
*/
- g_object_class_install_property (gobject_class, PROP_EXTENSIONS,
- g_param_spec_pointer ("extensions",
- "Active extensions",
- "The list of active extensions",
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
+ properties[PROP_EXTENSIONS] =
+ g_param_spec_pointer ("extensions",
+ "Active extensions",
+ "The list of active extensions",
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (gobject_class, LAST_PROPERTY, properties);
/**
* SoupWebsocketConnection::message:
@@ -2101,7 +2107,7 @@ soup_websocket_connection_set_max_incoming_payload_size (SoupWebsocketConnection
if (priv->max_incoming_payload_size != max_incoming_payload_size) {
priv->max_incoming_payload_size = max_incoming_payload_size;
- g_object_notify (G_OBJECT (self), "max-incoming-payload-size");
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MAX_INCOMING_PAYLOAD_SIZE]);
}
}
@@ -2157,7 +2163,7 @@ soup_websocket_connection_set_keepalive_interval (SoupWebsocketConnection *self,
if (priv->keepalive_interval != interval) {
priv->keepalive_interval = interval;
- g_object_notify (G_OBJECT (self), "keepalive-interval");
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_KEEPALIVE_INTERVAL]);
keepalive_stop_timeout (self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]