summaryrefslogtreecommitdiff
path: root/glib/gmain.c
diff options
context:
space:
mode:
authorPeter Eisenmann <p3732@getgoogleoff.me>2023-04-16 21:20:59 +0200
committerPeter Eisenmann <peter.eisenmann@vigem.de>2023-05-02 13:42:54 +0200
commit3abf23b2a7958bbbed44da519bee681651053f9d (patch)
treed84a0a1ace2138f1e31ec208774c4fab9a7a9758 /glib/gmain.c
parentc86fde7e02bb942af2165fb7e7a1947469ed45bc (diff)
downloadglib-3abf23b2a7958bbbed44da519bee681651053f9d.tar.gz
add g_timeout_add_seconds_once
Add a new call combing behaviors of g_timeout_add_seconds and g_timeout_add_once.
Diffstat (limited to 'glib/gmain.c')
-rw-r--r--glib/gmain.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/glib/gmain.c b/glib/gmain.c
index 13724c67f..9d9c123af 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -5471,6 +5471,26 @@ g_timeout_add_seconds (guint interval,
return g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, interval, function, data, NULL);
}
+/**
+ * g_timeout_add_seconds_once:
+ * @interval: the time after which the function will be called, in seconds
+ * @function: function to call
+ * @data: data to pass to @function
+ *
+ * This function behaves like g_timeout_add_once() but with a range in seconds.
+ *
+ * Returns: the ID (greater than 0) of the event source
+ *
+ * Since: 2.78
+ */
+guint
+g_timeout_add_seconds_once (guint interval,
+ GSourceOnceFunc function,
+ gpointer data)
+{
+ return timeout_add_full (G_PRIORITY_DEFAULT, interval, TRUE, TRUE, (GSourceFunc) function, data, NULL);
+}
+
/* Child watch functions */
#ifdef G_OS_WIN32