libsoup r1223 - in trunk: . libsoup
- From: danw svn gnome org
- To: svn-commits-list gnome org
- Subject: libsoup r1223 - in trunk: . libsoup
- Date: Tue, 23 Dec 2008 19:21:08 +0000 (UTC)
Author: danw
Date: Tue Dec 23 19:21:08 2008
New Revision: 1223
URL: http://svn.gnome.org/viewvc/libsoup?rev=1223&view=rev
Log:
* libsoup/soup-session.c (soup_session_get_features)
(soup_session_get_feature): add these to query session features.
#565392.
Modified:
trunk/ChangeLog
trunk/libsoup/soup-session.c
trunk/libsoup/soup-session.h
Modified: trunk/libsoup/soup-session.c
==============================================================================
--- trunk/libsoup/soup-session.c (original)
+++ trunk/libsoup/soup-session.c Tue Dec 23 19:21:08 2008
@@ -1436,6 +1436,62 @@
}
}
+/**
+ * soup_session_get_features:
+ * @session: a #SoupSession
+ * @feature_type: the #GType of the class of features to get
+ *
+ * Generates a list of @session's features of type @feature_type. (If
+ * you want to see all features, you can pass %G_TYPE_SESSION_FEATURE
+ * for @feature_type.)
+ *
+ * Return value: a list of features. You must free the list, but not
+ * its contents
+ **/
+GSList *
+soup_session_get_features (SoupSession *session, GType feature_type)
+{
+ SoupSessionPrivate *priv;
+ GSList *f, *ret;
+
+ g_return_val_if_fail (SOUP_IS_SESSION (session), NULL);
+
+ priv = SOUP_SESSION_GET_PRIVATE (session);
+ for (f = priv->features, ret = NULL; f; f = f->next) {
+ if (G_TYPE_CHECK_INSTANCE_TYPE (f->data, feature_type))
+ ret = g_slist_prepend (ret, f->data);
+ }
+ return g_slist_reverse (ret);
+}
+
+/**
+ * soup_session_get_feature:
+ * @session: a #SoupSession
+ * @feature_type: the #GType of the feature to get
+ *
+ * Gets the first feature in @session of type @feature_type. For
+ * features where there may be more than one feature of a given type,
+ * use soup_session_get_features().
+ *
+ * Return value: a #SoupSessionFeature, or %NULL. The feature is owned
+ * by @session.
+ **/
+SoupSessionFeature *
+soup_session_get_feature (SoupSession *session, GType feature_type)
+{
+ SoupSessionPrivate *priv;
+ GSList *f;
+
+ g_return_val_if_fail (SOUP_IS_SESSION (session), NULL);
+
+ priv = SOUP_SESSION_GET_PRIVATE (session);
+ for (f = priv->features; f; f = f->next) {
+ if (G_TYPE_CHECK_INSTANCE_TYPE (f->data, feature_type))
+ return f->data;
+ }
+ return NULL;
+}
+
SoupProxyResolver *
soup_session_get_proxy_resolver (SoupSession *session)
{
Modified: trunk/libsoup/soup-session.h
==============================================================================
--- trunk/libsoup/soup-session.h (original)
+++ trunk/libsoup/soup-session.h Tue Dec 23 19:21:08 2008
@@ -91,14 +91,18 @@
void soup_session_abort (SoupSession *session);
-void soup_session_add_feature (SoupSession *session,
- SoupSessionFeature *feature);
-void soup_session_add_feature_by_type (SoupSession *session,
- GType feature_type);
-void soup_session_remove_feature (SoupSession *session,
- SoupSessionFeature *feature);
-void soup_session_remove_feature_by_type (SoupSession *session,
- GType feature_type);
+void soup_session_add_feature (SoupSession *session,
+ SoupSessionFeature *feature);
+void soup_session_add_feature_by_type (SoupSession *session,
+ GType feature_type);
+void soup_session_remove_feature (SoupSession *session,
+ SoupSessionFeature *feature);
+void soup_session_remove_feature_by_type (SoupSession *session,
+ GType feature_type);
+GSList *soup_session_get_features (SoupSession *session,
+ GType feature_type);
+SoupSessionFeature *soup_session_get_feature (SoupSession *session,
+ GType feature_type);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]