![]() |
![]() |
![]() |
Grilo Library Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
enum GrlNetWcError; GrlNetWc; GrlNetWcClass; GrlNetWc * grl_net_wc_new (void
); void grl_net_wc_request_async (GrlNetWc *self
,const char *uri
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean grl_net_wc_request_finish (GrlNetWc *self
,GAsyncResult *result
,gchar **content
,gsize *length
,GError **error
); void grl_net_wc_set_log_level (GrlNetWc *self
,guint log_level
); void grl_net_wc_set_throttling (GrlNetWc *self
,guint throttling
); void grl_net_wc_flush_delayed_requests (GrlNetWc *self
);
Most of the Grilo's sources need to access to web resources. The purpose of this utility class is to provide a thin and lean mechanism for those plugins to interact with those resources.
typedef enum { GRL_NET_WC_ERROR_UNAVAILABLE = 1, GRL_NET_WC_ERROR_PROTOCOL_ERROR, GRL_NET_WC_ERROR_AUTHENTICATION_REQUIRED, GRL_NET_WC_ERROR_NOT_FOUND, GRL_NET_WC_ERROR_CONFLICT, GRL_NET_WC_ERROR_FORBIDDEN, GRL_NET_WC_ERROR_NETWORK_ERROR, GRL_NET_WC_ERROR_PROXY_ERROR, GRL_NET_WC_ERROR_CANCELLED, } GrlNetWcError;
These constants identify all the available errors managed by the web client.
TBD | |
Invalid URI or header | |
Required authentication | |
Request resource not found | |
The entry has been modified since is was downloaded | |
TBD | |
Cannot connect to the server | |
Cannot connect to the proxy server | |
The operation has been cancelled (see GCancellable) |
typedef struct { GObjectClass parent_class; } GrlNetWcClass;
Grilo web client helper class.
It's a simple and thin web client for be used by the sources.
GrlNetWc * grl_net_wc_new (void
);
Returns : |
a new allocated instance of GrlNetWc. Do g_object_unref() after
use it.
|
void grl_net_wc_request_async (GrlNetWc *self
,const char *uri
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Request the fetching of a web resource given the uri
. This request is
asynchronous, thus the result will be returned within the callback
.
|
a GrlNetWc instance |
|
The URI of the resource to request |
|
a GCancellable instance or NULL to ignore. [allow-none]
|
|
The callback when the result is ready |
|
User data set for the callback
|
gboolean grl_net_wc_request_finish (GrlNetWc *self
,GAsyncResult *result
,gchar **content
,gsize *length
,GError **error
);
Finishes an asynchronous load of the file's contents. The contents are placed in contents, and length is set to the size of the contents string.
The content address will be invalidated at the next request. So if you want to keep it, please copy it into another address.
|
a GrlNetWc instance |
|
The result of the request |
|
The contents of the resource |
|
The length of the contents or NULL if it is not
needed. [allow-none]
|
|
return location for a GError, or NULL
|
Returns : |
TRUE if the request was successfull. If FALSE an error occurred.
|
void grl_net_wc_set_log_level (GrlNetWc *self
,guint log_level
);
Setting the log level the logger feature is added into the libsoup session.
|
a GrlNetWc instance |
|
the libsoup log level to set [0,3] |
void grl_net_wc_set_throttling (GrlNetWc *self
,guint throttling
);
Setting this property, the GrlNetWc will queue all the requests and will dispatch them with a pause between them of this value.
|
a GrlNetWc instance |
|
the number of seconds to wait between requests |