Ubuntu TV Media Scanner
A centralized index for removable media content.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions | List of all members
mediascanner::Idle Class Reference

The Idle class provides access to GLib's idle source mechanism. More...

#include <mediascanner/glibutils.h>

+ Inheritance diagram for mediascanner::Idle:

Static Public Member Functions

static unsigned Add (const SourceFunction &function, int priority=G_PRIORITY_DEFAULT)
 Installs a regular idle source. More...
 
static unsigned AddOnce (const OneCallFunction &function, int priority=G_PRIORITY_DEFAULT)
 Installs a single-call idle source. More...
 
- Static Public Member Functions inherited from mediascanner::Source
static bool Remove (unsigned id)
 Removes an event source handler. More...
 

Additional Inherited Members

- Public Types inherited from mediascanner::Source
typedef std::function< bool()> SourceFunction
 The signature of a regular idle source. More...
 
typedef std::function< void()> OneCallFunction
 The signature of a single-call idle source. More...
 
- Static Protected Member Functions inherited from mediascanner::Source
static gboolean on_source_function (gpointer data)
 
static gboolean on_one_call_function (gpointer data)
 

Detailed Description

The Idle class provides access to GLib's idle source mechanism.

It manages functions which get called whenever there are no higher priority events pending to the default main loop.

See Also
Timeout

Member Function Documentation

static unsigned mediascanner::Idle::Add ( const SourceFunction function,
int  priority = G_PRIORITY_DEFAULT 
)
inlinestatic

Installs a regular idle source.

This source will be invoked until the function returns false. After that it be removed automatically from the list of event sources.

Parameters
functionThe function to be called on idle.
priorityThe priority of the idle source.
Returns
The identifier (greater than 0) of the event source.
See Also
AddOnce(), Source::Remove()
static unsigned mediascanner::Idle::AddOnce ( const OneCallFunction function,
int  priority = G_PRIORITY_DEFAULT 
)
inlinestatic

Installs a single-call idle source.

This source will be called exactly once. After that it be removed automatically from the list of event sources.

Parameters
functionThe function to be called on idle.
priorityThe priority of the idle source.
Returns
The identifier (greater than 0) of the event source.
See Also
Add(), Source::Remove()