use list functions for Tag
This commit is contained in:
parent
feac2caa81
commit
99e54ef971
14
config.c
14
config.c
|
@ -398,11 +398,12 @@ config_parse_screen(cfg_t *cfg, int screen)
|
|||
}
|
||||
|
||||
/* Tags */
|
||||
virtscreen->tags = tag = p_new(Tag, 1);
|
||||
if(cfg_size(cfg_tags, "tag"))
|
||||
for(i = 0; i < cfg_size(cfg_tags, "tag"); i++)
|
||||
tag_list_init(&virtscreen->tags);
|
||||
if((j = cfg_size(cfg_tags, "tag")))
|
||||
for(--j; j >= 0; j--)
|
||||
{
|
||||
cfgsectmp = cfg_getnsec(cfg_tags, "tag", i);
|
||||
tag = p_new(Tag, 1);
|
||||
cfgsectmp = cfg_getnsec(cfg_tags, "tag", j);
|
||||
tag->name = a_strdup(cfg_title(cfgsectmp));
|
||||
tag->selected = False;
|
||||
tag->was_selected = False;
|
||||
|
@ -417,10 +418,7 @@ config_parse_screen(cfg_t *cfg, int screen)
|
|||
tag->nmaster = cfg_getint(cfgsectmp, "nmaster");
|
||||
tag->ncol = cfg_getint(cfgsectmp, "ncol");
|
||||
|
||||
if(i < cfg_size(cfg_tags, "tag") - 1)
|
||||
tag = tag->next = p_new(Tag, 1);
|
||||
else
|
||||
tag->next = NULL;
|
||||
tag_list_push(&virtscreen->tags, tag);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
2
config.h
2
config.h
|
@ -232,6 +232,8 @@ struct Tag
|
|||
Tag *next;
|
||||
};
|
||||
|
||||
DO_SLIST(Tag, tag, p_delete);
|
||||
|
||||
/** TagClientLink type */
|
||||
typedef struct TagClientLink TagClientLink;
|
||||
struct TagClientLink
|
||||
|
|
6
tag.c
6
tag.c
|
@ -414,18 +414,18 @@ uicb_tag_viewprev(int screen, char *arg __attribute__ ((unused)))
|
|||
void
|
||||
uicb_tag_create(int screen, char *arg)
|
||||
{
|
||||
Tag *last_tag, *tag;
|
||||
Tag *tag;
|
||||
|
||||
if(!a_strlen(arg))
|
||||
return;
|
||||
|
||||
for(last_tag = globalconf.screens[screen].tags; last_tag && last_tag->next; last_tag = last_tag->next);
|
||||
last_tag->next = tag = p_new(Tag, 1);
|
||||
tag = p_new(Tag, 1);
|
||||
tag->name = a_strdup(arg);
|
||||
tag->layout = globalconf.screens[screen].layouts;
|
||||
tag->mwfact = 0.5;
|
||||
tag->nmaster = 1;
|
||||
tag->ncol = 1;
|
||||
tag_list_append(&globalconf.screens[screen].tags, tag);
|
||||
widget_invalidate_cache(screen, WIDGET_CACHE_TAGS);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue