/* gitg-diff-view-request-resource.c generated by valac 0.28.0, the Vala compiler
 * generated from gitg-diff-view-request-resource.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 <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <webkit2/webkit2.h>
#include <libsoup/soup.h>
#include <libgit2-glib/ggit.h>


#define GITG_TYPE_DIFF_VIEW_REQUEST (gitg_diff_view_request_get_type ())
#define GITG_DIFF_VIEW_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_VIEW_REQUEST, GitgDiffViewRequest))
#define GITG_DIFF_VIEW_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_DIFF_VIEW_REQUEST, GitgDiffViewRequestClass))
#define GITG_IS_DIFF_VIEW_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_VIEW_REQUEST))
#define GITG_IS_DIFF_VIEW_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_DIFF_VIEW_REQUEST))
#define GITG_DIFF_VIEW_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_DIFF_VIEW_REQUEST, GitgDiffViewRequestClass))

typedef struct _GitgDiffViewRequest GitgDiffViewRequest;
typedef struct _GitgDiffViewRequestClass GitgDiffViewRequestClass;
typedef struct _GitgDiffViewRequestPrivate GitgDiffViewRequestPrivate;

#define GITG_TYPE_DIFF_VIEW (gitg_diff_view_get_type ())
#define GITG_DIFF_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_VIEW, GitgDiffView))
#define GITG_DIFF_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_DIFF_VIEW, GitgDiffViewClass))
#define GITG_IS_DIFF_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_VIEW))
#define GITG_IS_DIFF_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_DIFF_VIEW))
#define GITG_DIFF_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_DIFF_VIEW, GitgDiffViewClass))

typedef struct _GitgDiffView GitgDiffView;
typedef struct _GitgDiffViewClass GitgDiffViewClass;

#define GITG_TYPE_DIFF_VIEW_REQUEST_RESOURCE (gitg_diff_view_request_resource_get_type ())
#define GITG_DIFF_VIEW_REQUEST_RESOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_VIEW_REQUEST_RESOURCE, GitgDiffViewRequestResource))
#define GITG_DIFF_VIEW_REQUEST_RESOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_DIFF_VIEW_REQUEST_RESOURCE, GitgDiffViewRequestResourceClass))
#define GITG_IS_DIFF_VIEW_REQUEST_RESOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_VIEW_REQUEST_RESOURCE))
#define GITG_IS_DIFF_VIEW_REQUEST_RESOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_DIFF_VIEW_REQUEST_RESOURCE))
#define GITG_DIFF_VIEW_REQUEST_RESOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_DIFF_VIEW_REQUEST_RESOURCE, GitgDiffViewRequestResourceClass))

typedef struct _GitgDiffViewRequestResource GitgDiffViewRequestResource;
typedef struct _GitgDiffViewRequestResourceClass GitgDiffViewRequestResourceClass;
typedef struct _GitgDiffViewRequestResourcePrivate GitgDiffViewRequestResourcePrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GitgDiffViewRequest {
	GTypeInstance parent_instance;
	volatile int ref_count;
	GitgDiffViewRequestPrivate * priv;
	GitgDiffView* d_view;
	SoupURI* d_uri;
	gchar* d_mimetype;
	gint64 d_size;
	WebKitURISchemeRequest* d_request;
	gboolean d_hasView;
};

struct _GitgDiffViewRequestClass {
	GTypeClass parent_class;
	void (*finalize) (GitgDiffViewRequest *self);
	GInputStream* (*run_async) (GitgDiffViewRequest* self, GCancellable* cancellable, GError** error);
	gint64 (*get_content_length) (GitgDiffViewRequest* self);
	gchar* (*get_content_type) (GitgDiffViewRequest* self);
};

struct _GitgDiffViewRequestResource {
	GitgDiffViewRequest parent_instance;
	GitgDiffViewRequestResourcePrivate * priv;
};

struct _GitgDiffViewRequestResourceClass {
	GitgDiffViewRequestClass parent_class;
};

struct _GitgDiffViewRequestResourcePrivate {
	GFile* d_resource;
};


static gpointer gitg_diff_view_request_resource_parent_class = NULL;

gpointer gitg_diff_view_request_ref (gpointer instance);
void gitg_diff_view_request_unref (gpointer instance);
GParamSpec* gitg_param_spec_diff_view_request (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void gitg_value_set_diff_view_request (GValue* value, gpointer v_object);
void gitg_value_take_diff_view_request (GValue* value, gpointer v_object);
gpointer gitg_value_get_diff_view_request (const GValue* value);
GType gitg_diff_view_request_get_type (void) G_GNUC_CONST;
GType gitg_diff_view_get_type (void) G_GNUC_CONST;
GType gitg_diff_view_request_resource_get_type (void) G_GNUC_CONST;
#define GITG_DIFF_VIEW_REQUEST_RESOURCE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GITG_TYPE_DIFF_VIEW_REQUEST_RESOURCE, GitgDiffViewRequestResourcePrivate))
enum  {
	GITG_DIFF_VIEW_REQUEST_RESOURCE_DUMMY_PROPERTY
};
GitgDiffViewRequestResource* gitg_diff_view_request_resource_new (GitgDiffView* view, WebKitURISchemeRequest* request, SoupURI* uri);
GitgDiffViewRequestResource* gitg_diff_view_request_resource_construct (GType object_type, GitgDiffView* view, WebKitURISchemeRequest* request, SoupURI* uri);
GitgDiffViewRequest* gitg_diff_view_request_new (GitgDiffView* view, WebKitURISchemeRequest* request, SoupURI* uri);
GitgDiffViewRequest* gitg_diff_view_request_construct (GType object_type, GitgDiffView* view, WebKitURISchemeRequest* request, SoupURI* uri);
static GFile* gitg_diff_view_request_resource_ensure_resource (GitgDiffViewRequestResource* self);
static GInputStream* gitg_diff_view_request_resource_real_run_async (GitgDiffViewRequest* base, GCancellable* cancellable, GError** error);
static void gitg_diff_view_request_resource_finalize (GitgDiffViewRequest* obj);


GitgDiffViewRequestResource* gitg_diff_view_request_resource_construct (GType object_type, GitgDiffView* view, WebKitURISchemeRequest* request, SoupURI* uri) {
	GitgDiffViewRequestResource* self = NULL;
	GitgDiffView* _tmp0_ = NULL;
	WebKitURISchemeRequest* _tmp1_ = NULL;
	SoupURI* _tmp2_ = NULL;
#line 26 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	g_return_val_if_fail (request != NULL, NULL);
#line 26 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	g_return_val_if_fail (uri != NULL, NULL);
#line 28 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp0_ = view;
#line 28 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp1_ = request;
#line 28 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp2_ = uri;
#line 28 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	self = (GitgDiffViewRequestResource*) gitg_diff_view_request_construct (object_type, _tmp0_, _tmp1_, _tmp2_);
#line 29 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_g_object_unref0 (((GitgDiffViewRequest*) self)->d_view);
#line 29 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	((GitgDiffViewRequest*) self)->d_view = NULL;
#line 30 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	((GitgDiffViewRequest*) self)->d_hasView = FALSE;
#line 26 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	return self;
#line 151 "gitg-diff-view-request-resource.c"
}


GitgDiffViewRequestResource* gitg_diff_view_request_resource_new (GitgDiffView* view, WebKitURISchemeRequest* request, SoupURI* uri) {
#line 26 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	return gitg_diff_view_request_resource_construct (GITG_TYPE_DIFF_VIEW_REQUEST_RESOURCE, view, request, uri);
#line 158 "gitg-diff-view-request-resource.c"
}


static gpointer _g_object_ref0 (gpointer self) {
#line 37 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	return self ? g_object_ref (self) : NULL;
#line 165 "gitg-diff-view-request-resource.c"
}


static glong string_strnlen (gchar* str, glong maxlen) {
	glong result = 0L;
	gchar* end = NULL;
	gchar* _tmp0_ = NULL;
	glong _tmp1_ = 0L;
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
#line 1197 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	_tmp0_ = str;
#line 1197 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	_tmp1_ = maxlen;
#line 1197 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	_tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
#line 1197 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	end = _tmp2_;
#line 1198 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	_tmp3_ = end;
#line 1198 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	if (_tmp3_ == NULL) {
#line 188 "gitg-diff-view-request-resource.c"
		glong _tmp4_ = 0L;
#line 1199 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp4_ = maxlen;
#line 1199 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		result = _tmp4_;
#line 1199 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		return result;
#line 196 "gitg-diff-view-request-resource.c"
	} else {
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
#line 1201 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp5_ = end;
#line 1201 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp6_ = str;
#line 1201 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		result = (glong) (_tmp5_ - _tmp6_);
#line 1201 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		return result;
#line 208 "gitg-diff-view-request-resource.c"
	}
}


static gchar* string_substring (const gchar* self, glong offset, glong len) {
	gchar* result = NULL;
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	glong _tmp1_ = 0L;
	glong _tmp8_ = 0L;
	glong _tmp14_ = 0L;
	glong _tmp17_ = 0L;
	glong _tmp18_ = 0L;
	glong _tmp19_ = 0L;
	glong _tmp20_ = 0L;
	glong _tmp21_ = 0L;
	gchar* _tmp22_ = NULL;
#line 1208 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1210 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	_tmp1_ = offset;
#line 1210 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	if (_tmp1_ >= ((glong) 0)) {
#line 232 "gitg-diff-view-request-resource.c"
		glong _tmp2_ = 0L;
#line 1210 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp2_ = len;
#line 1210 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp0_ = _tmp2_ >= ((glong) 0);
#line 238 "gitg-diff-view-request-resource.c"
	} else {
#line 1210 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp0_ = FALSE;
#line 242 "gitg-diff-view-request-resource.c"
	}
#line 1210 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	if (_tmp0_) {
#line 246 "gitg-diff-view-request-resource.c"
		glong _tmp3_ = 0L;
		glong _tmp4_ = 0L;
		glong _tmp5_ = 0L;
#line 1212 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp3_ = offset;
#line 1212 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp4_ = len;
#line 1212 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp5_ = string_strnlen ((gchar*) self, _tmp3_ + _tmp4_);
#line 1212 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		string_length = _tmp5_;
#line 258 "gitg-diff-view-request-resource.c"
	} else {
		gint _tmp6_ = 0;
		gint _tmp7_ = 0;
#line 1214 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp6_ = strlen (self);
#line 1214 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp7_ = _tmp6_;
#line 1214 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		string_length = (glong) _tmp7_;
#line 268 "gitg-diff-view-request-resource.c"
	}
#line 1217 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	_tmp8_ = offset;
#line 1217 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	if (_tmp8_ < ((glong) 0)) {
#line 274 "gitg-diff-view-request-resource.c"
		glong _tmp9_ = 0L;
		glong _tmp10_ = 0L;
		glong _tmp11_ = 0L;
#line 1218 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp9_ = string_length;
#line 1218 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp10_ = offset;
#line 1218 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		offset = _tmp9_ + _tmp10_;
#line 1219 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp11_ = offset;
#line 1219 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		g_return_val_if_fail (_tmp11_ >= ((glong) 0), NULL);
#line 288 "gitg-diff-view-request-resource.c"
	} else {
		glong _tmp12_ = 0L;
		glong _tmp13_ = 0L;
#line 1221 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp12_ = offset;
#line 1221 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp13_ = string_length;
#line 1221 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		g_return_val_if_fail (_tmp12_ <= _tmp13_, NULL);
#line 298 "gitg-diff-view-request-resource.c"
	}
#line 1223 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	_tmp14_ = len;
#line 1223 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	if (_tmp14_ < ((glong) 0)) {
#line 304 "gitg-diff-view-request-resource.c"
		glong _tmp15_ = 0L;
		glong _tmp16_ = 0L;
#line 1224 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp15_ = string_length;
#line 1224 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		_tmp16_ = offset;
#line 1224 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
		len = _tmp15_ - _tmp16_;
#line 313 "gitg-diff-view-request-resource.c"
	}
#line 1226 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	_tmp17_ = offset;
#line 1226 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	_tmp18_ = len;
#line 1226 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	_tmp19_ = string_length;
#line 1226 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	g_return_val_if_fail ((_tmp17_ + _tmp18_) <= _tmp19_, NULL);
#line 1227 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	_tmp20_ = offset;
#line 1227 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	_tmp21_ = len;
#line 1227 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	_tmp22_ = g_strndup (((gchar*) self) + _tmp20_, (gsize) _tmp21_);
#line 1227 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	result = _tmp22_;
#line 1227 "/usr/share/vala-0.28/vapi/glib-2.0.vapi"
	return result;
#line 333 "gitg-diff-view-request-resource.c"
}


static GFile* gitg_diff_view_request_resource_ensure_resource (GitgDiffViewRequestResource* self) {
	GFile* result = NULL;
	GFile* _tmp0_ = NULL;
	gchar* path = NULL;
	SoupURI* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	gchar* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	gchar* _tmp7_ = NULL;
	gchar* _tmp8_ = NULL;
	GFile* _tmp9_ = NULL;
	const gchar* _tmp10_ = NULL;
	GFile* _tmp38_ = NULL;
	GFile* _tmp39_ = NULL;
	GError * _inner_error_ = NULL;
#line 33 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 35 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp0_ = self->priv->d_resource;
#line 35 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	if (_tmp0_ != NULL) {
#line 358 "gitg-diff-view-request-resource.c"
		GFile* _tmp1_ = NULL;
		GFile* _tmp2_ = NULL;
#line 37 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp1_ = self->priv->d_resource;
#line 37 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp2_ = _g_object_ref0 (_tmp1_);
#line 37 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		result = _tmp2_;
#line 37 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		return result;
#line 369 "gitg-diff-view-request-resource.c"
	}
#line 40 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp3_ = ((GitgDiffViewRequest*) self)->d_uri;
#line 40 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp4_ = soup_uri_get_path (_tmp3_);
#line 40 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp5_ = soup_uri_decode (_tmp4_);
#line 40 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	path = _tmp5_;
#line 42 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp6_ = path;
#line 42 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp7_ = g_strconcat ("resource://", _tmp6_, NULL);
#line 42 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp8_ = _tmp7_;
#line 42 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp9_ = g_file_new_for_uri (_tmp8_);
#line 42 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_g_object_unref0 (self->priv->d_resource);
#line 42 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	self->priv->d_resource = _tmp9_;
#line 42 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_g_free0 (_tmp8_);
#line 45 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp10_ = g_getenv ("GITG_GTK_DIFF_VIEW_DEBUG");
#line 45 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	if (g_strcmp0 (_tmp10_, "local") == 0) {
#line 397 "gitg-diff-view-request-resource.c"
		gchar* pre = NULL;
		gchar* _tmp11_ = NULL;
		const gchar* _tmp12_ = NULL;
		const gchar* _tmp13_ = NULL;
		gboolean _tmp14_ = FALSE;
		GFile* repopath = NULL;
		GFile* _tmp26_ = NULL;
#line 47 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp11_ = g_strdup ("/org/gnome/gitg/");
#line 47 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		pre = _tmp11_;
#line 49 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp12_ = path;
#line 49 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp13_ = pre;
#line 49 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp14_ = g_str_has_prefix (_tmp12_, _tmp13_);
#line 49 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		if (_tmp14_) {
#line 417 "gitg-diff-view-request-resource.c"
			const gchar* _tmp15_ = NULL;
			const gchar* _tmp16_ = NULL;
			gint _tmp17_ = 0;
			gint _tmp18_ = 0;
			gchar* _tmp19_ = NULL;
#line 51 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp15_ = path;
#line 51 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp16_ = pre;
#line 51 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp17_ = strlen (_tmp16_);
#line 51 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp18_ = _tmp17_;
#line 51 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp19_ = string_substring (_tmp15_, (glong) _tmp18_, (glong) (-1));
#line 51 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_free0 (path);
#line 51 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			path = _tmp19_;
#line 437 "gitg-diff-view-request-resource.c"
		}
		{
			GFile* _tmp20_ = NULL;
			GFile* _tmp21_ = NULL;
			GFile* _tmp22_ = NULL;
			GFile* _tmp23_ = NULL;
			GFile* _tmp24_ = NULL;
			GFile* _tmp25_ = NULL;
#line 58 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp21_ = g_file_new_for_path (".");
#line 58 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp22_ = _tmp21_;
#line 58 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp23_ = ggit_repository_discover (_tmp22_, &_inner_error_);
#line 58 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp24_ = _tmp23_;
#line 58 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_object_unref0 (_tmp22_);
#line 58 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp20_ = _tmp24_;
#line 58 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 460 "gitg-diff-view-request-resource.c"
				goto __catch35_g_error;
			}
#line 58 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp25_ = _tmp20_;
#line 58 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp20_ = NULL;
#line 58 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_object_unref0 (repopath);
#line 58 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			repopath = _tmp25_;
#line 56 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_object_unref0 (_tmp20_);
#line 473 "gitg-diff-view-request-resource.c"
		}
		goto __finally35;
		__catch35_g_error:
		{
#line 56 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			g_clear_error (&_inner_error_);
#line 56 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_inner_error_ = NULL;
#line 62 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_object_unref0 (repopath);
#line 62 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			repopath = NULL;
#line 486 "gitg-diff-view-request-resource.c"
		}
		__finally35:
#line 56 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 56 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_object_unref0 (repopath);
#line 56 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_free0 (pre);
#line 56 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_free0 (path);
#line 56 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.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 56 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			g_clear_error (&_inner_error_);
#line 56 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			return NULL;
#line 503 "gitg-diff-view-request-resource.c"
		}
#line 65 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp26_ = repopath;
#line 65 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		if (_tmp26_ != NULL) {
#line 509 "gitg-diff-view-request-resource.c"
			GFile* _tmp27_ = NULL;
			gchar* _tmp28_ = NULL;
			gchar* _tmp29_ = NULL;
			const gchar* _tmp30_ = NULL;
			gchar* _tmp31_ = NULL;
			gchar* _tmp32_ = NULL;
			GFile* _tmp33_ = NULL;
#line 67 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp27_ = repopath;
#line 67 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp28_ = g_file_get_path (_tmp27_);
#line 67 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp29_ = _tmp28_;
#line 67 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp30_ = path;
#line 67 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp31_ = g_build_filename (_tmp29_, "..", "libgitg", "resources", _tmp30_, NULL);
#line 67 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp32_ = _tmp31_;
#line 67 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp33_ = g_file_new_for_path (_tmp32_);
#line 67 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_object_unref0 (self->priv->d_resource);
#line 67 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			self->priv->d_resource = _tmp33_;
#line 67 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_free0 (_tmp32_);
#line 67 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_free0 (_tmp29_);
#line 539 "gitg-diff-view-request-resource.c"
		} else {
			const gchar* _tmp34_ = NULL;
			gchar* _tmp35_ = NULL;
			gchar* _tmp36_ = NULL;
			GFile* _tmp37_ = NULL;
#line 71 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp34_ = path;
#line 71 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp35_ = g_build_filename ("resources", _tmp34_, NULL);
#line 71 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp36_ = _tmp35_;
#line 71 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp37_ = g_file_new_for_path (_tmp36_);
#line 71 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_object_unref0 (self->priv->d_resource);
#line 71 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			self->priv->d_resource = _tmp37_;
#line 71 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_free0 (_tmp36_);
#line 559 "gitg-diff-view-request-resource.c"
		}
#line 45 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_g_object_unref0 (repopath);
#line 45 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_g_free0 (pre);
#line 565 "gitg-diff-view-request-resource.c"
	}
#line 75 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp38_ = self->priv->d_resource;
#line 75 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp39_ = _g_object_ref0 (_tmp38_);
#line 75 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	result = _tmp39_;
#line 75 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_g_free0 (path);
#line 75 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	return result;
#line 577 "gitg-diff-view-request-resource.c"
}


static GInputStream* gitg_diff_view_request_resource_real_run_async (GitgDiffViewRequest* base, GCancellable* cancellable, GError** error) {
	GitgDiffViewRequestResource * self;
	GInputStream* result = NULL;
	GFile* f = NULL;
	GFile* _tmp0_ = NULL;
	GFileInputStream* stream = NULL;
	GCancellable* _tmp1_ = NULL;
	GFileInputStream* _tmp2_ = NULL;
	GError * _inner_error_ = NULL;
#line 78 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	self = (GitgDiffViewRequestResource*) base;
#line 80 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp0_ = gitg_diff_view_request_resource_ensure_resource (self);
#line 80 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	f = _tmp0_;
#line 82 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp1_ = cancellable;
#line 82 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_tmp2_ = g_file_read (f, _tmp1_, &_inner_error_);
#line 82 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	stream = _tmp2_;
#line 82 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 82 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		g_propagate_error (error, _inner_error_);
#line 82 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_g_object_unref0 (f);
#line 82 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		return NULL;
#line 610 "gitg-diff-view-request-resource.c"
	}
	{
		GFileInfo* info = NULL;
		GCancellable* _tmp3_ = NULL;
		GFileInfo* _tmp4_ = NULL;
		GFileInfo* _tmp5_ = NULL;
		gint64 _tmp6_ = 0LL;
		gchar* ctype = NULL;
		GFileInfo* _tmp7_ = NULL;
		const gchar* _tmp8_ = NULL;
		gchar* _tmp9_ = NULL;
		const gchar* _tmp10_ = NULL;
#line 86 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp3_ = cancellable;
#line 86 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp4_ = g_file_query_info (f, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," G_FILE_ATTRIBUTE_STANDARD_SIZE, 0, _tmp3_, &_inner_error_);
#line 86 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		info = _tmp4_;
#line 86 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 631 "gitg-diff-view-request-resource.c"
			goto __catch36_g_error;
		}
#line 92 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp5_ = info;
#line 92 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp6_ = g_file_info_get_size (_tmp5_);
#line 92 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		((GitgDiffViewRequest*) self)->d_size = _tmp6_;
#line 94 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp7_ = info;
#line 94 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp8_ = g_file_info_get_content_type (_tmp7_);
#line 94 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp9_ = g_strdup (_tmp8_);
#line 94 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		ctype = _tmp9_;
#line 96 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_tmp10_ = ctype;
#line 96 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		if (_tmp10_ != NULL) {
#line 652 "gitg-diff-view-request-resource.c"
			const gchar* _tmp11_ = NULL;
			gchar* _tmp12_ = NULL;
#line 98 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp11_ = ctype;
#line 98 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_tmp12_ = g_content_type_get_mime_type (_tmp11_);
#line 98 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			_g_free0 (((GitgDiffViewRequest*) self)->d_mimetype);
#line 98 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
			((GitgDiffViewRequest*) self)->d_mimetype = _tmp12_;
#line 663 "gitg-diff-view-request-resource.c"
		}
#line 84 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_g_free0 (ctype);
#line 84 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_g_object_unref0 (info);
#line 669 "gitg-diff-view-request-resource.c"
	}
	goto __finally36;
	__catch36_g_error:
	{
#line 84 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		g_clear_error (&_inner_error_);
#line 84 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_inner_error_ = NULL;
#line 678 "gitg-diff-view-request-resource.c"
	}
	__finally36:
#line 84 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 84 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		g_propagate_error (error, _inner_error_);
#line 84 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_g_object_unref0 (stream);
#line 84 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		_g_object_unref0 (f);
#line 84 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
		return NULL;
#line 691 "gitg-diff-view-request-resource.c"
	}
#line 102 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	result = (GInputStream*) stream;
#line 102 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_g_object_unref0 (f);
#line 102 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	return result;
#line 699 "gitg-diff-view-request-resource.c"
}


static void gitg_diff_view_request_resource_class_init (GitgDiffViewRequestResourceClass * klass) {
#line 22 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	gitg_diff_view_request_resource_parent_class = g_type_class_peek_parent (klass);
#line 22 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	((GitgDiffViewRequestClass *) klass)->finalize = gitg_diff_view_request_resource_finalize;
#line 22 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	g_type_class_add_private (klass, sizeof (GitgDiffViewRequestResourcePrivate));
#line 22 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	((GitgDiffViewRequestClass *) klass)->run_async = gitg_diff_view_request_resource_real_run_async;
#line 712 "gitg-diff-view-request-resource.c"
}


static void gitg_diff_view_request_resource_instance_init (GitgDiffViewRequestResource * self) {
#line 22 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	self->priv = GITG_DIFF_VIEW_REQUEST_RESOURCE_GET_PRIVATE (self);
#line 719 "gitg-diff-view-request-resource.c"
}


static void gitg_diff_view_request_resource_finalize (GitgDiffViewRequest* obj) {
	GitgDiffViewRequestResource * self;
#line 22 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_DIFF_VIEW_REQUEST_RESOURCE, GitgDiffViewRequestResource);
#line 24 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	_g_object_unref0 (self->priv->d_resource);
#line 22 "/home/jesse/devel/gitg/libgitg/gitg-diff-view-request-resource.vala"
	GITG_DIFF_VIEW_REQUEST_CLASS (gitg_diff_view_request_resource_parent_class)->finalize (obj);
#line 731 "gitg-diff-view-request-resource.c"
}


GType gitg_diff_view_request_resource_get_type (void) {
	static volatile gsize gitg_diff_view_request_resource_type_id__volatile = 0;
	if (g_once_init_enter (&gitg_diff_view_request_resource_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GitgDiffViewRequestResourceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_diff_view_request_resource_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgDiffViewRequestResource), 0, (GInstanceInitFunc) gitg_diff_view_request_resource_instance_init, NULL };
		GType gitg_diff_view_request_resource_type_id;
		gitg_diff_view_request_resource_type_id = g_type_register_static (GITG_TYPE_DIFF_VIEW_REQUEST, "GitgDiffViewRequestResource", &g_define_type_info, 0);
		g_once_init_leave (&gitg_diff_view_request_resource_type_id__volatile, gitg_diff_view_request_resource_type_id);
	}
	return gitg_diff_view_request_resource_type_id__volatile;
}



