From 92d0616e227e95dc1318a3a12945a5083028b457 Mon Sep 17 00:00:00 2001 From: Kalle Wallin Date: Sun, 28 Mar 2004 14:55:37 +0000 Subject: [PATCH] Distinguish directories, music and playlists with , and

. git-svn-id: https://svn.musicpd.org/ncmpc/trunk@522 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- screen_file.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/screen_file.c b/screen_file.c index 19230e0..c866566 100644 --- a/screen_file.c +++ b/screen_file.c @@ -15,6 +15,8 @@ #define BUFSIZE 1024 +#undef USE_OLD_LAYOUT + static char * list_callback(int index, int *highlight, void *data) { @@ -32,28 +34,47 @@ list_callback(int index, int *highlight, void *data) if( entity == NULL ) { +#ifdef USE_OLD_LAYOUT return "[..]"; +#else + return " .."; +#endif } if( entity->type==MPD_INFO_ENTITY_TYPE_DIRECTORY ) { mpd_Directory *dir = entity->info.directory; char *dirname = utf8_to_locale(basename(dir->path)); +#ifdef USE_OLD_LAYOUT snprintf(buf, BUFSIZE, "[%s]", dirname); +#else + snprintf(buf, BUFSIZE, " %s", dirname); +#endif free(dirname); return buf; } else if( entity->type==MPD_INFO_ENTITY_TYPE_SONG ) { mpd_Song *song = entity->info.song; - return mpc_get_song_name(song); + +#ifdef USE_OLD_LAYOUT + return mpc_get_song_name(song)); +#else + snprintf(buf, BUFSIZE, " %s", mpc_get_song_name(song)); + return buf; +#endif + } else if( entity->type==MPD_INFO_ENTITY_TYPE_PLAYLISTFILE ) { mpd_PlaylistFile *plf = entity->info.playlistFile; char *filename = utf8_to_locale(basename(plf->path)); - + +#ifdef USE_OLD_LAYOUT snprintf(buf, BUFSIZE, "*%s*", filename); +#else + snprintf(buf, BUFSIZE, "

%s", filename); +#endif free(filename); return buf; } @@ -327,11 +348,11 @@ file_clear_highlight(mpd_client_t *c, mpd_Song *song) char * file_get_header(mpd_client_t *c) { - static char buf[64]; + static char buf[BUFSIZE]; char *tmp; tmp = utf8_to_locale(basename(c->cwd)); - snprintf(buf, 64, + snprintf(buf, BUFSIZE, TOP_HEADER_FILE ": %s ", tmp ); -- 2.30.2