Code

screen_browser: don't return directory name with square brackets
authorMax Kellermann <max@duempel.org>
Sun, 11 Oct 2009 12:55:53 +0000 (14:55 +0200)
committerMax Kellermann <max@duempel.org>
Sun, 11 Oct 2009 12:55:53 +0000 (14:55 +0200)
Since the browser_lw_callback() isn't used for rendering anymore (only
for searching), we can remove the page breaks.

src/list_window.c
src/screen_browser.c

index f8ab8e9a708ccd0d996c26443d7a7f126f64ecdc..d1a6ce3ff2ca9f4d18b9046921317dbeb641037c 100644 (file)
@@ -561,9 +561,6 @@ list_window_jump(struct list_window *lw,
                label = callback(i, &h, NULL, callback_data);
                assert(label != NULL);
 
-               if (label[0] == '[')
-                       label++;
-
                if (jump_match(label, str)) {
                        list_window_move_cursor(lw, i);
                        return true;
index 16a2f5e7045c48233741e19aada820c76b1cdf02..edcd2d93bbbc9c820eac4701be8e1fcfb7fd46ef 100644 (file)
@@ -96,15 +96,13 @@ browser_lw_callback(unsigned idx, bool *highlight, G_GNUC_UNUSED char **second_c
 #endif
 
        if( entity == NULL )
-               return "[..]";
+               return "..";
 
        if (mpd_entity_get_type(entity) == MPD_ENTITY_TYPE_DIRECTORY) {
                const struct mpd_directory *dir =
                        mpd_entity_get_directory(entity);
                char *directory = utf8_to_locale(g_basename(mpd_directory_get_path(dir)));
-
-               g_snprintf(buf, BUFSIZE, "[%s]", directory);
-               g_free(directory);
+               g_strlcpy(buf, directory, sizeof(buf));
                return buf;
        } else if (mpd_entity_get_type(entity) == MPD_ENTITY_TYPE_SONG) {
                const struct mpd_song *song = mpd_entity_get_song(entity);