# HG changeset patch # User Tomasz Mon # Date 1184836661 -7200 # Node ID 4f011bf1d08364e2aeb1d051d3b951d2c55dc75d # Parent 821a712c08a3bd987a92161ac4289b9f7f903b7d# Parent bb1fa0aed8f4fc64b3d09b953d5cbb3133de7dba branch merge diff -r 821a712c08a3 -r 4f011bf1d083 src/audacious/playlist.c --- a/src/audacious/playlist.c Thu Jul 19 11:16:38 2007 +0200 +++ b/src/audacious/playlist.c Thu Jul 19 11:17:41 2007 +0200 @@ -1501,9 +1501,13 @@ title = str_to_utf8(playlist->position->title); } else { - gchar *basename = g_path_get_basename(playlist->position->filename); + gchar *realfn = NULL; + gchar *basename = NULL; + realfn = g_filename_from_uri(playlist->position->filename, NULL, NULL); + basename = g_path_get_basename(realfn ? realfn : playlist->position->filename); title = filename_to_utf8(basename); - g_free(basename); + g_free(realfn); realfn = NULL; + g_free(basename); basename = NULL; } /* diff -r 821a712c08a3 -r 4f011bf1d083 src/audacious/ui_jumptotrack.c --- a/src/audacious/ui_jumptotrack.c Thu Jul 19 11:16:38 2007 +0200 +++ b/src/audacious/ui_jumptotrack.c Thu Jul 19 11:17:41 2007 +0200 @@ -277,21 +277,24 @@ PlaylistEntry *entry = PLAYLIST_ENTRY(playlist_glist->data); if (entry->title) - desc_buf = g_strdup(entry->title); - else if (strchr(entry->filename, '/')) - desc_buf = str_to_utf8(strrchr(entry->filename, '/') + 1); - else - desc_buf = str_to_utf8(entry->filename); + desc_buf = g_strdup(entry->title); + else { + gchar *realfn = NULL; + realfn = g_filename_from_uri(entry->filename, NULL, NULL); + if (strchr(realfn ? realfn : entry->filename, '/')) + desc_buf = str_to_utf8(strrchr(realfn ? realfn : entry->filename, '/') + 1); + else + desc_buf = str_to_utf8(realfn ? realfn : entry->filename); + g_free(realfn); realfn = NULL; + } gtk_list_store_append(GTK_LIST_STORE(store), &iter); gtk_list_store_set(GTK_LIST_STORE(store), &iter, 0, row, 1, desc_buf, -1); row++; - if(desc_buf) { - g_free(desc_buf); - desc_buf = NULL; - } + g_free(desc_buf); + desc_buf = NULL; } gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter); @@ -350,13 +353,17 @@ playlist_glist = g_list_next(playlist_glist)) { PlaylistEntry *entry = PLAYLIST_ENTRY(playlist_glist->data); - const gchar *title=NULL; - gchar *filename = NULL; - filename = str_to_utf8(entry->filename); + gchar *title = NULL; + if (entry->title) - title = entry->title; - else - title = filename; + title = g_strdup(entry->title); + else { + gchar *realfn = NULL; + realfn = g_filename_from_uri(entry->filename, NULL, NULL); + title = str_to_utf8(realfn ? realfn : entry->filename); + g_free(realfn); realfn = NULL; + } + /*we are matching all the path not just the filename or title*/ /* Compare the reg.expressions to the string - if all the @@ -379,21 +386,21 @@ if (match) { if (entry->title) - title = g_strdup(entry->title); - else if (strchr(entry->filename, '/')) - title = str_to_utf8(strrchr(entry->filename, '/') + 1); - else - title = str_to_utf8(entry->filename); - + title = g_strdup(entry->title); + else { + gchar *realfn = NULL; + realfn = g_filename_from_uri(entry->filename, NULL, NULL); + if (strchr(realfn ? realfn : entry->filename, '/')) + title = str_to_utf8(strrchr(realfn ? realfn : entry->filename, '/') + 1); + else + title = str_to_utf8(realfn ? realfn : entry->filename); + g_free(realfn); realfn = NULL; + } gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, song_index + 1 , 1, title, -1); } song_index++; - - if (filename) { - g_free(filename); - filename = NULL; - } + g_free(title); title = NULL; } PLAYLIST_UNLOCK(playlist->mutex); @@ -449,18 +456,16 @@ PlaylistEntry *entry = PLAYLIST_ENTRY(playlist_glist->data); if (entry->title) - desc_buf = g_strdup(entry->title); - else if (strchr(entry->filename, '/')) { + desc_buf = g_strdup(entry->title); + else { gchar *realfn = NULL; realfn = g_filename_from_uri(entry->filename, NULL, NULL); - if(realfn) - desc_buf = str_to_utf8(strrchr(realfn, '/') + 1); + if (strchr(realfn ? realfn : entry->filename, '/')) + desc_buf = str_to_utf8(strrchr(realfn ? realfn : entry->filename, '/') + 1); else - desc_buf = str_to_utf8(strrchr(entry->filename, '/') + 1); + desc_buf = str_to_utf8(realfn ? realfn : entry->filename); g_free(realfn); realfn = NULL; } - else - desc_buf = str_to_utf8(entry->filename); gtk_list_store_append(GTK_LIST_STORE(jtf_store), &iter); gtk_list_store_set(GTK_LIST_STORE(jtf_store), &iter,