[gnome-multi-writer] Show the size next to the device name when the device is idle
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-multi-writer] Show the size next to the device name when the device is idle
- Date: Sun, 11 Jan 2015 13:43:55 +0000 (UTC)
commit 97875d01209eb151ea2ef4d1a2be110a098177bd
Author: Richard Hughes <richard hughsie com>
Date: Sun Jan 11 13:43:39 2015 +0000
Show the size next to the device name when the device is idle
src/gmw-device.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/gmw-device.c b/src/gmw-device.c
index 863c05c..e0afb01 100644
--- a/src/gmw-device.c
+++ b/src/gmw-device.c
@@ -256,12 +256,18 @@ gchar *
gmw_device_get_description (GmwDevice *device)
{
GmwDevicePrivate *priv = gmw_device_get_instance_private (device);
+ guint64 size;
g_return_val_if_fail (GMW_IS_DEVICE (device), NULL);
/* waiting to be written */
- if (priv->state == GMW_DEVICE_STATE_IDLE)
- return g_strdup (priv->name);
+ if (priv->state == GMW_DEVICE_STATE_IDLE) {
+ size = gmw_device_get_size (device) / (1000 * 1000 * 1000);
+ if (size == 0)
+ return g_strdup (priv->name);
+ return g_strdup_printf ("%s (%" G_GUINT64_FORMAT "GB)",
+ priv->name, size);
+ }
/* failed to read or write */
if (priv->state == GMW_DEVICE_STATE_FAILED) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]