[libsoup] soup-cookie-jar: Add SoupCookieJar:is-persistent property
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] soup-cookie-jar: Add SoupCookieJar:is-persistent property
- Date: Wed, 18 Apr 2012 15:01:13 +0000 (UTC)
commit b896f183c628a54655b1f0f43488017487782f42
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Mon Mar 26 17:46:16 2012 +0200
soup-cookie-jar: Add SoupCookieJar:is-persistent property
It allows to query whether cookies are stored persisently by the
SoupCookieJar.
https://bugzilla.gnome.org/show_bug.cgi?id=672838
docs/reference/libsoup-2.4-sections.txt | 2 ++
libsoup/soup-cookie-jar-sqlite.c | 10 +++++++++-
libsoup/soup-cookie-jar-text.c | 10 +++++++++-
libsoup/soup-cookie-jar.c | 27 +++++++++++++++++++++++++++
libsoup/soup-cookie-jar.h | 5 +++--
5 files changed, 50 insertions(+), 4 deletions(-)
---
diff --git a/docs/reference/libsoup-2.4-sections.txt b/docs/reference/libsoup-2.4-sections.txt
index 038e6b6..8731edd 100644
--- a/docs/reference/libsoup-2.4-sections.txt
+++ b/docs/reference/libsoup-2.4-sections.txt
@@ -888,6 +888,8 @@ SoupCookieJarAcceptPolicy
soup_cookie_jar_get_accept_policy
soup_cookie_jar_set_accept_policy
<SUBSECTION>
+soup_cookie_jar_is_persistent
+<SUBSECTION>
SOUP_COOKIE_JAR_READ_ONLY
SOUP_COOKIE_JAR_ACCEPT_POLICY
<SUBSECTION Standard>
diff --git a/libsoup/soup-cookie-jar-sqlite.c b/libsoup/soup-cookie-jar-sqlite.c
index 250abb8..413a565 100644
--- a/libsoup/soup-cookie-jar-sqlite.c
+++ b/libsoup/soup-cookie-jar-sqlite.c
@@ -49,6 +49,7 @@ static void load (SoupCookieJar *jar);
static void changed (SoupCookieJar *jar,
SoupCookie *old_cookie,
SoupCookie *new_cookie);
+static gboolean is_persistent (SoupCookieJar *jar);
static void set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec);
@@ -83,7 +84,8 @@ soup_cookie_jar_sqlite_class_init (SoupCookieJarSqliteClass *sqlite_class)
g_type_class_add_private (sqlite_class, sizeof (SoupCookieJarSqlitePrivate));
- cookie_jar_class->changed = changed;
+ cookie_jar_class->is_persistent = is_persistent;
+ cookie_jar_class->changed = changed;
object_class->finalize = finalize;
object_class->set_property = set_property;
@@ -336,3 +338,9 @@ changed (SoupCookieJar *jar,
sqlite3_free (query);
}
}
+
+static gboolean
+is_persistent (SoupCookieJar *jar)
+{
+ return TRUE;
+}
diff --git a/libsoup/soup-cookie-jar-text.c b/libsoup/soup-cookie-jar-text.c
index 527d442..259431f 100644
--- a/libsoup/soup-cookie-jar-text.c
+++ b/libsoup/soup-cookie-jar-text.c
@@ -45,6 +45,7 @@ static void load (SoupCookieJar *jar);
static void changed (SoupCookieJar *jar,
SoupCookie *old_cookie,
SoupCookie *new_cookie);
+static gboolean is_persistent (SoupCookieJar *jar);
static void set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec);
@@ -76,7 +77,8 @@ soup_cookie_jar_text_class_init (SoupCookieJarTextClass *text_class)
g_type_class_add_private (text_class, sizeof (SoupCookieJarTextPrivate));
- cookie_jar_class->changed = changed;
+ cookie_jar_class->is_persistent = is_persistent;
+ cookie_jar_class->changed = changed;
object_class->finalize = finalize;
object_class->set_property = set_property;
@@ -363,3 +365,9 @@ changed (SoupCookieJar *jar,
}
}
}
+
+static gboolean
+is_persistent (SoupCookieJar *jar)
+{
+ return TRUE;
+}
diff --git a/libsoup/soup-cookie-jar.c b/libsoup/soup-cookie-jar.c
index 1f6500f..6dd9d85 100644
--- a/libsoup/soup-cookie-jar.c
+++ b/libsoup/soup-cookie-jar.c
@@ -42,6 +42,7 @@ static void request_started (SoupSessionFeature *feature, SoupSession *session,
SoupMessage *msg, SoupSocket *socket);
static void request_unqueued (SoupSessionFeature *feature, SoupSession *session,
SoupMessage *msg);
+static gboolean is_persistent (SoupCookieJar *jar);
G_DEFINE_TYPE_WITH_CODE (SoupCookieJar, soup_cookie_jar, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (SOUP_TYPE_SESSION_FEATURE,
@@ -124,6 +125,8 @@ soup_cookie_jar_class_init (SoupCookieJarClass *jar_class)
object_class->set_property = set_property;
object_class->get_property = get_property;
+ jar_class->is_persistent = is_persistent;
+
/**
* SoupCookieJar::changed
* @jar: the #SoupCookieJar
@@ -266,6 +269,12 @@ soup_cookie_jar_save (SoupCookieJar *jar)
/* Does nothing, obsolete */
}
+static gboolean
+is_persistent (SoupCookieJar *jar)
+{
+ return FALSE;
+}
+
static void
soup_cookie_jar_changed (SoupCookieJar *jar,
SoupCookie *old, SoupCookie *new)
@@ -766,3 +775,21 @@ soup_cookie_jar_set_accept_policy (SoupCookieJar *jar,
g_object_notify (G_OBJECT (jar), SOUP_COOKIE_JAR_ACCEPT_POLICY);
}
}
+
+/**
+ * soup_cookie_jar_is_persistent:
+ * @jar: a #SoupCookieJar
+ *
+ * Gets whether @jar stores cookies persistenly.
+ *
+ * Returns: %TRUE if @jar storage is persistent or %FALSE otherwise.
+ *
+ * Since: 2.40
+ **/
+gboolean
+soup_cookie_jar_is_persistent (SoupCookieJar *jar)
+{
+ g_return_val_if_fail (SOUP_IS_COOKIE_JAR (jar), FALSE);
+
+ return SOUP_COOKIE_JAR_GET_CLASS (jar)->is_persistent (jar);
+}
diff --git a/libsoup/soup-cookie-jar.h b/libsoup/soup-cookie-jar.h
index eab64bf..091b5e4 100644
--- a/libsoup/soup-cookie-jar.h
+++ b/libsoup/soup-cookie-jar.h
@@ -25,7 +25,8 @@ struct _SoupCookieJar {
typedef struct {
GObjectClass parent_class;
- void (*save) (SoupCookieJar *jar);
+ void (*save) (SoupCookieJar *jar);
+ gboolean (*is_persistent) (SoupCookieJar *jar);
/* signals */
void (*changed) (SoupCookieJar *jar,
@@ -35,7 +36,6 @@ typedef struct {
/* Padding for future expansion */
void (*_libsoup_reserved1) (void);
void (*_libsoup_reserved2) (void);
- void (*_libsoup_reserved3) (void);
} SoupCookieJarClass;
#define SOUP_COOKIE_JAR_READ_ONLY "read-only"
@@ -70,6 +70,7 @@ GSList * soup_cookie_jar_all_cookies (SoupCooki
void soup_cookie_jar_set_accept_policy (SoupCookieJar *jar,
SoupCookieJarAcceptPolicy policy);
SoupCookieJarAcceptPolicy soup_cookie_jar_get_accept_policy (SoupCookieJar *jar);
+gboolean soup_cookie_jar_is_persistent (SoupCookieJar *jar);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]