-static void
-eject_mount_do (GVolume *volume,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data,
- char **argv)
-{
- GUnixVolume *unix_volume = G_UNIX_VOLUME (volume);
- EjectMountOp *data;
- GPid child_pid;
- GError *error;
-
- data = g_new0 (EjectMountOp, 1);
- data->unix_volume = unix_volume;
- data->callback = callback;
- data->user_data = user_data;
- data->cancellable = cancellable;
-
- error = NULL;
- if (!g_spawn_async_with_pipes (NULL, /* working dir */
- argv,
- NULL, /* envp */
- G_SPAWN_DO_NOT_REAP_CHILD|G_SPAWN_SEARCH_PATH,
- NULL, /* child_setup */
- NULL, /* user_data for child_setup */
- &child_pid,
- NULL, /* standard_input */
- NULL, /* standard_output */
- &(data->error_fd),
- &error)) {
- GSimpleAsyncResult *simple;
- simple = g_simple_async_result_new_from_error (G_OBJECT (data->unix_volume),
- data->callback,
- data->user_data,
- error);
- g_simple_async_result_complete (simple);
- g_object_unref (simple);
- g_error_free (error);
- g_free (data);
- return;
- }
- data->error_string = g_string_new ("");
- data->error_channel = g_io_channel_unix_new (data->error_fd);
- data->error_channel_source_id = g_io_add_watch (data->error_channel, G_IO_IN, eject_mount_read_error, data);
- g_child_watch_add (child_pid, eject_mount_cb, data);
-}