From cd21e6665b97ee8a89eafae20503f9c51b3a187f Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 23 Jun 2008 14:12:01 +0200 Subject: [PATCH] tasklist: tokenize Signed-off-by: Julien Danjou --- common/tokenize.gperf | 5 +++++ widgets/tasklist.c | 42 ++++++++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/common/tokenize.gperf b/common/tokenize.gperf index 9f514bdc..b5119bc1 100644 --- a/common/tokenize.gperf +++ b/common/tokenize.gperf @@ -1,4 +1,5 @@ align +all auto bg border_padding @@ -16,6 +17,7 @@ fg_center fg_end fg_off flex +focus gap grow height @@ -30,7 +32,10 @@ right scale shadow shadow_offset +show show_empty +show_icons +tags text text_focus text_normal diff --git a/widgets/tasklist.c b/widgets/tasklist.c index 36368cd8..887047dc 100644 --- a/widgets/tasklist.c +++ b/widgets/tasklist.c @@ -28,6 +28,7 @@ #include "tag.h" #include "common/configopts.h" #include "common/markup.h" +#include "common/tokenize.h" 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; - if(!a_strcmp(property, "text_normal")) + switch(a_tokenize(property, -1)) { + case A_TK_TEXT_NORMAL: p_delete(&d->text_normal); d->text_normal = a_strdup(new_value); - } - else if(!a_strcmp(property, "text_focus")) - { + break; + case A_TK_TEXT_FOCUS: p_delete(&d->text_focus); d->text_focus = a_strdup(new_value); - } - else if(!a_strcmp(property, "text_urgent")) - { + break; + case A_TK_TEXT_URGENT: p_delete(&d->text_urgent); d->text_urgent = a_strdup(new_value); - } - else if(!a_strcmp(property, "show_icons")) + break; + case A_TK_SHOW_ICONS: d->show_icons = a_strtobool(new_value); - else if(!a_strcmp(property, "show")) - { - if(!a_strcmp(new_value, "tags")) + break; + case A_TK_SHOW: + switch(a_tokenize(new_value, -1)) + { + case A_TK_TAGS: d->show = ShowTags; - else if(!a_strcmp(new_value, "focus")) + break; + case A_TK_FOCUS: d->show = ShowFocus; - else if(!a_strcmp(new_value, "all")) + break; + case A_TK_ALL: d->show = ShowAll; - else + break; + default: return WIDGET_ERROR; - } - else + } + break; + default: return WIDGET_ERROR; - + } return WIDGET_NOERROR; }