changeset 35939:736092b4a1be

Allow home directory to be in non-ASCII encoding.
author ib
date Thu, 21 Mar 2013 10:19:29 +0000
parents 8515446e81c6
children 0d59a87d2e28
files gui/dialog/fileselect.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gui/dialog/fileselect.c	Thu Mar 21 09:56:58 2013 +0000
+++ b/gui/dialog/fileselect.c	Thu Mar 21 10:19:29 2013 +0000
@@ -257,6 +257,8 @@
 {
  int i, k, fsMedium;
  char * tmp = NULL, * dir = NULL;
+ const gchar *fname;
+ gchar *utf8name;
  struct stat f;
 
  if ( fsFileSelect ) gtkActive( fsFileSelect );
@@ -343,14 +345,12 @@
  if ( fsPathTable ) g_hash_table_destroy( fsPathTable ); fsPathTable=g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
  {
   unsigned int  i, c = 1;
-  gchar *utf8name;
 
   if ( fsMedium )
    {
     for ( i=0;i < FF_ARRAY_ELEMS(fsHistory);i++ )
      if ( fsHistory[i] )
       {
-       const gchar *fname;
        fname = cfg_old_filename_from_utf8(fsHistory[i]);
        utf8name = g_filename_display_name(fname);
        fsTopList_items=g_list_append( fsTopList_items,utf8name );
@@ -366,7 +366,13 @@
    }
  }
  free( dir );
- if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) );
+ fname = getenv( "HOME" );
+ if ( fname )
+  {
+   utf8name = g_filename_display_name( fname );
+   fsTopList_items=g_list_append( fsTopList_items,utf8name );
+   g_hash_table_insert(fsPathTable, strdup(utf8name), strdup(fname));
+  }
  else fsTopList_items=g_list_append( fsTopList_items,"/home" );
  if (stat( "/media",&f ) == 0) fsTopList_items=g_list_append( fsTopList_items,"/media" );
  if (stat( "/mnt",&f ) == 0) fsTopList_items=g_list_append( fsTopList_items,"/mnt" );