Exemplo n.º 1
0
GDavMultiStatus *
gdav_propfind_finish (SoupSession *session,
                      GAsyncResult *result,
                      SoupMessage **out_message,
                      GError **error)
{
	AsyncContext *async_context;

	g_return_val_if_fail (
		g_task_is_valid (result, session), NULL);
	g_return_val_if_fail (
		g_async_result_is_tagged (result, gdav_propfind), FALSE);

	async_context = g_task_get_task_data (G_TASK (result));

	/* SoupMessage is set even in case of error for uses
	 * like calling soup_message_get_https_status() when
	 * SSL/TLS negotiation fails, though SoupMessage may
	 * be NULL if the Request-URI was invalid. */
	if (out_message != NULL) {
		*out_message = async_context->message;
		async_context->message = NULL;
	}

	return g_task_propagate_pointer (G_TASK (result), error);
}
Exemplo n.º 2
0
/**
 * e_trust_prompt_run_for_source_finish:
 * @source: an #ESource which was used with e_trust_prompt_run_for_source()
 * @result: a #GAsyncResult
 * @response: an output argument, user's response to the trust prompt
 * @error: return location for a #GError, or %NULL
 *
 * Finishes the operation started with e_trust_prompt_run_for_source().
 * The @response will contain a code of the user's choice.
 * The #E_TRUST_PROMPT_RESPONSE_UNKNOWN is used, when the user cancelled the trust
 * prompt dialog and no changes are made with the @source.
 *
 * If an error occurs, the function sets @error and returns %FALSE.
 *
 * Returns: %TRUE on success, %FALSE on error
 *
 * Since: 3.16
 **/
gboolean
e_trust_prompt_run_for_source_finish (ESource *source,
				      GAsyncResult *result,
				      ETrustPromptResponse *response,
				      GError **error)
{
	gboolean success;

	g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
	g_return_val_if_fail (g_task_is_valid (result, source), FALSE);
	g_return_val_if_fail (response != NULL, FALSE);

	g_return_val_if_fail (
		g_async_result_is_tagged (
		result, e_trust_prompt_run_for_source), FALSE);

	success = g_task_propagate_boolean (G_TASK (result), error);

	if (success) {
		SaveSourceData *save_data;

		save_data = g_task_get_task_data (G_TASK (result));
		g_return_val_if_fail (save_data != NULL, FALSE);

		*response = save_data->response;
	}

	return success;
}
Exemplo n.º 3
0
gboolean
gdav_options_finish (SoupSession *session,
                     GAsyncResult *result,
                     GDavAllow *out_allow,
                     GDavOptions *out_options,
                     SoupMessage **out_message,
                     GError **error)
{
	AsyncContext *async_context;

	g_return_val_if_fail (
		g_task_is_valid (result, session), FALSE);
	g_return_val_if_fail (
		g_async_result_is_tagged (result, gdav_options), FALSE);

	async_context = g_task_get_task_data (G_TASK (result));

	if (!g_task_had_error (G_TASK (result))) {
		if (out_allow != NULL)
			*out_allow = async_context->allow;
		if (out_options != NULL)
			*out_options = async_context->options;
	}

	/* SoupMessage is set even in case of error for uses
	 * like calling soup_message_get_https_status() when
	 * SSL/TLS negotiation fails, though SoupMessage may
	 * be NULL if the Request-URI was invalid. */
	if (out_message != NULL) {
		*out_message = async_context->message;
		async_context->message = NULL;
	}

	return g_task_propagate_boolean (G_TASK (result), error);
}
Exemplo n.º 4
0
gboolean
g_vfs_dns_sd_resolver_resolve_finish (GVfsDnsSdResolver  *resolver,
                                      GAsyncResult       *res,
                                      GError            **error)
{
    g_return_val_if_fail (g_task_is_valid (res, resolver), FALSE);
    g_return_val_if_fail (g_async_result_is_tagged (res, g_vfs_dns_sd_resolver_resolve), FALSE);

    return g_task_propagate_boolean (G_TASK (res), error);
}
Exemplo n.º 5
0
/**
 * g_volume_eject_finish:
 * @volume: pointer to a #GVolume
 * @result: a #GAsyncResult
 * @error: a #GError location to store an error, or %NULL to ignore
 * 
 * Finishes ejecting a volume. If any errors occurred during the operation,
 * @error will be set to contain the errors and %FALSE will be returned.
 * 
 * Returns: %TRUE, %FALSE if operation failed
 *
 * Deprecated: 2.22: Use g_volume_eject_with_operation_finish() instead.
 **/
