25 #include "dbus-internals.h"    26 #include "dbus-timeout.h"    27 #include "dbus-list.h"   199   if (timeout_list == 
NULL)
   247   if (add_function != 
NULL)
   257           if (!(* add_function) (link->
data, data))
   263               while (link2 != link)
   268                   (* remove_function) (link2->
data, 
data);
   368   if (enabled == timeout->
enabled)
   431   return timeout->
data;
 DBusTimeout * _dbus_timeout_new(int interval, DBusTimeoutHandler handler, void *data, DBusFreeFunction free_data_function)
Creates a new DBusTimeout, enabled by default. 
Internals of DBusTimeout. 
unsigned int enabled
True if timeout is active. 
DBusAddTimeoutFunction add_timeout_function
Callback for adding a timeout. 
#define NULL
A null pointer, defined appropriately for C or C++. 
void(* DBusFreeFunction)(void *memory)
The type of a function which frees a block of memory. 
dbus_bool_t _dbus_timeout_list_set_functions(DBusTimeoutList *timeout_list, DBusAddTimeoutFunction add_function, DBusRemoveTimeoutFunction remove_function, DBusTimeoutToggledFunction toggled_function, void *data, DBusFreeFunction free_data_function)
Sets the timeout functions. 
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0(). 
DBusTimeout * _dbus_timeout_ref(DBusTimeout *timeout)
Increments the reference count of a DBusTimeout object. 
void _dbus_timeout_set_enabled(DBusTimeout *timeout, dbus_bool_t enabled)
Changes the timeout's enabled-ness. 
void _dbus_timeout_list_free(DBusTimeoutList *timeout_list)
Frees a DBusTimeoutList. 
DBusTimeoutList * _dbus_timeout_list_new(void)
Creates a new timeout list. 
#define _dbus_assert(condition)
Aborts with an error message if the condition is false. 
void * data
Data stored at this element. 
dbus_bool_t _dbus_list_remove(DBusList **list, void *data)
Removes a value from the list. 
void * data
Application data. 
#define _dbus_list_get_next_link(list, link)
Gets the next link in the list, or NULL if there are no more links. 
void(* DBusRemoveTimeoutFunction)(DBusTimeout *timeout, void *data)
Called when libdbus no longer needs a timeout to be monitored by the main loop. 
DBusTimeoutToggledFunction timeout_toggled_function
Callback when timeout is enabled/disabled or changes interval. 
DBUS_EXPORT dbus_bool_t dbus_timeout_get_enabled(DBusTimeout *timeout)
Returns whether a timeout is enabled or not. 
dbus_bool_t _dbus_list_remove_last(DBusList **list, void *data)
Removes a value from the list. 
void * timeout_data
Data for timeout callbacks. 
#define dbus_new0(type, count)
Safe macro for using dbus_malloc0(). 
dbus_bool_t _dbus_timeout_list_add_timeout(DBusTimeoutList *timeout_list, DBusTimeout *timeout)
Adds a new timeout to the timeout list, invoking the application DBusAddTimeoutFunction if appropriat...
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE. 
DBUS_EXPORT dbus_bool_t dbus_timeout_handle(DBusTimeout *timeout)
Calls the timeout handler for this timeout. 
int refcount
Reference count. 
dbus_bool_t(* DBusAddTimeoutFunction)(DBusTimeout *timeout, void *data)
Called when libdbus needs a new timeout to be monitored by the main loop. 
DBusList * timeouts
Timeout objects. 
dbus_bool_t _dbus_list_append(DBusList **list, void *data)
Appends a value to the list. 
void _dbus_timeout_unref(DBusTimeout *timeout)
Decrements the reference count of a DBusTimeout object and finalizes the object if the count reaches ...
void _dbus_list_foreach(DBusList **list, DBusForeachFunction function, void *data)
Calls the given function for each element in the list. 
DBusFreeFunction free_handler_data_function
Free the timeout handler data. 
void _dbus_timeout_list_toggle_timeout(DBusTimeoutList *timeout_list, DBusTimeout *timeout, dbus_bool_t enabled)
Sets a timeout to the given enabled state, invoking the application's DBusTimeoutToggledFunction if a...
void(* DBusTimeoutToggledFunction)(DBusTimeout *timeout, void *data)
Called when dbus_timeout_get_enabled() may return a different value than it did before. 
#define TRUE
Expands to "1". 
#define _dbus_assert_not_reached(explanation)
Aborts with an error message if called. 
DBusTimeoutHandler handler
Timeout handler. 
void _dbus_timeout_list_remove_timeout(DBusTimeoutList *timeout_list, DBusTimeout *timeout)
Removes a timeout from the timeout list, invoking the application's DBusRemoveTimeoutFunction if appr...
void * handler_data
Timeout handler data. 
DBusRemoveTimeoutFunction remove_timeout_function
Callback for removing a timeout. 
DBUS_EXPORT void dbus_timeout_set_data(DBusTimeout *timeout, void *data, DBusFreeFunction free_data_function)
Sets data which can be retrieved with dbus_timeout_get_data(). 
DBusFreeFunction free_data_function
Free the application data. 
void(* DBusForeachFunction)(void *element, void *data)
Used to iterate over each item in a collection, such as a DBusList. 
DBusList * _dbus_list_get_first_link(DBusList **list)
Gets the first link in the list. 
#define FALSE
Expands to "0". 
DBUS_EXPORT void * dbus_timeout_get_data(DBusTimeout *timeout)
Gets data previously set with dbus_timeout_set_data() or NULL if none. 
int interval
Timeout interval in milliseconds. 
void _dbus_timeout_set_interval(DBusTimeout *timeout, int interval)
Changes the timeout interval. 
DBusTimeoutList implementation details. 
void _dbus_list_clear(DBusList **list)
Frees all links in the list and sets the list head to NULL. 
dbus_bool_t(* DBusTimeoutHandler)(void *data)
function to run when the timeout is handled 
DBUS_EXPORT int dbus_timeout_get_interval(DBusTimeout *timeout)
Gets the timeout interval. 
DBusFreeFunction timeout_free_data_function
Free function for timeout callback data.