Mercurial > pidgin
comparison libpurple/util.c @ 22060:83613550512b
Ignore both NULL and empty strings.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 11 Jan 2008 23:21:16 +0000 |
parents | af0426c34c27 |
children | 1e227e2587e6 |
comparison
equal
deleted
inserted
replaced
22059:fdebef95b300 | 22060:83613550512b |
---|---|
4657 char * purple_util_format_song_info(const char *title, const char *artist, const char *album, gpointer unused) | 4657 char * purple_util_format_song_info(const char *title, const char *artist, const char *album, gpointer unused) |
4658 { | 4658 { |
4659 GString *string; | 4659 GString *string; |
4660 char *esc; | 4660 char *esc; |
4661 | 4661 |
4662 if (!title) | 4662 if (!title || !*title) |
4663 return NULL; | 4663 return NULL; |
4664 | 4664 |
4665 esc = g_markup_escape_text(title, -1); | 4665 esc = g_markup_escape_text(title, -1); |
4666 string = g_string_new(""); | 4666 string = g_string_new(""); |
4667 g_string_append_printf(string, "%s", esc); | 4667 g_string_append_printf(string, "%s", esc); |
4668 g_free(esc); | 4668 g_free(esc); |
4669 | 4669 |
4670 if (artist) { | 4670 if (artist && *artist) { |
4671 esc = g_markup_escape_text(artist, -1); | 4671 esc = g_markup_escape_text(artist, -1); |
4672 g_string_append_printf(string, _(" - %s"), esc); | 4672 g_string_append_printf(string, _(" - %s"), esc); |
4673 g_free(esc); | 4673 g_free(esc); |
4674 } | 4674 } |
4675 | 4675 |
4676 if (album) { | 4676 if (album && *album) { |
4677 esc = g_markup_escape_text(album, -1); | 4677 esc = g_markup_escape_text(album, -1); |
4678 g_string_append_printf(string, _(" (%s)"), esc); | 4678 g_string_append_printf(string, _(" (%s)"), esc); |
4679 g_free(esc); | 4679 g_free(esc); |
4680 } | 4680 } |
4681 | 4681 |