iconbox: use tokenize

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-23 14:06:37 +02:00
parent ab5119732d
commit 4c133bc646
2 changed files with 9 additions and 4 deletions

View File

@ -24,6 +24,7 @@ left
line line
max_value max_value
min_value min_value
resize
reverse reverse
right right
scale scale

View File

@ -21,6 +21,7 @@
#include "widget.h" #include "widget.h"
#include "common/util.h" #include "common/util.h"
#include "common/tokenize.h"
typedef struct typedef struct
{ {
@ -73,15 +74,18 @@ iconbox_tell(widget_t *widget, const char *property, const char *new_value)
if(!new_value) if(!new_value)
return WIDGET_ERROR_NOVALUE; return WIDGET_ERROR_NOVALUE;
if(!a_strcmp(property, "image")) switch(a_tokenize(property, -1))
{ {
case A_TK_IMAGE:
draw_image_delete(&d->image); draw_image_delete(&d->image);
d->image = draw_image_new(new_value); d->image = draw_image_new(new_value);
} break;
else if(!a_strcmp(property, "resize")) case A_TK_RESIZE:
d->resize = a_strtobool(new_value); d->resize = a_strtobool(new_value);
else break;
default:
return WIDGET_ERROR; return WIDGET_ERROR;
}
return WIDGET_NOERROR; return WIDGET_NOERROR;
} }