[patch] use gnome-mount and small fixes for gnome-vfs
- From: David Zeuthen <david fubar dk>
- To: gnome-vfs-list gnome org, utopia-list gnome org
- Cc:
- Subject: [patch] use gnome-mount and small fixes for gnome-vfs
- Date: Sun, 15 Jan 2006 16:16:56 -0500
Hey,
Attached is a small patch for gnome-vfs that does the following
1. Looks for gnome-mount and uses that if available - can be
disabled. Using gnome-mount will ignore the render the options
--with-hal-[mount,umount,eject] useless btw. Needs to have
gnome-mount in the same prefix as where you build gnome-vfs.
Also needs gnome-mount 0.4 (already available in CVS, will do
a release tomorrow night).
You should still be able to build without gnome-mount and things
should be like before (e.g. it should work with pmount or whatever)
2. Fixes small hal backend bugs and require hal >= 0.5.6 rather than
hal >= 0.5. This works already with HAL CVS and 0.5.6 is out
today or tomorrow. Btw, I fixed one very bad bug in libhal-storage
(whilst debugging hal/gnome-vfs integration issues) that effectively
made gnome-vfs display drives that were not mountable. Notably one
bug this fixes is when you attach a HFS+ formatted iPod and you see
three drives.
Also, the main reason for requiring 0.5.6 is the use of new HAL API
to determine if certain volumes [1] should be hidden from the user.
I think this is very useful.
3. Changed how uniquiness naming is done. Without this change my iPod
Nano shows up as "Apple iPod Music Player (2) : David Zeuthen's
iPod" exactly because we in fact have three GnomeVFSDrive objects
stemming from that iPod (two of them contain firmware partitions
and are thus not mountable). Some times it's (3) instead of (2)
and sometimes nothing at all. This is due to the non-deterministic
nature of device probing. Either way, this patch fixes it so I get
"Apple iPod Music Player : David Zeuthen's iPod" as expected.
4. Change the defaults in the gconf schema that determines whether
internal hard disks are shown or not. This is now sane as gnome-
mount is able to mount the internal drives in the default HAL
configuration.
Btw, I couldn't build without ripping out Werror - maybe it's just my
compiler or version of glib/gtk+/gnome libraries, maybe not. I'm on
Fedora Rawhide ppc btw.
Also, nautilus and the gnomevfs filechooser backend still needs fixing
as they don't honor the contract (we introduced it in 2.12 I think, see
libgnomevfs/gnome-vfs-volume-ops.c:mount_umount_thread() - search for
'contract'). This is bad as gnome-mount now displays error dialogs on
it's own but both Nautilus and the file chooser shows an empty dialog.
Which looks bad. Btw, these issues have to be resolved even without this
patch being applied.
Oh, as an aside, I had to do some voodoo in gnome-mount to daemonize
such that we don't block on error dialogs because otherwise Nautilus
puts up an annoying dialog asking if you want to cancel while we display
the dialog. Hmm.. I guess there is no way around this?
There are no changes to any strings in this patch to gnome-vfs. OK to
commit?
Thanks,
David
[1] : such as the Apple Bootstrap or FAT recovery partitions on OEM
Windows systems such as HP or Dell or whatever the admin wants to hide
from his users. The property is called volume.ignore.
ChangeLog | 27 +++++++++++++++
configure.in | 25 +++++++++++++-
libgnomevfs/Makefile.am | 1
libgnomevfs/gnome-vfs-hal-mounts.c | 24 +++++++++++--
libgnomevfs/gnome-vfs-volume-monitor.c | 10 ++---
libgnomevfs/gnome-vfs-volume-ops.c | 57 ++++++++++++++++++++++++++++++---
schemas/system_storage.schemas.in | 2 -
7 files changed, 129 insertions(+), 17 deletions(-)
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-vfs/ChangeLog,v
retrieving revision 1.2346
diff -u -p -r1.2346 ChangeLog
--- ChangeLog 15 Jan 2006 12:27:48 -0000 1.2346
+++ ChangeLog 15 Jan 2006 21:01:14 -0000
@@ -1,3 +1,30 @@
+2006-01-15 David Zeuthen <davidz redhat com>
+
+ * schemas/system_storage.schemas.in: Make TRUE the default for key
+ /schemas/system/storage/display_internal_hard_drives as
+ gnome-mount now allows mounting these in the upstream default HAL
+ configuration.
+
+ * libgnomevfs/gnome-vfs-volume-ops.c:
+ (mount_unmount_thread): Use gnome-mount if configured to do so.
+
+ * libgnomevfs/gnome-vfs-volume-monitor.c:
+ (drive_name_is_unique): Do not test name uniqueness against hidden
+ drives
+ (volume_name_is_unique): Same for volumes
+
+ * libgnomevfs/gnome-vfs-hal-mounts.c:
+ (_hal_drive_policy_get_display_name): Vendor as returned from
+ libhal- storage may be NULL; handle that case
+ (_hal_volume_policy_check): Use new hal 0.5.6 API addition to hide
+ volumes that are to be ignored
+
+ * libgnomevfs/Makefile.am: Export $(bindir) as GNOME_VFS_BINDIR as
+ it's needed to find gnome-mount and friends
+
+ * configure.in: Look for gnome-mount and use it if found (unless
+ specifically told not to; on by default). Require hal >= 0.5.6.
+
2006-01-15 Christian Neumair <chris gnome-de org>
* libgnomevfs/gnome-vfs-xfer.c: (handle_overwrite):
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gnome-vfs/configure.in,v
retrieving revision 1.404
diff -u -p -r1.404 configure.in
--- configure.in 10 Jan 2006 15:06:44 -0000 1.404
+++ configure.in 15 Jan 2006 21:01:17 -0000
@@ -724,8 +724,8 @@ esac],
[ENABLE_HAL=yes]) dnl Default value
if test "$ENABLE_HAL" = "yes"; then
- PKG_CHECK_MODULES(HAL, hal >= 0.5,
- [ USE_HAL="hal >= 0.5, hal-storage >= 0.5, dbus-1 >= 0.32, dbus-glib-1 >= 0.32"
+ PKG_CHECK_MODULES(HAL, hal >= 0.5.6,
+ [ USE_HAL="hal >= 0.5.6, hal-storage >= 0.5.6, dbus-1 >= 0.32, dbus-glib-1 >= 0.32"
AC_DEFINE(USE_HAL, 1, [defined if using libhal])
msg_hal=yes],
[ USE_HAL=""])
@@ -752,6 +752,26 @@ if test "$USE_HAL" != ""; then
fi
+msg_gnome_mount=no
+AC_ARG_ENABLE(gnome-mount,
+AC_HELP_STRING([--enable-gnome-mount],[use gnome-mount, if available]),
+[case $enableval in
+yes) ENABLE_GNOME_MOUNT=yes ;;
+no) ENABLE_GNOME_MOUNT=no ;;
+*) AC_MSG_ERROR(bad value $enableval for --enable-gnome-mount) ;;
+esac],
+[ENABLE_GNOME_MOUNT=yes]) dnl Default value
+
+if test "$ENABLE_GNOME_MOUNT" = "yes"; then
+ PKG_CHECK_MODULES(GNOME_MOUNT, gnome-mount >= 0.4,
+ [ AC_DEFINE(USE_GNOME_MOUNT, 1, [defined if using gnome-mount])
+ msg_gnome_mount="yes, overrides --with-hal-mount et. al."],
+ [ USE_GNOME_MOUNT=""])
+else
+ USE_GNOME_MOUNT=""
+fi
+
+
dnl ==============================================================================
dnl Check for a supported resolver functions
dnl ==============================================================================
@@ -1216,6 +1236,7 @@ echo "
Avahi support: $msg_avahi
Howl support: $msg_howl
HAL support: $msg_hal
+ gnome-mount support: $msg_gnome_mount
Gtk Doc: $enable_gtk_doc
FS monitor backends: $fs_monitor_backends
Samba method: $msg_samba
Index: libgnomevfs/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/Makefile.am,v
retrieving revision 1.144
diff -u -p -r1.144 Makefile.am
--- libgnomevfs/Makefile.am 2 Dec 2005 18:25:16 -0000 1.144
+++ libgnomevfs/Makefile.am 15 Jan 2006 21:01:24 -0000
@@ -21,6 +21,7 @@ INCLUDES = \
-D_REENTRANT \
-DG_DISABLE_DEPRECATED \
-DGNOME_VFS_PREFIX=\"$(prefix)\" \
+ -DGNOME_VFS_BINDIR=\"$(bindir)\" \
-DGNOME_VFS_DATADIR=\"$(datadir)\" \
-DGNOME_VFS_LIBDIR=\"$(libdir)\" \
-DGNOME_VFS_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\" \
Index: libgnomevfs/gnome-vfs-hal-mounts.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-hal-mounts.c,v
retrieving revision 1.23
diff -u -p -r1.23 gnome-vfs-hal-mounts.c
--- libgnomevfs/gnome-vfs-hal-mounts.c 14 Nov 2005 11:11:24 -0000 1.23
+++ libgnomevfs/gnome-vfs-hal-mounts.c 15 Jan 2006 21:01:26 -0000
@@ -428,13 +428,21 @@ _hal_drive_policy_get_display_name (Gnom
} else if (drive_type == LIBHAL_DRIVE_TYPE_FLASHKEY) {
name = g_strdup (_("Pen Drive"));
} else if (drive_type == LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER) {
+ const char *vendor;
+ const char *model;
+ vendor = libhal_drive_get_vendor (hal_drive);
+ model = libhal_drive_get_model (hal_drive);
name = g_strdup_printf (_("%s %s Music Player"),
- libhal_drive_get_vendor (hal_drive),
- libhal_drive_get_model (hal_drive));
+ vendor != NULL ? vendor : "",
+ model != NULL ? model : "");
} else if (drive_type == LIBHAL_DRIVE_TYPE_CAMERA) {
+ const char *vendor;
+ const char *model;
+ vendor = libhal_drive_get_vendor (hal_drive);
+ model = libhal_drive_get_model (hal_drive);
name = g_strdup_printf (_("%s %s Digital Camera"),
- libhal_drive_get_vendor (hal_drive),
- libhal_drive_get_model (hal_drive));
+ vendor != NULL ? vendor : "",
+ model != NULL ? model : "");
}
if (name != NULL)
@@ -687,6 +695,12 @@ _hal_volume_policy_check (GnomeVFSVolume
libhal_volume_disc_is_blank (hal_volume)))
goto out;
+ /* for volumes the vendor and/or sysadmin wants to be ignore (e.g. bootstrap HFS
+ * partitions on the Mac, HP_RECOVERY partitions on HP systems etc.)
+ */
+ if (libhal_volume_should_ignore (hal_volume))
+ goto out;
+
/* if mounted; discard if it got a FHS-2.3 name (to get /, /boot, /usr etc. out of the way)
*
* (yes, this breaks if the user mounts it later but that is not normally the case for such volumes)
@@ -709,8 +723,10 @@ _hal_volume_policy_check (GnomeVFSVolume
fstype = libhal_volume_get_fstype (hal_volume);
/* blacklist partitions with name 'bootstrap' of type HFS (Apple uses that) */
+/*
if (label != NULL && fstype != NULL && strcmp (label, "bootstrap") == 0 && strcmp (fstype, "hfs") == 0)
goto out;
+*/
ret = TRUE;
out:
Index: libgnomevfs/gnome-vfs-volume-monitor.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-volume-monitor.c,v
retrieving revision 1.14
diff -u -p -r1.14 gnome-vfs-volume-monitor.c
--- libgnomevfs/gnome-vfs-volume-monitor.c 14 Nov 2005 11:41:13 -0000 1.14
+++ libgnomevfs/gnome-vfs-volume-monitor.c 15 Jan 2006 21:01:27 -0000
@@ -809,19 +809,19 @@ volume_name_is_unique (GnomeVFSVolumeMon
for (l = volume_monitor->priv->mtab_volumes; l != NULL; l = l->next) {
volume = l->data;
- if (strcmp (volume->priv->display_name, name) == 0) {
+ if (volume->priv->is_user_visible && strcmp (volume->priv->display_name, name) == 0) {
return FALSE;
}
}
for (l = volume_monitor->priv->server_volumes; l != NULL; l = l->next) {
volume = l->data;
- if (strcmp (volume->priv->display_name, name) == 0) {
+ if (volume->priv->is_user_visible && strcmp (volume->priv->display_name, name) == 0) {
return FALSE;
}
}
for (l = volume_monitor->priv->vfs_volumes; l != NULL; l = l->next) {
volume = l->data;
- if (strcmp (volume->priv->display_name, name) == 0) {
+ if (volume->priv->is_user_visible && strcmp (volume->priv->display_name, name) == 0) {
return FALSE;
}
}
@@ -857,13 +857,13 @@ drive_name_is_unique (GnomeVFSVolumeMoni
for (l = volume_monitor->priv->fstab_drives; l != NULL; l = l->next) {
drive = l->data;
- if (strcmp (drive->priv->display_name, name) == 0) {
+ if (drive->priv->is_user_visible && strcmp (drive->priv->display_name, name) == 0) {
return FALSE;
}
}
for (l = volume_monitor->priv->vfs_drives; l != NULL; l = l->next) {
drive = l->data;
- if (strcmp (drive->priv->display_name, name) == 0) {
+ if (drive->priv->is_user_visible && strcmp (drive->priv->display_name, name) == 0) {
return FALSE;
}
}
Index: libgnomevfs/gnome-vfs-volume-ops.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-volume-ops.c,v
retrieving revision 1.24
diff -u -p -r1.24 gnome-vfs-volume-ops.c
--- libgnomevfs/gnome-vfs-volume-ops.c 26 Nov 2005 19:32:23 -0000 1.24
+++ libgnomevfs/gnome-vfs-volume-ops.c 15 Jan 2006 21:01:28 -0000
@@ -155,6 +155,9 @@ typedef struct _MountThreadAuth {
GMutex *mutex;
} MountThreadAuth;
+
+#if !defined(USE_GNOME_MOUNT)
+/* gnome-mount programs display their own dialogs so no use for these functions */
static char *
generate_mount_error_message (char *standard_error,
GnomeVFSDeviceType device_type)
@@ -211,6 +214,7 @@ generate_unmount_error_message (char *st
return message;
}
+#endif /* !defined(USE_GNOME_MOUNT) */
static void
force_probe (void)
@@ -605,7 +609,12 @@ mount_unmount_thread (void *arg)
if (info->should_mount || info->should_unmount) {
error = NULL;
if (spawn_mount (info,
-#if defined(USE_HAL) && defined(HAL_MOUNT) && defined(HAL_UMOUNT)
+#if defined(USE_GNOME_MOUNT)
+ /* do pass our environment when using gnome-mount progams */
+ ((strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-mount") == 0) ||
+ (strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-umount") == 0) ||
+ (strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-eject") == 0)) ? NULL : envp,
+#elif defined(USE_HAL) && defined(HAL_MOUNT) && defined(HAL_UMOUNT)
/* do pass our environment when using hal mount progams */
((strcmp (info->argv[0], HAL_MOUNT) == 0) ||
(strcmp (info->argv[0], HAL_UMOUNT) == 0)) ? NULL : envp,
@@ -617,6 +626,11 @@ mount_unmount_thread (void *arg)
&error)) {
if (exit_status != 0) {
info->succeeded = FALSE;
+#if defined(USE_GNOME_MOUNT)
+ /* gnome-mount programs display their own dialogs */
+ info->error_message = g_strdup ("");
+ info->detailed_error_message = g_strdup ("");
+#else
if (strlen (standard_error) > 0) {
if (info->should_mount) {
info->error_message = generate_mount_error_message (standard_error,
@@ -639,6 +653,7 @@ mount_unmount_thread (void *arg)
info->error_message = g_strdup ("");
info->detailed_error_message = g_strdup ("");
}
+#endif
}
g_free (standard_error);
@@ -656,7 +671,17 @@ mount_unmount_thread (void *arg)
argv[0] = NULL;
-#if defined(USE_HAL) && defined(HAL_EJECT)
+#if defined(USE_GNOME_MOUNT)
+ if (info->hal_udi != NULL) {
+ argv[0] = GNOME_VFS_BINDIR "/gnome-eject";
+ argv[1] = "--hal-udi";
+ argv[2] = info->hal_udi;
+ argv[3] = NULL;
+
+ if (!g_file_test (argv [0], G_FILE_TEST_IS_EXECUTABLE))
+ argv[0] = NULL;
+ }
+#elif defined(USE_HAL) && defined(HAL_EJECT)
if (info->hal_udi != NULL) {
argv[0] = HAL_EJECT;
argv[1] = info->device_path;
@@ -700,8 +725,14 @@ mount_unmount_thread (void *arg)
if (exit_status != 0) {
info->succeeded = FALSE;
+#if defined(USE_GNOME_MOUNT)
+ /* gnome-mount programs display their own dialogs */
+ info->error_message = g_strdup ("");
+ info->detailed_error_message = g_strdup ("");
+#else
info->error_message = g_strdup (_("Unable to eject media"));
info->detailed_error_message = g_strdup (standard_error);
+#endif
} else {
/* If the eject succeed then ignore the previous unmount error (if any) */
info->succeeded = TRUE;
@@ -769,7 +800,15 @@ mount_unmount_operation (const char *mou
#endif
if (should_mount) {
-#if defined(USE_HAL) && defined(HAL_MOUNT)
+#if defined(USE_GNOME_MOUNT)
+ if (hal_udi != NULL && g_file_test (GNOME_VFS_BINDIR "/gnome-mount", G_FILE_TEST_IS_EXECUTABLE)) {
+ command = GNOME_VFS_BINDIR "/gnome-mount";
+ argument = "--hal-udi";
+ name = hal_udi;
+ } else {
+ command = find_command (MOUNT_COMMAND);
+ }
+#elif defined(USE_HAL) && defined(HAL_MOUNT)
if (hal_udi != NULL && g_file_test (HAL_MOUNT, G_FILE_TEST_IS_EXECUTABLE))
command = HAL_MOUNT;
else
@@ -783,8 +822,16 @@ mount_unmount_operation (const char *mou
}
if (should_unmount) {
- gboolean is_in_media = g_str_has_prefix (mount_point, "/media");
-#if defined(USE_HAL) && defined(HAL_UMOUNT)
+ gboolean is_in_media = g_str_has_prefix (mount_point, "/media");
+#if defined(USE_GNOME_MOUNT)
+ if (hal_udi != NULL && g_file_test (GNOME_VFS_BINDIR "/gnome-umount", G_FILE_TEST_IS_EXECUTABLE)) {
+ command = GNOME_VFS_BINDIR "/gnome-umount";
+ argument = "--hal-udi";
+ name = hal_udi;
+ } else {
+ command = find_command (is_in_media ? PUMOUNT_COMMAND : UMOUNT_COMMAND);
+ }
+#elif defined(USE_HAL) && defined(HAL_UMOUNT)
if (hal_udi != NULL && g_file_test (HAL_UMOUNT, G_FILE_TEST_IS_EXECUTABLE))
command = HAL_UMOUNT;
else
Index: schemas/system_storage.schemas.in
===================================================================
RCS file: /cvs/gnome/gnome-vfs/schemas/system_storage.schemas.in,v
retrieving revision 1.1
diff -u -p -r1.1 system_storage.schemas.in
--- schemas/system_storage.schemas.in 1 Jul 2005 10:32:50 -0000 1.1
+++ schemas/system_storage.schemas.in 15 Jan 2006 21:01:28 -0000
@@ -7,7 +7,7 @@
<applyto>/system/storage/display_internal_hard_drives</applyto>
<owner>gnome-vfs</owner>
<type>bool</type>
- <default>false</default>
+ <default>true</default>
<locale name="C">
<short>Display internal hard drives</short>
<long>Whether to display drives and mountable volumes from internal hard drives (non-SCSI optical drives are always shown).</long>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]