[gnome-disk-utility/wip/mdraid] Nuke "Home Host" field - just display it in the Array Name field if non-local
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/wip/mdraid] Nuke "Home Host" field - just display it in the Array Name field if non-local
- Date: Tue, 11 Sep 2012 18:32:20 +0000 (UTC)
commit 00a1b45251859d17e2ef974bfc743fdb6abe0999
Author: David Zeuthen <zeuthen gmail com>
Date: Tue Sep 11 14:31:21 2012 -0400
Nuke "Home Host" field - just display it in the Array Name field if non-local
Also reword some of the other fields and show number of members.
http://people.freedesktop.org/~david/gnome-disks-mdraid-20120911-2.png
Signed-off-by: David Zeuthen <zeuthen gmail com>
data/ui/disks.ui | 141 +++++++++++++++++++------------------------------
src/disks/gduwindow.c | 52 +++++++++++++++----
2 files changed, 97 insertions(+), 96 deletions(-)
---
diff --git a/data/ui/disks.ui b/data/ui/disks.ui
index b812260..27e2fbc 100644
--- a/data/ui/disks.ui
+++ b/data/ui/disks.ui
@@ -237,7 +237,7 @@
<object class="GtkTable" id="devtab-drive-table">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="n_rows">13</property>
+ <property name="n_rows">12</property>
<property name="n_columns">2</property>
<property name="column_spacing">10</property>
<child>
@@ -284,8 +284,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">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>
@@ -303,8 +303,8 @@
<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="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>
@@ -319,8 +319,8 @@
<style><class name="dim-label"/></style>
</object>
<packing>
- <property name="top_attach">9</property>
- <property name="bottom_attach">10</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 name="y_padding">4</property>
@@ -338,8 +338,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">9</property>
- <property name="bottom_attach">10</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 name="y_padding">4</property>
@@ -354,8 +354,8 @@
<style><class name="dim-label"/></style>
</object>
<packing>
- <property name="top_attach">10</property>
- <property name="bottom_attach">11</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 name="y_padding">4</property>
@@ -373,8 +373,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">10</property>
- <property name="bottom_attach">11</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 name="y_padding">4</property>
@@ -429,41 +429,6 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-drive-size-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">Size</property>
- <style><class name="dim-label"/></style>
- </object>
- <packing>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</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-size-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">6</property>
- <property name="bottom_attach">7</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-smart-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -472,8 +437,8 @@
<style><class name="dim-label"/></style>
</object>
<packing>
- <property name="top_attach">11</property>
- <property name="bottom_attach">12</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 name="y_padding">4</property>
@@ -491,8 +456,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">11</property>
- <property name="bottom_attach">12</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 name="y_padding">4</property>
@@ -557,6 +522,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="related_action">devtab-drive-action-eject</property>
<property name="use_action_appearance">False</property>
<child>
<object class="GtkImage" id="image1">
@@ -582,6 +548,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="related_action">devtab-drive-action-raid-start</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<child>
@@ -608,6 +575,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="related_action">devtab-drive-action-raid-stop</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<child>
@@ -634,6 +602,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="related_action">devtab-drive-action-generic</property>
<property name="use_action_appearance">False</property>
<child>
<object class="GtkImage" id="image2">
@@ -679,8 +648,8 @@
<style><class name="dim-label"/></style>
</object>
<packing>
- <property name="top_attach">12</property>
- <property name="bottom_attach">13</property>
+ <property name="top_attach">11</property>
+ <property name="bottom_attach">12</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
<property name="y_padding">4</property>
@@ -763,8 +732,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">12</property>
- <property name="bottom_attach">13</property>
+ <property name="top_attach">11</property>
+ <property name="bottom_attach">12</property>
<property name="y_options"/>
</packing>
</child>
@@ -773,7 +742,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Array Name</property>
+ <property name="label" translatable="yes">Name</property>
<style><class name="dim-label"/></style>
</object>
<packing>
@@ -804,7 +773,7 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="devtab-drive-homehost-value-label">
+ <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>
@@ -815,82 +784,82 @@
<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">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-homehost-label">
+ <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">Home Host</property>
+ <property name="label" translatable="yes">RAID Level</property>
<style><class name="dim-label"/></style>
</object>
<packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</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-value-label">
+ <object class="GtkLabel" id="devtab-drive-numdevices-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>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Members</property>
+ <style><class name="dim-label"/></style>
</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="top_attach">6</property>
+ <property name="bottom_attach">7</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">
+ <object class="GtkLabel" id="devtab-drive-numdevices-value-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>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ <property name="ellipsize">end</property>
</object>
<packing>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <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="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">
+ <object class="GtkLabel" id="devtab-drive-size-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>
+ <property name="label" translatable="yes">Size</property>
<style><class name="dim-label"/></style>
</object>
<packing>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</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-numdevices-value-label">
+ <object class="GtkLabel" id="devtab-drive-size-value-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -901,8 +870,8 @@
<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">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>
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index fc86cd9..3748a21 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -1816,11 +1816,14 @@ update_device_page_for_mdraid (GduWindow *window,
gchar *device_desc = NULL;
UDisksBlock *block = NULL;
guint64 size = 0;
+ gint num_devices = 0;
gchar *name = NULL;
gchar *homehost = NULL;
gchar *level_desc = NULL;
+ char hostname[512];
size = udisks_mdraid_get_size (mdraid);
+ num_devices = udisks_mdraid_get_num_devices (mdraid);
block = udisks_client_get_block_for_mdraid (window->client, mdraid);
icon = g_themed_icon_new ("gdu-enclosure");
@@ -1875,6 +1878,16 @@ update_device_page_for_mdraid (GduWindow *window,
"devtab-drive-size-value-label",
size, SET_MARKUP_FLAGS_HYPHEN_IF_EMPTY);
+
+ /* figure out hostname of this box */
+ hostname[sizeof hostname - 1] = '\0';
+ if (gethostname (hostname, sizeof hostname - 1) != 0)
+ {
+ g_warning ("Error getting hostname: %m");
+ hostname[0] = '\0';
+ }
+
+ /* figure out the hostname the array is local to */
homehost = udisks_mdraid_dup_name (mdraid);
s = strstr (homehost, ":");
if (s != NULL)
@@ -1888,22 +1901,41 @@ update_device_page_for_mdraid (GduWindow *window,
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);
+ if (homehost != NULL && strlen (homehost) > 0 && g_strcmp0 (homehost, hostname) != 0)
+ {
+ /* Translators: Shown in the 'Array Name' field when the RAID array is deemed to belong to another machine.
+ * Search for "homehost" in the mdadm(8) documentation for more information.
+ * The first %s is the array name (e.g. "My Raid Disk").
+ * The second %s is the hostname that the RAID array belongs to (e.g. "big-server-042").
+ */
+ s = g_strdup_printf (C_("mdraid", "%s (local to %s)"), name, homehost);
+ set_markup (window,
+ "devtab-drive-arrayname-label",
+ "devtab-drive-arrayname-value-label",
+ s, SET_MARKUP_FLAGS_HYPHEN_IF_EMPTY);
+ g_free (s);
+ }
+ else
+ {
+ 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);
+ /* TODO: Do something like "8 (6 available)" if not all members are there */
+ s = g_strdup_printf ("%d", num_devices);
+ set_markup (window,
+ "devtab-drive-numdevices-label",
+ "devtab-drive-numdevices-value-label",
+ s, SET_MARKUP_FLAGS_NONE);
+ g_free (s);
+
/* -------------------------------------------------- */
g_free (level_desc);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]