[gnome-disk-utility] Include the parent id in the id for GduDrive and GduLinuxMdDrive



commit 232157d05f5c5d61647cde46a4057478264ab8b9
Author: David Zeuthen <davidz redhat com>
Date:   Mon Dec 14 11:10:37 2009 -0500

    Include the parent id in the id for GduDrive and GduLinuxMdDrive
    
    Otherwise we get collision when handling drives from multiple pools.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 src/gdu/gdu-drive.c          |    4 +++-
 src/gdu/gdu-linux-md-drive.c |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/gdu/gdu-drive.c b/src/gdu/gdu-drive.c
index 5453097..72ecc5a 100644
--- a/src/gdu/gdu-drive.c
+++ b/src/gdu/gdu-drive.c
@@ -482,7 +482,9 @@ _gdu_drive_new_from_device (GduPool *pool, GduDevice *device, GduPresentable *en
         drive->priv->pool = g_object_ref (pool);
         drive->priv->enclosing_presentable =
                 enclosing_presentable != NULL ? g_object_ref (enclosing_presentable) : NULL;
-        drive->priv->id = g_strdup_printf ("drive_%s", gdu_device_get_device_file (drive->priv->device));
+        drive->priv->id = g_strdup_printf ("drive_%s_enclosed_by_%s",
+                                           gdu_device_get_device_file (drive->priv->device),
+                                           enclosing_presentable != NULL ? gdu_presentable_get_id (enclosing_presentable) : "(none)");
 
         g_signal_connect (device, "changed", (GCallback) device_changed, drive);
         g_signal_connect (device, "job-changed", (GCallback) device_job_changed, drive);
diff --git a/src/gdu/gdu-linux-md-drive.c b/src/gdu/gdu-linux-md-drive.c
index 05051a7..3605283 100644
--- a/src/gdu/gdu-linux-md-drive.c
+++ b/src/gdu/gdu-linux-md-drive.c
@@ -357,7 +357,9 @@ _gdu_linux_md_drive_new (GduPool      *pool,
                 g_signal_connect (drive->priv->pool, "device-job-changed", G_CALLBACK (device_job_changed), drive);
                 prime_devices (drive);
         } else {
-                drive->priv->id = g_strdup_printf ("linux_md_%s", device_file);
+                drive->priv->id = g_strdup_printf ("linux_md_%s_enclosed_by_%s",
+                                                   device_file,
+                                                   enclosing_presentable != NULL ? gdu_presentable_get_id (enclosing_presentable) : "(none)");
                 drive->priv->device = gdu_pool_get_by_device_file (pool, device_file);
         }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]