From a6349a2444571624c792ca222dff57c7f1711c71 Mon Sep 17 00:00:00 2001
From: Mikkel Oscar Lyderik <mikkeloscar@gmail.com>
Date: Sat, 23 Jan 2016 20:55:01 +0100
Subject: swaybar: feactor render, statusline

---
 swaybar/state.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 swaybar/state.c

(limited to 'swaybar/state.c')

diff --git a/swaybar/state.c b/swaybar/state.c
new file mode 100644
index 00000000..900842e0
--- /dev/null
+++ b/swaybar/state.c
@@ -0,0 +1,29 @@
+#include <stdlib.h>
+
+#include "list.h"
+#include "config.h"
+#include "status_line.h"
+#include "state.h"
+
+struct swaybar_state *init_state() {
+	struct swaybar_state *state = calloc(1, sizeof(struct swaybar_state));
+	state->config = init_config();
+	state->status = init_status_line();
+	state->output = malloc(sizeof(struct output));
+	state->output->window = NULL;
+	state->output->registry = NULL;
+	state->output->workspaces = create_list();
+
+	return state;
+}
+
+void free_workspace(void *item) {
+	if (!item) {
+		return;
+	}
+	struct workspace *ws = (struct workspace *)item;
+	if (ws->name) {
+		free(ws->name);
+	}
+	free(ws);
+}
-- 
cgit v1.2.3