本文整理汇总了C++中G_IS_ASYNC_RESULT函数的典型用法代码示例。如果您正苦于以下问题:C++ G_IS_ASYNC_RESULT函数的具体用法?C++ G_IS_ASYNC_RESULT怎么用?C++ G_IS_ASYNC_RESULT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_IS_ASYNC_RESULT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: g_dbus_address_get_stream_finish
/**
* g_dbus_address_get_stream_finish:
* @res: A #GAsyncResult obtained from the GAsyncReadyCallback passed to g_dbus_address_get_stream().
* @out_guid: %NULL or return location to store the GUID extracted from @address, if any.
* @error: Return location for error or %NULL.
*
* Finishes an operation started with g_dbus_address_get_stream().
*
* Returns: (transfer full): A #GIOStream or %NULL if @error is set.
*
* Since: 2.26
*/
GIOStream *
g_dbus_address_get_stream_finish (GAsyncResult *res,
gchar **out_guid,
GError **error)
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
GetStreamData *data;
GIOStream *ret;
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == g_dbus_address_get_stream);
ret = NULL;
data = g_simple_async_result_get_op_res_gpointer (simple);
if (g_simple_async_result_propagate_error (simple, error))
goto out;
ret = g_object_ref (data->stream);
if (out_guid != NULL)
*out_guid = g_strdup (data->guid);
out:
return ret;
}
示例2: la_handler_service_handle_register_finish
static void
la_handler_service_handle_register_finish (GObject *object,
GAsyncResult *res,
gpointer user_data)
{
GDBusMethodInvocation *invocation = G_DBUS_METHOD_INVOCATION (user_data);
LAHandlerService *service;
NSMConsumer *nsm_consumer = NSM_CONSUMER (object);
GError *error = NULL;
gint error_code;
g_return_if_fail (IS_NSM_CONSUMER (nsm_consumer));
g_return_if_fail (G_IS_ASYNC_RESULT (res));
g_return_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation));
/* finish registering the shutdown client */
nsm_consumer_call_register_shutdown_client_finish (nsm_consumer, &error_code, res,
&error);
if (error != NULL)
{
DLT_LOG (la_handler_context, DLT_LOG_ERROR,
DLT_STRING ("Failed to register a shutdown consumer:"),
DLT_STRING (error->message));
g_error_free (error);
}
/* retrieve the LAHandlerService from the invocation object */
service = g_object_get_data (G_OBJECT (invocation), "la-handler-service");
/* notify the caller that we have handled the registration request */
la_handler_complete_register (service->interface, invocation);
}
示例3: update_dependencies_cb
static void
update_dependencies_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
IdeDependencyUpdater *updater = (IdeDependencyUpdater *)object;
g_autoptr(IdeTask) task = user_data;
g_autoptr(GError) error = NULL;
IdePrimaryWorkspace *self;
UpdateDependencies *ud;
IdeContext *context;
g_assert (IDE_IS_DEPENDENCY_UPDATER (updater));
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (IDE_IS_TASK (task));
self = ide_task_get_source_object (task);
context = ide_widget_get_context (GTK_WIDGET (self));
if (!ide_dependency_updater_update_finish (updater, result, &error))
ide_context_warning (context, "%s", error->message);
ide_object_destroy (IDE_OBJECT (updater));
ud = ide_task_get_task_data (task);
ud->n_active--;
if (ud->n_active == 0)
ide_task_return_boolean (task, TRUE);
}
示例4: news_parser_buffered_fill_cb
/**
* news_parser_buffered_fill_cb:
* @object: (in): A #GBufferedInputStream.
* @result: (in): A #GAsyncResult.
* @user_data: (in): A #NewsParser.
*
* Completes an asynchronous request to fill the buffer of a
* #GBufferedInputStream. If the buffer was successfully filled, then
* the feed format will be discovered and the stream parsed.
*
* Returns: None.
*/
static void
news_parser_buffered_fill_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
GBufferedInputStream *buffered = (GBufferedInputStream *)object;
NewsParserPrivate *priv;
NewsParser *parser = user_data;
NewsFormat *format;
guint8 buffer[BUFFER_FILL_SIZE];
gsize length = 0;
GType format_type = G_TYPE_INVALID;
ENTRY;
g_assert(G_IS_BUFFERED_INPUT_STREAM(buffered));
g_assert(G_IS_ASYNC_RESULT(result));
g_assert(NEWS_IS_PARSER(parser));
priv = parser->priv;
length = g_buffered_input_stream_peek(buffered, buffer, 0, sizeof buffer);
if (length <= 0) {
g_simple_async_result_set_error(priv->simple, NEWS_PARSER_ERROR,
NEWS_PARSER_ERROR_NO_DATA,
_("No data was available to parse."));
g_simple_async_result_complete_in_idle(priv->simple);
} else {
format_type = news_parser_discover_format(parser, buffer, length);
if (format_type) {
format = g_object_new(format_type,
"adapter", priv->adapter,
"source", priv->source,
NULL);
news_format_read_async(format, G_INPUT_STREAM(buffered),
priv->cancellable,
news_parser_format_read_cb,
g_object_ref(parser));
g_object_unref(format);
} else {
g_simple_async_result_set_error(priv->simple, NEWS_PARSER_ERROR,
NEWS_PARSER_ERROR_NO_FORMAT,
_("Failed to discover format."));
g_simple_async_result_complete_in_idle(priv->simple);
#if 0
{
gchar *uri;
g_object_get(priv->source, "uri", &uri, NULL);
g_printerr("%s\n", uri);
g_free(uri);
}
#endif
}
}
g_object_unref(parser);
EXIT;
}
示例5: ide_build_system_get_build_flags_for_files_finish
/**
* ide_build_system_get_build_flags_for_files_finish:
* @self: an #IdeBuildSystem
* @result: a #GAsyncResult
* @error: a location for a #GError or %NULL
*
* Returns: (element-type Ide.File GStrv) (transfer full): a #GHashTable or #GFile to #GStrv
*
* Since: 3.32
*/
GHashTable *
ide_build_system_get_build_flags_for_files_finish (IdeBuildSystem *self,
GAsyncResult *result,
GError **error)
{
GHashTable *ret;
IDE_ENTRY;
g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), NULL);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), NULL);
ret = IDE_BUILD_SYSTEM_GET_IFACE (self)->get_build_flags_for_files_finish (self, result, error);
if (ret != NULL)
{
GHashTableIter iter;
gchar **flags;
g_hash_table_iter_init (&iter, ret);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&flags))
ide_build_system_post_process_build_flags (self, flags);
}
IDE_RETURN (ret);
}
示例6: news_parser_format_read_cb
/**
* news_parser_format_read_cb:
* @object: (in): A #NewsFormat.
* @result: (in): A #GAsyncResult.
* @user_data: (in): A #NewsParser.
*
* Handles the asynchronous completion of a call to news_format_read_async().
* If the reading of the buffer was successful; then the resulting feed
* is stored for use by news_parser_parse_finish(). Otherwise, a proper
* error is set.
*
* Returns: None.
*/
static void
news_parser_format_read_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
NewsParserPrivate *priv;
NewsParser *parser = user_data;
NewsFormat *format = (NewsFormat *)object;
GError *error = NULL;
ENTRY;
g_return_if_fail(NEWS_IS_FORMAT(format));
g_return_if_fail(G_IS_ASYNC_RESULT(result));
g_return_if_fail(NEWS_IS_PARSER(parser));
priv = parser->priv;
if (!(priv->feed = news_format_read_finish(format, result, &error))) {
g_simple_async_result_take_error(priv->simple, error);
}
g_simple_async_result_complete_in_idle(priv->simple);
g_object_unref(parser);
EXIT;
}
示例7: g_tls_interaction_ask_password_finish
/**
* 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);
/* If it's one of our simple unhandled async results, handle here */
if (g_simple_async_result_is_valid (result, G_OBJECT (interaction),
g_tls_interaction_ask_password_async))
{
return G_TLS_INTERACTION_UNHANDLED;
}
/* Invoke finish of derived class */
else
{
klass = G_TLS_INTERACTION_GET_CLASS (interaction);
g_return_val_if_fail (klass->ask_password_finish, G_TLS_INTERACTION_UNHANDLED);
return (klass->ask_password_finish) (interaction, result, error);
}
}
示例8: ide_lsp_formatter_format_call_cb
static void
ide_lsp_formatter_format_call_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
IdeLspClient *client = (IdeLspClient *)object;
g_autoptr(IdeTask) task = user_data;
g_autoptr(GError) error = NULL;
g_autoptr(GVariant) reply = NULL;
IdeLspFormatter *self;
IdeBuffer *buffer;
g_return_if_fail (IDE_IS_LSP_CLIENT (client));
g_return_if_fail (G_IS_ASYNC_RESULT (result));
if (!ide_lsp_client_call_finish (client, result, &reply, &error))
{
ide_task_return_error (task, g_steal_pointer (&error));
return;
}
self = ide_task_get_source_object (task);
buffer = ide_task_get_task_data (task);
g_assert (IDE_IS_LSP_FORMATTER (self));
g_assert (IDE_IS_BUFFER (buffer));
ide_lsp_formatter_apply_changes (self, buffer, reply);
ide_task_return_boolean (task, TRUE);
}
示例9: ide_lsp_completion_provider_complete_cb
static void
ide_lsp_completion_provider_complete_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
IdeLspCompletionProviderPrivate *priv;
IdeLspCompletionProvider *self;
IdeLspClient *client = (IdeLspClient *)object;
g_autoptr(GVariant) return_value = NULL;
g_autoptr(IdeTask) task = user_data;
g_autoptr(GError) error = NULL;
IdeLspCompletionResults *ret;
IDE_ENTRY;
g_assert (IDE_IS_LSP_CLIENT (client));
g_assert (G_IS_ASYNC_RESULT (result));
if (!ide_lsp_client_call_finish (client, result, &return_value, &error))
{
ide_task_return_error (task, g_steal_pointer (&error));
return;
}
self = ide_task_get_source_object (task);
priv = ide_lsp_completion_provider_get_instance_private (self);
ret = ide_lsp_completion_results_new (return_value);
if (priv->word != NULL && *priv->word != 0)
ide_lsp_completion_results_refilter (ret, priv->word);
ide_task_return_object (task, g_steal_pointer (&ret));
IDE_EXIT;
}
示例10: load_find_files_cb
static void
load_find_files_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
GFile *file = (GFile *)object;
g_autoptr(IdeTask) task = user_data;
g_autoptr(GError) error = NULL;
g_autoptr(GPtrArray) ret = NULL;
g_assert (G_IS_FILE (file));
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (IDE_IS_TASK (task));
ret = ide_g_file_find_finish (file, result, &error);
IDE_PTR_ARRAY_SET_FREE_FUNC (ret, g_object_unref);
if (ret == NULL)
{
ide_task_return_error (task, g_steal_pointer (&error));
return;
}
ide_task_set_task_data (task, g_steal_pointer (&ret), g_ptr_array_unref);
ide_task_run_in_thread (task, gbp_cmake_toolchain_provider_load_worker);
}
示例11: pkg_channels_page_add_channel_cb
static void
pkg_channels_page_add_channel_cb (PkConnection *connection,
GAsyncResult *result,
PkgChannelsPage *page)
{
PkgChannelsPagePrivate *priv;
GError *error = NULL;
gint channel;
g_return_if_fail(PK_IS_CONNECTION(connection));
g_return_if_fail(G_IS_ASYNC_RESULT(result));
g_return_if_fail(PKG_IS_CHANNELS_PAGE(page));
ENTRY;
priv = page->priv;
if (!pk_connection_manager_add_channel_finish(priv->connection, result,
&channel, &error)) {
WARNING(Channels, "Failed to add new channel: %s", error->message);
pkg_util_dialog_warning(gtk_widget_get_toplevel(GTK_WIDGET(page)),
"",
_("There was an error adding the channel."),
error->message,
TRUE);
g_error_free(error);
GOTO(fail);
}
DEBUG(Channels, "Added channel %d to system.", channel);
fail:
EXIT;
}
示例12: ide_build_system_get_build_flags_cb
static void
ide_build_system_get_build_flags_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
IdeBuildSystem *self = (IdeBuildSystem *)object;
g_autoptr(IdeTask) task = user_data;
g_autoptr(GError) error = NULL;
g_auto(GStrv) flags = NULL;
GetBuildFlagsData *data;
GFile *file;
g_assert (IDE_IS_BUILD_SYSTEM (self));
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (IDE_IS_TASK (task));
data = ide_task_get_task_data (task);
g_assert (data != NULL);
g_assert (data->files != NULL);
g_assert (data->files->len > 0);
g_assert (data->index < data->files->len);
g_assert (data->flags != NULL);
file = g_ptr_array_index (data->files, data->index);
g_assert (G_IS_FILE (file));
data->index++;
flags = ide_build_system_get_build_flags_finish (self, result, &error);
if (error != NULL)
g_debug ("Failed to load build flags for \"%s\": %s",
g_file_peek_path (file),
error->message);
else
g_hash_table_insert (data->flags, g_object_ref (file), g_steal_pointer (&flags));
if (ide_task_return_error_if_cancelled (task))
return;
if (data->index < data->files->len)
{
GCancellable *cancellable = ide_task_get_cancellable (task);
file = g_ptr_array_index (data->files, data->index);
g_assert (G_IS_FILE (file));
ide_build_system_get_build_flags_async (self,
file,
cancellable,
ide_build_system_get_build_flags_cb,
g_steal_pointer (&task));
return;
}
ide_task_return_pointer (task,
g_steal_pointer (&data->flags),
g_hash_table_unref);
}
示例13: ide_terminal_page_spawn_cb
static void
ide_terminal_page_spawn_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
IdeTerminalLauncher *launcher = (IdeTerminalLauncher *)object;
g_autoptr(IdeTerminalPage) self = user_data;
g_autoptr(GError) error = NULL;
gint64 now;
g_assert (IDE_IS_TERMINAL_LAUNCHER (launcher));
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (IDE_IS_TERMINAL_PAGE (self));
if (!ide_terminal_launcher_spawn_finish (launcher, result, &error))
{
g_autofree gchar *format = NULL;
format = g_strdup_printf ("%s: %s", _("Subprocess launcher failed"), error->message);
ide_terminal_page_feed (self, format);
}
if (gtk_widget_in_destruction (GTK_WIDGET (self)))
return;
now = g_get_monotonic_time ();
if (ABS (now - self->last_respawn) < FLAPPING_DURATION_USEC)
{
ide_terminal_page_feed (self, _("Subprocess launcher failed too quickly, will not respawn."));
return;
}
if (!self->respawn_on_exit)
{
if (self->close_on_exit)
gdk_threads_add_idle_full (G_PRIORITY_LOW + 1000,
(GSourceFunc) destroy_widget_in_idle,
g_object_ref (self),
g_object_unref);
return;
}
g_clear_object (&self->pty);
vte_terminal_reset (VTE_TERMINAL (self->terminal_top), TRUE, TRUE);
self->pty = vte_pty_new_sync (VTE_PTY_DEFAULT, NULL, NULL);
vte_terminal_set_pty (VTE_TERMINAL (self->terminal_top), self->pty);
/* Spawn our terminal and wait for it to exit */
self->last_respawn = now;
ide_terminal_launcher_spawn_async (self->launcher,
self->pty,
NULL,
ide_terminal_page_spawn_cb,
g_object_ref (self));
}
示例14: ide_application_tool_run_finish
gint
ide_application_tool_run_finish (IdeApplicationTool *self,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (IDE_IS_APPLICATION_TOOL (self), 0);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), 0);
return IDE_APPLICATION_TOOL_GET_IFACE (self)->run_finish (self, result, error);
}
示例15: ide_device_provider_load_finish
/**
* ide_device_provider_load_finish:
* @self: an #IdeDeviceProvider
* @result: a #GAsyncResult provided to callback
* @error: a location for a #GError, or %NULL
*
* Completes an asynchronous request to load known devices via
* ide_device_provider_load_async().
*
* Returns: %TRUE if successful; otherwise %FALSE and @error is set.
*
* Since: 3.32
*/
gboolean
ide_device_provider_load_finish (IdeDeviceProvider *self,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (IDE_IS_DEVICE_PROVIDER (self), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
return IDE_DEVICE_PROVIDER_GET_CLASS (self)->load_finish (self, result, error);
}