Mercurial > audlegacy
comparison src/audacious/eventqueue.c @ 4581:cf6711eeb12f
implement event_queue_with_data_free()
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Wed, 21 May 2008 18:40:05 +0200 |
parents | e71fe9091fc9 |
children | d9b2fe7a2d04 |
comparison
equal
deleted
inserted
replaced
4580:910ed095b5a9 | 4581:cf6711eeb12f |
---|---|
25 HookCallQueue *hq = (HookCallQueue *) udata; | 25 HookCallQueue *hq = (HookCallQueue *) udata; |
26 | 26 |
27 hook_call(hq->name, hq->user_data); | 27 hook_call(hq->name, hq->user_data); |
28 | 28 |
29 g_free(hq->name); | 29 g_free(hq->name); |
30 if (hq->free_data && hq->user_data) | |
31 g_free(hq->user_data); | |
32 | |
30 g_slice_free(HookCallQueue, hq); | 33 g_slice_free(HookCallQueue, hq); |
31 | 34 |
32 return FALSE; | 35 return FALSE; |
33 } | 36 } |
34 | 37 |
40 g_return_if_fail(user_data != NULL); | 43 g_return_if_fail(user_data != NULL); |
41 | 44 |
42 hq = g_slice_new0(HookCallQueue); | 45 hq = g_slice_new0(HookCallQueue); |
43 hq->name = g_strdup(name); | 46 hq->name = g_strdup(name); |
44 hq->user_data = user_data; | 47 hq->user_data = user_data; |
48 hq->free_data = FALSE; | |
45 | 49 |
46 g_idle_add_full(G_PRIORITY_HIGH_IDLE, eventqueue_handle, hq, NULL); | 50 g_idle_add_full(G_PRIORITY_HIGH_IDLE, eventqueue_handle, hq, NULL); |
47 } | 51 } |
48 | 52 |
49 void event_queue_timed(gint time, const gchar *name, gpointer user_data) | 53 void event_queue_timed(gint time, const gchar *name, gpointer user_data) |
54 g_return_if_fail(user_data != NULL); | 58 g_return_if_fail(user_data != NULL); |
55 | 59 |
56 hq = g_slice_new0(HookCallQueue); | 60 hq = g_slice_new0(HookCallQueue); |
57 hq->name = g_strdup(name); | 61 hq->name = g_strdup(name); |
58 hq->user_data = user_data; | 62 hq->user_data = user_data; |
63 hq->free_data = FALSE; | |
59 | 64 |
60 g_timeout_add(time, eventqueue_handle, hq); | 65 g_timeout_add(time, eventqueue_handle, hq); |
61 } | 66 } |
67 | |
68 void event_queue_with_data_free(const gchar *name, gpointer user_data) | |
69 { | |
70 HookCallQueue *hq; | |
71 | |
72 g_return_if_fail(name != NULL); | |
73 g_return_if_fail(user_data != NULL); | |
74 | |
75 hq = g_slice_new0(HookCallQueue); | |
76 hq->name = g_strdup(name); | |
77 hq->user_data = user_data; | |
78 hq->free_data = TRUE; | |
79 | |
80 g_idle_add_full(G_PRIORITY_HIGH_IDLE, eventqueue_handle, hq, NULL); | |
81 } |