From ceb6fc010ee9f4fadbcbf3e3cdc481ec505cdc32 Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 20 Jan 2007 06:37:35 +0000 Subject: dynamic properties for bars; new 'property_valid()' helper git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@749 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- widget_text.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'widget_text.c') diff --git a/widget_text.c b/widget_text.c index 688fe70..a0b08ad 100644 --- a/widget_text.c +++ b/widget_text.c @@ -161,9 +161,10 @@ void widget_text_update(void *Self) char *string; int update = 0; - /* evaluate prefix and postfix */ + /* evaluate properties */ update += property_eval(&T->prefix); update += property_eval(&T->postfix); + update += property_eval(&T->style); /* evaluate value */ property_eval(&T->value); @@ -211,9 +212,6 @@ void widget_text_update(void *Self) free(string); } - /* text style */ - update += property_eval(&T->style); - /* something has changed and should be updated */ if (update) { /* reset marquee counter if content has changed */ @@ -246,9 +244,14 @@ int widget_text_init(WIDGET * Self) /* load properties */ property_load(section, "prefix", NULL, &Text->prefix); - property_load(section, "expression", NULL, &Text->value); + property_load(section, "expression", "", &Text->value); property_load(section, "postfix", NULL, &Text->postfix); - property_load(section, "style", "'norm'", &Text->style); + property_load(section, "style", NULL, &Text->style); + + /* sanity checks */ + if (!property_valid(&Text->value)) { + error("Warning: widget %s has no expression", section); + } /* field width, default 10 */ cfg_number(section, "width", 10, 0, -1, &(Text->width)); -- cgit v1.2.3