[gvfs] mtpvolume: improve volume name



commit 8a1d6a00889fea35889a939c228edec38bf0955b
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Jan 29 19:09:02 2014 +0100

    mtpvolume: improve volume name
    
    Replace _ and - with spaces, and apply that pass on
    the product string too.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723251

 monitor/mtp/gmtpvolume.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/monitor/mtp/gmtpvolume.c b/monitor/mtp/gmtpvolume.c
index 58ef0dd..362a58c 100644
--- a/monitor/mtp/gmtpvolume.c
+++ b/monitor/mtp/gmtpvolume.c
@@ -112,11 +112,14 @@ udev_decode_string (const char* encoded)
     if (s[0] == '\\' && s[1] == 'x' && s[2] >= '0' && s[3] >= '0') {
       decoded[len] = (hexdigit (s[2]) << 4) | hexdigit (s[3]);
       s += 3;
+    } else if (s[0] == '_' || s[0] == '-') {
+      decoded[len] = ' ';
     } else {
       decoded[len] = *s;
     }
   }
   decoded[len] = '\0';
+
   return decoded;
 }
 
@@ -148,7 +151,7 @@ set_volume_name (GMtpVolume *v)
 
   v->name = NULL;
   if (product != NULL && strlen (product) > 0) {
-    v->name = g_strdup (product);
+    v->name = g_strdup (udev_decode_string (product));
   } else if (vendor == NULL) {
     if (model != NULL)
       v->name = g_strdup (udev_decode_string (model));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]