[gnome-disk-utility] Use ensure_unused() before ejecting
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility] Use ensure_unused() before ejecting
- Date: Wed, 7 Nov 2012 17:55:55 +0000 (UTC)
commit cbb809ac40815e851bca8875c8b40b5e9117bce4
Author: David Zeuthen <zeuthen gmail com>
Date: Wed Nov 7 12:47:02 2012 -0500
Use ensure_unused() before ejecting
Attempt to unmount/lock all filesystems on media before ejecting it.
Signed-off-by: David Zeuthen <zeuthen gmail com>
src/disks/gduwindow.c | 32 ++++++++++++++++++++++++--------
1 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index cf197e5..744393a 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -3942,19 +3942,35 @@ eject_cb (UDisksDrive *drive,
g_object_unref (window);
}
+
+static void
+eject_ensure_unused_cb (GduWindow *window,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ UDisksObject *object = UDISKS_OBJECT (user_data);
+ if (gdu_window_ensure_unused_finish (window, res, NULL))
+ {
+ UDisksDrive *drive = udisks_object_peek_drive (object);
+ udisks_drive_call_eject (drive,
+ g_variant_new ("a{sv}", NULL), /* options */
+ NULL, /* cancellable */
+ (GAsyncReadyCallback) eject_cb,
+ g_object_ref (window));
+ }
+ g_object_unref (object);
+}
+
static void
on_devtab_drive_action_eject_activated (GtkAction *action,
gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
- UDisksDrive *drive;
-
- drive = udisks_object_peek_drive (window->current_object);
- udisks_drive_call_eject (drive,
- g_variant_new ("a{sv}", NULL), /* options */
- NULL, /* cancellable */
- (GAsyncReadyCallback) eject_cb,
- g_object_ref (window));
+ gdu_window_ensure_unused (window,
+ window->current_object,
+ (GAsyncReadyCallback) eject_ensure_unused_cb,
+ NULL, /* GCancellable */
+ g_object_ref (window->current_object));
}
/* ---------------------------------------------------------------------------------------------------- */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]