[gnome-disk-utility/wip/mdraid] If available, show block device when MD-RAID device is selected
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/wip/mdraid] If available, show block device when MD-RAID device is selected
- Date: Fri, 7 Sep 2012 21:13:50 +0000 (UTC)
commit 7140d0d7cd95cb15975f0a1f835cc6ce3639cb10
Author: David Zeuthen <zeuthen gmail com>
Date: Fri Sep 7 17:12:59 2012 -0400
If available, show block device when MD-RAID device is selected
Also hide it the "Other devices" section.
Signed-off-by: David Zeuthen <zeuthen gmail com>
src/disks/gdudevicetreemodel.c | 4 ++++
src/disks/gduwindow.c | 26 +++++++++++++++++++++-----
2 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/src/disks/gdudevicetreemodel.c b/src/disks/gdudevicetreemodel.c
index 67ca522..c853832 100644
--- a/src/disks/gdudevicetreemodel.c
+++ b/src/disks/gdudevicetreemodel.c
@@ -1394,6 +1394,10 @@ should_include_block (UDisksObject *object)
if (g_str_has_prefix (device, "/dev/ram"))
goto out;
+ /* MD-RAID devices (e.g. /dev/md0) are shown in their own section */
+ if (g_strcmp0 (udisks_block_get_mdraid (block), "/") != 0)
+ goto out;
+
/* Don't show devices of size zero - otherwise we'd end up showing unused loop devices */
size = udisks_block_get_size (block);
if (size == 0)
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index 6a890ec..9ad267f 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -1684,8 +1684,7 @@ setup_device_page (GduWindow *window,
}
else if (mdraid != NULL)
{
- /* MD-TODO */
- gdu_volume_grid_set_block_object (GDU_VOLUME_GRID (window->volume_grid), NULL);
+ /* happens in update_device_page_for_mdraid as the /dev/md* device can come and go */
}
else if (block != NULL)
{
@@ -1760,6 +1759,21 @@ get_job_progress_text (GduWindow *window,
/* ---------------------------------------------------------------------------------------------------- */
static void
+update_grid_for_mdraid (GduWindow *window,
+ UDisksMDRaid *mdraid)
+{
+ UDisksBlock *mdraid_block = NULL;
+ UDisksObject *mdraid_block_object = NULL;
+
+ mdraid_block = udisks_client_get_block_for_mdraid (window->client, mdraid);
+ if (mdraid_block != NULL)
+ mdraid_block_object = (UDisksObject *) g_dbus_interface_dup_object (G_DBUS_INTERFACE (mdraid_block));
+ gdu_volume_grid_set_block_object (GDU_VOLUME_GRID (window->volume_grid), mdraid_block_object);
+ g_clear_object (&mdraid_block_object);
+ g_clear_object (&mdraid_block);
+}
+
+static void
update_device_page_for_mdraid (GduWindow *window,
UDisksObject *object,
UDisksMDRaid *mdraid,
@@ -1780,6 +1794,8 @@ update_device_page_for_mdraid (GduWindow *window,
desc = gdu_utils_get_mdraid_desc (window->client, mdraid);
+ update_grid_for_mdraid (window, mdraid);
+
if (block != NULL)
{
device_desc = get_device_file_for_display (block);
@@ -2601,9 +2617,6 @@ update_device_page (GduWindow *window,
drive = udisks_object_peek_drive (window->current_object);
mdraid = udisks_object_peek_mdraid (window->current_object);
- type = gdu_volume_grid_get_selected_type (GDU_VOLUME_GRID (window->volume_grid));
- size = gdu_volume_grid_get_selected_size (GDU_VOLUME_GRID (window->volume_grid));
-
if (udisks_object_peek_loop (object) != NULL)
*show_flags |= SHOW_FLAGS_DETACH_DISK_IMAGE;
@@ -2613,6 +2626,9 @@ update_device_page (GduWindow *window,
if (mdraid != NULL)
update_device_page_for_mdraid (window, object, mdraid, show_flags);
+ type = gdu_volume_grid_get_selected_type (GDU_VOLUME_GRID (window->volume_grid));
+ size = gdu_volume_grid_get_selected_size (GDU_VOLUME_GRID (window->volume_grid));
+
if (type == GDU_VOLUME_GRID_ELEMENT_TYPE_CONTAINER)
{
if (block != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]