Ask to unmount the disc via dbus/hal, although it isn't as much of a silver bullet as I wish. It unmounts discs from EFM fine, but Thunar isn't so compliant.

This commit is contained in:
Jaime Thomas
2009-04-29 02:46:32 +00:00
parent a3360d81a2
commit d54838db08
4 changed files with 107 additions and 51 deletions

View File

@@ -6,10 +6,11 @@ void _ecdb_hal_volume_all_cb(void *data, void *reply_data, DBusError *error);
void _ecdb_hal_device_handle(void *data, void *reply_data, DBusError *error);
void _ecdb_hal_volume_removed_cb(void *data, DBusMessage *msg);
void _ecdb_hal_volume_added_cb(void *data, DBusMessage *msg);
void _ecdb_hal_volume_prop_modified(void *data, DBusMessage *msg);
void _ecdb_hal_volume_cb(void *data, void *reply_data, DBusError *error);
void _ecdb_hal_volume_handle(void *data, void *reply_data, DBusError *error);
void _ecdb_hal_unmount_cb(void *data, void *reply_data, DBusError *error);
void _ecdb_hal_volumes_init(void);
static void _ecdb_hal_volumes_init(void);
void
_ecdb_hal_device_handle(void *data, void *reply_data, DBusError *error)
@@ -202,27 +203,14 @@ ecdb_hal_shutdown(void)
}
void
ecdb_hal_request_unmount(Ecdb_Drive_Info *drive)
ecdb_hal_request_unmount(Ecdb_Drive_Info *drive, E_DBus_Callback_Func cb,
void *data)
{
e_hal_device_volume_unmount(em->conn, drive->udi, NULL,
_ecdb_hal_unmount_cb, drive);
e_hal_device_volume_unmount(em->conn, drive->disc_udi, NULL,
cb, data);
}
void
_ecdb_hal_unmount_cb(void *data, void *reply_data __UNUSED__, DBusError *error)
{
Ecdb_Drive_Info *drive;
drive = data;
if (dbus_error_is_set(error))
{
EINA_ERROR_PWARN("Unmount Error: %s %s\n", error->name, error->message);
dbus_error_free(error);
}
}
void
static void
_ecdb_hal_volumes_init()
{
@@ -324,12 +312,12 @@ _ecdb_hal_volume_handle(void *data, void *reply_data, DBusError *error)
if (e_hal_property_bool_get(ret, "volume.disc.is_rewritable", NULL))
drive->status |= ECDB_DISC_REWRITABLE;
drive->type = e_hal_property_string_get(ret, "volume.disc.type", NULL);
drive->type = e_hal_property_string_get(ret, "volume.disc.type",
NULL);
/* Also refresh the drive, for write speeds */
e_hal_device_get_all_properties(em->conn, udi,
_ecdb_hal_device_handle, udi);
break;
}
}