GrssFeedsPool: libgrss Reference Manual

## GrssFeedsPool GrssFeedsPool — feeds auto-fetcher |

## Functions

GrssFeedsPool * | grss_feeds_pool_new ()
void | grss_feeds_pool_listen ()
GList * | grss_feeds_pool_get_listened ()
int | grss_feeds_pool_get_listened_num ()
void | grss_feeds_pool_switch ()
SoupSession * | grss_feeds_pool_get_session ()

## Signals

void | feed-fail | Run Last
void | feed-fetching | Run Last
void | feed-ready | Run Last

## Types and Values

#define | GRSS_FEEDS_POOL_TYPE

## Object Hierarchy

        GObject
        ╰── GrssFeedsPool

## 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.

## Functions

### 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.

#### Parameters

pool | a GrssFeedsPool. |
feeds | a list of GrssFeedChannel. | [element-type 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()`.

#### Parameters

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.

[element-type GrssFeedChannel][transfer container]

### 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()`.

#### Parameters

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.

#### Parameters

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.

#### Parameters

pool | a GrssFeedsPool. |

#### Returns

instance of SoupSession. Do not free it.

[transfer none]

## Types and Values

### GRSS_FEEDS_POOL_TYPE

    #define GRSS_FEEDS_POOL_TYPE		(grss_feeds_pool_get_type())

## Signal Details

### The `“feed-fail”` signal

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

Emitted when an error raises in fetching or parsing a GrssFeedChannel assigned to the `pool` .

#### Parameters

pool | the GrssFeedsPool emitting the signal. |
feed | the GrssFeedChannel which failed to fetch or parse. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“feed-fetching”` signal

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

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

#### Parameters

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. |

Flags: Run Last

### The `“feed-ready”` signal

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

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 occurred while fetching and/or parsing. List of `items` is freed, and his elements are unref'd, when signal ends.

#### Parameters

pool | the GrssFeedsPool emitting the signal. |
feed | the GrssFeedChannel which has been fetched and parsed. |
items | list of GrssFeedItem obtained parsing the feed. | [type GLib.List][element-type GrssFeedItem][transfer none]
user_data | user data set when the signal handler was connected. |

Flags: Run Last