/* gitg-async.c generated by valac 0.34.7, the Vala compiler
 * generated from gitg-async.vala, do not modify */

/*
 * This file is part of gitg
 *
 * Copyright (C) 2013 - Jesse van den Kieboom
 *
 * gitg is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * gitg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with gitg. If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <gobject/gvaluecollector.h>


#define GITG_TYPE_ASYNC (gitg_async_get_type ())
#define GITG_ASYNC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_ASYNC, GitgAsync))
#define GITG_ASYNC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_ASYNC, GitgAsyncClass))
#define GITG_IS_ASYNC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_ASYNC))
#define GITG_IS_ASYNC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_ASYNC))
#define GITG_ASYNC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_ASYNC, GitgAsyncClass))

typedef struct _GitgAsync GitgAsync;
typedef struct _GitgAsyncClass GitgAsyncClass;
typedef struct _GitgAsyncPrivate GitgAsyncPrivate;
typedef struct _Block1Data Block1Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_thread_unref0(var) ((var == NULL) ? NULL : (var = (g_thread_unref (var), NULL)))
typedef struct _GitgAsyncThreadData GitgAsyncThreadData;
typedef struct _GitgAsyncThreadTryData GitgAsyncThreadTryData;
typedef struct _GitgParamSpecAsync GitgParamSpecAsync;

struct _GitgAsync {
	GTypeInstance parent_instance;
	volatile int ref_count;
	GitgAsyncPrivate * priv;
};

struct _GitgAsyncClass {
	GTypeClass parent_class;
	void (*finalize) (GitgAsync *self);
};

typedef void (*GitgAsyncThreadFunc) (void* user_data, GError** error);
struct _Block1Data {
	int _ref_count_;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	GError* err;
	GitgAsyncThreadFunc func;
	gpointer func_target;
	gpointer _async_data_;
};

struct _GitgAsyncThreadData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	GitgAsyncThreadFunc func;
	gpointer func_target;
	Block1Data* _data1_;
	GitgAsyncThreadFunc _tmp0_;
	void* _tmp0__target;
	GThread* t;
	GThread* _tmp1_;
	GThread* _tmp2_;
	GThread* _tmp3_;
	GError* _tmp4_;
	GError* _tmp5_;
	GError* _tmp6_;
	GError * _inner_error_;
};

struct _GitgAsyncThreadTryData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	GitgAsyncThreadFunc func;
	gpointer func_target;
	GitgAsyncThreadFunc _tmp0_;
	void* _tmp0__target;
	GError * _inner_error_;
};

struct _GitgParamSpecAsync {
	GParamSpec parent_instance;
};


static gpointer gitg_async_parent_class = NULL;

gpointer gitg_async_ref (gpointer instance);
void gitg_async_unref (gpointer instance);
GParamSpec* gitg_param_spec_async (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void gitg_value_set_async (GValue* value, gpointer v_object);
void gitg_value_take_async (GValue* value, gpointer v_object);
gpointer gitg_value_get_async (const GValue* value);
GType gitg_async_get_type (void) G_GNUC_CONST;
enum  {
	GITG_ASYNC_DUMMY_PROPERTY
};
static void gitg_async_thread_data_free (gpointer _data);
void gitg_async_thread (GitgAsyncThreadFunc func, void* func_target, GAsyncReadyCallback _callback_, gpointer _user_data_);
void gitg_async_thread_finish (GAsyncResult* _res_, GError** error);
static gboolean gitg_async_thread_co (GitgAsyncThreadData* _data_);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static gboolean _gitg_async_thread_co_gsource_func (gpointer self);
static void* __lambda4_ (Block1Data* _data1_);
static gpointer ___lambda4__gthread_func (gpointer self);
static void gitg_async_thread_try_data_free (gpointer _data);
void gitg_async_thread_try (GitgAsyncThreadFunc func, void* func_target, GAsyncReadyCallback _callback_, gpointer _user_data_);
void gitg_async_thread_try_finish (GAsyncResult* _res_);
static gboolean gitg_async_thread_try_co (GitgAsyncThreadTryData* _data_);
static void gitg_async_thread_try_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
GitgAsync* gitg_async_new (void);
GitgAsync* gitg_async_construct (GType object_type);
static void gitg_async_finalize (GitgAsync* obj);


static void gitg_async_thread_data_free (gpointer _data) {
	GitgAsyncThreadData* _data_;
	_data_ = _data;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_slice_free (GitgAsyncThreadData, _data_);
#line 143 "gitg-async.c"
}


void gitg_async_thread (GitgAsyncThreadFunc func, void* func_target, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GitgAsyncThreadData* _data_;
	GitgAsyncThreadFunc _tmp0_ = NULL;
	void* _tmp0__target = NULL;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_ = g_slice_new0 (GitgAsyncThreadData);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, gitg_async_thread);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, gitg_async_thread_data_free);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_tmp0_ = func;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_tmp0__target = func_target;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->func = _tmp0_;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->func_target = _tmp0__target;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	gitg_async_thread_co (_data_);
#line 167 "gitg-async.c"
}


void gitg_async_thread_finish (GAsyncResult* _res_, GError** error) {
	GitgAsyncThreadData* _data_;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		return;
#line 177 "gitg-async.c"
	}
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
#line 181 "gitg-async.c"
}


static Block1Data* block1_data_ref (Block1Data* _data1_) {
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_atomic_int_inc (&_data1_->_ref_count_);
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return _data1_;
#line 190 "gitg-async.c"
}


static void block1_data_unref (void * _userdata_) {
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_g_error_free0 (_data1_->err);
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		(_data1_->callback_target_destroy_notify == NULL) ? NULL : (_data1_->callback_target_destroy_notify (_data1_->callback_target), NULL);
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data1_->callback = NULL;
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data1_->callback_target = NULL;
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data1_->callback_target_destroy_notify = NULL;
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_slice_free (Block1Data, _data1_);
#line 211 "gitg-async.c"
	}
}


static gboolean _gitg_async_thread_co_gsource_func (gpointer self) {
	gboolean result;
	result = gitg_async_thread_co (self);
#line 29 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return result;
#line 221 "gitg-async.c"
}


static gpointer _g_error_copy0 (gpointer self) {
#line 39 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return self ? g_error_copy (self) : NULL;
#line 228 "gitg-async.c"
}


static void* __lambda4_ (Block1Data* _data1_) {
	void* result = NULL;
	GSourceFunc _tmp3_ = NULL;
	void* _tmp3__target = NULL;
	GDestroyNotify _tmp3__target_destroy_notify = NULL;
	GError * _inner_error_ = NULL;
	{
		GitgAsyncThreadFunc _tmp0_ = NULL;
		void* _tmp0__target = NULL;
#line 35 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_tmp0_ = _data1_->func;
#line 35 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_tmp0__target = _data1_->func_target;
#line 35 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_tmp0_ (_tmp0__target, &_inner_error_);
#line 35 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 249 "gitg-async.c"
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp1_ = NULL;
		GError* _tmp2_ = NULL;
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		e = _inner_error_;
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_inner_error_ = NULL;
#line 39 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_tmp1_ = e;
#line 39 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_tmp2_ = _g_error_copy0 (_tmp1_);
#line 39 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_g_error_free0 (_data1_->err);
#line 39 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data1_->err = _tmp2_;
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_g_error_free0 (e);
#line 273 "gitg-async.c"
	}
	__finally0:
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_clear_error (&_inner_error_);
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		return NULL;
#line 284 "gitg-async.c"
	}
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_tmp3_ = _data1_->callback;
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_tmp3__target = _data1_->callback_target;
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_tmp3__target_destroy_notify = _data1_->callback_target_destroy_notify;
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data1_->callback = NULL;
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data1_->callback_target = NULL;
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data1_->callback_target_destroy_notify = NULL;
#line 42 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp3_, _tmp3__target, _tmp3__target_destroy_notify);
#line 43 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	result = NULL;
#line 43 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return result;
#line 304 "gitg-async.c"
}


static gpointer ___lambda4__gthread_func (gpointer self) {
	gpointer result;
	result = __lambda4_ (self);
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	block1_data_unref (self);
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return result;
#line 315 "gitg-async.c"
}


static gpointer _g_thread_ref0 (gpointer self) {
#line 48 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return self ? g_thread_ref (self) : NULL;
#line 322 "gitg-async.c"
}


static gboolean gitg_async_thread_co (GitgAsyncThreadData* _data_) {
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	switch (_data_->_state_) {
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		case 0:
#line 331 "gitg-async.c"
		goto _state_0;
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		case 1:
#line 335 "gitg-async.c"
		goto _state_1;
		default:
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_assert_not_reached ();
#line 340 "gitg-async.c"
	}
	_state_0:
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_data1_ = g_slice_new0 (Block1Data);
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_data1_->_ref_count_ = 1;
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_tmp0_ = NULL;
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_tmp0__target = NULL;
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_tmp0_ = _data_->func;
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_tmp0__target = _data_->func_target;
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_data1_->func = _data_->_tmp0_;
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_data1_->func_target = _data_->_tmp0__target;
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_data1_->_async_data_ = _data_;
#line 29 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_data1_->callback = _gitg_async_thread_co_gsource_func;
#line 29 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_data1_->callback_target = _data_;
#line 29 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_data1_->callback_target_destroy_notify = NULL;
#line 30 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_data1_->err = NULL;
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_tmp1_ = NULL;
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_tmp1_ = g_thread_try_new ("gitg-async", ___lambda4__gthread_func, block1_data_ref (_data_->_data1_), &_data_->_inner_error_);
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->t = _data_->_tmp1_;
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_error_free (_data_->_inner_error_);
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		block1_data_unref (_data_->_data1_);
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data_->_data1_ = NULL;
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		if (_data_->_state_ == 0) {
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
			g_simple_async_result_complete_in_idle (_data_->_async_result);
#line 389 "gitg-async.c"
		} else {
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
			g_simple_async_result_complete (_data_->_async_result);
#line 393 "gitg-async.c"
		}
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_object_unref (_data_->_async_result);
#line 32 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		return FALSE;
#line 399 "gitg-async.c"
	}
#line 46 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_state_ = 1;
#line 46 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return FALSE;
#line 405 "gitg-async.c"
	_state_1:
	;
#line 48 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_tmp2_ = NULL;
#line 48 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_tmp2_ = _data_->t;
#line 48 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_tmp3_ = NULL;
#line 48 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_tmp3_ = _g_thread_ref0 (_data_->_tmp2_);
#line 48 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_thread_join (_data_->_tmp3_);
#line 50 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_tmp4_ = NULL;
#line 50 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_tmp4_ = _data_->_data1_->err;
#line 50 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (_data_->_tmp4_ != NULL) {
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data_->_tmp5_ = NULL;
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data_->_tmp5_ = _data_->_data1_->err;
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data_->_tmp6_ = NULL;
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data_->_tmp6_ = _g_error_copy0 (_data_->_tmp5_);
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data_->_inner_error_ = _data_->_tmp6_;
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_error_free (_data_->_inner_error_);
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_g_thread_unref0 (_data_->t);
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		block1_data_unref (_data_->_data1_);
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data_->_data1_ = NULL;
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		if (_data_->_state_ == 0) {
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
			g_simple_async_result_complete_in_idle (_data_->_async_result);
#line 448 "gitg-async.c"
		} else {
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
			g_simple_async_result_complete (_data_->_async_result);
#line 452 "gitg-async.c"
		}
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_object_unref (_data_->_async_result);
#line 52 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		return FALSE;
#line 458 "gitg-async.c"
	}
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_g_thread_unref0 (_data_->t);
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	block1_data_unref (_data_->_data1_);
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_data1_ = NULL;
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (_data_->_state_ == 0) {
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_simple_async_result_complete_in_idle (_data_->_async_result);
#line 470 "gitg-async.c"
	} else {
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_simple_async_result_complete (_data_->_async_result);
#line 474 "gitg-async.c"
	}
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_object_unref (_data_->_async_result);
#line 27 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return FALSE;
#line 480 "gitg-async.c"
}


static void gitg_async_thread_try_data_free (gpointer _data) {
	GitgAsyncThreadTryData* _data_;
	_data_ = _data;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_slice_free (GitgAsyncThreadTryData, _data_);
#line 489 "gitg-async.c"
}


void gitg_async_thread_try (GitgAsyncThreadFunc func, void* func_target, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GitgAsyncThreadTryData* _data_;
	GitgAsyncThreadFunc _tmp0_ = NULL;
	void* _tmp0__target = NULL;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_ = g_slice_new0 (GitgAsyncThreadTryData);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, gitg_async_thread_try);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, gitg_async_thread_try_data_free);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_tmp0_ = func;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_tmp0__target = func_target;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->func = _tmp0_;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->func_target = _tmp0__target;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	gitg_async_thread_try_co (_data_);
#line 513 "gitg-async.c"
}


void gitg_async_thread_try_finish (GAsyncResult* _res_) {
	GitgAsyncThreadTryData* _data_;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
#line 521 "gitg-async.c"
}


static void gitg_async_thread_try_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	GitgAsyncThreadTryData* _data_;
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_ = _user_data_;
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_source_object_ = source_object;
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	_data_->_res_ = _res_;
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	gitg_async_thread_try_co (_data_);
#line 535 "gitg-async.c"
}


static gboolean gitg_async_thread_try_co (GitgAsyncThreadTryData* _data_) {
#line 56 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	switch (_data_->_state_) {
#line 56 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		case 0:
#line 544 "gitg-async.c"
		goto _state_0;
#line 56 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		case 1:
#line 548 "gitg-async.c"
		goto _state_1;
		default:
#line 56 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_assert_not_reached ();
#line 553 "gitg-async.c"
	}
	_state_0:
	{
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data_->_tmp0_ = NULL;
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data_->_tmp0__target = NULL;
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data_->_tmp0_ = _data_->func;
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data_->_tmp0__target = _data_->func_target;
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data_->_state_ = 1;
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		gitg_async_thread (_data_->_tmp0_, _data_->_tmp0__target, gitg_async_thread_try_ready, _data_);
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		return FALSE;
#line 571 "gitg-async.c"
		_state_1:
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		gitg_async_thread_finish (_data_->_res_, &_data_->_inner_error_);
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
#line 577 "gitg-async.c"
			goto __catch1_g_error;
		}
	}
	goto __finally1;
	__catch1_g_error:
	{
#line 58 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_clear_error (&_data_->_inner_error_);
#line 58 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		_data_->_inner_error_ = NULL;
#line 588 "gitg-async.c"
	}
	__finally1:
#line 58 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
#line 58 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
#line 58 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_clear_error (&_data_->_inner_error_);
#line 58 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		return FALSE;
#line 599 "gitg-async.c"
	}
#line 56 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (_data_->_state_ == 0) {
#line 56 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_simple_async_result_complete_in_idle (_data_->_async_result);
#line 605 "gitg-async.c"
	} else {
#line 56 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_simple_async_result_complete (_data_->_async_result);
#line 609 "gitg-async.c"
	}
#line 56 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_object_unref (_data_->_async_result);
#line 56 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return FALSE;
#line 615 "gitg-async.c"
}


GitgAsync* gitg_async_construct (GType object_type) {
	GitgAsync* self = NULL;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	self = (GitgAsync*) g_type_create_instance (object_type);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return self;
#line 625 "gitg-async.c"
}


GitgAsync* gitg_async_new (void) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return gitg_async_construct (GITG_TYPE_ASYNC);
#line 632 "gitg-async.c"
}


static void gitg_value_async_init (GValue* value) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	value->data[0].v_pointer = NULL;
#line 639 "gitg-async.c"
}


static void gitg_value_async_free_value (GValue* value) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (value->data[0].v_pointer) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		gitg_async_unref (value->data[0].v_pointer);
#line 648 "gitg-async.c"
	}
}


static void gitg_value_async_copy_value (const GValue* src_value, GValue* dest_value) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (src_value->data[0].v_pointer) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		dest_value->data[0].v_pointer = gitg_async_ref (src_value->data[0].v_pointer);
#line 658 "gitg-async.c"
	} else {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		dest_value->data[0].v_pointer = NULL;
#line 662 "gitg-async.c"
	}
}


static gpointer gitg_value_async_peek_pointer (const GValue* value) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return value->data[0].v_pointer;
#line 670 "gitg-async.c"
}


static gchar* gitg_value_async_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (collect_values[0].v_pointer) {
#line 677 "gitg-async.c"
		GitgAsync* object;
		object = collect_values[0].v_pointer;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		if (object->parent_instance.g_class == NULL) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 684 "gitg-async.c"
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 688 "gitg-async.c"
		}
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		value->data[0].v_pointer = gitg_async_ref (object);
#line 692 "gitg-async.c"
	} else {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		value->data[0].v_pointer = NULL;
#line 696 "gitg-async.c"
	}
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return NULL;
#line 700 "gitg-async.c"
}


static gchar* gitg_value_async_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	GitgAsync** object_p;
	object_p = collect_values[0].v_pointer;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (!object_p) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
#line 711 "gitg-async.c"
	}
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (!value->data[0].v_pointer) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		*object_p = NULL;
#line 717 "gitg-async.c"
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		*object_p = value->data[0].v_pointer;
#line 721 "gitg-async.c"
	} else {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		*object_p = gitg_async_ref (value->data[0].v_pointer);
#line 725 "gitg-async.c"
	}
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return NULL;
#line 729 "gitg-async.c"
}


GParamSpec* gitg_param_spec_async (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	GitgParamSpecAsync* spec;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_return_val_if_fail (g_type_is_a (object_type, GITG_TYPE_ASYNC), NULL);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	G_PARAM_SPEC (spec)->value_type = object_type;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return G_PARAM_SPEC (spec);
#line 743 "gitg-async.c"
}


gpointer gitg_value_get_async (const GValue* value) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GITG_TYPE_ASYNC), NULL);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return value->data[0].v_pointer;
#line 752 "gitg-async.c"
}


void gitg_value_set_async (GValue* value, gpointer v_object) {
	GitgAsync* old;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GITG_TYPE_ASYNC));
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	old = value->data[0].v_pointer;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (v_object) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GITG_TYPE_ASYNC));
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		value->data[0].v_pointer = v_object;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		gitg_async_ref (value->data[0].v_pointer);
#line 772 "gitg-async.c"
	} else {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		value->data[0].v_pointer = NULL;
#line 776 "gitg-async.c"
	}
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (old) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		gitg_async_unref (old);
#line 782 "gitg-async.c"
	}
}


void gitg_value_take_async (GValue* value, gpointer v_object) {
	GitgAsync* old;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GITG_TYPE_ASYNC));
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	old = value->data[0].v_pointer;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (v_object) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GITG_TYPE_ASYNC));
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		value->data[0].v_pointer = v_object;
#line 801 "gitg-async.c"
	} else {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		value->data[0].v_pointer = NULL;
#line 805 "gitg-async.c"
	}
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (old) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		gitg_async_unref (old);
#line 811 "gitg-async.c"
	}
}


static void gitg_async_class_init (GitgAsyncClass * klass) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	gitg_async_parent_class = g_type_class_peek_parent (klass);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	((GitgAsyncClass *) klass)->finalize = gitg_async_finalize;
#line 821 "gitg-async.c"
}


static void gitg_async_instance_init (GitgAsync * self) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	self->ref_count = 1;
#line 828 "gitg-async.c"
}


static void gitg_async_finalize (GitgAsync* obj) {
	GitgAsync * self;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_ASYNC, GitgAsync);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_signal_handlers_destroy (self);
#line 838 "gitg-async.c"
}


GType gitg_async_get_type (void) {
	static volatile gsize gitg_async_type_id__volatile = 0;
	if (g_once_init_enter (&gitg_async_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { gitg_value_async_init, gitg_value_async_free_value, gitg_value_async_copy_value, gitg_value_async_peek_pointer, "p", gitg_value_async_collect_value, "p", gitg_value_async_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (GitgAsyncClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_async_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgAsync), 0, (GInstanceInitFunc) gitg_async_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType gitg_async_type_id;
		gitg_async_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GitgAsync", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&gitg_async_type_id__volatile, gitg_async_type_id);
	}
	return gitg_async_type_id__volatile;
}


gpointer gitg_async_ref (gpointer instance) {
	GitgAsync* self;
	self = instance;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	g_atomic_int_inc (&self->ref_count);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	return instance;
#line 863 "gitg-async.c"
}


void gitg_async_unref (gpointer instance) {
	GitgAsync* self;
	self = instance;
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		GITG_ASYNC_GET_CLASS (self)->finalize (self);
#line 23 "/home/jesse/dev/gitg/libgitg/gitg-async.vala"
		g_type_free_instance ((GTypeInstance *) self);
#line 876 "gitg-async.c"
	}
}



