changeset 3720:6f6982108001

Add a function to eventqueue API, event_queue_timed() which calls a hook at a postponed time.
author William Pitcock <nenolod@atheme.org>
date Thu, 11 Oct 2007 20:00:05 -0500
parents 48795d67d9cb
children e71fe9091fc9
files src/audacious/eventqueue.c src/audacious/eventqueue.h src/audacious/playback.c
diffstat 3 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/eventqueue.c	Thu Oct 11 19:51:08 2007 -0500
+++ b/src/audacious/eventqueue.c	Thu Oct 11 20:00:05 2007 -0500
@@ -45,3 +45,17 @@
 
     g_idle_add_full(G_PRIORITY_HIGH_IDLE, eventqueue_handle, hq, NULL);
 }
+
+void event_queue_timed(gint time, const gchar *name, gpointer data)
+{
+    HookCallQueue *hq;
+
+    g_return_if_fail(name != NULL);
+    g_return_if_fail(user_data != NULL);
+
+    hq = g_slice_new0(HookCallQueue);
+    hq->name = g_strdup(name);
+    hq->user_data = user_data;
+
+    g_timeout_add(time, eventqueue_handle, hq);
+}
--- a/src/audacious/eventqueue.h	Thu Oct 11 19:51:08 2007 -0500
+++ b/src/audacious/eventqueue.h	Thu Oct 11 20:00:05 2007 -0500
@@ -31,5 +31,6 @@
 } HookCallQueue;
 
 void event_queue(const gchar *name, gpointer user_data);
+void event_queue_timed(gint time, const gchar *name, gpointer user_data);
 
 #endif
--- a/src/audacious/playback.c	Thu Oct 11 19:51:08 2007 -0500
+++ b/src/audacious/playback.c	Thu Oct 11 20:00:05 2007 -0500
@@ -503,7 +503,7 @@
         output_set_volume(l, r);
     }
 
-    event_queue("playback seek", playback);
+    event_queue_timed(10, "playback seek", playback);
 }
 
 void