aboutsummaryrefslogtreecommitdiff
path: root/src/state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/state.c b/src/state.c
index e8ddbe0..c5dc759 100644
--- a/src/state.c
+++ b/src/state.c
@@ -55,6 +55,21 @@ void state_redraw(State *state, bool changed_layout)
state->id = g_idle_add_full(G_PRIORITY_HIGH_IDLE, changed_layout ? redraw_and_layout : redraw, state, NULL);
}
+static gint align_compare(gconstpointer a, gconstpointer b)
+{
+ PangoAlignment a_align = ((Button *)a)->align;
+ PangoAlignment b_align = ((Button *)b)->align;
+
+ if (a_align < b_align) return -1;
+ if (a_align > b_align) return 1;
+ return 0;
+}
+
+void state_order_button(State *state)
+{
+ state->btns = g_list_sort(state->btns, align_compare);
+}
+
void state_destroy(State *state)
{
g_list_free_full(state->btns, (void *)button_destroy);