gui: Output "xxx tag not set" for unset tags rather than empty strings.
authorAndre Noll <maan@systemlinux.org>
Sat, 11 Jul 2009 11:31:50 +0000 (13:31 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 11 Jul 2009 11:31:50 +0000 (13:31 +0200)
gui.c

diff --git a/gui.c b/gui.c
index 4866979a2e93c197bd92a6679c7ff08de2af32f3..394b69fe5466efe19fb532a2cf43e18381409d8e 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -679,8 +679,31 @@ static void print_stat_item(int i)
 
 static int update_item(int item_num, char *buf)
 {
 
 static int update_item(int item_num, char *buf)
 {
-       free(stat_content[item_num]);
-       stat_content[item_num] = para_strdup(buf);
+       char **c = stat_content + item_num;
+
+       free(*c);
+       if (buf && buf[0])
+               goto dup;
+       switch (item_num) {
+       case SI_ARTIST:
+               *c = para_strdup("(artist tag not set)");
+               goto print;
+       case SI_TITLE:
+               *c = para_strdup("(title tag not set)");
+               goto print;
+       case SI_YEAR:
+               *c = para_strdup("????");
+               goto print;
+       case SI_ALBUM:
+               *c = para_strdup("(album tag not set)");
+               goto print;
+       case SI_COMMENT:
+               *c = para_strdup("(comment tag not set)");
+               goto print;
+       }
+dup:
+       *c = para_strdup(buf);
+print:
        print_stat_item(item_num);
        return 1;
 }
        print_stat_item(item_num);
        return 1;
 }