static void unmount_done_cb (GObject *object, GAsyncResult *res, gpointer user_data) { gboolean succeeded; GError *error = NULL; GFile *file = G_FILE (user_data); succeeded = g_mount_unmount_with_operation_finish (G_MOUNT (object), res, &error); g_object_unref (G_MOUNT (object)); if (!succeeded) { print_file_error (file, error->message); success = FALSE; g_error_free (error); } g_object_unref (file); outstanding_mounts--; if (outstanding_mounts == 0) g_main_loop_quit (main_loop); }
static void unmount_done_cb (GObject *object, GAsyncResult *result, gpointer psource) { GMount *mount; RBMtpSource *source; gboolean ok; GError *error = NULL; RBMtpSourcePrivate *priv; mount = G_MOUNT (object); source = RB_MTP_SOURCE (psource); priv = MTP_SOURCE_GET_PRIVATE (source); ok = g_mount_unmount_with_operation_finish (mount, result, &error); if (ok) { rb_debug ("successfully unmounted mtp device"); priv->remount_volume = g_mount_get_volume (mount); open_device (source); } else { g_warning ("Unable to unmount MTP device: %s", error->message); g_error_free (error); } g_object_unref (mount); g_object_unref (source); }
static void brasero_gio_operation_umount_finish (GObject *source, GAsyncResult *result, gpointer user_data) { BraseroGioOperation *op = user_data; if (!op->loop) return; op->result = g_mount_unmount_with_operation_finish (G_MOUNT (source), result, &op->error); BRASERO_MEDIA_LOG ("Umount operation completed (result = %d)", op->result); if (op->error) { if (op->error->code == G_IO_ERROR_NOT_MOUNTED) { /* That can happen sometimes */ g_error_free (op->error); op->error = NULL; op->result = TRUE; } /* Since there was an error. The "unmounted" signal won't be * emitted by GVolumeMonitor and therefore we'd get stuck if * we didn't get out of the loop. */ brasero_gio_operation_end (op); } else if (!op->result) brasero_gio_operation_end (op); }
static void unmount_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) { GMount *mount = G_MOUNT (source_object); UnmountData *data = user_data; g_mount_unmount_with_operation_finish (mount, res, &data->error); g_main_loop_quit (data->loop); }
static void unmount_mount_callback (GObject *source_object, GAsyncResult *res, gpointer user_data) { GError *error; char *primary; gboolean unmounted; gboolean should_eject; GtkWidget *dialog; should_eject = user_data != NULL; error = NULL; if (should_eject) { unmounted = g_mount_eject_with_operation_finish (G_MOUNT (source_object), res, &error); } else { unmounted = g_mount_unmount_with_operation_finish (G_MOUNT (source_object), res, &error); } if (! unmounted) { if (error->code != G_IO_ERROR_FAILED_HANDLED) { if (should_eject) { primary = g_strdup_printf (_("Unable to eject %p"), source_object); } else { primary = g_strdup_printf (_("Unable to unmount %p"), source_object); } dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", primary); gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "%s", error->message); gtk_widget_show (GTK_WIDGET (dialog)); g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); g_free (primary); } } if (error != NULL) { g_error_free (error); } }
static void unmount_cb (GObject *object, GAsyncResult *result, gpointer nothing) { GMount *mount = G_MOUNT (object); GError *error = NULL; rb_debug ("finishing unmount of mount"); g_mount_unmount_with_operation_finish (mount, result, &error); if (error != NULL) { if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_FAILED_HANDLED)) { rb_error_dialog (NULL, _("Unable to unmount"), "%s", error->message); } else { rb_debug ("unmount failure has already been handled"); } g_error_free (error); } }
static void xfdesktop_volume_icon_unmount_finish(GObject *object, GAsyncResult *result, gpointer user_data) { XfdesktopVolumeIcon *icon = XFDESKTOP_VOLUME_ICON(user_data); GtkWidget *icon_view = xfdesktop_icon_peek_icon_view(XFDESKTOP_ICON(icon)); GtkWidget *toplevel = gtk_widget_get_toplevel(icon_view); GMount *mount = G_MOUNT(object); GError *error = NULL; gboolean unmount_successful; g_return_if_fail(G_IS_MOUNT(object)); g_return_if_fail(G_IS_ASYNC_RESULT(result)); g_return_if_fail(XFDESKTOP_IS_VOLUME_ICON(icon)); unmount_successful = g_mount_unmount_with_operation_finish(mount, result, &error); if(!unmount_successful) { /* ignore GIO errors handled internally */ if(error->domain != G_IO_ERROR || error->code != G_IO_ERROR_FAILED_HANDLED) { gchar *mount_name = g_mount_get_name(mount); gchar *primary = g_markup_printf_escaped(_("Failed to eject \"%s\""), mount_name); /* display an error dialog to inform the user */ xfce_message_dialog(toplevel ? GTK_WINDOW(toplevel) : NULL, _("Eject Failed"), GTK_STOCK_DIALOG_ERROR, primary, error->message, GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT, NULL); g_free(primary); g_free(mount_name); } g_error_free(error); } #ifdef HAVE_LIBNOTIFY xfdesktop_notify_unmount_finish(mount, unmount_successful); #endif g_object_unref(icon); }
static void unmount_done_cb (GObject *object, GAsyncResult *res, gpointer user_data) { gboolean succeeded; GError *error = NULL; succeeded = g_mount_unmount_with_operation_finish (G_MOUNT (object), res, &error); g_object_unref (G_MOUNT (object)); if (!succeeded) g_printerr (_("Error unmounting mount: %s\n"), error->message); outstanding_mounts--; if (outstanding_mounts == 0) g_main_loop_quit (main_loop); }
void unmountVolumeAsyncCallback (GObject *source_object, GAsyncResult *res, gpointer user_data) { GVolume *volume = (GVolume*) user_data; ASBiDirElem *item = ASVolume_findGVolume_item (AppState.volumes, volume); if (item) { GError* error = NULL; ASVolume *v = (ASVolume*)item->data; GMount *mount = (GMount*)source_object; Bool success = False; if (mount) { success = g_mount_unmount_with_operation_finish(mount, res, &error); g_object_unref (mount); } LOCAL_DEBUG_OUT ("result = %p, eror = %p", res, error); clear_flags (v->flags, ASVolume_UnmountRequested); if (success) GVolume2ASVolume (v, volume); else show_error( "Unmount on volume \"%s\" failed with message \"%s\"", v->name, error ? error->message : "unknown error" ); ASVolume_refreshDisplay (v); } }
static void _mount_unmount_cb (GMount *mount, GAsyncResult *result, gpointer data) { GError *error = NULL; g_return_if_fail (MPD_IS_STORAGE_DEVICE_TILE (data)); g_mount_unmount_with_operation_finish (mount, result, &error); if (error) { mpd_storage_device_tile_show_message ( MPD_STORAGE_DEVICE_TILE (data), get_eject_failed_message (), false); mx_widget_set_disabled (MX_WIDGET (data), FALSE); g_warning ("%s : %s", G_STRLOC, error->message); g_clear_error (&error); } }
static void on_mount_action_finished(GObject* src, GAsyncResult *res, gpointer user_data) { struct MountData* data = user_data; switch(data->action) { case MOUNT_VOLUME: data->ret = g_volume_mount_finish(G_VOLUME(src), res, &data->err); break; case MOUNT_GFILE: data->ret = g_file_mount_enclosing_volume_finish(G_FILE(src), res, &data->err); break; case UMOUNT_MOUNT: data->ret = g_mount_unmount_with_operation_finish(G_MOUNT(src), res, &data->err); break; case EJECT_MOUNT: data->ret = g_mount_eject_with_operation_finish(G_MOUNT(src), res, &data->err); break; case EJECT_VOLUME: data->ret = g_volume_eject_with_operation_finish(G_VOLUME(src), res, &data->err); break; } g_main_loop_quit(data->loop); }