diff options
author | Anders Carlsson <andersca@codefactory.se> | 2003-02-13 20:37:07 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@codefactory.se> | 2003-02-13 20:37:07 +0000 |
commit | fef27dc10d03bf0b80e11e77739e50322aa163b9 (patch) | |
tree | f856d050e786678252e5df6e11eb3477d1593f98 /glib | |
parent | 1bfced6e45f733328f2509695974be86fbf2bef2 (diff) | |
download | dbus-fef27dc10d03bf0b80e11e77739e50322aa163b9.tar.gz dbus-fef27dc10d03bf0b80e11e77739e50322aa163b9.tar.bz2 dbus-fef27dc10d03bf0b80e11e77739e50322aa163b9.zip |
2003-02-13 Anders Carlsson <andersca@codefactory.se>
* glib/dbus-gmain.c: (timeout_handler), (add_timeout),
(remove_timeout):
Implement support for timeouts in dbus-glib.
Diffstat (limited to 'glib')
-rw-r--r-- | glib/dbus-gmain.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/glib/dbus-gmain.c b/glib/dbus-gmain.c index c5197e5e..80d7d6ba 100644 --- a/glib/dbus-gmain.c +++ b/glib/dbus-gmain.c @@ -172,16 +172,38 @@ remove_watch (DBusWatch *watch, g_free (poll_fd); } +static gboolean +timeout_handler (gpointer data) +{ + DBusTimeout *timeout = data; + + dbus_timeout_handle (timeout); + + return FALSE; +} + + static void add_timeout (DBusTimeout *timeout, void *data) { + guint timeout_tag; + + timeout_tag = g_timeout_add (dbus_timeout_get_interval (timeout), + timeout_handler, timeout); + + dbus_timeout_set_data (timeout, GUINT_TO_POINTER (timeout_tag), NULL); } static void remove_timeout (DBusTimeout *timeout, void *data) { + guint timeout_tag; + + timeout_tag = GPOINTER_TO_UINT (dbus_timeout_get_data (timeout)); + + g_source_remove (timeout_tag); } void |