diff --git a/src/dunst.c b/src/dunst.c index b1d9696..ef6df80 100644 --- a/src/dunst.c +++ b/src/dunst.c @@ -240,10 +240,7 @@ static void teardown(void) int dunst_main(int argc, char *argv[]) { - /*TODO: move to queues.c */ - history = g_queue_new(); - displayed = g_queue_new(); - queue = g_queue_new(); + queues_init(); cmdline_load(argc, argv); diff --git a/src/queues.c b/src/queues.c index 163f7d2..e1f1a26 100644 --- a/src/queues.c +++ b/src/queues.c @@ -14,6 +14,13 @@ GQueue *queue = NULL; /* all new notifications get into here */ GQueue *displayed = NULL; /* currently displayed notifications */ GQueue *history = NULL; /* history of displayed notifications */ +void queues_init(void) +{ + history = g_queue_new(); + displayed = g_queue_new(); + queue = g_queue_new(); +} + bool notification_replace_by_id(notification *new) { diff --git a/src/queues.h b/src/queues.h index 70e031f..6440e5d 100644 --- a/src/queues.h +++ b/src/queues.h @@ -9,6 +9,11 @@ extern GQueue *queue; extern GQueue *displayed; extern GQueue *history; +/* + * Initialise neccessary queues + */ +void queues_init(void); + /* * Replace the notification which matches the id field of * the new notification. The given notification is inserted