mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Add a function that adds an entry to a menuq, normalizing a common code
path; from Tiago Cunha.
This commit is contained in:
11
group.c
11
group.c
@ -324,15 +324,8 @@ group_menu(struct screen_ctx *sc)
|
||||
if (TAILQ_EMPTY(&gc->clients))
|
||||
continue;
|
||||
|
||||
mi = xcalloc(1, sizeof(*mi));
|
||||
if (gc->hidden)
|
||||
(void)snprintf(mi->text, sizeof(mi->text), "%d: [%s]",
|
||||
gc->shortcut, sc->group_names[i]);
|
||||
else
|
||||
(void)snprintf(mi->text, sizeof(mi->text), "%d: %s",
|
||||
gc->shortcut, sc->group_names[i]);
|
||||
mi->ctx = gc;
|
||||
TAILQ_INSERT_TAIL(&menuq, mi, entry);
|
||||
menuq_add(&menuq, gc, gc->hidden ? "%d: [%s]" : "%d: %s",
|
||||
gc->shortcut, sc->group_names[i]);
|
||||
}
|
||||
|
||||
if (TAILQ_EMPTY(&menuq))
|
||||
|
Reference in New Issue
Block a user