Code

Distinguish directories, music and playlists with <d>,<m> and <p>.
authorKalle Wallin <kaw@linux.se>
Sun, 28 Mar 2004 14:55:37 +0000 (14:55 +0000)
committerKalle Wallin <kaw@linux.se>
Sun, 28 Mar 2004 14:55:37 +0000 (14:55 +0000)
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@522 09075e82-0dd4-0310-85a5-a0d7c8717e4f

screen_file.c

index 19230e0ce5d9f403d11a9ebae32db789787901f1..c866566de66ba5e866add2223aa6c188e10cfdee 100644 (file)
@@ -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
           );