use list function for Widget

This commit is contained in:
Julien Danjou 2008-01-12 21:35:44 +01:00
parent 19887a3201
commit a823470fd0
2 changed files with 5 additions and 8 deletions

View File

@ -265,19 +265,14 @@ create_widgets(cfg_t* cfg_statusbar, Statusbar *statusbar)
qsort(widgets, numwidgets, sizeof(cfg_t), cmp_widget_cfg); qsort(widgets, numwidgets, sizeof(cfg_t), cmp_widget_cfg);
for (i = 0; i < numwidgets; i++) for(i = 0; i < numwidgets; i++)
{ {
wptr = widgets + i; wptr = widgets + i;
widget_new = name_func_lookup(cfg_name(wptr), WidgetList); widget_new = name_func_lookup(cfg_name(wptr), WidgetList);
if(widget_new) if(widget_new)
{ {
if(!widget) widget = widget_new(statusbar, wptr);
statusbar->widgets = widget = widget_new(statusbar, wptr); widget_list_append(&statusbar->widgets, widget);
else
{
widget->next = widget_new(statusbar, wptr);
widget = widget->next;
}
widget->buttons = parse_mouse_bindings(wptr, "mouse", a_strcmp(cfg_name(wptr), "taglist")); widget->buttons = parse_mouse_bindings(wptr, "mouse", a_strcmp(cfg_name(wptr), "taglist"));
} }
else else

View File

@ -132,6 +132,8 @@ struct Widget
Widget *next; Widget *next;
}; };
DO_SLIST(Widget, widget, p_delete);
/** Status bar */ /** Status bar */
struct Statusbar struct Statusbar
{ {