tasklist: tokenize

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-23 14:12:01 +02:00
parent e880f7c11b
commit cd21e6665b
2 changed files with 29 additions and 18 deletions

View File

@ -1,4 +1,5 @@
align align
all
auto auto
bg bg
border_padding border_padding
@ -16,6 +17,7 @@ fg_center
fg_end fg_end
fg_off fg_off
flex flex
focus
gap gap
grow grow
height height
@ -30,7 +32,10 @@ right
scale scale
shadow shadow
shadow_offset shadow_offset
show
show_empty show_empty
show_icons
tags
text text
text_focus text_focus
text_normal text_normal

View File

@ -28,6 +28,7 @@
#include "tag.h" #include "tag.h"
#include "common/configopts.h" #include "common/configopts.h"
#include "common/markup.h" #include "common/markup.h"
#include "common/tokenize.h"
extern awesome_t globalconf; extern awesome_t globalconf;
@ -263,37 +264,42 @@ tasklist_tell(widget_t *widget, const char *property, const char *new_value)
{ {
tasklist_data_t *d = widget->data; tasklist_data_t *d = widget->data;
if(!a_strcmp(property, "text_normal")) switch(a_tokenize(property, -1))
{ {
case A_TK_TEXT_NORMAL:
p_delete(&d->text_normal); p_delete(&d->text_normal);
d->text_normal = a_strdup(new_value); d->text_normal = a_strdup(new_value);
} break;
else if(!a_strcmp(property, "text_focus")) case A_TK_TEXT_FOCUS:
{
p_delete(&d->text_focus); p_delete(&d->text_focus);
d->text_focus = a_strdup(new_value); d->text_focus = a_strdup(new_value);
} break;
else if(!a_strcmp(property, "text_urgent")) case A_TK_TEXT_URGENT:
{
p_delete(&d->text_urgent); p_delete(&d->text_urgent);
d->text_urgent = a_strdup(new_value); d->text_urgent = a_strdup(new_value);
} break;
else if(!a_strcmp(property, "show_icons")) case A_TK_SHOW_ICONS:
d->show_icons = a_strtobool(new_value); d->show_icons = a_strtobool(new_value);
else if(!a_strcmp(property, "show")) break;
case A_TK_SHOW:
switch(a_tokenize(new_value, -1))
{ {
if(!a_strcmp(new_value, "tags")) case A_TK_TAGS:
d->show = ShowTags; d->show = ShowTags;
else if(!a_strcmp(new_value, "focus")) break;
case A_TK_FOCUS:
d->show = ShowFocus; d->show = ShowFocus;
else if(!a_strcmp(new_value, "all")) break;
case A_TK_ALL:
d->show = ShowAll; d->show = ShowAll;
else break;
default:
return WIDGET_ERROR; return WIDGET_ERROR;
} }
else break;
default:
return WIDGET_ERROR; return WIDGET_ERROR;
}
return WIDGET_NOERROR; return WIDGET_NOERROR;
} }