[maemo-commits] [maemo-commits] r11873 - projects/haf/trunk/hildon-fm/hildon-fm

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri May 25 18:50:53 EEST 2007
Author: marivoll
Date: 2007-05-25 18:50:52 +0300 (Fri, 25 May 2007)
New Revision: 11873

Modified:
   projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-private.c
Log:
	* hildon-fm/hildon-file-system-private.c (translate_special_name): New.
	(_hildon_file_system_create_file_name): Use it.


Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-private.c
===================================================================
--- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-private.c	2007-05-25 15:10:06 UTC (rev 11872)
+++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-private.c	2007-05-25 15:50:52 UTC (rev 11873)
@@ -510,22 +510,40 @@
   return result;
 }
 
+static char *
+translate_special_name (char *name)
+{
+  if (name && name[0] == '~' && name[1] != '\0')
+    {
+      char *trans = _(name + 1);
+      if (trans != name + 1)
+	{
+	  g_free (name);
+	  name = g_strdup (trans);
+	}
+    }
+
+  return name;
+}
+
 gchar *
 _hildon_file_system_create_file_name (GtkFileSystem *fs,
                                       const GtkFilePath *path,
                                       HildonFileSystemSpecialLocation *location,
                                       GtkFileInfo *info)
 {
-  if (location) {
-    char *name;
-    name = hildon_file_system_special_location_get_display_name(location, fs);
-    if (name) return name;
-  }
+  char *name = NULL;
 
-  if (info)
-    return g_strdup(gtk_file_info_get_display_name(info));
+  if (location)
+    name = hildon_file_system_special_location_get_display_name (location, fs);
 
-  return unescape_string (get_custom_root_name (path));
+  if (name == NULL && info)
+    name = g_strdup (gtk_file_info_get_display_name (info));
+
+  if (name == NULL)
+    name = unescape_string (get_custom_root_name (path));
+
+  return translate_special_name (name);
 }
 
 gchar *


More information about the maemo-commits mailing list