[gnome-disk-utility/wip/mdraid] Slightly rework presentation strings for RAID arrays
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/wip/mdraid] Slightly rework presentation strings for RAID arrays
- Date: Tue, 11 Sep 2012 17:11:33 +0000 (UTC)
commit 2ee85f84b7d5b305f3e59cfc309de10de28748ae
Author: David Zeuthen <zeuthen gmail com>
Date: Tue Sep 11 13:11:14 2012 -0400
Slightly rework presentation strings for RAID arrays
Signed-off-by: David Zeuthen <zeuthen gmail com>
src/disks/gdudevicetreemodel.c | 26 ++++++++++++++++--
src/disks/gduwindow.c | 15 ++++++++++-
src/libgdu/gduutils.c | 55 ++++++++-------------------------------
src/libgdu/gduutils.h | 3 --
4 files changed, 49 insertions(+), 50 deletions(-)
---
diff --git a/src/disks/gdudevicetreemodel.c b/src/disks/gdudevicetreemodel.c
index 861c186..fc0abde 100644
--- a/src/disks/gdudevicetreemodel.c
+++ b/src/disks/gdudevicetreemodel.c
@@ -1037,6 +1037,7 @@ update_mdraid (GduDeviceTreeModel *model,
gboolean jobs_running = FALSE;
GtkTreeIter iter;
guint pulse;
+ guint64 size;
if (!find_iter_for_object (model,
object,
@@ -1060,15 +1061,34 @@ update_mdraid (GduDeviceTreeModel *model,
s = NULL;
}
- desc = gdu_utils_get_mdraid_desc (model->client, mdraid);
+ size = udisks_mdraid_get_size (mdraid);
+ if (size > 0)
+ {
+ s = udisks_client_get_size_for_display (model->client, size, FALSE, FALSE);
+ /* Translators: Used in the device tree for a RAID Array, the first %s is the size */
+ desc = g_strdup_printf (C_("md-raid-tree-primary", "%s RAID Array"), s);
+ g_free (s);
+ }
+ else
+ {
+ /* Translators: Used in the device tree for a RAID Array where the size is not known */
+ desc = g_strdup (C_("md-raid-tree-primary", "RAID Array"));
+ }
+
if (name != NULL && strlen (name) > 0)
{
- desc2 = g_strdup (name);
+ s = gdu_utils_format_mdraid_level (udisks_mdraid_get_level (mdraid), FALSE);
+ /* Translators: Used as a secondary line in device tree for RAID Array.
+ * The first %s is the name of the array (e.g. "My RAID Array").
+ * The second %s is the RAID level (e.g. "RAID-5").
+ */
+ desc2 = g_strdup_printf (C_("md-raid-tree-secondary", "%s (%s)"), name, s);
+ g_free (s);
}
else
{
- desc2 = udisks_mdraid_dup_uuid (mdraid); /* TODO: not very friendly */
+ desc2 = gdu_utils_format_mdraid_level (udisks_mdraid_get_level (mdraid), FALSE);
}
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index 94107b3..fc86cd9 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -1823,7 +1823,20 @@ update_device_page_for_mdraid (GduWindow *window,
size = udisks_mdraid_get_size (mdraid);
block = udisks_client_get_block_for_mdraid (window->client, mdraid);
icon = g_themed_icon_new ("gdu-enclosure");
- desc = gdu_utils_get_mdraid_desc (window->client, mdraid);
+
+ if (size > 0)
+ {
+ s = udisks_client_get_size_for_display (window->client, size, FALSE, FALSE);
+ /* Translators: Used in the main window for a RAID Array, the first %s is the size */
+ desc = g_strdup_printf (C_("md-raid-window", "%s RAID Array"), s);
+ g_free (s);
+ }
+ else
+ {
+ /* Translators: Used in the main window for a RAID Array where the size is not known */
+ desc = g_strdup (C_("md-raid-window", "RAID Array"));
+ }
+
level_desc = gdu_utils_format_mdraid_level (udisks_mdraid_get_level (mdraid), TRUE);
update_grid_for_mdraid (window, mdraid);
diff --git a/src/libgdu/gduutils.c b/src/libgdu/gduutils.c
index 1bcf4ba..408d4bf 100644
--- a/src/libgdu/gduutils.c
+++ b/src/libgdu/gduutils.c
@@ -674,44 +674,44 @@ gdu_utils_format_mdraid_level (const gchar *level,
if (g_strcmp0 (level, "raid0") == 0)
{
if (long_desc)
- ret = g_strdup (_("RAID-0 (Stripe)"));
+ ret = g_strdup (_("RAID 0 (Stripe)"));
else
- ret = g_strdup (_("RAID-0"));
+ ret = g_strdup (_("RAID 0"));
}
else if (g_strcmp0 (level, "raid1") == 0)
{
if (long_desc)
- ret = g_strdup (_("RAID-1 (Mirror)"));
+ ret = g_strdup (_("RAID 1 (Mirror)"));
else
- ret = g_strdup (_("RAID-1"));
+ ret = g_strdup (_("RAID 1"));
}
else if (g_strcmp0 (level, "raid4") == 0)
{
if (long_desc)
- ret = g_strdup (_("RAID-4 (Dedicated Parity)"));
+ ret = g_strdup (_("RAID 4 (Dedicated Parity)"));
else
- ret = g_strdup (_("RAID-4"));
+ ret = g_strdup (_("RAID 4"));
}
else if (g_strcmp0 (level, "raid5") == 0)
{
if (long_desc)
- ret = g_strdup (_("RAID-5 (Distributed Parity)"));
+ ret = g_strdup (_("RAID 5 (Distributed Parity)"));
else
- ret = g_strdup (_("RAID-5"));
+ ret = g_strdup (_("RAID 5"));
}
else if (g_strcmp0 (level, "raid6") == 0)
{
if (long_desc)
- ret = g_strdup (_("RAID-6 (Double Distributed Parity)"));
+ ret = g_strdup (_("RAID 6 (Double Distributed Parity)"));
else
- ret = g_strdup (_("RAID-6"));
+ ret = g_strdup (_("RAID 6"));
}
else if (g_strcmp0 (level, "raid10") == 0)
{
if (long_desc)
- ret = g_strdup (_("RAID-10 (Stripe of Mirrors)"));
+ ret = g_strdup (_("RAID 10 (Stripe of Mirrors)"));
else
- ret = g_strdup (_("RAID-10"));
+ ret = g_strdup (_("RAID 10"));
}
if (ret == NULL)
@@ -720,34 +720,3 @@ gdu_utils_format_mdraid_level (const gchar *level,
}
return ret;
}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-gchar *
-gdu_utils_get_mdraid_desc (UDisksClient *client,
- UDisksMDRaid *raid)
-{
- gchar *s;
- gchar *s2;
- gchar *ret;
- guint64 size;
-
- size = udisks_mdraid_get_size (raid);
- if (size > 0)
- {
- s = udisks_client_get_size_for_display (client, size, FALSE, FALSE);
- s2 = gdu_utils_format_mdraid_level (udisks_mdraid_get_level (raid), FALSE);
- /* Translators: The first %s is the size (e.g. "12 TB"), the second %s is the RAID level, e.g. 'RAID-5' */
- ret = g_strdup_printf (C_("md-raid", "%s %s Array"), s, s2);
- g_free (s);
- g_free (s2);
- }
- else
- {
- s = gdu_utils_format_mdraid_level (udisks_mdraid_get_level (raid), FALSE);
- /* Translators: The first %s is the RAID level, e.g. 'RAID-5' */
- ret = g_strdup_printf (C_("md-raid", "%s Array"), s);
- g_free (s);
- }
- return ret;
-}
diff --git a/src/libgdu/gduutils.h b/src/libgdu/gduutils.h
index 37880e7..4ea1fcc 100644
--- a/src/libgdu/gduutils.h
+++ b/src/libgdu/gduutils.h
@@ -60,9 +60,6 @@ gboolean gdu_utils_is_ntfs_available (void);
gchar *gdu_utils_format_mdraid_level (const gchar *level,
gboolean long_desc);
-gchar *gdu_utils_get_mdraid_desc (UDisksClient *client,
- UDisksMDRaid *raid);
-
G_END_DECLS
#endif /* __GDU_UTILS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]