glibmm: Glib::SignalIdle Class Reference

glibmm 2.32.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
Glib::SignalIdle Class Reference
The Main Event Loop

`#include <glibmm/main.h>`

List of all members.

## Public Member Functions
sigc::connection | connect (const sigc::slot< bool >& slot, int priority=PRIORITY_DEFAULT_IDLE)
| Connects an idle handler.
void | connect_once (const sigc::slot< void >& slot, int priority=PRIORITY_DEFAULT_IDLE)
| Connects an idle handler that runs only once.

## Member Function Documentation

sigc::connection Glib::SignalIdle::connect | ( | const sigc::slot< bool > & | slot,
|  | int | priority = `PRIORITY_DEFAULT_IDLE`
| ) |  |

Connects an idle handler.

bool idle_handler() { ... }
Glib::signal_idle().connect(sigc::ptr_fun(&idle_handler));

is equivalent to:

bool idle_handler() { ... }
const Glib::RefPtr<Glib::IdleSource> idle_source = Glib::IdleSource::create();
idle_source->connect(sigc::ptr_fun(&idle_handler));
idle_source->attach(Glib::MainContext::get_default());

Parameters:

  slot | A slot to call when the main loop is idle. If `idle_handler()` returns `false` the handler is disconnected.
  priority | The priority of the new event source.

Returns:
  A connection handle, which can be used to disconnect the handler.

void Glib::SignalIdle::connect_once | ( | const sigc::slot< void > & | slot,
|  | int | priority = `PRIORITY_DEFAULT_IDLE`
| ) |  |

Connects an idle handler that runs only once.

This method takes a function pointer to a function with a void return and no parameters. After running once it is not called again.

See also:
  connect()

Parameters:

  slot | A slot to call when the main loop is idle. For example: void on_idle_once()
  priority | The priority of the new event source.

Examples:
  thread/dispatcher.cc.