diff src/amidi-plug/i_fileinfo.c @ 1275:b839faa693e2

updated amidi-plug to handle URIs in fileinfo and all-over in code
author Giacomo Lozito <james@develia.org>
date Sun, 15 Jul 2007 23:41:06 +0200
parents 3da1b8942b8b
children
line wrap: on
line diff
--- a/src/amidi-plug/i_fileinfo.c	Mon Jul 16 00:39:17 2007 +0900
+++ b/src/amidi-plug/i_fileinfo.c	Sun Jul 15 23:41:06 2007 +0200
@@ -106,7 +106,7 @@
 }
 
 
-void i_fileinfo_gui( gchar * filename )
+void i_fileinfo_gui( gchar * filename_uri )
 {
   static GtkWidget *fileinfowin = NULL;
   GtkWidget *fileinfowin_vbox, *fileinfowin_columns_hbox;
@@ -121,7 +121,7 @@
   PangoAttrList *pangoattrlist;
   PangoAttribute *pangoattr;
   GString *value_gstring;
-  gchar *title , *filename_utf8;
+  gchar *title , *filename, *filename_utf8;
   gint bpm = 0, wavg_bpm = 0;
   midifile_t *mf;
 
@@ -131,7 +131,7 @@
   mf = g_malloc(sizeof(midifile_t));
 
   /****************** midifile parser ******************/
-  if ( !i_midi_parse_from_filename( filename , mf ) )
+  if ( !i_midi_parse_from_filename( filename_uri , mf ) )
     return;
   /* midifile is filled with information at this point,
      bpm information is needed too */
@@ -333,6 +333,9 @@
 
 
   /* utf8-ize filename and set window title */
+  filename = g_filename_from_uri( filename_uri , NULL , NULL );
+  if ( !filename )
+    filename = g_strdup( filename_uri );
   filename_utf8 = g_strdup(g_filename_to_utf8( filename , -1 , NULL , NULL , NULL ));
   if ( !filename_utf8 )
   {
@@ -353,6 +356,7 @@
   gtk_entry_set_text( GTK_ENTRY(title_name_v_entry) , filename_utf8 );
   gtk_editable_set_position( GTK_EDITABLE(title_name_v_entry) , -1 );
   g_free(filename_utf8);
+  g_free(filename);
 
   gtk_widget_grab_focus( GTK_WIDGET(footer_bclose) );
   gtk_widget_show_all( fileinfowin );