[gnome-disk-utility/udisks2-port] Show "230 MB Loop Device" rather than "Loop Device 0"
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/udisks2-port] Show "230 MB Loop Device" rather than "Loop Device 0"
- Date: Wed, 9 Mar 2011 18:20:57 +0000 (UTC)
commit 6738fb08b3b0c63ee8ec828c07dd0f3d67db31ea
Author: David Zeuthen <davidz redhat com>
Date: Wed Mar 9 13:20:37 2011 -0500
Show "230 MB Loop Device" rather than "Loop Device 0"
Signed-off-by: David Zeuthen <davidz redhat com>
src/palimpsest/gdudevicetreemodel.c | 26 ++++++++++----------------
1 files changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/src/palimpsest/gdudevicetreemodel.c b/src/palimpsest/gdudevicetreemodel.c
index 5755ebf..7e36094 100644
--- a/src/palimpsest/gdudevicetreemodel.c
+++ b/src/palimpsest/gdudevicetreemodel.c
@@ -553,29 +553,23 @@ add_block (GduDeviceTreeModel *model,
loop_backing_file = udisks_block_device_get_loop_backing_file (block);
if (strlen (loop_backing_file) > 0)
{
- gchar *s1;
- gint loop_number;
+ guint64 size;
+ gchar *size_str;
+ gchar *loop_name;
- if (sscanf (udisks_block_device_get_device (block),
- "/dev/loop%d",
- &loop_number) == 1)
- {
- /* Translators: This is for a /dev/loop device - %d is the number of the device */
- s1 = g_strdup_printf (_("Loop Device %d"), loop_number);
- }
- else
- {
- /* Translators: This is for a /dev/loop device */
- s1 = g_strdup (_("Loop Device"));
- }
+ size = udisks_block_device_get_size (block);
+ size_str = udisks_util_get_size_for_display (size, FALSE, FALSE);
+ /* Translators: This is for a /dev/loop device - %s is the size of the device e.g. "230 MB" */
+ loop_name = g_strdup_printf (_("%s Loop Device"), size_str);
+ g_free (size_str);
/* loop devices */
icon = g_themed_icon_new ("drive-removable-media"); /* for now */
s = g_strdup_printf ("%s\n"
"<small><span foreground=\"#555555\">%s</span></small>",
- s1,
+ loop_name,
loop_backing_file);
- g_free (s1);
+ g_free (loop_name);
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]