[libsoup/wip/withprivate: 21/26] cookie-jar: port to the new private api
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/wip/withprivate: 21/26] cookie-jar: port to the new private api
- Date: Thu, 10 Nov 2016 13:23:05 +0000 (UTC)
commit 08efd8f0c1c5f06251dbdfeda627708185c7e56a
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Mon Nov 7 11:11:19 2016 +0100
cookie-jar: port to the new private api
https://bugzilla.gnome.org/show_bug.cgi?id=774189
libsoup/soup-cookie-jar.c | 50 ++++++++++++++++++++++----------------------
1 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/libsoup/soup-cookie-jar.c b/libsoup/soup-cookie-jar.c
index d12bc85..41b614a 100644
--- a/libsoup/soup-cookie-jar.c
+++ b/libsoup/soup-cookie-jar.c
@@ -28,12 +28,6 @@
* of long-term cookie persistence.
**/
-static void soup_cookie_jar_session_feature_init (SoupSessionFeatureInterface *feature_interface, gpointer
interface_data);
-
-G_DEFINE_TYPE_WITH_CODE (SoupCookieJar, soup_cookie_jar, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (SOUP_TYPE_SESSION_FEATURE,
- soup_cookie_jar_session_feature_init))
-
enum {
CHANGED,
LAST_SIGNAL
@@ -56,12 +50,18 @@ typedef struct {
guint serial;
SoupCookieJarAcceptPolicy accept_policy;
} SoupCookieJarPrivate;
-#define SOUP_COOKIE_JAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SOUP_TYPE_COOKIE_JAR,
SoupCookieJarPrivate))
+
+static void soup_cookie_jar_session_feature_init (SoupSessionFeatureInterface *feature_interface, gpointer
interface_data);
+
+G_DEFINE_TYPE_WITH_CODE (SoupCookieJar, soup_cookie_jar, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (SoupCookieJar)
+ G_IMPLEMENT_INTERFACE (SOUP_TYPE_SESSION_FEATURE,
+ soup_cookie_jar_session_feature_init))
static void
soup_cookie_jar_init (SoupCookieJar *jar)
{
- SoupCookieJarPrivate *priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+ SoupCookieJarPrivate *priv = soup_cookie_jar_get_instance_private (jar);
priv->domains = g_hash_table_new_full (soup_str_case_hash,
soup_str_case_equal,
@@ -73,7 +73,8 @@ soup_cookie_jar_init (SoupCookieJar *jar)
static void
soup_cookie_jar_constructed (GObject *object)
{
- SoupCookieJarPrivate *priv = SOUP_COOKIE_JAR_GET_PRIVATE (object);
+ SoupCookieJarPrivate *priv =
+ soup_cookie_jar_get_instance_private (SOUP_COOKIE_JAR (object));
priv->constructed = TRUE;
}
@@ -81,7 +82,8 @@ soup_cookie_jar_constructed (GObject *object)
static void
soup_cookie_jar_finalize (GObject *object)
{
- SoupCookieJarPrivate *priv = SOUP_COOKIE_JAR_GET_PRIVATE (object);
+ SoupCookieJarPrivate *priv =
+ soup_cookie_jar_get_instance_private (SOUP_COOKIE_JAR (object));
GHashTableIter iter;
gpointer key, value;
@@ -99,7 +101,7 @@ soup_cookie_jar_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
{
SoupCookieJarPrivate *priv =
- SOUP_COOKIE_JAR_GET_PRIVATE (object);
+ soup_cookie_jar_get_instance_private (SOUP_COOKIE_JAR (object));
switch (prop_id) {
case PROP_READ_ONLY:
@@ -119,7 +121,7 @@ soup_cookie_jar_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
SoupCookieJarPrivate *priv =
- SOUP_COOKIE_JAR_GET_PRIVATE (object);
+ soup_cookie_jar_get_instance_private (SOUP_COOKIE_JAR (object));
switch (prop_id) {
case PROP_READ_ONLY:
@@ -145,8 +147,6 @@ soup_cookie_jar_class_init (SoupCookieJarClass *jar_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (jar_class);
- g_type_class_add_private (jar_class, sizeof (SoupCookieJarPrivate));
-
object_class->constructed = soup_cookie_jar_constructed;
object_class->finalize = soup_cookie_jar_finalize;
object_class->set_property = soup_cookie_jar_set_property;
@@ -255,7 +255,7 @@ static void
soup_cookie_jar_changed (SoupCookieJar *jar,
SoupCookie *old, SoupCookie *new)
{
- SoupCookieJarPrivate *priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+ SoupCookieJarPrivate *priv = soup_cookie_jar_get_instance_private (jar);
if (old && old != new)
g_hash_table_remove (priv->serials, old);
@@ -275,7 +275,7 @@ compare_cookies (gconstpointer a, gconstpointer b, gpointer jar)
{
SoupCookie *ca = (SoupCookie *)a;
SoupCookie *cb = (SoupCookie *)b;
- SoupCookieJarPrivate *priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+ SoupCookieJarPrivate *priv = soup_cookie_jar_get_instance_private (jar);
int alen, blen;
guint aserial, bserial;
@@ -304,7 +304,7 @@ get_cookies (SoupCookieJar *jar, SoupURI *uri, gboolean for_http, gboolean copy_
char *domain, *cur, *next_domain;
GSList *new_head, *cookies_to_remove = NULL, *p;
- priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+ priv = soup_cookie_jar_get_instance_private (jar);
if (!uri->host)
return NULL;
@@ -462,7 +462,7 @@ soup_cookie_jar_add_cookie (SoupCookieJar *jar, SoupCookie *cookie)
return;
}
- priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+ priv = soup_cookie_jar_get_instance_private (jar);
old_cookies = g_hash_table_lookup (priv->domains, cookie->domain);
for (oc = old_cookies; oc; oc = oc->next) {
old_cookie = oc->data;
@@ -535,7 +535,7 @@ soup_cookie_jar_add_cookie_with_first_party (SoupCookieJar *jar, SoupURI *first_
g_return_if_fail (first_party != NULL);
g_return_if_fail (cookie != NULL);
- priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+ priv = soup_cookie_jar_get_instance_private (jar);
if (priv->accept_policy == SOUP_COOKIE_JAR_ACCEPT_NEVER) {
soup_cookie_free (cookie);
return;
@@ -581,7 +581,7 @@ soup_cookie_jar_set_cookie (SoupCookieJar *jar, SoupURI *uri,
if (!uri->host)
return;
- priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+ priv = soup_cookie_jar_get_instance_private (jar);
if (priv->accept_policy == SOUP_COOKIE_JAR_ACCEPT_NEVER)
return;
@@ -633,7 +633,7 @@ static void
process_set_cookie_header (SoupMessage *msg, gpointer user_data)
{
SoupCookieJar *jar = user_data;
- SoupCookieJarPrivate *priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+ SoupCookieJarPrivate *priv = soup_cookie_jar_get_instance_private (jar);
GSList *new_cookies, *nc;
if (priv->accept_policy == SOUP_COOKIE_JAR_ACCEPT_NEVER)
@@ -723,7 +723,7 @@ soup_cookie_jar_all_cookies (SoupCookieJar *jar)
g_return_val_if_fail (SOUP_IS_COOKIE_JAR (jar), NULL);
- priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+ priv = soup_cookie_jar_get_instance_private (jar);
g_hash_table_iter_init (&iter, priv->domains);
@@ -755,7 +755,7 @@ soup_cookie_jar_delete_cookie (SoupCookieJar *jar,
g_return_if_fail (SOUP_IS_COOKIE_JAR (jar));
g_return_if_fail (cookie != NULL);
- priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+ priv = soup_cookie_jar_get_instance_private (jar);
cookies = g_hash_table_lookup (priv->domains, cookie->domain);
if (cookies == NULL)
@@ -814,7 +814,7 @@ soup_cookie_jar_get_accept_policy (SoupCookieJar *jar)
g_return_val_if_fail (SOUP_IS_COOKIE_JAR (jar), SOUP_COOKIE_JAR_ACCEPT_ALWAYS);
- priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+ priv = soup_cookie_jar_get_instance_private (jar);
return priv->accept_policy;
}
@@ -835,7 +835,7 @@ soup_cookie_jar_set_accept_policy (SoupCookieJar *jar,
g_return_if_fail (SOUP_IS_COOKIE_JAR (jar));
- priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+ priv = soup_cookie_jar_get_instance_private (jar);
if (priv->accept_policy != policy) {
priv->accept_policy = policy;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]