Author: benny Date: 2006-08-31 08:22:00 +0000 (Thu, 31 Aug 2006) New Revision: 22959
Modified: thunar/trunk/ChangeLog thunar/trunk/thunar-vfs/thunar-vfs-volume-hal.c Log: 2006-08-31 Benedikt Meurer <[EMAIL PROTECTED]> * thunar-vfs/thunar-vfs-volume-hal.c(thunar_vfs_volume_hal_eject): Unmount volumes prior to ejecting them if they are currently mounted. Bug #2236. Modified: thunar/trunk/ChangeLog =================================================================== --- thunar/trunk/ChangeLog 2006-08-31 07:26:37 UTC (rev 22958) +++ thunar/trunk/ChangeLog 2006-08-31 08:22:00 UTC (rev 22959) @@ -1,3 +1,9 @@ +2006-08-31 Benedikt Meurer <[EMAIL PROTECTED]> + + * thunar-vfs/thunar-vfs-volume-hal.c(thunar_vfs_volume_hal_eject): + Unmount volumes prior to ejecting them if they are currently + mounted. Bug #2236. + 2006-08-30 Benedikt Meurer <[EMAIL PROTECTED]> * thunar-vfs/thunar-vfs-io-local.c, thunar-vfs/thunar-vfs-os-generic.c, Modified: thunar/trunk/thunar-vfs/thunar-vfs-volume-hal.c =================================================================== --- thunar/trunk/thunar-vfs/thunar-vfs-volume-hal.c 2006-08-31 07:26:37 UTC (rev 22958) +++ thunar/trunk/thunar-vfs/thunar-vfs-volume-hal.c 2006-08-31 08:22:00 UTC (rev 22959) @@ -198,43 +198,52 @@ GError **error) { ThunarVfsVolumeHal *volume_hal = THUNAR_VFS_VOLUME_HAL (volume); - gboolean result; + ThunarVfsPath *path; + gboolean result = TRUE; gchar *program; gchar *quoted; - /* check if gnome-eject is present */ - program = g_find_program_in_path ("gnome-eject"); - if (G_LIKELY (program != NULL)) + /* check if the volume is currently mounted */ + path = thunar_vfs_volume_hal_find_mount_point (volume_hal, "/proc/mounts"); + if (G_LIKELY (path != NULL)) { - /* gnome-eject doesn't seem to unmount properly first */ + /* try to unmount the volume first */ result = thunar_vfs_volume_hal_unmount (volume, window, error); - if (G_LIKELY (result)) + thunar_vfs_path_unref (path); + } + + /* check the unmount was successfull */ + if (G_LIKELY (result)) + { + /* check if gnome-eject is present */ + program = g_find_program_in_path ("gnome-eject"); + if (G_LIKELY (program != NULL)) { /* try to use gnome-eject then */ quoted = g_shell_quote (volume_hal->udi); result = thunar_vfs_exec_sync ("%s -t -h %s", error, program, quoted); g_free (quoted); + + /* cleanup */ + g_free (program); } + else + { + /* use eject */ + quoted = g_path_get_basename (volume_hal->device_file); + result = thunar_vfs_exec_sync ("eject %s", error, quoted); + g_free (quoted); + } - /* cleanup */ - g_free (program); - } - else - { - /* use eject */ - quoted = g_path_get_basename (volume_hal->device_file); - result = thunar_vfs_exec_sync ("eject %s", error, quoted); - g_free (quoted); - } + /* check if we were successfull */ + if (G_LIKELY (result)) + { + /* reset the status */ + volume_hal->status &= ~(THUNAR_VFS_VOLUME_STATUS_MOUNTED | THUNAR_VFS_VOLUME_STATUS_PRESENT); - /* check if we were successfull */ - if (G_LIKELY (result)) - { - /* reset the status */ - volume_hal->status &= ~(THUNAR_VFS_VOLUME_STATUS_MOUNTED | THUNAR_VFS_VOLUME_STATUS_PRESENT); - - /* emit "changed" on the volume */ - thunar_vfs_volume_changed (THUNAR_VFS_VOLUME (volume_hal)); + /* emit "changed" on the volume */ + thunar_vfs_volume_changed (THUNAR_VFS_VOLUME (volume_hal)); + } } return result; _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits