diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2021-05-04 09:38:54 +0200 |
---|---|---|
committer | Carlos Garcia Campos <cgarcia@igalia.com> | 2021-05-04 13:41:10 +0200 |
commit | 24d9c48c5a6cf4cecb9b46762a2a0addf097f993 (patch) | |
tree | d3cc7a9ce6a37620bd8cef3b6cf6fe797fd2ffa9 /libsoup/cookies | |
parent | ef07c697de0f26a7efc488a8945d404bdbaf6a39 (diff) | |
download | libsoup-24d9c48c5a6cf4cecb9b46762a2a0addf097f993.tar.gz |
Use g_object_notify_by_pspec instead of g_object_notify
Diffstat (limited to 'libsoup/cookies')
-rw-r--r-- | libsoup/cookies/soup-cookie-jar-db.c | 11 | ||||
-rw-r--r-- | libsoup/cookies/soup-cookie-jar-text.c | 11 | ||||
-rw-r--r-- | libsoup/cookies/soup-cookie-jar.c | 18 |
3 files changed, 24 insertions, 16 deletions
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]); } } |