Mercurial > audlegacy
changeset 3081:ba2143c1c6f5
unescape url encoded filename where real filename is needed.
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Tue, 17 Jul 2007 00:31:43 +0900 |
parents | 5dc103115dab |
children | 20830a69b5f5 e75fc3c056e6 |
files | src/audacious/input.c src/audacious/playlist.c src/audacious/ui_jumptotrack.c |
diffstat | 3 files changed, 25 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/input.c Mon Jul 16 00:02:11 2007 +0200 +++ b/src/audacious/input.c Tue Jul 17 00:31:43 2007 +0900 @@ -532,12 +532,14 @@ gchar *title, *fileinfo, *basename, *iplugin; gchar *filename_utf8; + gchar *realfn = NULL; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_resizable(GTK_WINDOW(window), FALSE); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); - basename = g_path_get_basename(filename); + realfn = g_filename_from_uri(filename, NULL, NULL); + basename = g_path_get_basename(realfn ? realfn : filename); fileinfo = filename_to_utf8(basename); title = g_strdup_printf(_("audacious: %s"), fileinfo); @@ -559,7 +561,8 @@ gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0); filename_entry = gtk_entry_new(); - filename_utf8 = filename_to_utf8(filename); + filename_utf8 = filename_to_utf8(realfn ? realfn : filename); + g_free(realfn); realfn = NULL; gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_utf8); gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE);
--- a/src/audacious/playlist.c Mon Jul 16 00:02:11 2007 +0200 +++ b/src/audacious/playlist.c Tue Jul 17 00:31:43 2007 +0900 @@ -352,6 +352,7 @@ return playlist->title; } +/* filename is real filename here. --yaz */ gboolean playlist_set_current_name(Playlist *playlist, const gchar * filename) { @@ -1817,7 +1818,10 @@ PLAYLIST_UNLOCK(playlist->mutex); if (!title) { - title = g_path_get_basename(entry->filename); + gchar *realfn = NULL; + realfn = g_filename_from_uri(entry->filename, NULL, NULL); + title = g_path_get_basename(realfn ? realfn : entry->filename); + g_free(realfn); realfn = NULL; return str_replace(title, filename_to_utf8(title)); } @@ -2069,8 +2073,12 @@ { struct stat buf; gint rv; - - rv = stat(filename, &buf); + gchar *realfn = NULL; + + /* stat() does not accept file:// --yaz */ + realfn = g_filename_from_uri(filename, NULL, NULL); + rv = stat(realfn ? realfn : filename, &buf); + g_free(realfn); realfn = NULL; if (rv == 0) { return buf.st_mtime;
--- a/src/audacious/ui_jumptotrack.c Mon Jul 16 00:02:11 2007 +0200 +++ b/src/audacious/ui_jumptotrack.c Tue Jul 17 00:31:43 2007 +0900 @@ -450,8 +450,15 @@ if (entry->title) desc_buf = g_strdup(entry->title); - else if (strchr(entry->filename, '/')) - desc_buf = str_to_utf8(strrchr(entry->filename, '/') + 1); + else if (strchr(entry->filename, '/')) { + gchar *realfn = NULL; + realfn = g_filename_from_uri(entry->filename, NULL, NULL); + if(realfn) + desc_buf = str_to_utf8(strrchr(realfn, '/') + 1); + else + desc_buf = str_to_utf8(strrchr(entry->filename, '/') + 1); + g_free(realfn); realfn = NULL; + } else desc_buf = str_to_utf8(entry->filename);