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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu May 31 13:27:32 EEST 2007
Author: marivoll
Date: 2007-05-31 13:27:27 +0300 (Thu, 31 May 2007)
New Revision: 12000

Modified:
   projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.c
Log:
	* hildon-fm/hildon-file-system-voldev.c (capitalize_ascii_string,
	beautify_mmc_name): New.
	(hildon_file_system_voldev_volumes_changed): Use them to hack the
	display name of memory cards (N33701).


Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.c
===================================================================
--- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.c	2007-05-31 09:35:23 UTC (rev 11999)
+++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.c	2007-05-31 10:27:27 UTC (rev 12000)
@@ -164,6 +164,44 @@
 }
 
 static void
+capitalize_ascii_string (gchar *str)
+{
+  if (*str)
+    {
+      *str = g_ascii_toupper (*str);
+      str++;
+      while (*str)
+        {
+          *str = g_ascii_tolower (*str);
+          str++;
+        }
+    }
+}
+
+static char *
+beautify_mmc_name (char *name, gboolean internal)
+{
+  if (name && strncmp (name, "mmc-undefined-name", 18) == 0)
+    {
+      g_free (name);
+      name = NULL;
+    }
+
+  if (!name)
+    {
+      if (internal)
+	name = _("sfil_li_memorycard_internal");
+      else
+	name = _("sfil_li_memorycard_removable");
+      name = g_strdup (name);
+    }
+  else
+    capitalize_ascii_string (name);
+
+  return name;
+}
+
+static void
 hildon_file_system_voldev_volumes_changed (HildonFileSystemSpecialLocation
                                            *location, GtkFileSystem *fs)
 {
@@ -200,10 +238,16 @@
   else if (strcmp (location->fixed_icon, "gnome-dev-removable") == 0
 	   || strcmp (location->fixed_icon, "gnome-dev-media-sdmmc") == 0)
     {
-      if (g_str_has_prefix (location->basepath, "file:///media/mmc2"))
+      gboolean internal = 
+	g_str_has_prefix (location->basepath, "file:///media/mmc2");
+
+      if (internal)
 	location->fixed_icon = "qgn_list_gene_internal_memory_card";
       else
       	location->fixed_icon = "qgn_list_gene_removable_memory_card";
+
+      location->fixed_title = beautify_mmc_name (location->fixed_title,
+						 internal);
     }
 
   g_signal_emit_by_name (location, "changed");


More information about the maemo-commits mailing list