Use string of element instead of multi section

This commit is contained in:
Martin Duquesnoy 2011-08-30 23:37:00 +02:00
parent f2d67a8ace
commit 55586bc20a
3 changed files with 8 additions and 18 deletions

View File

@ -16,9 +16,10 @@ static void
config_bars(void) config_bars(void)
{ {
Scr33n *s; Scr33n *s;
size_t i, n, j, m; size_t i, n;
struct conf_sec *sec, **ks, **es; struct conf_sec *sec, **ks;
int screenid; int screenid;
char *elem;
/* [bars] */ /* [bars] */
sec = fetch_section_first(NULL, "bars"); sec = fetch_section_first(NULL, "bars");
@ -28,21 +29,12 @@ config_bars(void)
/* [bar] */ /* [bar] */
for(i = 0; i < n; ++i) for(i = 0; i < n; ++i)
{ {
char elem[128] = { 0 }; elem = fetch_opt_first(ks[i], "", "elements").str;
/* [element] */
es = fetch_section(ks[i], "element");
m = fetch_section_count(es);
for(j = 0; j < m; ++j)
elem[j] = fetch_opt_first(es[j], "t", "type").str[0];
screenid = fetch_opt_first(ks[i], "-1", "screen").num; screenid = fetch_opt_first(ks[i], "-1", "screen").num;
SLIST_FOREACH(s, &W->h.screen, next) SLIST_FOREACH(s, &W->h.screen, next)
if(screenid == s->id || screenid == -1) if(screenid == s->id || screenid == -1)
(Infobar*)infobar_new(s, elem); (Infobar*)infobar_new(s, elem);
free(es);
} }
free(ks); free(ks);

View File

@ -27,8 +27,6 @@ tag_new(Scr33n *s, char *name)
void void
tag_screen(Scr33n *s, Tag *t) tag_screen(Scr33n *s, Tag *t)
{ {
Infobar *i;
s->seltag = t; s->seltag = t;
infobar_elem_screen_update(s, ElemTag); infobar_elem_screen_update(s, ElemTag);

View File

@ -5,17 +5,17 @@
[bars] [bars]
# element type: # element type:
# t Tag list # t Tags
# S statustext # S Statustext
[bar] [bar]
screen = 0 screen = 0
[element] type = "t" [/element] elements = "tt"
[/bar] [/bar]
[bar] [bar]
screen = 1 screen = 1
[element] type = "t" [/element] elements = "t"
[/bar] [/bar]
[/bars] [/bars]