gboolean
g_volume_eject_finish (GVolume       *volume,
                       GAsyncResult  *result,
                       GError       **error)
{
  GVolumeIface *iface;

  g_return_val_if_fail (G_IS_VOLUME (volume), FALSE);
  g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);

  if (g_async_result_legacy_propagate_error (result, error))
    return FALSE;
  if (g_async_result_is_tagged (result, g_volume_eject_with_operation))
    return g_task_propagate_boolean (G_TASK (result), error);
  
  iface = G_VOLUME_GET_IFACE (volume);
  return (* iface->eject_finish) (volume, result, error);
}
Exemplo n.º 6
0
/**
 * g_drive_stop_finish:
 * @drive: a #GDrive.
 * @result: a #GAsyncResult.
 * @error: a #GError, or %NULL
 *
 * Finishes stopping a drive.
 *
 * Returns: %TRUE if the drive has been stopped successfully,
 *     %FALSE otherwise.
 *
 * Since: 2.22
 */
gboolean
g_drive_stop_finish (GDrive        *drive,
                     GAsyncResult  *result,
                     GError       **error)
{
  GDriveIface *iface;

  g_return_val_if_fail (G_IS_DRIVE (drive), FALSE);
  g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);

  if (g_async_result_legacy_propagate_error (result, error))
    return FALSE;
  else if (g_async_result_is_tagged (result, g_drive_start))
    return g_task_propagate_boolean (G_TASK (result), error);

  iface = G_DRIVE_GET_IFACE (drive);

  return (* iface->stop_finish) (drive, result, error);
}
Exemplo n.º 7
0
/**
 * g_tls_interaction_ask_password_finish:
 * @interaction: a #GTlsInteraction object
 * @result: the result passed to the callback
 * @error: an optional location to place an error on failure
 *
 * Complete an ask password user interaction request. This should be once
 * the g_tls_interaction_ask_password_async() completion callback is called.
 *
 * If %G_TLS_INTERACTION_HANDLED is returned, then the #GTlsPassword passed
 * to g_tls_interaction_ask_password() will have its password filled in.
 *
 * If the interaction is cancelled by the cancellation object, or by the
 * user then %G_TLS_INTERACTION_FAILED will be returned with an error that
 * contains a %G_IO_ERROR_CANCELLED error code.
 *
 * Returns: The status of the ask password interaction.
 *
 * Since: 2.30
 */
GTlsInteractionResult
g_tls_interaction_ask_password_finish (GTlsInteraction    *interaction,
                                       GAsyncResult       *result,
                                       GError            **error)
{
  GTlsInteractionClass *klass;

  g_return_val_if_fail (G_IS_TLS_INTERACTION (interaction), G_TLS_INTERACTION_UNHANDLED);
  g_return_val_if_fail (G_IS_ASYNC_RESULT (result), G_TLS_INTERACTION_UNHANDLED);

  klass = G_TLS_INTERACTION_GET_CLASS (interaction);
  if (klass->ask_password_finish)
    {
      g_return_val_if_fail (klass->ask_password_async != NULL, G_TLS_INTERACTION_UNHANDLED);

      return (klass->ask_password_finish) (interaction, result, error);
    }
  else
    {
      g_return_val_if_fail (g_async_result_is_tagged (result, g_tls_interaction_ask_password_async), G_TLS_INTERACTION_UNHANDLED);

      return g_task_propagate_int (G_TASK (result), error);
    }
}