diff options
author | okan <okan> | 2014-01-20 18:58:03 +0000 |
---|---|---|
committer | okan <okan> | 2014-01-20 18:58:03 +0000 |
commit | 720b5452aa13bf27740a2b923617188fde8814ed (patch) | |
tree | 92a1a0020533747078662aea1050a906e0715398 /group.c | |
parent | 43ccf4eae0f0f5c50495834e29f93671468a7cfe (diff) | |
download | cwm-720b5452aa13bf27740a2b923617188fde8814ed.tar.gz cwm-720b5452aa13bf27740a2b923617188fde8814ed.tar.xz cwm-720b5452aa13bf27740a2b923617188fde8814ed.zip |
Add a function that adds an entry to a menuq, normalizing a common code
path; from Tiago Cunha.
Diffstat (limited to 'group.c')
-rw-r--r-- | group.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/group.c b/group.c index 94d881a..929f9c2 100644 --- a/group.c +++ b/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)) |