[gnome-disk-utility] Use ensure_unused() before creating disk image



commit 8574e00fb2f17b67e63e18fb3fd619c7b372d6f9
Author: David Zeuthen <zeuthen gmail com>
Date:   Mon Nov 19 17:20:14 2012 -0500

    Use ensure_unused() before creating disk image
    
    This way users won't have to manually unmount/lock whatever is on a
    device before create a disk image with its contents.
    
    This was reported in bug 677869.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677869
    
    Signed-off-by: David Zeuthen <zeuthen gmail com>

 src/disks/gducreatediskimagedialog.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/disks/gducreatediskimagedialog.c b/src/disks/gducreatediskimagedialog.c
index 3bd495f..9bffe00 100644
--- a/src/disks/gducreatediskimagedialog.c
+++ b/src/disks/gducreatediskimagedialog.c
@@ -949,6 +949,22 @@ show_in_folder (DialogData *data)
 
 
 static void
+ensure_unused_cb (GduWindow     *window,
+                  GAsyncResult  *res,
+                  gpointer       user_data)
+{
+  DialogData *data = user_data;
+  if (gdu_window_ensure_unused_finish (window, res, NULL))
+    {
+      start_copying (data);
+    }
+  else
+    {
+      dialog_data_complete_and_unref (data);
+    }
+}
+
+static void
 on_dialog_response (GtkDialog     *dialog,
                     gint           response,
                     gpointer       user_data)
@@ -972,7 +988,12 @@ on_dialog_response (GtkDialog     *dialog,
 
           gtk_widget_hide (data->start_copying_button);
 
-          start_copying (data);
+          /* ensure the device is unused (e.g. unmounted) before copying data from it... */
+          gdu_window_ensure_unused (data->window,
+                                    data->object,
+                                    (GAsyncReadyCallback) ensure_unused_cb,
+                                    NULL, /* GCancellable */
+                                    data);
         }
       break;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]