diff src/madplug/fileinfo.c @ 1329:4b07404814ca

- reduce the number of file open in loading. - make use of new vfs_is_remote() and vfs_is_streaming().
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Sun, 22 Jul 2007 22:21:28 +0900
parents 38fb3bb3e21e
children a19e4395eaff
line wrap: on
line diff
--- a/src/madplug/fileinfo.c	Sun Jul 22 04:28:20 2007 +0900
+++ b/src/madplug/fileinfo.c	Sun Jul 22 22:21:28 2007 +0900
@@ -587,7 +587,7 @@
         ("single channel"), ("dual channel"), "joint stereo", "stereo"
     };
     gchar *tmp, *utf_filename;
-
+    gchar *realfn = NULL;
 #ifdef DEBUG
     {
         tmp = str_to_utf8(fileurl);
@@ -597,7 +597,7 @@
     }
 #endif
 
-    if(!vfs_file_test(fileurl, G_FILE_TEST_EXISTS)) {
+    if(!vfs_is_remote(fileurl) && !vfs_file_test(fileurl, G_FILE_TEST_EXISTS)) {
         return;
     }
 
@@ -605,23 +605,13 @@
 
     if(audmad_is_remote(fileurl)) {
         info.remote = TRUE;
-        return; //file info dialog for remote streaming doesn't make sense.
+        if(vfs_is_streaming(info.infile))
+           return; //file info dialog for remote streaming doesn't make sense.
     }
 
-    tmp = g_filename_from_uri(fileurl, NULL, NULL);
-    if (tmp == NULL)
-    {
-#ifdef DEBUG
-        tmp = str_to_utf8(fileurl);
-        g_message("f: audmad_get_file_info: %s , g_filename_from_uri failed", tmp);
-        g_free(tmp);
-        tmp = NULL;
-#endif
-        return;
-    }
-    utf_filename = str_to_utf8(tmp);
-    g_free(tmp);
-    tmp = NULL;
+    realfn = g_filename_from_uri(fileurl, NULL, NULL);
+    utf_filename = str_to_utf8(realfn ? realfn : fileurl);
+    g_free(realfn); realfn = NULL;
     create_window();
 
     info.fileinfo_request = TRUE;