Mercurial > audlegacy
diff src/audacious/tuple_formatter.c @ 3349:01a241d35146 trunk
add tuple_formatter_make_title_string(). it is a wrapper function to tuple_formatter_process_construct() to make title string. it falls back to the file name if the formatted string is blank or unavailable.
| author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
|---|---|
| date | Mon, 13 Aug 2007 19:45:52 +0900 |
| parents | c23513d0ee17 |
| children | 678ea77b6b1f |
line wrap: on
line diff
--- a/src/audacious/tuple_formatter.c Mon Aug 13 00:03:33 2007 -0700 +++ b/src/audacious/tuple_formatter.c Mon Aug 13 19:45:52 2007 +0900 @@ -509,3 +509,22 @@ return tuple_formatter_process_construct(tuple, string); } + +/* wrapper function for making title string. it falls back to filename + * if process_string returns NULL or a blank string. */ +gchar * +tuple_formatter_make_title_string(Tuple *tuple, const gchar *string) +{ + gchar *rv; + + g_return_val_if_fail(tuple != NULL, NULL); + + rv = tuple_formatter_process_construct(tuple, string); + + if(!rv || !strcmp(rv, "")) { + g_free(rv); + rv = g_strdup(tuple_get_string(tuple, "file-name")); + } + + return rv; +}
