[gnome-disk-utility] Show RAID Level description in smaller font
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility] Show RAID Level description in smaller font
- Date: Sat, 13 Oct 2012 10:04:25 +0000 (UTC)
commit 5c70f6a8561e7ab62e0762804787ebec29d8e01c
Author: David Zeuthen <zeuthen gmail com>
Date: Sat Oct 13 06:03:51 2012 -0400
Show RAID Level description in smaller font
This is to be more consistent with other combo boxes.
Signed-off-by: David Zeuthen <zeuthen gmail com>
src/disks/gducreateraidarraydialog.c | 12 +++---
src/disks/gdudevicetreemodel.c | 4 +-
src/disks/gduwindow.c | 2 +-
src/libgdu/gduutils.c | 77 +++++++++++++++++++++++-----------
src/libgdu/gduutils.h | 3 +-
5 files changed, 63 insertions(+), 35 deletions(-)
---
diff --git a/src/disks/gducreateraidarraydialog.c b/src/disks/gducreateraidarraydialog.c
index 500481b..f83da01 100644
--- a/src/disks/gducreateraidarraydialog.c
+++ b/src/disks/gducreateraidarraydialog.c
@@ -318,17 +318,17 @@ init_dialog (DialogData *data)
/* ---------- */
/* 'RAID Level' combobox */
model = combobox_init (data, data->level_combobox);
- s = gdu_utils_format_mdraid_level ("raid0", TRUE);
+ s = gdu_utils_format_mdraid_level ("raid0", TRUE, TRUE);
combobox_add_item (model, s, "raid0", TRUE); g_free (s);
- s = gdu_utils_format_mdraid_level ("raid1", TRUE);
+ s = gdu_utils_format_mdraid_level ("raid1", TRUE, TRUE);
combobox_add_item (model, s, "raid1", TRUE); g_free (s);
- s = gdu_utils_format_mdraid_level ("raid4", TRUE);
+ s = gdu_utils_format_mdraid_level ("raid4", TRUE, TRUE);
combobox_add_item (model, s, "raid4", TRUE); g_free (s);
- s = gdu_utils_format_mdraid_level ("raid5", TRUE);
+ s = gdu_utils_format_mdraid_level ("raid5", TRUE, TRUE);
combobox_add_item (model, s, "raid5", TRUE); g_free (s);
- s = gdu_utils_format_mdraid_level ("raid6", TRUE);
+ s = gdu_utils_format_mdraid_level ("raid6", TRUE, TRUE);
combobox_add_item (model, s, "raid6", data->num_disks > 2); g_free (s);
- s = gdu_utils_format_mdraid_level ("raid10", TRUE);
+ s = gdu_utils_format_mdraid_level ("raid10", TRUE, TRUE);
combobox_add_item (model, s, "raid10", TRUE); g_free (s);
/* ---------- */
diff --git a/src/disks/gdudevicetreemodel.c b/src/disks/gdudevicetreemodel.c
index e1ba3f4..81752f0 100644
--- a/src/disks/gdudevicetreemodel.c
+++ b/src/disks/gdudevicetreemodel.c
@@ -1098,7 +1098,7 @@ update_mdraid (GduDeviceTreeModel *model,
if (name != NULL && strlen (name) > 0)
{
- s = gdu_utils_format_mdraid_level (udisks_mdraid_get_level (mdraid), FALSE);
+ s = gdu_utils_format_mdraid_level (udisks_mdraid_get_level (mdraid), FALSE, 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").
@@ -1108,7 +1108,7 @@ update_mdraid (GduDeviceTreeModel *model,
}
else
{
- desc2 = gdu_utils_format_mdraid_level (udisks_mdraid_get_level (mdraid), FALSE);
+ desc2 = gdu_utils_format_mdraid_level (udisks_mdraid_get_level (mdraid), FALSE, FALSE);
}
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index 86d129c..62350c5 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -2204,7 +2204,7 @@ update_device_page_for_mdraid (GduWindow *window,
/* -------------------------------------------------- */
/* 'Raid Level' field */
- level_desc = gdu_utils_format_mdraid_level (udisks_mdraid_get_level (mdraid), FALSE);
+ level_desc = gdu_utils_format_mdraid_level (udisks_mdraid_get_level (mdraid), FALSE, FALSE);
/* Translators: Used to convey the number of required disks for a RAID array
* The %d is the number of required disks.
diff --git a/src/libgdu/gduutils.c b/src/libgdu/gduutils.c
index ccd2405..22d7673 100644
--- a/src/libgdu/gduutils.c
+++ b/src/libgdu/gduutils.c
@@ -14,6 +14,11 @@
#include "gduutils.h"
+/* For __GNUC_PREREQ usage below */
+#ifdef __GNUC__
+# include <features.h>
+#endif
+
#if defined(HAVE_LIBSYSTEMD_LOGIN)
#include <systemd/sd-login.h>
#endif
@@ -685,51 +690,67 @@ gdu_utils_is_ntfs_available (void)
gchar *
gdu_utils_format_mdraid_level (const gchar *level,
- gboolean long_desc)
+ gboolean long_desc,
+ gboolean use_markup)
{
gchar *ret = NULL;
+ const gchar *markup_format;
- if (g_strcmp0 (level, "raid0") == 0)
+ if (long_desc)
{
- if (long_desc)
- ret = g_strdup (_("RAID 0 (Stripe)"));
+ if (use_markup)
+ markup_format = "%s <span size=\"small\">(%s)</span>";
else
- ret = g_strdup (_("RAID 0"));
+ markup_format = "%s (%s)";
+ }
+ else
+ {
+ markup_format = "%s";
+ }
+
+ /* we know better than the compiler here */
+#ifdef __GNUC_PREREQ
+# if __GNUC_PREREQ(4,6)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+# endif
+#endif
+
+ if (g_strcmp0 (level, "raid0") == 0)
+ {
+ ret = g_strdup_printf (markup_format,
+ _("RAID 0"),
+ _("Stripe"));
}
else if (g_strcmp0 (level, "raid1") == 0)
{
- if (long_desc)
- ret = g_strdup (_("RAID 1 (Mirror)"));
- else
- ret = g_strdup (_("RAID 1"));
+ ret = g_strdup_printf (markup_format,
+ _("RAID 1"),
+ _("Mirror"));
}
else if (g_strcmp0 (level, "raid4") == 0)
{
- if (long_desc)
- ret = g_strdup (_("RAID 4 (Dedicated Parity)"));
- else
- ret = g_strdup (_("RAID 4"));
+ ret = g_strdup_printf (markup_format,
+ _("RAID 4"),
+ _("Dedicated Parity"));
}
else if (g_strcmp0 (level, "raid5") == 0)
{
- if (long_desc)
- ret = g_strdup (_("RAID 5 (Distributed Parity)"));
- else
- ret = g_strdup (_("RAID 5"));
+ ret = g_strdup_printf (markup_format,
+ _("RAID 5"),
+ _("Distributed Parity"));
}
else if (g_strcmp0 (level, "raid6") == 0)
{
- if (long_desc)
- ret = g_strdup (_("RAID 6 (Double Distributed Parity)"));
- else
- ret = g_strdup (_("RAID 6"));
+ ret = g_strdup_printf (markup_format,
+ _("RAID 6"),
+ _("Double Distributed Parity"));
}
else if (g_strcmp0 (level, "raid10") == 0)
{
- if (long_desc)
- ret = g_strdup (_("RAID 10 (Stripe of Mirrors)"));
- else
- ret = g_strdup (_("RAID 10"));
+ ret = g_strdup_printf (markup_format,
+ _("RAID 10"),
+ _("Stripe of Mirrors"));
}
if (ret == NULL)
@@ -739,6 +760,12 @@ gdu_utils_format_mdraid_level (const gchar *level,
return ret;
}
+#ifdef __GNUC_PREREQ
+# if __GNUC_PREREQ(4,6)
+# pragma GCC diagnostic pop
+# endif
+#endif
+
gboolean
gdu_util_is_same_size (GList *blocks,
guint64 *out_min_size)
diff --git a/src/libgdu/gduutils.h b/src/libgdu/gduutils.h
index 03fe8ac..6fc6d75 100644
--- a/src/libgdu/gduutils.h
+++ b/src/libgdu/gduutils.h
@@ -60,7 +60,8 @@ gboolean gdu_utils_show_confirmation (GtkWindow *parent_window,
gboolean gdu_utils_is_ntfs_available (void);
gchar *gdu_utils_format_mdraid_level (const gchar *level,
- gboolean long_desc);
+ gboolean long_desc,
+ gboolean use_markup);
gboolean gdu_util_is_same_size (GList *blocks,
guint64 *out_min_size);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]