[gnome-disk-utility] Add gdu_device_should_ignore() method



commit f900cd39d1d59f30bd4d35ee36cd88406b48f523
Author: David Zeuthen <davidz redhat com>
Date:   Tue Feb 23 11:34:36 2010 -0500

    Add gdu_device_should_ignore() method
    
    For now, this is a local method.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 src/gdu/gdu-device.c |   36 ++++++++++++++++++++++++++++++++++++
 src/gdu/gdu-device.h |    4 ++++
 2 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/src/gdu/gdu-device.c b/src/gdu/gdu-device.c
index 4c59f34..10b4f20 100644
--- a/src/gdu/gdu-device.c
+++ b/src/gdu/gdu-device.c
@@ -826,6 +826,42 @@ gdu_device_get_object_path (GduDevice *device)
         return device->priv->object_path;
 }
 
+/* ---------------------------------------------------------------------------------------------------- */
+
+/* TODO:
+ *
+ *  - for now this is a local method - we might want it to be a D-Bus property instead
+ *  - we might want to convey the reason why the device should be ignored (see current call-sites)
+ */
+gboolean
+gdu_device_should_ignore (GduDevice *device)
+{
+        gboolean ret;
+
+        ret = FALSE;
+
+        if (device->priv->props->device_is_drive) {
+                if (device->priv->props->device_is_linux_dmmp_component) {
+                        ret = TRUE;
+                } else if (g_strv_length (device->priv->props->drive_similar_devices) > 0 &&
+                           !device->priv->props->device_is_linux_dmmp) {
+                        ret = TRUE;
+                }
+        } else if (device->priv->props->device_is_partition) {
+                GduDevice *drive_device;
+                drive_device = gdu_pool_get_by_object_path (device->priv->pool, device->priv->props->partition_slave);
+                if (drive_device != NULL) {
+                        ret = gdu_device_should_ignore (drive_device);
+                        g_object_unref (drive_device);
+                }
+        }
+
+        return ret;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+
 /**
  * gdu_device_find_parent:
  * @device: the device
diff --git a/src/gdu/gdu-device.h b/src/gdu/gdu-device.h
index bd55058..38a7365 100644
--- a/src/gdu/gdu-device.h
+++ b/src/gdu/gdu-device.h
@@ -212,6 +212,10 @@ gconstpointer gdu_device_drive_ata_smart_get_blob (GduDevice *device, gsize *out
 
 /* ---------------------------------------------------------------------------------------------------- */
 
+gboolean gdu_device_should_ignore (GduDevice *device);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
 void gdu_device_op_filesystem_mount                   (GduDevice                             *device,
                                                        gchar                                **options,
                                                        GduDeviceFilesystemMountCompletedFunc  callback,



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