changeset 3235:c48ce3f67130

gtk_file_chooser_get_uris() results in unpredictable behaviour when GNOME is not installed. Build URIs ourselves.
author William Pitcock <nenolod@atheme-project.org>
date Fri, 03 Aug 2007 21:52:25 -0500
parents fb2f3675cbeb
children 74a999f3f4d2
files src/audacious/ui_fileopener.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_fileopener.c	Fri Aug 03 21:16:18 2007 -0500
+++ b/src/audacious/ui_fileopener.c	Fri Aug 03 21:52:25 2007 -0500
@@ -39,11 +39,12 @@
     Playlist *playlist = playlist_get_active();
 
     for (cur = files; cur; cur = g_slist_next(cur)) {
+        gchar *filename = g_filename_to_uri((const gchar *) cur->data, NULL, NULL);
 
         if (vfs_file_test(cur->data, G_FILE_TEST_IS_DIR)) {
-            playlist_add_dir(playlist, (const gchar *) cur->data);
+            playlist_add_dir(playlist, filename ? filename : (const gchar *) cur->data);
         } else {
-            playlist_add(playlist, (const gchar *) cur->data);
+            playlist_add(playlist, filename ? filename : (const gchar *) cur->data);
         }       
 
         if (++ctr == 20) {
@@ -51,6 +52,8 @@
             ctr = 0;
             while (gtk_events_pending() ) gtk_main_iteration();
         }
+
+        g_free(filename);
     } 
 
     playlistwin_update_list(playlist);
@@ -75,7 +78,7 @@
     play_button =
         GPOINTER_TO_INT(g_object_get_data(data, "play-button"));
 
-    files = gtk_file_chooser_get_uris(GTK_FILE_CHOOSER(chooser));
+    files = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(chooser));
     if (!files) return;
 
     if (play_button)