textbox: use tokenize

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-23 13:24:03 +02:00
parent 723299ff5f
commit 28830c0dc9
3 changed files with 13 additions and 6 deletions

View File

@ -23,6 +23,7 @@ min_value
reverse
right
scale
text
ticks_count
ticks_gap
top

View File

@ -412,7 +412,8 @@ progressbar_tell(widget_t *widget, const char *property, const char *new_value)
if(!new_value)
return WIDGET_ERROR_NOVALUE;
switch (prop) {
switch (prop)
{
case A_TK_GAP:
d->gap = atoi(new_value);
return WIDGET_NOERROR;
@ -470,7 +471,8 @@ progressbar_tell(widget_t *widget, const char *property, const char *new_value)
return WIDGET_ERROR;
}
switch (prop) {
switch (prop)
{
case A_TK_DATA:
value = atof(setting);
bar->value = (value < bar->min_value ? bar->min_value :

View File

@ -24,6 +24,7 @@
#include "screen.h"
#include "common/util.h"
#include "common/configopts.h"
#include "common/tokenize.h"
extern awesome_t globalconf;
@ -73,15 +74,18 @@ textbox_tell(widget_t *widget, const char *property, const char *new_value)
{
textbox_data_t *d = widget->data;
if(!a_strcmp(property, "text"))
switch(a_tokenize(property, -1))
{
case A_TK_TEXT:
p_delete(&d->text);
a_iso2utf8(new_value, &d->text);
}
else if(!a_strcmp(property, "width"))
break;
case A_TK_WIDTH:
d->width = atoi(new_value);
else
break;
default:
return WIDGET_ERROR;
}
return WIDGET_NOERROR;
}