refresh_add_timeout


Description:

public uint refresh_add_timeout (MainContext? context, owned SourceRefreshFunc callback)

This is a simple way to schedule a periodic data source refresh.

Adds a timeout SocketSource to context and handles all the bookkeeping if this's refresh enabled state or its refresh interval_minutes value changes. The callback is expected to dispatch an asynchronous job to connect to and fetch updates from a remote server.

The returned ID can be passed to refresh_remove_timeout to remove the timeout from context. Note the ID is a private handle and cannot be passed to remove.

Parameters:

this

an Source

context

a MainContext, or null (if null, the default context will be used)

callback

function to call on each timeout

notify

function to call when the timeout is removed, or null

user_data

data to pass to callback

Returns:

a refresh timeout ID