widget: allow widgets to be added several times

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-18 18:38:08 +02:00
parent 81fb5ab50b
commit 88cff0eadc
2 changed files with 4 additions and 6 deletions

View File

@ -368,9 +368,8 @@ luaA_statusbar_widget_add(lua_State *L)
/* check that there is not already a widget with that name in the titlebar */ /* check that there is not already a widget with that name in the titlebar */
for(witer = (*sb)->widgets; witer; witer = witer->next) for(witer = (*sb)->widgets; witer; witer = witer->next)
if(witer->widget == *widget) if(witer->widget != *widget
luaL_error(L, "widget `%s' is already on statusbar"); && !a_strcmp(witer->widget->name, (*widget)->name))
else if(!a_strcmp(witer->widget->name, (*widget)->name))
luaL_error(L, "a widget with name `%s' already on statusbar `%s'", luaL_error(L, "a widget with name `%s' already on statusbar `%s'",
witer->widget->name, (*sb)->name); witer->widget->name, (*sb)->name);

View File

@ -354,9 +354,8 @@ luaA_titlebar_widget_add(lua_State *L)
/* check that there is not already a widget with that name in the titlebar */ /* check that there is not already a widget with that name in the titlebar */
for(witer = (*tb)->widgets; witer; witer = witer->next) for(witer = (*tb)->widgets; witer; witer = witer->next)
if(witer->widget == *widget) if(witer->widget != *widget
luaL_error(L, "widget `%s' is already on titlebar"); && !a_strcmp(witer->widget->name, (*widget)->name))
else if(!a_strcmp(witer->widget->name, (*widget)->name))
luaL_error(L, "a widget with name `%s' already on titlebar", witer->widget->name); luaL_error(L, "a widget with name `%s' already on titlebar", witer->widget->name);
w->widget = *widget; w->widget = *widget;