GrssFeedsPool

GrssFeedsPool — feeds auto-fetcher

Synopsis

struct              GrssFeedsPool;
GrssFeedsPool *     grss_feeds_pool_new                 ();
void                grss_feeds_pool_listen              (GrssFeedsPool *pool,
                                                         GList *feeds);
GList *             grss_feeds_pool_get_listened        (GrssFeedsPool *pool);
int                 grss_feeds_pool_get_listened_num    (GrssFeedsPool *pool);
void                grss_feeds_pool_switch              (GrssFeedsPool *pool,
                                                         gboolean run);
SoupSession *       grss_feeds_pool_get_session         (GrssFeedsPool *pool);

Object Hierarchy

  GObject
   +----GrssFeedsPool

Signals

  "feed-fetching"                                  : Run Last
  "feed-ready"                                     : Run Last

Description

The GrssFeedsPool permits to automatically "listen" for more feeds: it provides to fetch them on regular intervals (as defined by grss_feed_channel_get_update_interval() for each channel), parse them with GrssFeedParser, and emits signals when feeds are ready.

Details

struct GrssFeedsPool

struct GrssFeedsPool;


grss_feeds_pool_new ()

GrssFeedsPool *     grss_feeds_pool_new                 ();

Allocates a new GrssFeedsPool.

Returns :

a new GrssFeedsPool.

grss_feeds_pool_listen ()

void                grss_feeds_pool_listen              (GrssFeedsPool *pool,
                                                         GList *feeds);

To set the list of feeds to be managed by the pool. The previous list, if any, is invalidated. After invokation to the function, grss_feeds_pool_switch() must be call to run the auto-fetching (always, also if previous state was "running"). The list in feeds can be freed after calling this; linked GrssFeedChannel are g_object_ref'd here.

pool :

a GrssFeedsPool.

feeds :

a list of GrssFeedChannel.

grss_feeds_pool_get_listened ()

GList *             grss_feeds_pool_get_listened        (GrssFeedsPool *pool);

Returns the list of feeds currently managed by the pool. Please consider this function has to build the list that returns, and of course this is a time and resources consuming task: if you only need to know how many feeds are currently handled, check grss_feeds_pool_get_listened_num().

pool :

a GrssFeedsPool.

Returns :

a list of GrssFeedChannel, to be freed with g_list_free() when no longer in use. Do not modify elements found in this list.

grss_feeds_pool_get_listened_num ()

int                 grss_feeds_pool_get_listened_num    (GrssFeedsPool *pool);

Returns number of feeds under the pool control, as provided by grss_feeds_pool_listen(). To get the complete list of those feeds, check grss_feeds_pool_get_listened().

pool :

a GrssFeedsPool

Returns :

number of feeds currently managed by the GrssFeedsPool.

grss_feeds_pool_switch ()

void                grss_feeds_pool_switch              (GrssFeedsPool *pool,
                                                         gboolean run);

Permits to pause or resume the pool fetching feeds. If run is TRUE, the pool starts immediately.

pool :

a GrssFeedsPool.

run :

TRUE to run the pool, FALSE to pause it.

grss_feeds_pool_get_session ()

SoupSession *       grss_feeds_pool_get_session         (GrssFeedsPool *pool);

To access the internal SoupSession used by the pool to fetch items.

pool :

a GrssFeedsPool.

Returns :

istance of SoupSession. Do not free it.

Signal Details

The "feed-fetching" signal

void                user_function                      (GrssFeedsPool *pool,
                                                        GObject       *feed,
                                                        gpointer       user_data)      : Run Last

Emitted when the pool starts fetching a new GrssFeedChannel. To be used to know the internal status of the component.

pool :

the GrssFeedsPool emitting the signal.

feed :

the GrssFeedChannel which is going to be fetched.

user_data :

user data set when the signal handler was connected.

The "feed-ready" signal

void                user_function                      (GrssFeedsPool *pool,
                                                        GObject       *feed,
                                                        gpointer       items,
                                                        gpointer       user_data)      : Run Last

Emitted when a GrssFeedChannel assigned to the pool has been fetched and parsed. All parsed items are exposed in the array, with no regards about previously existing elements. items may be NULL, if an error occourred while fetching and/or parsing. List of items is freed, and his elements are unref'd, when signal ends.

pool :

the GrssFeedsPool emitting the signal.

feed :

the GrssFeedChannel which has been fetched and parsed.

items :

list of GrssFeedItem obtained parsing the feed.

user_data :

user data set when the signal handler was connected.