[gvfs] Never ignore drives without media



commit 6d96b756d39a924d1244388f20d93a0a96d06698
Author: David Zeuthen <davidz redhat com>
Date:   Sat Apr 11 12:57:55 2009 -0400

    Never ignore drives without media
---
 monitor/gdu/ggduvolumemonitor.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/monitor/gdu/ggduvolumemonitor.c b/monitor/gdu/ggduvolumemonitor.c
index 0e7ce6f..caa25a0 100644
--- a/monitor/gdu/ggduvolumemonitor.c
+++ b/monitor/gdu/ggduvolumemonitor.c
@@ -751,13 +751,13 @@ static gboolean
 should_drive_be_ignored (GduPool *pool, GduDrive *d, GList *fstab_mount_points)
 {
   GduDevice *device;
-  gboolean ret;
+  gboolean ignored;
   gboolean has_volumes;
   gboolean all_volumes_are_ignored;
   GList *enclosed;
   GList *l;
 
-  ret = FALSE;
+  ignored = FALSE;
   device = NULL;
   enclosed = NULL;
 
@@ -771,7 +771,7 @@ should_drive_be_ignored (GduPool *pool, GduDrive *d, GList *fstab_mount_points)
    */
   if (device == NULL)
     {
-      ret = TRUE;
+      ignored = TRUE;
       goto out;
     }
 
@@ -801,11 +801,20 @@ should_drive_be_ignored (GduPool *pool, GduDrive *d, GList *fstab_mount_points)
 
   /* we ignore a drive if
    *
-   * a) it doesn't have any volumes; or
+   * a) no volumes are available AND media is available; OR
    *
    * b) the volumes of the drive are all ignored
    */
-  ret = (!has_volumes) || (has_volumes && all_volumes_are_ignored);
+  if (!has_volumes)
+    {
+      if (gdu_device_is_media_available (device))
+        ignored = TRUE;
+    }
+  else
+    {
+      if (all_volumes_are_ignored)
+        ignored = TRUE;
+    }
 
  out:
   g_list_foreach (enclosed, (GFunc) g_object_unref, NULL);
@@ -814,7 +823,7 @@ should_drive_be_ignored (GduPool *pool, GduDrive *d, GList *fstab_mount_points)
   if (device != NULL)
     g_object_unref (device);
 
-  return ret;
+  return ignored;
 }
 
 static void



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