示例#1
0
static void gtkhash_hash_file_get_size(struct hash_file_s *data)
{
	if (G_UNLIKELY(g_cancellable_is_cancelled(data->cancellable))) {
		gtkhash_hash_file_set_state(data, HASH_FILE_STATE_CLOSE);
		return;
	}

	gtkhash_hash_file_remove_source(data);
	g_file_input_stream_query_info_async(data->stream,
		G_FILE_ATTRIBUTE_STANDARD_SIZE, G_PRIORITY_DEFAULT, data->cancellable,
		(GAsyncReadyCallback)gtkhash_hash_file_get_size_finish, data);
}
示例#2
0
static void
file_read_async_cb (GObject *obj, GAsyncResult *res, gpointer data)
{
	RBChunkLoader *loader = RB_CHUNK_LOADER (data);

	loader->priv->stream = g_file_read_finish (G_FILE (obj),
						   res,
						   &loader->priv->error);
	if (loader->priv->error != NULL) {
		loader->priv->callback (loader, NULL, 0, loader->priv->callback_data);
		return;
	}

	g_file_input_stream_query_info_async (loader->priv->stream,
					      G_FILE_ATTRIBUTE_STANDARD_SIZE,
					      G_PRIORITY_DEFAULT,
					      loader->priv->cancel,
					      stream_info_async_cb,
					      loader);


}
示例#3
0
static VALUE
rg_query_info_async(int argc, VALUE *argv, VALUE self)
{
        VALUE rbattributes, rbio_priority, rbcancellable, block;
        const char *attributes;
        int io_priority;
        GCancellable *cancellable;

        rb_scan_args(argc, argv, "03&", &rbattributes, &rbio_priority, &rbcancellable, &block);
        attributes = RVAL2ATTRIBUTESDEFAULT(rbattributes);
        io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
        cancellable = RVAL2GCANCELLABLE(rbcancellable);
        SAVE_BLOCK(block);
        g_file_input_stream_query_info_async(_SELF(self),
                                             attributes,
                                             io_priority,
                                             cancellable,
                                             rbgio_async_ready_callback,
                                             (gpointer)block);

        return self;
}