static void spawn_exit_cb (GObject *obj, GAsyncResult *result, gpointer user_data) { SpawnData *data = user_data; g_subprocess_wait_check_finish (G_SUBPROCESS (obj), result, &data->error); spawn_data_exit (data); }
static void reformatter_exited_cb (GObject *source, GAsyncResult *result, gpointer user_data) { g_autoptr(GTask) task = G_TASK (user_data); g_autoptr(GError) error = NULL; g_subprocess_wait_check_finish (G_SUBPROCESS (source), result, &error); on_reformatter_exited (task, g_steal_pointer (&error)); }
static void content_chooser_done (GObject *object, GAsyncResult *result, gpointer user_data) { g_autoptr(GSubprocess) subprocess = G_SUBPROCESS (object); ContentChooserData *data = user_data; g_autoptr(GBytes) stdout_buf = NULL; g_autoptr(GError) error = NULL; const char *uri = NULL; g_autoptr (GFile) file = NULL; g_autoptr(GDBusConnection) connection = NULL; if (!g_subprocess_communicate_finish (subprocess, result, &stdout_buf, NULL, &error)) { g_dbus_method_invocation_return_error (data->invocation, XDP_ERROR, XDP_ERROR_FAILED, "Content chooser failed: %s", error->message); g_free (data); return; } if (!g_subprocess_get_if_exited (subprocess) || g_subprocess_get_exit_status (subprocess) != 0) { g_dbus_method_invocation_return_error (data->invocation, XDP_ERROR, XDP_ERROR_FAILED, "Content chooser exit %d", g_subprocess_get_exit_status (subprocess)); g_free (data); return; } uri = g_bytes_get_data (stdout_buf, NULL); file = g_file_new_for_uri (uri); data->basename = g_file_get_basename (file); connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); g_dbus_connection_call (connection, "org.freedesktop.portal.Documents", "/org/freedesktop/portal/documents", "org.freedesktop.portal.Documents", "Add", g_variant_new ("(s)", uri), G_VARIANT_TYPE ("(u)"), G_DBUS_CALL_FLAGS_NONE, 30000, NULL, got_document_handle, data); }
static void xserver_died (GObject *source, GAsyncResult *result, gpointer user_data) { GSubprocess *proc = G_SUBPROCESS (source); if (!g_subprocess_get_successful (proc)) g_error ("X Wayland crashed; aborting"); else { /* For now we simply abort if we see the server exit. * * In the future X will only be loaded lazily for legacy X support * but for now it's a hard requirement. */ g_error ("Spurious exit of X Wayland server"); } }