aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-03-28 14:55:37 +0000
committerKalle Wallin <kaw@linux.se>2004-03-28 14:55:37 +0000
commit92d0616e227e95dc1318a3a12945a5083028b457 (patch)
tree02642a72facc7a9113f067358a4294e25833155a
parentb24947b96670b3e2f7fe7d23c06e1ec2b4b7c262 (diff)
downloadmpd-92d0616e227e95dc1318a3a12945a5083028b457.tar.gz
mpd-92d0616e227e95dc1318a3a12945a5083028b457.tar.xz
mpd-92d0616e227e95dc1318a3a12945a5083028b457.zip
Distinguish directories, music and playlists with <d>,<m> and <p>.
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@522 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--screen_file.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/screen_file.c b/screen_file.c
index 19230e0ce..c866566de 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 "<d> ..";
+#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, "<d> %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, "<m> %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, "<p> %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
);