summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagna@src.gnome.org>2014-01-29 19:09:02 +0100
committerGiovanni Campagna <gcampagna@src.gnome.org>2014-02-08 22:04:26 +0100
commit8a1d6a00889fea35889a939c228edec38bf0955b (patch)
treeff02e7235d1be36dbbec2478b77d16acda924b7c
parent5076749384dd769b16025c1cc8281772bf8a0c8d (diff)
downloadgvfs-8a1d6a00889fea35889a939c228edec38bf0955b.tar.gz
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
-rw-r--r--monitor/mtp/gmtpvolume.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/monitor/mtp/gmtpvolume.c b/monitor/mtp/gmtpvolume.c
index 58ef0dd7..362a58cb 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));