From a823470fd07c6afb78526fd3d8cef06b37db0be5 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sat, 12 Jan 2008 21:35:44 +0100 Subject: [PATCH] use list function for Widget --- config.c | 11 +++-------- config.h | 2 ++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/config.c b/config.c index 5b04a60d..558ab7d8 100644 --- a/config.c +++ b/config.c @@ -265,19 +265,14 @@ create_widgets(cfg_t* cfg_statusbar, Statusbar *statusbar) qsort(widgets, numwidgets, sizeof(cfg_t), cmp_widget_cfg); - for (i = 0; i < numwidgets; i++) + for(i = 0; i < numwidgets; i++) { wptr = widgets + i; widget_new = name_func_lookup(cfg_name(wptr), WidgetList); if(widget_new) { - if(!widget) - statusbar->widgets = widget = widget_new(statusbar, wptr); - else - { - widget->next = widget_new(statusbar, wptr); - widget = widget->next; - } + widget = widget_new(statusbar, wptr); + widget_list_append(&statusbar->widgets, widget); widget->buttons = parse_mouse_bindings(wptr, "mouse", a_strcmp(cfg_name(wptr), "taglist")); } else diff --git a/config.h b/config.h index 65f620e0..3454df21 100644 --- a/config.h +++ b/config.h @@ -132,6 +132,8 @@ struct Widget Widget *next; }; +DO_SLIST(Widget, widget, p_delete); + /** Status bar */ struct Statusbar {