From 88cff0eadc469b6f4637a76bf47a6f576aa4764f Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 18 Jun 2008 18:38:08 +0200 Subject: [PATCH] widget: allow widgets to be added several times Signed-off-by: Julien Danjou --- statusbar.c | 5 ++--- titlebar.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/statusbar.c b/statusbar.c index 73c979ea..e8cc3b8e 100644 --- a/statusbar.c +++ b/statusbar.c @@ -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 */ for(witer = (*sb)->widgets; witer; witer = witer->next) - if(witer->widget == *widget) - luaL_error(L, "widget `%s' is already on statusbar"); - else if(!a_strcmp(witer->widget->name, (*widget)->name)) + if(witer->widget != *widget + && !a_strcmp(witer->widget->name, (*widget)->name)) luaL_error(L, "a widget with name `%s' already on statusbar `%s'", witer->widget->name, (*sb)->name); diff --git a/titlebar.c b/titlebar.c index 06e83951..f7fd49b9 100644 --- a/titlebar.c +++ b/titlebar.c @@ -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 */ for(witer = (*tb)->widgets; witer; witer = witer->next) - if(witer->widget == *widget) - luaL_error(L, "widget `%s' is already on titlebar"); - else if(!a_strcmp(witer->widget->name, (*widget)->name)) + if(witer->widget != *widget + && !a_strcmp(witer->widget->name, (*widget)->name)) luaL_error(L, "a widget with name `%s' already on titlebar", witer->widget->name); w->widget = *widget;