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

/*
 * This file is part of gitg
 *
 * Copyright (C) 2012 - 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 <libgit2-glib/ggit.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>

#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define GITG_TYPE_REPOSITORY (gitg_repository_get_type ())
#define GITG_REPOSITORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_REPOSITORY, GitgRepository))
#define GITG_REPOSITORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_REPOSITORY, GitgRepositoryClass))
#define GITG_IS_REPOSITORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_REPOSITORY))
#define GITG_IS_REPOSITORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_REPOSITORY))
#define GITG_REPOSITORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_REPOSITORY, GitgRepositoryClass))

typedef struct _GitgRepository GitgRepository;
typedef struct _GitgRepositoryClass GitgRepositoryClass;

#define GITG_TYPE_REF_BASE (gitg_ref_base_get_type ())
#define GITG_REF_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_REF_BASE, GitgRefBase))
#define GITG_REF_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_REF_BASE, GitgRefBaseClass))
#define GITG_IS_REF_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_REF_BASE))
#define GITG_IS_REF_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_REF_BASE))
#define GITG_REF_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_REF_BASE, GitgRefBaseClass))

typedef struct _GitgRefBase GitgRefBase;
typedef struct _GitgRefBaseClass GitgRefBaseClass;

#define GITG_TYPE_BRANCH_BASE (gitg_branch_base_get_type ())
#define GITG_BRANCH_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_BRANCH_BASE, GitgBranchBase))
#define GITG_BRANCH_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_BRANCH_BASE, GitgBranchBaseClass))
#define GITG_IS_BRANCH_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_BRANCH_BASE))
#define GITG_IS_BRANCH_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_BRANCH_BASE))
#define GITG_BRANCH_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_BRANCH_BASE, GitgBranchBaseClass))

typedef struct _GitgBranchBase GitgBranchBase;
typedef struct _GitgBranchBaseClass GitgBranchBaseClass;

#define GITG_TYPE_COMMIT (gitg_commit_get_type ())
#define GITG_COMMIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_COMMIT, GitgCommit))
#define GITG_COMMIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_COMMIT, GitgCommitClass))
#define GITG_IS_COMMIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_COMMIT))
#define GITG_IS_COMMIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_COMMIT))
#define GITG_COMMIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_COMMIT, GitgCommitClass))

typedef struct _GitgCommit GitgCommit;
typedef struct _GitgCommitClass GitgCommitClass;

#define GITG_TYPE_REMOTE (gitg_remote_get_type ())
#define GITG_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_REMOTE, GitgRemote))
#define GITG_REMOTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_REMOTE, GitgRemoteClass))
#define GITG_IS_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_REMOTE))
#define GITG_IS_REMOTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_REMOTE))
#define GITG_REMOTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_REMOTE, GitgRemoteClass))

typedef struct _GitgRemote GitgRemote;
typedef struct _GitgRemoteClass GitgRemoteClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

typedef enum  {
	GITG_INIT_ERROR_THREADS_UNSAFE
} GitgInitError;
#define GITG_INIT_ERROR gitg_init_error_quark ()

extern gboolean gitg_gitg_inited;
gboolean gitg_gitg_inited = FALSE;
extern GError* gitg_gitg_initerr;
GError* gitg_gitg_initerr = NULL;

GQuark gitg_init_error_quark (void);
void gitg_init (GError** error);
GType gitg_repository_get_type (void) G_GNUC_CONST;
GType gitg_ref_base_get_type (void) G_GNUC_CONST;
GType gitg_branch_base_get_type (void) G_GNUC_CONST;
GType gitg_commit_get_type (void) G_GNUC_CONST;
GType gitg_remote_get_type (void) G_GNUC_CONST;
GtkCssProvider* gitg_resource_load_css (const gchar* id);


GQuark gitg_init_error_quark (void) {
	return g_quark_from_static_string ("gitg_init_error-quark");
}


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


static gpointer _g_object_ref0 (gpointer self) {
#line 55 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	return self ? g_object_ref (self) : NULL;
#line 120 "gitg-init.c"
}


void gitg_init (GError** error) {
	gboolean _tmp0_ = FALSE;
	GgitFeatureFlags _tmp4_ = 0;
	GgitObjectFactory* factory = NULL;
	GgitObjectFactory* _tmp8_ = NULL;
	GgitObjectFactory* _tmp9_ = NULL;
	GgitObjectFactory* _tmp10_ = NULL;
	GgitObjectFactory* _tmp11_ = NULL;
	GgitObjectFactory* _tmp12_ = NULL;
	GgitObjectFactory* _tmp13_ = NULL;
	GgitObjectFactory* _tmp14_ = NULL;
	GtkCssProvider* provider = NULL;
	GtkCssProvider* _tmp15_ = NULL;
	GtkCssProvider* _tmp16_ = NULL;
	GError * _inner_error_ = NULL;
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	_tmp0_ = gitg_gitg_inited;
#line 33 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	if (_tmp0_) {
#line 143 "gitg-init.c"
		GError* _tmp1_ = NULL;
#line 35 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		_tmp1_ = gitg_gitg_initerr;
#line 35 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		if (_tmp1_ != NULL) {
#line 149 "gitg-init.c"
			GError* _tmp2_ = NULL;
			GError* _tmp3_ = NULL;
#line 37 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
			_tmp2_ = gitg_gitg_initerr;
#line 37 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
			_tmp3_ = _g_error_copy0 (_tmp2_);
#line 37 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
			_inner_error_ = _tmp3_;
#line 37 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
			g_propagate_error (error, _inner_error_);
#line 37 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
			return;
#line 162 "gitg-init.c"
		}
#line 40 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		return;
#line 166 "gitg-init.c"
	}
#line 43 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	gitg_gitg_inited = TRUE;
#line 45 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	_tmp4_ = ggit_get_features ();
#line 45 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	if ((_tmp4_ & GGIT_FEATURE_THREADS) == 0) {
#line 174 "gitg-init.c"
		GError* _tmp5_ = NULL;
		GError* _tmp6_ = NULL;
		GError* _tmp7_ = NULL;
#line 47 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		_tmp5_ = g_error_new_literal (GITG_INIT_ERROR, GITG_INIT_ERROR_THREADS_UNSAFE, "no thread support");
#line 47 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		_g_error_free0 (gitg_gitg_initerr);
#line 47 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		gitg_gitg_initerr = _tmp5_;
#line 49 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		g_warning ("gitg-init.vala:49: libgit2 must be built with threading support in ord" \
"er to run gitg");
#line 50 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		_tmp6_ = gitg_gitg_initerr;
#line 50 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		_tmp7_ = _g_error_copy0 (_tmp6_);
#line 50 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		_inner_error_ = _tmp7_;
#line 50 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		g_propagate_error (error, _inner_error_);
#line 50 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		return;
#line 196 "gitg-init.c"
	}
#line 53 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	ggit_init ();
#line 55 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	_tmp8_ = ggit_object_factory_get_default ();
#line 55 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	_tmp9_ = _g_object_ref0 (_tmp8_);
#line 55 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	factory = _tmp9_;
#line 57 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	_tmp10_ = factory;
#line 57 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	ggit_object_factory_register (_tmp10_, ggit_repository_get_type (), GITG_TYPE_REPOSITORY);
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	_tmp11_ = factory;
#line 60 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	ggit_object_factory_register (_tmp11_, ggit_ref_get_type (), GITG_TYPE_REF_BASE);
#line 63 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	_tmp12_ = factory;
#line 63 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	ggit_object_factory_register (_tmp12_, ggit_branch_get_type (), GITG_TYPE_BRANCH_BASE);
#line 66 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	_tmp13_ = factory;
#line 66 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	ggit_object_factory_register (_tmp13_, ggit_commit_get_type (), GITG_TYPE_COMMIT);
#line 69 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	_tmp14_ = factory;
#line 69 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	ggit_object_factory_register (_tmp14_, ggit_remote_get_type (), GITG_TYPE_REMOTE);
#line 73 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	_tmp15_ = gitg_resource_load_css ("libgitg-style.css");
#line 73 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	provider = _tmp15_;
#line 75 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	_tmp16_ = provider;
#line 75 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	if (_tmp16_ != NULL) {
#line 234 "gitg-init.c"
		GdkScreen* _tmp17_ = NULL;
		GtkCssProvider* _tmp18_ = NULL;
#line 77 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		_tmp17_ = gdk_screen_get_default ();
#line 77 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		_tmp18_ = provider;
#line 77 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
		gtk_style_context_add_provider_for_screen (_tmp17_, (GtkStyleProvider*) _tmp18_, (guint) 600);
#line 243 "gitg-init.c"
	}
#line 31 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	_g_object_unref0 (provider);
#line 31 "/home/jesse/dev/gitg/libgitg/gitg-init.vala"
	_g_object_unref0 (factory);
#line 249 "gitg-init.c"
}



