本文整理汇总了C++中G_IS_TASK函数的典型用法代码示例。如果您正苦于以下问题:C++ G_IS_TASK函数的具体用法?C++ G_IS_TASK怎么用?C++ G_IS_TASK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_IS_TASK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ide_async_helper_cb
static void
ide_async_helper_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
g_autoptr(GTask) task = user_data;
GPtrArray *funcs;
GError *error = NULL;
g_return_if_fail (G_IS_TASK (task));
g_return_if_fail (G_IS_TASK (result));
funcs = g_task_get_task_data (task);
if (!g_task_propagate_boolean (G_TASK (result), &error))
{
g_task_return_error (task, error);
return;
}
g_ptr_array_remove_index (funcs, 0);
if (funcs->len)
{
IdeAsyncStep step;
step = g_ptr_array_index (funcs, 0);
step (g_task_get_source_object (task),
g_task_get_cancellable (task),
ide_async_helper_cb,
g_object_ref (task));
}
else
g_task_return_boolean (task, TRUE);
}
示例2: egg_task_cache_get_finish
/**
* egg_task_cache_get_finish:
*
* Finish a call to egg_task_cache_get_async().
*
* Returns: (transfer full): The result from the cache.
*/
gpointer
egg_task_cache_get_finish (EggTaskCache *self,
GAsyncResult *result,
GError **error)
{
GTask *task = (GTask *)result;
g_return_val_if_fail (EGG_IS_TASK_CACHE (self), NULL);
g_return_val_if_fail (G_IS_TASK (result), NULL);
g_return_val_if_fail (G_IS_TASK (task), NULL);
return g_task_propagate_pointer (task, error);
}
示例3: ide_autotools_build_system_get_build_targets_cb
static void
ide_autotools_build_system_get_build_targets_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
IdeAutotoolsBuildSystem *self = (IdeAutotoolsBuildSystem *)object;
g_autoptr(IdeMakecache) makecache = NULL;
g_autoptr(GTask) task = user_data;
GError *error = NULL;
g_assert (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (self));
g_assert (G_IS_TASK (task));
makecache = ide_autotools_build_system_get_makecache_finish (self, result, &error);
if (makecache == NULL)
{
g_task_return_error (task, error);
return;
}
ide_makecache_get_build_targets_async (makecache,
g_task_get_cancellable (task),
ide_autotools_build_system_get_build_targets_cb2,
g_object_ref (task));
}
示例4: finish_animation_in_idle
static gboolean
finish_animation_in_idle (gpointer data)
{
g_autoptr(GTask) task = data;
IdeGitCloneWidget *self;
IDE_ENTRY;
g_assert (G_IS_TASK (task));
self = g_task_get_source_object (task);
g_assert (IDE_IS_GIT_CLONE_WIDGET (self));
egg_object_animate_full (self->clone_progress,
EGG_ANIMATION_EASE_IN_OUT_QUAD,
ANIMATION_DURATION_MSEC,
NULL,
(GDestroyNotify)ide_widget_hide_with_fade,
self->clone_progress,
"fraction", 1.0,
NULL);
/*
* Wait for a second so animations can complete before opening
* the project. Otherwise, it's pretty jarring to the user.
*/
g_timeout_add (ANIMATION_DURATION_MSEC, open_after_timeout, g_object_ref (task));
IDE_RETURN (G_SOURCE_REMOVE);
}
示例5: populate_cache__get_local_makefile_cb
static void
populate_cache__get_local_makefile_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
IdeAutotoolsBuildSystem *self = (IdeAutotoolsBuildSystem *)object;
g_autoptr(GTask) task = user_data;
g_autoptr(GFile) makefile = NULL;
IdeContext *context;
GError *error = NULL;
IDE_ENTRY;
g_assert (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (self));
g_assert (G_IS_TASK (task));
makefile = ide_autotools_build_system_get_local_makefile_finish (self, result, &error);
if (makefile == NULL)
{
g_task_return_error (task, error);
IDE_EXIT;
}
context = ide_object_get_context (IDE_OBJECT (self));
ide_makecache_new_for_makefile_async (context,
makefile,
g_task_get_cancellable (task),
populate_cache__new_makecache_cb,
g_object_ref (task));
IDE_EXIT;
}
示例6: egg_task_cache_fetch_cb
static void
egg_task_cache_fetch_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
EggTaskCache *self = (EggTaskCache *)object;
GTask *task = (GTask *)result;
GError *error = NULL;
gpointer key = user_data;
gpointer ret;
g_assert (EGG_IS_TASK_CACHE (self));
g_assert (G_IS_TASK (task));
g_hash_table_remove (self->in_flight, key);
ret = g_task_propagate_pointer (task, &error);
if (ret != NULL)
{
egg_task_cache_populate (self, key, ret);
egg_task_cache_propagate_pointer (self, key, ret);
self->value_destroy_func (ret);
}
else
{
egg_task_cache_propagate_error (self, key, error);
g_clear_error (&error);
}
self->key_destroy_func (key);
EGG_COUNTER_DEC (in_flight);
}
示例7: aws_s3_client_read_got_chunk
static void
aws_s3_client_read_got_chunk (SoupMessage *message,
SoupBuffer *buffer,
GTask *task)
{
AwsS3Client *client;
ReadState *state;
g_assert (SOUP_IS_MESSAGE (message));
g_assert (buffer != NULL);
g_assert (G_IS_TASK (task));
client = g_task_get_source_object (task);
g_assert (AWS_IS_S3_CLIENT (client));
state = g_task_get_task_data (task);
g_assert (state != NULL);
g_assert (state->handler != NULL);
if (!state->handler (client, message, buffer, state->handler_data))
{
g_task_return_new_error (task,
G_IO_ERROR,
G_IO_ERROR_CANCELLED,
"The request was cancelled");
soup_session_cancel_message (SOUP_SESSION (client), message, SOUP_STATUS_CANCELLED);
}
}
示例8: discover_file_cb
static void
discover_file_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
IdeAutotoolsBuildSystem *self;
g_autoptr(GTask) task = user_data;
g_autoptr(GFile) file = NULL;
GError *error = NULL;
g_return_if_fail (G_IS_TASK (task));
self = g_task_get_source_object (task);
file = ide_autotools_build_system_discover_file_finish (self, result, &error);
if (!file)
{
g_task_return_error (task, error);
return;
}
g_object_set (self, "project-file", file, NULL);
ide_autotools_build_system_parse_async (self,
file,
g_task_get_cancellable (task),
parse_cb,
g_object_ref (task));
}
示例9: ide_git_vcs_reload_worker
static void
ide_git_vcs_reload_worker (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
IdeGitVcs *self = source_object;
g_autoptr(GgitRepository) repository1 = NULL;
g_autoptr(GgitRepository) repository2 = NULL;
GError *error = NULL;
g_assert (G_IS_TASK (task));
g_assert (IDE_IS_GIT_VCS (self));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
if (!(repository1 = ide_git_vcs_load (self, &error)) ||
!(repository2 = ide_git_vcs_load (self, &error)))
{
g_task_return_error (task, error);
return;
}
g_set_object (&self->repository, repository1);
g_set_object (&self->change_monitor_repository, repository2);
if (!ide_git_vcs_load_monitor (self, &error))
{
g_task_return_error (task, error);
return;
}
g_task_return_boolean (task, TRUE);
}
示例10: parse_xml_worker
static void
parse_xml_worker (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
DspyIntrospectionModel *self = source_object;
GBytes *bytes = task_data;
g_autoptr(GError) error = NULL;
DspyNodeInfo *info;
const gchar *xml;
g_assert (G_IS_TASK (task));
g_assert (DSPY_IS_INTROSPECTION_MODEL (source_object));
g_assert (bytes != NULL);
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
xml = (const gchar *)g_bytes_get_data (bytes, NULL);
g_mutex_lock (&self->chunks_mutex);
info = _dspy_node_parse (xml, self->chunks, &error);
g_mutex_unlock (&self->chunks_mutex);
if (info != NULL)
g_task_return_pointer (task, info, (GDestroyNotify) _dspy_node_free);
else
g_task_return_error (task, g_steal_pointer (&error));
}
示例11: fetch_items
static void
fetch_items(GTask* task, gpointer source, gpointer task_data, GCancellable* cancel)
{
g_assert(GT_IS_SEARCH_GAME_CONTAINER(source));
GtSearchGameContainer* self = GT_SEARCH_GAME_CONTAINER(source);
GtSearchGameContainerPrivate* priv = gt_search_game_container_get_instance_private(self);
g_assert(G_IS_CANCELLABLE(cancel));
g_assert(G_IS_TASK(task));
if (g_task_return_error_if_cancelled(task))
return;
if (utils_str_empty(priv->query))
{
g_task_return_pointer(task, NULL, NULL);
return;
}
g_assert_nonnull(task_data);
FetchItemsData* data = task_data;
g_mutex_lock(&priv->mutex);
gint64 end_time = g_get_monotonic_time() + SEARCH_DELAY;
g_cancellable_connect(cancel, G_CALLBACK(cancelled_cb), self, NULL);
while (!g_cancellable_is_cancelled(cancel))
{
if (!g_cond_wait_until(&priv->cond, &priv->mutex, end_time))
{
/* We weren't cancelled */
g_assert(!utils_str_empty(priv->query));
GError* err = NULL;
GList* items = data->offset == 0 ? gt_twitch_search_games(main_app->twitch,
priv->query, data->amount, data->offset, &err) : NULL;
if (err)
g_task_return_error(task, err);
else
g_task_return_pointer(task, items, (GDestroyNotify) gt_game_list_free);
g_mutex_unlock(&priv->mutex);
return;
}
}
/* We were cancelled */
g_assert(g_task_return_error_if_cancelled(task));
g_mutex_unlock(&priv->mutex);
}
示例12: ide_application_task_completion
static gboolean
ide_application_task_completion (GAsyncResult *result,
GError **error)
{
g_assert (G_IS_TASK (result));
return g_task_propagate_boolean (G_TASK (result), error);
}
示例13: ide_autotools_build_system_discover_file_worker
static void
ide_autotools_build_system_discover_file_worker (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
GFile *file = task_data;
GFile *parent;
g_assert (G_IS_TASK (task));
g_assert (G_IS_FILE (file));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
if (is_configure (file) && g_file_query_exists (file, cancellable))
{
g_task_return_pointer (task, g_object_ref (file), g_object_unref);
return;
}
parent = g_object_ref (file);
while (parent != NULL)
{
GFile *child;
GFile *tmp;
child = g_file_get_child (parent, "configure.ac");
if (g_file_query_exists (child, cancellable))
{
g_task_return_pointer (task, g_object_ref (child), g_object_unref);
g_clear_object (&child);
g_clear_object (&parent);
return;
}
child = g_file_get_child (parent, "configure.in");
if (g_file_query_exists (child, cancellable))
{
g_task_return_pointer (task, g_object_ref (child), g_object_unref);
g_clear_object (&child);
g_clear_object (&parent);
return;
}
g_clear_object (&child);
tmp = parent;
parent = g_file_get_parent (parent);
g_clear_object (&tmp);
}
g_clear_object (&parent);
g_task_return_new_error (task,
G_IO_ERROR,
G_IO_ERROR_NOT_FOUND,
_("Failed to locate configure.ac"));
}
示例14: ide_clang_service_unit_completed_cb
static void
ide_clang_service_unit_completed_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
g_autoptr(GTask) task = user_data;
gpointer ret;
GError *error = NULL;
g_assert (IDE_IS_CLANG_SERVICE (object));
g_assert (G_IS_TASK (result));
g_assert (G_IS_TASK (task));
if (!(ret = g_task_propagate_pointer (G_TASK (result), &error)))
g_task_return_error (task, error);
else
g_task_return_pointer (task, ret, g_object_unref);
}
示例15: dummy_finish
static gboolean
dummy_finish (IdeRunnerAddin *self,
GAsyncResult *result,
GError **error)
{
g_assert (IDE_IS_RUNNER_ADDIN (self));
g_assert (G_IS_TASK (result));
return g_task_propagate_boolean (G_TASK (result), error);
}