- Don't show drives in computer:/// if media is available but no volumes

are recognized (#495152)
This commit is contained in:
David Zeuthen 2009-04-11 17:04:34 +00:00
parent 301d9751b8
commit f59916cda6
3 changed files with 125 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From 9a265228542de72df41caef8bd31402841ac389c Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz@redhat.com>
Date: Sat, 11 Apr 2009 12:43:06 -0400
Subject: [PATCH] ignore drives without volumes
This fixes a problem on some dmraid setups where we have drives
without any partitions (the dmraid boot scripts removes all partitions
(!)). See https://bugzilla.redhat.com/show_bug.cgi?id=495152 for more
details.
This fix is also consistent with the policy of ignoring drives where
all volumes are ignored. E.g. prior to this patch we didn't shown
neither sdb if sdb1 was a the only unrecognized partition on sdb.. so
if you delete sdb1, it would be natural to keep hiding sdb (which is
what this patch does).
---
monitor/gdu/ggduvolumemonitor.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/monitor/gdu/ggduvolumemonitor.c b/monitor/gdu/ggduvolumemonitor.c
index 9ecee8b..0e7ce6f 100644
--- a/monitor/gdu/ggduvolumemonitor.c
+++ b/monitor/gdu/ggduvolumemonitor.c
@@ -799,7 +799,13 @@ should_drive_be_ignored (GduPool *pool, GduDrive *d, GList *fstab_mount_points)
}
}
- ret = has_volumes && all_volumes_are_ignored;
+ /* we ignore a drive if
+ *
+ * a) it doesn't have any volumes; or
+ *
+ * b) the volumes of the drive are all ignored
+ */
+ ret = (!has_volumes) || (has_volumes && all_volumes_are_ignored);
out:
g_list_foreach (enclosed, (GFunc) g_object_unref, NULL);
--
1.6.2.2

View File

@ -0,0 +1,73 @@
From c54217a58f71f3ca7a85ce81fb96f363255c6110 Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz@redhat.com>
Date: Sat, 11 Apr 2009 12:57:55 -0400
Subject: [PATCH] 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
--
1.6.2.2

View File

@ -1,7 +1,7 @@
Summary: Backends for the gio framework in GLib
Name: gvfs
Version: 1.2.1
Release: 4%{?dist}
Release: 5%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtk.org
@ -52,6 +52,10 @@ Patch106: gdu-0006-Ignore-drives-if-all-volumes-of-the-drive-are-ignore.patch
# - Pending discussion + requires Nautilus patch
#Patch107: gdu-0007-Bug-576587-allow-eject-even-on-non-ejectable-vol.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=495152
Patch108: gdu-0008-ignore-drives-without-volumes.patch
Patch109: gdu-0009-never-ignore-drives-without-media.patch
%description
The gvfs package provides backend implementations for the gio
framework in GLib. It includes ftp, sftp, cifs.
@ -143,6 +147,8 @@ media players (Media Transfer Protocol) to applications using gvfs.
%patch105 -p1 -b .gdu-ignore-1
%patch106 -p1 -b .gdu-ignore-2
#%patch107 -p1 -b .gdu-always-eject
%patch108 -p1 -b .gdu-ignore-drives-without-volumes
%patch109 -p1 -b .gdu-never-ignore-drives-without-media
%build
@ -286,6 +292,10 @@ update-desktop-database &> /dev/null ||:
%changelog
* Sat Apr 11 2009 David Zeuthen <davidz@redhat.com> - 1.2.1-5
- Don't show drives in computer:/// if media is available but
no volumes are recognized (#495152)
* Sat Apr 11 2009 Matthias Clasen <mclasen@redhat.com> - 1.2.1-4
- No need for bash completion to be executable