[gnome-disk-utility] Rescan device when we're done restoring a disk image onto it
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility] Rescan device when we're done restoring a disk image onto it
- Date: Sat, 14 Jul 2012 19:02:43 +0000 (UTC)
commit 9b3c2eb7eb1afd52cc98c293bd100dd8368708c3
Author: David Zeuthen <zeuthen gmail com>
Date: Sat Jul 14 15:00:44 2012 -0400
Rescan device when we're done restoring a disk image onto it
Otherwise a replug of the device is needed to make e.g. the restored
partition table appear.
Signed-off-by: David Zeuthen <zeuthen gmail com>
src/disks/gdurestorediskimagedialog.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/disks/gdurestorediskimagedialog.c b/src/disks/gdurestorediskimagedialog.c
index 18e7c46..779f37e 100644
--- a/src/disks/gdurestorediskimagedialog.c
+++ b/src/disks/gdurestorediskimagedialog.c
@@ -121,8 +121,32 @@ restore_disk_image_data_unref (RestoreDiskImageData *data)
/* ---------------------------------------------------------------------------------------------------- */
static void
+rescan_cb (UDisksBlock *block,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ RestoreDiskImageData *data = user_data;
+ GError *error = NULL;
+ if (!udisks_block_call_rescan_finish (block,
+ res,
+ &error))
+ {
+ if (!(error->domain == G_IO_ERROR && error->code == G_IO_ERROR_CANCELLED))
+ gdu_window_show_error (data->window, _("Error rescanning device"), error);
+ g_clear_error (&error);
+ }
+ restore_disk_image_data_unref (data);
+}
+
+static void
restore_disk_image_data_complete (RestoreDiskImageData *data)
{
+ /* request that the core OS / kernel rescans the device */
+ udisks_block_call_rescan (data->block,
+ g_variant_new ("a{sv}", NULL), /* options */
+ NULL, /* cancellable */
+ (GAsyncReadyCallback) rescan_cb,
+ restore_disk_image_data_ref (data));
g_cancellable_cancel (data->cancellable);
if (data->dialog != NULL)
gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_CANCEL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]