From cc2f58b12e1170f1b1f52d64f2c06c1172112949 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 10 Oct 2009 15:58:06 +0200 Subject: [PATCH] screen_search: moved help text into a global variable --- src/screen_search.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/src/screen_search.c b/src/screen_search.c index b410219..b2b6b11 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -94,33 +94,27 @@ static gboolean advanced_search_mode = FALSE; static struct screen_browser browser; +static const char *const help_text[] = { + "Quick - Enter a string and ncmpc will search according", + " to the current search mode (displayed above).", + "", + "Advanced - : [:...]", + " Example: artist:radiohead album:pablo honey", + "", + " Available tags: artist, album, title, track,", + " name, genre, date composer, performer, comment, file", + "", +}; /* search info */ static const char * lw_search_help_callback(unsigned idx, G_GNUC_UNUSED bool *highlight, G_GNUC_UNUSED char** sc, G_GNUC_UNUSED void *data) { - unsigned text_rows; - static const char *text[] = { - "Quick - Enter a string and ncmpc will search according", - " to the current search mode (displayed above).", - "", - "Advanced - : [:...]", - " Example: artist:radiohead album:pablo honey", - "", - " Available tags: artist, album, title, track,", - " name, genre, date composer, performer, comment, file", - "", - NULL - }; - - text_rows=0; - while (text[text_rows]) - text_rows++; - - if (idx < text_rows) - return text[idx]; - return NULL; + if (idx >= G_N_ELEMENTS(help_text)) + return NULL; + + return help_text[idx]; } static void -- 2.30.2