[gnome-disk-utility/wip/mdraid] Show information about array
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/wip/mdraid] Show information about array
- Date: Sat, 8 Sep 2012 20:57:22 +0000 (UTC)
commit 28b77effc97bc2674efbc10ec423c8bc46f1e5a6
Author: David Zeuthen <zeuthen gmail com>
Date: Sat Sep 8 16:56:59 2012 -0400
Show information about array
http://people.freedesktop.org/~david/gnome-disks-mdraid-20120908-1.png
Signed-off-by: David Zeuthen <zeuthen gmail com>
data/ui/disks.ui | 272 ++++++++++++++++++++++++++++++----------
src/disks/gdudevicetreemodel.c | 7 +
src/disks/gduwindow.c | 78 ++++++++----
src/libgdu/gduutils.c | 43 +++++--
src/libgdu/gduutils.h | 3 +-
5 files changed, 303 insertions(+), 100 deletions(-)
---
diff --git a/data/ui/disks.ui b/data/ui/disks.ui
index d0a2228..70c7321 100644
--- a/data/ui/disks.ui
+++ b/data/ui/disks.ui
@@ -225,11 +225,11 @@
<object class="GtkTable" id="devtab-drive-table">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="n_rows">9</property>
+ <property name="n_rows">13</property>
<property name="n_columns">2</property>
<property name="column_spacing">10</property>
<child>
- <object class="GtkLabel" id="devtab-model-label">
+ <object class="GtkLabel" id="devtab-drive-model-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
@@ -240,12 +240,12 @@
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-model-value-label">
+ <object class="GtkLabel" id="devtab-drive-model-value-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -259,12 +259,12 @@
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-serial-number-label">
+ <object class="GtkLabel" id="devtab-drive-serial-number-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
@@ -272,15 +272,15 @@
<style><class name="dim-label"/></style>
</object>
<packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-serial-number-value-label">
+ <object class="GtkLabel" id="devtab-drive-serial-number-value-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -291,15 +291,15 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-wwn-label">
+ <object class="GtkLabel" id="devtab-drive-wwn-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
@@ -307,15 +307,15 @@
<style><class name="dim-label"/></style>
</object>
<packing>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">9</property>
+ <property name="bottom_attach">10</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-wwn-value-label">
+ <object class="GtkLabel" id="devtab-drive-wwn-value-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -326,15 +326,15 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">9</property>
+ <property name="bottom_attach">10</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-location-label">
+ <object class="GtkLabel" id="devtab-drive-location-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
@@ -342,15 +342,15 @@
<style><class name="dim-label"/></style>
</object>
<packing>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
+ <property name="top_attach">10</property>
+ <property name="bottom_attach">11</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-location-value-label">
+ <object class="GtkLabel" id="devtab-drive-location-value-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -361,15 +361,15 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
+ <property name="top_attach">10</property>
+ <property name="bottom_attach">11</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-media-label">
+ <object class="GtkLabel" id="devtab-drive-media-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
@@ -380,12 +380,12 @@
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-media-value-label">
+ <object class="GtkLabel" id="devtab-drive-media-value-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -399,7 +399,7 @@
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -425,10 +425,10 @@
<style><class name="dim-label"/></style>
</object>
<packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -444,10 +444,10 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -460,10 +460,10 @@
<style><class name="dim-label"/></style>
</object>
<packing>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
+ <property name="top_attach">11</property>
+ <property name="bottom_attach">12</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -479,10 +479,10 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
+ <property name="top_attach">11</property>
+ <property name="bottom_attach">12</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -495,7 +495,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkLabel" id="devtab-drive-name-label">
+ <object class="GtkLabel" id="devtab-drive-desc-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -602,7 +602,7 @@
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -616,8 +616,8 @@
<style><class name="dim-label"/></style>
</object>
<packing>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
+ <property name="top_attach">12</property>
+ <property name="bottom_attach">13</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
<property name="y_padding">4</property>
@@ -700,9 +700,149 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
- <property name="y_options"></property>
+ <property name="top_attach">12</property>
+ <property name="bottom_attach">13</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="devtab-drive-arrayname-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Array Name</property>
+ <style><class name="dim-label"/></style>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="devtab-drive-arrayname-value-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ <property name="ellipsize">end</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="devtab-drive-homehost-value-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ <property name="ellipsize">end</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="devtab-drive-homehost-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Home Host</property>
+ <style><class name="dim-label"/></style>
+ </object>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="devtab-drive-raidlevel-value-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ <property name="ellipsize">end</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="devtab-drive-raidlevel-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">RAID Level</property>
+ <style><class name="dim-label"/></style>
+ </object>
+ <packing>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="devtab-drive-numdevices-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Number of Devices</property>
+ <style><class name="dim-label"/></style>
+ </object>
+ <packing>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="devtab-drive-numdevices-value-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ <property name="ellipsize">end</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ <property name="y_padding">4</property>
</packing>
</child>
</object>
@@ -921,7 +1061,7 @@
</object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -938,7 +1078,7 @@
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -954,7 +1094,7 @@
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -973,7 +1113,7 @@
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -989,7 +1129,7 @@
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -1008,7 +1148,7 @@
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -1024,7 +1164,7 @@
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -1043,7 +1183,7 @@
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -1059,7 +1199,7 @@
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -1087,7 +1227,7 @@
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -1102,7 +1242,7 @@
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -1121,7 +1261,7 @@
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -1137,7 +1277,7 @@
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
@@ -1156,7 +1296,7 @@
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
diff --git a/src/disks/gdudevicetreemodel.c b/src/disks/gdudevicetreemodel.c
index 7933ffa..861c186 100644
--- a/src/disks/gdudevicetreemodel.c
+++ b/src/disks/gdudevicetreemodel.c
@@ -1052,6 +1052,13 @@ update_mdraid (GduDeviceTreeModel *model,
sort_key = g_strdup_printf ("01_mdraid_1_%s", udisks_mdraid_get_uuid (mdraid)); /* TODO: sort_key? */
name = udisks_mdraid_get_name (mdraid);
+ /* skip homehost, if any */
+ s = strstr (name, ":");
+ if (s != NULL)
+ {
+ name = s + 1;
+ s = NULL;
+ }
desc = gdu_utils_get_mdraid_desc (model->client, mdraid);
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index 559b7c8..1a9bc90 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -74,7 +74,7 @@ struct _GduWindow
GtkWidget *devtab_drive_buttonbox;
GtkWidget *devtab_drive_eject_button;
GtkWidget *devtab_drive_generic_button;
- GtkWidget *devtab_drive_name_label;
+ GtkWidget *devtab_drive_desc_label;
GtkWidget *devtab_drive_devices_label;
GtkWidget *devtab_drive_image;
GtkWidget *devtab_table;
@@ -149,7 +149,7 @@ static const struct {
{G_STRUCT_OFFSET (GduWindow, devtab_drive_buttonbox), "devtab-drive-buttonbox"},
{G_STRUCT_OFFSET (GduWindow, devtab_drive_eject_button), "devtab-drive-eject-button"},
{G_STRUCT_OFFSET (GduWindow, devtab_drive_generic_button), "devtab-drive-generic-button"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_name_label), "devtab-drive-name-label"},
+ {G_STRUCT_OFFSET (GduWindow, devtab_drive_desc_label), "devtab-drive-desc-label"},
{G_STRUCT_OFFSET (GduWindow, devtab_drive_devices_label), "devtab-drive-devices-label"},
{G_STRUCT_OFFSET (GduWindow, devtab_drive_image), "devtab-drive-image"},
{G_STRUCT_OFFSET (GduWindow, devtab_table), "devtab-table"},
@@ -1784,15 +1784,16 @@ update_device_page_for_mdraid (GduWindow *window,
gchar *desc = NULL;
gchar *device_desc = NULL;
UDisksBlock *block = NULL;
- guint64 size;
+ guint64 size = 0;
+ gchar *name = NULL;
+ gchar *homehost = NULL;
+ gchar *level_desc = NULL;
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);
+ level_desc = gdu_utils_format_mdraid_level (udisks_mdraid_get_level (mdraid), TRUE);
update_grid_for_mdraid (window, mdraid);
@@ -1810,8 +1811,8 @@ update_device_page_for_mdraid (GduWindow *window,
gtk_widget_show (window->devtab_drive_image);
s = g_strdup_printf ("<big><b>%s</b></big>", desc);
- gtk_label_set_markup (GTK_LABEL (window->devtab_drive_name_label), s);
- gtk_widget_show (window->devtab_drive_name_label);
+ gtk_label_set_markup (GTK_LABEL (window->devtab_drive_desc_label), s);
+ gtk_widget_show (window->devtab_drive_desc_label);
g_free (s);
s = g_strdup_printf ("<small>%s</small>", device_desc);
gtk_label_set_markup (GTK_LABEL (window->devtab_drive_devices_label), s);
@@ -1823,14 +1824,45 @@ update_device_page_for_mdraid (GduWindow *window,
gtk_widget_show (window->devtab_drive_buttonbox);
gtk_widget_show (window->devtab_drive_generic_button);
-
set_size (window,
"devtab-drive-size-label",
"devtab-drive-size-value-label",
size, SET_MARKUP_FLAGS_HYPHEN_IF_EMPTY);
+ homehost = udisks_mdraid_dup_name (mdraid);
+ s = strstr (homehost, ":");
+ if (s != NULL)
+ {
+ name = g_strdup (s + 1);
+ *s = '\0';
+ }
+ else
+ {
+ name = homehost;
+ homehost = NULL;
+ }
+
+ /* MD-TODO: don't show homehost if it matches hostname? */
+ set_markup (window,
+ "devtab-drive-homehost-label",
+ "devtab-drive-homehost-value-label",
+ homehost, SET_MARKUP_FLAGS_NONE);
+
+ set_markup (window,
+ "devtab-drive-arrayname-label",
+ "devtab-drive-arrayname-value-label",
+ name, SET_MARKUP_FLAGS_HYPHEN_IF_EMPTY);
+
+ set_markup (window,
+ "devtab-drive-raidlevel-label",
+ "devtab-drive-raidlevel-value-label",
+ level_desc, SET_MARKUP_FLAGS_NONE);
+
/* -------------------------------------------------- */
+ g_free (level_desc);
+ g_free (homehost);
+ g_free (name);
g_free (device_desc);
g_free (desc);
g_clear_object (&icon);
@@ -1897,8 +1929,8 @@ update_device_page_for_drive (GduWindow *window,
}
s = g_strdup_printf ("<big><b>%s</b></big>",
description);
- gtk_label_set_markup (GTK_LABEL (window->devtab_drive_name_label), s);
- gtk_widget_show (window->devtab_drive_name_label);
+ gtk_label_set_markup (GTK_LABEL (window->devtab_drive_desc_label), s);
+ gtk_widget_show (window->devtab_drive_desc_label);
g_free (s);
s = g_strdup_printf ("<small>%s</small>", str->str);
gtk_label_set_markup (GTK_LABEL (window->devtab_drive_devices_label), s);
@@ -1927,20 +1959,20 @@ update_device_page_for_drive (GduWindow *window,
if (strlen (drive_revision) > 0)
g_string_append_printf (str, " (%s)", drive_revision);
set_markup (window,
- "devtab-model-label",
- "devtab-model-value-label", str->str, SET_MARKUP_FLAGS_HYPHEN_IF_EMPTY);
+ "devtab-drive-model-label",
+ "devtab-drive-model-value-label", str->str, SET_MARKUP_FLAGS_HYPHEN_IF_EMPTY);
g_string_free (str, TRUE);
serial = udisks_drive_get_serial (drive);
set_markup (window,
- "devtab-serial-number-label",
- "devtab-serial-number-value-label",
+ "devtab-drive-serial-number-label",
+ "devtab-drive-serial-number-value-label",
serial, SET_MARKUP_FLAGS_NONE);
if (serial == NULL || strlen (serial) == 0)
{
set_markup (window,
- "devtab-wwn-label",
- "devtab-wwn-value-label",
+ "devtab-drive-wwn-label",
+ "devtab-drive-wwn-value-label",
udisks_drive_get_wwn (drive), SET_MARKUP_FLAGS_NONE);
}
@@ -1986,8 +2018,8 @@ update_device_page_for_drive (GduWindow *window,
if (s != NULL)
{
set_markup (window,
- "devtab-location-label",
- "devtab-location-value-label",
+ "devtab-drive-location-label",
+ "devtab-drive-location-value-label",
s, SET_MARKUP_FLAGS_NONE);
g_free (s);
}
@@ -2053,15 +2085,15 @@ update_device_page_for_drive (GduWindow *window,
if (udisks_drive_get_media_available (drive))
{
set_markup (window,
- "devtab-media-label",
- "devtab-media-value-label",
+ "devtab-drive-media-label",
+ "devtab-drive-media-value-label",
media_description, SET_MARKUP_FLAGS_NONE);
}
else
{
set_markup (window,
- "devtab-media-label",
- "devtab-media-value-label",
+ "devtab-drive-media-label",
+ "devtab-drive-media-value-label",
"",
SET_MARKUP_FLAGS_HYPHEN_IF_EMPTY);
}
diff --git a/src/libgdu/gduutils.c b/src/libgdu/gduutils.c
index ea51a6d..1bcf4ba 100644
--- a/src/libgdu/gduutils.c
+++ b/src/libgdu/gduutils.c
@@ -666,33 +666,52 @@ gdu_utils_is_ntfs_available (void)
/* ---------------------------------------------------------------------------------------------------- */
gchar *
-gdu_utils_format_mdraid_level (const gchar *level)
+gdu_utils_format_mdraid_level (const gchar *level,
+ gboolean long_desc)
{
gchar *ret = NULL;
if (g_strcmp0 (level, "raid0") == 0)
{
- ret = g_strdup (_("RAID-0 Array"));
+ if (long_desc)
+ ret = g_strdup (_("RAID-0 (Stripe)"));
+ else
+ ret = g_strdup (_("RAID-0"));
}
else if (g_strcmp0 (level, "raid1") == 0)
{
- ret = g_strdup (_("RAID-1 Array"));
+ if (long_desc)
+ ret = g_strdup (_("RAID-1 (Mirror)"));
+ else
+ ret = g_strdup (_("RAID-1"));
}
else if (g_strcmp0 (level, "raid4") == 0)
{
- ret = g_strdup (_("RAID-4 Array"));
+ if (long_desc)
+ ret = g_strdup (_("RAID-4 (Dedicated Parity)"));
+ else
+ ret = g_strdup (_("RAID-4"));
}
else if (g_strcmp0 (level, "raid5") == 0)
{
- ret = g_strdup (_("RAID-5 Array"));
+ if (long_desc)
+ ret = g_strdup (_("RAID-5 (Distributed Parity)"));
+ else
+ ret = g_strdup (_("RAID-5"));
}
else if (g_strcmp0 (level, "raid6") == 0)
{
- ret = g_strdup (_("RAID-6 Array"));
+ if (long_desc)
+ ret = g_strdup (_("RAID-6 (Double Distributed Parity)"));
+ else
+ ret = g_strdup (_("RAID-6"));
}
else if (g_strcmp0 (level, "raid10") == 0)
{
- ret = g_strdup (_("RAID-10 Array"));
+ if (long_desc)
+ ret = g_strdup (_("RAID-10 (Stripe of Mirrors)"));
+ else
+ ret = g_strdup (_("RAID-10"));
}
if (ret == NULL)
@@ -717,14 +736,18 @@ gdu_utils_get_mdraid_desc (UDisksClient *client,
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));
- ret = g_strdup_printf ("%s %s", s, s2);
+ 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
{
- ret = gdu_utils_format_mdraid_level (udisks_mdraid_get_level (raid));
+ 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 285e580..37880e7 100644
--- a/src/libgdu/gduutils.h
+++ b/src/libgdu/gduutils.h
@@ -57,7 +57,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);
+gchar *gdu_utils_format_mdraid_level (const gchar *level,
+ gboolean long_desc);
gchar *gdu_utils_get_mdraid_desc (UDisksClient *client,
UDisksMDRaid *raid);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]