/* Image.c generated by valac 0.56.19, the Vala compiler
 * generated from Image.vala, do not modify */

#include <glib-object.h>
#include <libsoup/soup.h>
#include <gio/gio.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <adwaita.h>
#include <gobject/gvaluecollector.h>

#define BUILD_NAME "Tuba"
#define BUILD_VERSION "0.11.1"
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TUBA_HELPER_TYPE_IMAGE (tuba_helper_image_get_type ())
#define TUBA_HELPER_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_HELPER_TYPE_IMAGE, TubaHelperImage))
#define TUBA_HELPER_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_HELPER_TYPE_IMAGE, TubaHelperImageClass))
#define TUBA_HELPER_IS_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_HELPER_TYPE_IMAGE))
#define TUBA_HELPER_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_HELPER_TYPE_IMAGE))
#define TUBA_HELPER_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_HELPER_TYPE_IMAGE, TubaHelperImageClass))

typedef struct _TubaHelperImage TubaHelperImage;
typedef struct _TubaHelperImageClass TubaHelperImageClass;
typedef struct _TubaHelperImagePrivate TubaHelperImagePrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TUBA_TYPE_OOPSIE (tuba_oopsie_get_type ())
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _TubaHelperImageDecodeData TubaHelperImageDecodeData;
#define _tuba_helper_image_unref0(var) ((var == NULL) ? NULL : (var = (tuba_helper_image_unref (var), NULL)))

#define TUBA_TYPE_APPLICATION (tuba_application_get_type ())
#define TUBA_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_APPLICATION, TubaApplication))
#define TUBA_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_APPLICATION, TubaApplicationClass))
#define TUBA_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_APPLICATION))
#define TUBA_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_APPLICATION))
#define TUBA_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_APPLICATION, TubaApplicationClass))

typedef struct _TubaApplication TubaApplication;
typedef struct _TubaApplicationClass TubaApplicationClass;
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _TubaHelperImageRequestBytesData TubaHelperImageRequestBytesData;
typedef struct _TubaHelperImageFetchPaintableData TubaHelperImageFetchPaintableData;
typedef void (*TubaHelperImageOnItemChangedFn) (GdkPaintable* data, gpointer user_data);
typedef struct _Block56Data Block56Data;

#define TUBA_TYPE_SETTINGS (tuba_settings_get_type ())
#define TUBA_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_SETTINGS, TubaSettings))
#define TUBA_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_SETTINGS, TubaSettingsClass))
#define TUBA_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_SETTINGS))
#define TUBA_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_SETTINGS))
#define TUBA_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_SETTINGS, TubaSettingsClass))

typedef struct _TubaSettings TubaSettings;
typedef struct _TubaSettingsClass TubaSettingsClass;
typedef struct _TubaHelperParamSpecImage TubaHelperParamSpecImage;

struct _TubaHelperImage {
	GTypeInstance parent_instance;
	volatile int ref_count;
	TubaHelperImagePrivate * priv;
};

struct _TubaHelperImageClass {
	GTypeClass parent_class;
	void (*finalize) (TubaHelperImage *self);
};

typedef enum  {
	TUBA_OOPSIE_USER,
	TUBA_OOPSIE_PARSING,
	TUBA_OOPSIE_INSTANCE,
	TUBA_OOPSIE_INTERNAL,
	TUBA_OOPSIE_HTTP_401 = 401,
	TUBA_OOPSIE_HTTP_403 = 403,
	TUBA_OOPSIE_HTTP_404 = 404,
	TUBA_OOPSIE_HTTP_410 = 410,
	TUBA_OOPSIE_HTTP_422 = 422,
	TUBA_OOPSIE_HTTP_429 = 429,
	TUBA_OOPSIE_HTTP_500 = 500,
	TUBA_OOPSIE_HTTP_503 = 503
} TubaOopsie;
#define TUBA_OOPSIE tuba_oopsie_quark ()

struct _TubaHelperImageDecodeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SoupMessage* msg;
	GInputStream* in_stream;
	GdkPaintable* result;
	guint _tmp0_;
	guint _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GError* _tmp7_;
	GError* _tmp8_;
	GdkPixbuf* _tmp9_;
	GdkPixbuf* _tmp10_;
	GdkPixbuf* _tmp11_;
	GdkPixbuf* _tmp12_;
	GdkTexture* _tmp13_;
	GdkPaintable* _tmp14_;
	GError* _inner_error0_;
};

struct _TubaHelperImageRequestBytesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* url;
	GBytes* result;
	TubaHelperImage* _tmp0_;
	TubaHelperImage* _tmp1_;
	SoupMessage* download_msg;
	SoupMessage* _tmp2_;
	GBytes* _tmp3_;
	SoupSession* _tmp4_;
	GBytes* _tmp5_;
	GBytes* _tmp6_;
	GError* e;
	const gchar* _tmp7_;
	GError* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	GError* _inner_error0_;
};

struct _TubaHelperImageFetchPaintableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* url;
	gboolean disable_cache;
	GCancellable* cancellable;
	GdkPaintable* result;
	SoupMessage* download_msg;
	SoupMessage* _tmp0_;
	SoupMessage* _tmp1_;
	GInputStream* in_stream;
	SoupSession* _tmp2_;
	SoupMessage* _tmp3_;
	GInputStream* _tmp4_;
	GdkPaintable* _tmp5_;
	SoupMessage* _tmp6_;
	GInputStream* _tmp7_;
	GdkPaintable* _tmp8_;
	GdkPaintable* _tmp9_;
	GError* e;
	const gchar* _tmp10_;
	GError* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	GError* _inner_error0_;
};

struct _Block56Data {
	int _ref_count_;
	gboolean has_loaded;
	gchar* blurhash;
	TubaHelperImageOnItemChangedFn cb;
	gpointer cb_target;
	GDestroyNotify cb_target_destroy_notify;
};

struct _TubaHelperParamSpecImage {
	GParamSpec parent_instance;
};

static gpointer tuba_helper_image_parent_class = NULL;
static SoupSession* tuba_helper_image_session;
static SoupSession* tuba_helper_image_session = NULL;
static SoupCache* tuba_helper_image_cache;
static SoupCache* tuba_helper_image_cache = NULL;
VALA_EXTERN TubaApplication* tuba_app;
VALA_EXTERN TubaSettings* tuba_settings;
VALA_EXTERN gchar* tuba_cache_path;

VALA_EXTERN gpointer tuba_helper_image_ref (gpointer instance);
VALA_EXTERN void tuba_helper_image_unref (gpointer instance);
VALA_EXTERN GParamSpec* tuba_helper_param_spec_image (const gchar* name,
                                          const gchar* nick,
                                          const gchar* blurb,
                                          GType object_type,
                                          GParamFlags flags);
VALA_EXTERN void tuba_helper_value_set_image (GValue* value,
                                  gpointer v_object);
VALA_EXTERN void tuba_helper_value_take_image (GValue* value,
                                   gpointer v_object);
VALA_EXTERN gpointer tuba_helper_value_get_image (const GValue* value);
VALA_EXTERN GType tuba_helper_image_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaHelperImage, tuba_helper_image_unref)
static void tuba_helper_image_decode_data_free (gpointer _data);
VALA_EXTERN void tuba_helper_image_decode (SoupMessage* msg,
                               GInputStream* in_stream,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_);
VALA_EXTERN GdkPaintable* tuba_helper_image_decode_finish (GAsyncResult* _res_,
                                               GError** error);
static gboolean tuba_helper_image_decode_co (TubaHelperImageDecodeData* _data_);
VALA_EXTERN GQuark tuba_oopsie_quark (void);
VALA_EXTERN GType tuba_oopsie_get_type (void) G_GNUC_CONST ;
static void tuba_helper_image_decode_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_);
VALA_EXTERN void tuba_helper_image_clear_cache (void);
VALA_EXTERN TubaHelperImage* tuba_helper_image_new (void);
VALA_EXTERN TubaHelperImage* tuba_helper_image_construct (GType object_type);
VALA_EXTERN void tuba_helper_image_flush_cache (void);
static void tuba_helper_image_on_proxy_change (void);
VALA_EXTERN GType tuba_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaApplication, g_object_unref)
VALA_EXTERN GProxyResolver* tuba_application_get_proxy (TubaApplication* self);
static void tuba_helper_image_request_bytes_data_free (gpointer _data);
VALA_EXTERN void tuba_helper_image_request_bytes (const gchar* url,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
VALA_EXTERN GBytes* tuba_helper_image_request_bytes_finish (GAsyncResult* _res_);
static gboolean tuba_helper_image_request_bytes_co (TubaHelperImageRequestBytesData* _data_);
static void tuba_helper_image_request_bytes_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
static void tuba_helper_image_fetch_paintable_data_free (gpointer _data);
static void tuba_helper_image_fetch_paintable (const gchar* url,
                                        gboolean disable_cache,
                                        GCancellable* cancellable,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
static GdkPaintable* tuba_helper_image_fetch_paintable_finish (GAsyncResult* _res_);
static gboolean tuba_helper_image_fetch_paintable_co (TubaHelperImageFetchPaintableData* _data_);
static void tuba_helper_image_fetch_paintable_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
VALA_EXTERN void tuba_helper_image_request_paintable (const gchar* url,
                                          const gchar* blurhash,
                                          gboolean disable_cache,
                                          TubaHelperImageOnItemChangedFn cb,
                                          gpointer cb_target,
                                          GDestroyNotify cb_target_destroy_notify,
                                          GCancellable* cancellable);
static Block56Data* block56_data_ref (Block56Data* _data56_);
static void block56_data_unref (void * _userdata_);
VALA_EXTERN GType tuba_settings_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaSettings, g_object_unref)
VALA_EXTERN gboolean tuba_settings_get_use_blurhash (TubaSettings* self);
static gboolean ___lambda10_ (Block56Data* _data56_);
VALA_EXTERN GdkPaintable* tuba_helper_blurhash_decode (const gchar* blurhash);
static gboolean ____lambda10__gsource_func (gpointer self);
static void __lambda11_ (Block56Data* _data56_,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda11__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
VALA_EXTERN GdkPaintable* tuba_helper_image_lookup_cache (const gchar* uri);
static void _tuba_helper_image_on_proxy_change_g_object_notify (GObject* _sender,
                                                         GParamSpec* pspec,
                                                         gpointer self);
static void tuba_helper_image_finalize (TubaHelperImage * obj);
static GType tuba_helper_image_get_type_once (void);

static void
tuba_helper_image_decode_data_free (gpointer _data)
{
	TubaHelperImageDecodeData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->msg);
	_g_object_unref0 (_data_->in_stream);
	_g_object_unref0 (_data_->result);
	g_slice_free (TubaHelperImageDecodeData, _data_);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

void
tuba_helper_image_decode (SoupMessage* msg,
                          GInputStream* in_stream,
                          GAsyncReadyCallback _callback_,
                          gpointer _user_data_)
{
	TubaHelperImageDecodeData* _data_;
	SoupMessage* _tmp0_;
	GInputStream* _tmp1_;
	g_return_if_fail (msg != NULL);
	g_return_if_fail (in_stream != NULL);
	_data_ = g_slice_new0 (TubaHelperImageDecodeData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_helper_image_decode_data_free);
	_tmp0_ = _g_object_ref0 (msg);
	_g_object_unref0 (_data_->msg);
	_data_->msg = _tmp0_;
	_tmp1_ = _g_object_ref0 (in_stream);
	_g_object_unref0 (_data_->in_stream);
	_data_->in_stream = _tmp1_;
	tuba_helper_image_decode_co (_data_);
}

GdkPaintable*
tuba_helper_image_decode_finish (GAsyncResult* _res_,
                                 GError** error)
{
	GdkPaintable* result;
	TubaHelperImageDecodeData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

static void
tuba_helper_image_decode_ready (GObject* source_object,
                                GAsyncResult* _res_,
                                gpointer _user_data_)
{
	TubaHelperImageDecodeData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_helper_image_decode_co (_data_);
}

static gboolean
tuba_helper_image_decode_co (TubaHelperImageDecodeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_object_get (_data_->msg, "status-code", &_data_->_tmp0_, NULL);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (_data_->_tmp1_ != ((guint) SOUP_STATUS_OK)) {
		_data_->_tmp2_ = soup_message_get_reason_phrase (_data_->msg);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp4_ = string_to_string (_data_->_tmp3_);
		_data_->_tmp5_ = g_strconcat ("Server returned ", _data_->_tmp4_, NULL);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp7_ = g_error_new_literal (TUBA_OOPSIE, TUBA_OOPSIE_INSTANCE, _data_->_tmp6_);
		_data_->_tmp8_ = _data_->_tmp7_;
		_g_free0 (_data_->_tmp6_);
		_data_->_inner_error0_ = _data_->_tmp8_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_state_ = 1;
	gdk_pixbuf_new_from_stream_async (_data_->in_stream, NULL, tuba_helper_image_decode_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp10_ = (GdkPixbuf*) gdk_pixbuf_new_from_stream_finish (_data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp9_ = _data_->_tmp10_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp11_ = gdk_pixbuf_apply_embedded_orientation (_data_->_tmp9_);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = gdk_texture_new_for_pixbuf (_data_->_tmp12_);
	_data_->_tmp14_ = (GdkPaintable*) _data_->_tmp13_;
	_g_object_unref0 (_data_->_tmp12_);
	_data_->result = _data_->_tmp14_;
	_g_object_unref0 (_data_->_tmp9_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
tuba_helper_image_clear_cache (void)
{
	TubaHelperImage* _tmp0_;
	TubaHelperImage* _tmp1_;
	SoupCache* _tmp2_;
	_tmp0_ = tuba_helper_image_new ();
	_tmp1_ = _tmp0_;
	_tuba_helper_image_unref0 (_tmp1_);
	_tmp2_ = tuba_helper_image_cache;
	soup_cache_clear (_tmp2_);
}

void
tuba_helper_image_flush_cache (void)
{
	TubaHelperImage* _tmp0_;
	TubaHelperImage* _tmp1_;
	SoupCache* _tmp2_;
	SoupCache* _tmp3_;
	_tmp0_ = tuba_helper_image_new ();
	_tmp1_ = _tmp0_;
	_tuba_helper_image_unref0 (_tmp1_);
	_tmp2_ = tuba_helper_image_cache;
	soup_cache_flush (_tmp2_);
	_tmp3_ = tuba_helper_image_cache;
	soup_cache_dump (_tmp3_);
}

static void
tuba_helper_image_on_proxy_change (void)
{
	SoupSession* _tmp0_;
	TubaApplication* _tmp1_;
	GProxyResolver* _tmp2_;
	GProxyResolver* _tmp3_;
	_tmp0_ = tuba_helper_image_session;
	_tmp1_ = tuba_app;
	_tmp2_ = tuba_application_get_proxy (_tmp1_);
	_tmp3_ = _tmp2_;
	soup_session_set_proxy_resolver (_tmp0_, _tmp3_);
}

static void
tuba_helper_image_request_bytes_data_free (gpointer _data)
{
	TubaHelperImageRequestBytesData* _data_;
	_data_ = _data;
	_g_free0 (_data_->url);
	_g_bytes_unref0 (_data_->result);
	g_slice_free (TubaHelperImageRequestBytesData, _data_);
}

void
tuba_helper_image_request_bytes (const gchar* url,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	TubaHelperImageRequestBytesData* _data_;
	gchar* _tmp0_;
	g_return_if_fail (url != NULL);
	_data_ = g_slice_new0 (TubaHelperImageRequestBytesData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_helper_image_request_bytes_data_free);
	_tmp0_ = g_strdup (url);
	_g_free0 (_data_->url);
	_data_->url = _tmp0_;
	tuba_helper_image_request_bytes_co (_data_);
}

GBytes*
tuba_helper_image_request_bytes_finish (GAsyncResult* _res_)
{
	GBytes* result;
	TubaHelperImageRequestBytesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
tuba_helper_image_request_bytes_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	TubaHelperImageRequestBytesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_helper_image_request_bytes_co (_data_);
}

static gboolean
tuba_helper_image_request_bytes_co (TubaHelperImageRequestBytesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = tuba_helper_image_new ();
	_data_->_tmp1_ = _data_->_tmp0_;
	_tuba_helper_image_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = soup_message_new ("GET", _data_->url);
	_data_->download_msg = _data_->_tmp2_;
	{
		_data_->_tmp4_ = tuba_helper_image_session;
		_data_->_state_ = 1;
		soup_session_send_and_read_async (_data_->_tmp4_, _data_->download_msg, 0, NULL, tuba_helper_image_request_bytes_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp5_ = soup_session_send_and_read_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp3_ = _data_->_tmp5_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp6_ = _data_->_tmp3_;
		_data_->_tmp3_ = NULL;
		_data_->result = _data_->_tmp6_;
		_g_bytes_unref0 (_data_->_tmp3_);
		_g_object_unref0 (_data_->download_msg);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = string_to_string (_data_->url);
		_data_->_tmp8_ = _data_->e;
		_data_->_tmp9_ = _data_->_tmp8_->message;
		_data_->_tmp10_ = string_to_string (_data_->_tmp9_);
		_data_->_tmp11_ = g_strconcat ("Failed to download and read image at \"", _data_->_tmp7_, "\": ", _data_->_tmp10_, NULL);
		_data_->_tmp12_ = _data_->_tmp11_;
		g_warning ("Image.vala:57: %s", _data_->_tmp12_);
		_g_free0 (_data_->_tmp12_);
		_data_->result = NULL;
		_g_error_free0 (_data_->e);
		_g_object_unref0 (_data_->download_msg);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	_g_object_unref0 (_data_->download_msg);
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
	g_clear_error (&_data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
tuba_helper_image_fetch_paintable_data_free (gpointer _data)
{
	TubaHelperImageFetchPaintableData* _data_;
	_data_ = _data;
	_g_free0 (_data_->url);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	g_slice_free (TubaHelperImageFetchPaintableData, _data_);
}

static void
tuba_helper_image_fetch_paintable (const gchar* url,
                                   gboolean disable_cache,
                                   GCancellable* cancellable,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	TubaHelperImageFetchPaintableData* _data_;
	gchar* _tmp0_;
	GCancellable* _tmp1_;
	g_return_if_fail (url != NULL);
	_data_ = g_slice_new0 (TubaHelperImageFetchPaintableData);
	_data_->_async_result = g_task_new (NULL, cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_helper_image_fetch_paintable_data_free);
	_tmp0_ = g_strdup (url);
	_g_free0 (_data_->url);
	_data_->url = _tmp0_;
	_data_->disable_cache = disable_cache;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	tuba_helper_image_fetch_paintable_co (_data_);
}

static GdkPaintable*
tuba_helper_image_fetch_paintable_finish (GAsyncResult* _res_)
{
	GdkPaintable* result;
	TubaHelperImageFetchPaintableData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
tuba_helper_image_fetch_paintable_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	TubaHelperImageFetchPaintableData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_helper_image_fetch_paintable_co (_data_);
}

static gboolean
tuba_helper_image_fetch_paintable_co (TubaHelperImageFetchPaintableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = soup_message_new ("GET", _data_->url);
	_data_->download_msg = _data_->_tmp0_;
	if (_data_->disable_cache) {
		_data_->_tmp1_ = _data_->download_msg;
		soup_message_disable_feature (_data_->_tmp1_, soup_cache_get_type ());
	}
	{
		_data_->_tmp2_ = tuba_helper_image_session;
		_data_->_tmp3_ = _data_->download_msg;
		_data_->_state_ = 1;
		soup_session_send_async (_data_->_tmp2_, _data_->_tmp3_, 0, _data_->cancellable, tuba_helper_image_fetch_paintable_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp4_ = soup_session_send_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error0_);
		_data_->in_stream = _data_->_tmp4_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			if (g_error_matches (_data_->_inner_error0_, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
				goto __catch0_g_io_error_cancelled;
			}
			goto __catch0_g_error;
		}
		_data_->_tmp6_ = _data_->download_msg;
		_data_->_tmp7_ = _data_->in_stream;
		_data_->_state_ = 2;
		tuba_helper_image_decode (_data_->_tmp6_, _data_->_tmp7_, tuba_helper_image_fetch_paintable_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp8_ = tuba_helper_image_decode_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp5_ = _data_->_tmp8_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->in_stream);
			if (g_error_matches (_data_->_inner_error0_, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
				goto __catch0_g_io_error_cancelled;
			}
			goto __catch0_g_error;
		}
		_data_->_tmp9_ = _data_->_tmp5_;
		_data_->_tmp5_ = NULL;
		_data_->result = _data_->_tmp9_;
		_g_object_unref0 (_data_->_tmp5_);
		_g_object_unref0 (_data_->in_stream);
		_g_object_unref0 (_data_->download_msg);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	goto __finally0;
	__catch0_g_io_error_cancelled:
	{
		g_clear_error (&_data_->_inner_error0_);
		g_debug ("Image.vala:69: Message is cancelled.");
		_data_->result = NULL;
		_g_object_unref0 (_data_->download_msg);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp10_ = string_to_string (_data_->url);
		_data_->_tmp11_ = _data_->e;
		_data_->_tmp12_ = _data_->_tmp11_->message;
		_data_->_tmp13_ = string_to_string (_data_->_tmp12_);
		_data_->_tmp14_ = g_strconcat ("Failed to download image at \"", _data_->_tmp10_, "\": ", _data_->_tmp13_, NULL);
		_data_->_tmp15_ = _data_->_tmp14_;
		g_warning ("Image.vala:72: %s", _data_->_tmp15_);
		_g_free0 (_data_->_tmp15_);
		_data_->result = NULL;
		_g_error_free0 (_data_->e);
		_g_object_unref0 (_data_->download_msg);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	_g_object_unref0 (_data_->download_msg);
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
	g_clear_error (&_data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static Block56Data*
block56_data_ref (Block56Data* _data56_)
{
	g_atomic_int_inc (&_data56_->_ref_count_);
	return _data56_;
}

static void
block56_data_unref (void * _userdata_)
{
	Block56Data* _data56_;
	_data56_ = (Block56Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data56_->_ref_count_)) {
		_g_free0 (_data56_->blurhash);
		(_data56_->cb_target_destroy_notify == NULL) ? NULL : (_data56_->cb_target_destroy_notify (_data56_->cb_target), NULL);
		_data56_->cb = NULL;
		_data56_->cb_target = NULL;
		_data56_->cb_target_destroy_notify = NULL;
		g_slice_free (Block56Data, _data56_);
	}
}

static gboolean
___lambda10_ (Block56Data* _data56_)
{
	gboolean result;
	if (!_data56_->has_loaded) {
		GdkPaintable* _tmp0_;
		GdkPaintable* _tmp1_;
		_tmp0_ = tuba_helper_blurhash_decode (_data56_->blurhash);
		_tmp1_ = _tmp0_;
		_data56_->cb (_tmp1_, _data56_->cb_target);
		_g_object_unref0 (_tmp1_);
	}
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
____lambda10__gsource_func (gpointer self)
{
	gboolean result;
	result = ___lambda10_ (self);
	return result;
}

static void
__lambda11_ (Block56Data* _data56_,
             GObject* obj,
             GAsyncResult* res)
{
	GdkPaintable* _result_ = NULL;
	GdkPaintable* _tmp0_;
	g_return_if_fail (res != NULL);
	_tmp0_ = tuba_helper_image_fetch_paintable_finish (res);
	_result_ = _tmp0_;
	_data56_->has_loaded = TRUE;
	_data56_->cb (_result_, _data56_->cb_target);
	_g_object_unref0 (_result_);
}

static void
___lambda11__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda11_ (self, source_object, res);
	block56_data_unref (self);
}

void
tuba_helper_image_request_paintable (const gchar* url,
                                     const gchar* blurhash,
                                     gboolean disable_cache,
                                     TubaHelperImageOnItemChangedFn cb,
                                     gpointer cb_target,
                                     GDestroyNotify cb_target_destroy_notify,
                                     GCancellable* cancellable)
{
	Block56Data* _data56_;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	TubaHelperImage* _tmp2_;
	TubaHelperImage* _tmp3_;
	gboolean _tmp4_ = FALSE;
	_data56_ = g_slice_new0 (Block56Data);
	_data56_->_ref_count_ = 1;
	_tmp0_ = g_strdup (blurhash);
	_g_free0 (_data56_->blurhash);
	_data56_->blurhash = _tmp0_;
	(_data56_->cb_target_destroy_notify == NULL) ? NULL : (_data56_->cb_target_destroy_notify (_data56_->cb_target), NULL);
	_data56_->cb = NULL;
	_data56_->cb_target = NULL;
	_data56_->cb_target_destroy_notify = NULL;
	_data56_->cb = cb;
	_data56_->cb_target = cb_target;
	_data56_->cb_target_destroy_notify = cb_target_destroy_notify;
	if (url == NULL) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = g_strcmp0 (url, "") == 0;
	}
	if (_tmp1_) {
		block56_data_unref (_data56_);
		_data56_ = NULL;
		return;
	}
	_tmp2_ = tuba_helper_image_new ();
	_tmp3_ = _tmp2_;
	_tuba_helper_image_unref0 (_tmp3_);
	_data56_->has_loaded = FALSE;
	_data56_->cb (NULL, _data56_->cb_target);
	if (_data56_->blurhash != NULL) {
		TubaSettings* _tmp5_;
		gboolean _tmp6_;
		gboolean _tmp7_;
		_tmp5_ = tuba_settings;
		_tmp6_ = tuba_settings_get_use_blurhash (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp4_ = _tmp7_;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ____lambda10__gsource_func, block56_data_ref (_data56_), block56_data_unref);
	}
	tuba_helper_image_fetch_paintable (url, disable_cache, cancellable, ___lambda11__gasync_ready_callback, block56_data_ref (_data56_));
	block56_data_unref (_data56_);
	_data56_ = NULL;
}

GdkPaintable*
tuba_helper_image_lookup_cache (const gchar* uri)
{
	GError* _inner_error0_ = NULL;
	GdkPaintable* result;
	g_return_val_if_fail (uri != NULL, NULL);
	{
		GdkTexture* _tmp0_ = NULL;
		SoupCache* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GHashFunc _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		GdkTexture* _tmp10_;
		GdkTexture* _tmp11_;
		GdkTexture* _tmp12_;
		_tmp1_ = tuba_helper_image_cache;
		g_object_get (_tmp1_, "cache-dir", &_tmp2_, NULL);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		_tmp5_ = g_str_hash;
		_tmp6_ = g_strdup_printf ("%u", _tmp5_ (uri));
		_tmp7_ = _tmp6_;
		_tmp8_ = g_build_path (G_DIR_SEPARATOR_S, _tmp4_, _tmp7_, NULL);
		_tmp9_ = _tmp8_;
		_tmp10_ = gdk_texture_new_from_filename (_tmp9_, &_inner_error0_);
		_tmp11_ = _tmp10_;
		_g_free0 (_tmp9_);
		_g_free0 (_tmp7_);
		_g_free0 (_tmp4_);
		_tmp0_ = _tmp11_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp12_ = _tmp0_;
		_tmp0_ = NULL;
		result = (GdkPaintable*) _tmp12_;
		_g_object_unref0 (_tmp0_);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		result = NULL;
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

TubaHelperImage*
tuba_helper_image_construct (GType object_type)
{
	TubaHelperImage* self = NULL;
	self = (TubaHelperImage*) g_type_create_instance (object_type);
	return self;
}

TubaHelperImage*
tuba_helper_image_new (void)
{
	return tuba_helper_image_construct (TUBA_HELPER_TYPE_IMAGE);
}

static void
_tuba_helper_image_on_proxy_change_g_object_notify (GObject* _sender,
                                                    GParamSpec* pspec,
                                                    gpointer self)
{
	tuba_helper_image_on_proxy_change ();
}

static void
tuba_helper_value_image_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
tuba_helper_value_image_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		tuba_helper_image_unref (value->data[0].v_pointer);
	}
}

static void
tuba_helper_value_image_copy_value (const GValue* src_value,
                                    GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = tuba_helper_image_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
tuba_helper_value_image_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
tuba_helper_value_image_collect_value (GValue* value,
                                       guint n_collect_values,
                                       GTypeCValue* collect_values,
                                       guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		TubaHelperImage * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = tuba_helper_image_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
tuba_helper_value_image_lcopy_value (const GValue* value,
                                     guint n_collect_values,
                                     GTypeCValue* collect_values,
                                     guint collect_flags)
{
	TubaHelperImage ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = tuba_helper_image_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
tuba_helper_param_spec_image (const gchar* name,
                              const gchar* nick,
                              const gchar* blurb,
                              GType object_type,
                              GParamFlags flags)
{
	TubaHelperParamSpecImage* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TUBA_HELPER_TYPE_IMAGE), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
tuba_helper_value_get_image (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TUBA_HELPER_TYPE_IMAGE), NULL);
	return value->data[0].v_pointer;
}

void
tuba_helper_value_set_image (GValue* value,
                             gpointer v_object)
{
	TubaHelperImage * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TUBA_HELPER_TYPE_IMAGE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TUBA_HELPER_TYPE_IMAGE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		tuba_helper_image_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		tuba_helper_image_unref (old);
	}
}

void
tuba_helper_value_take_image (GValue* value,
                              gpointer v_object)
{
	TubaHelperImage * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TUBA_HELPER_TYPE_IMAGE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TUBA_HELPER_TYPE_IMAGE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		tuba_helper_image_unref (old);
	}
}

static void
tuba_helper_image_class_init (TubaHelperImageClass * klass,
                              gpointer klass_data)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	SoupCache* _tmp3_;
	SoupCache* _tmp4_;
	SoupCache* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	SoupSession* _tmp21_ = NULL;
	SoupSession* _tmp22_;
	SoupCache* _tmp23_;
	TubaApplication* _tmp24_;
	tuba_helper_image_parent_class = g_type_class_peek_parent (klass);
	((TubaHelperImageClass *) klass)->finalize = tuba_helper_image_finalize;
	_tmp0_ = tuba_cache_path;
	_tmp1_ = g_build_path (G_DIR_SEPARATOR_S, _tmp0_, "soup", "media", NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = soup_cache_new (_tmp2_, SOUP_CACHE_SINGLE_USER);
	_g_object_unref0 (tuba_helper_image_cache);
	tuba_helper_image_cache = _tmp3_;
	_g_free0 (_tmp2_);
	_tmp4_ = tuba_helper_image_cache;
	soup_cache_load (_tmp4_);
	_tmp5_ = tuba_helper_image_cache;
	soup_cache_set_max_size (_tmp5_, (guint) ((1024 * 1024) * 100));
	_tmp6_ = string_to_string (BUILD_NAME);
	_tmp7_ = string_to_string (BUILD_VERSION);
	_tmp8_ = g_strdup_printf ("%u", soup_get_major_version ());
	_tmp9_ = _tmp8_;
	_tmp10_ = g_strdup_printf ("%u", soup_get_minor_version ());
	_tmp11_ = _tmp10_;
	_tmp12_ = g_strdup_printf ("%u", soup_get_micro_version ());
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strdup_printf ("%i", SOUP_MAJOR_VERSION);
	_tmp15_ = _tmp14_;
	_tmp16_ = g_strdup_printf ("%i", SOUP_MINOR_VERSION);
	_tmp17_ = _tmp16_;
	_tmp18_ = g_strdup_printf ("%i", SOUP_MICRO_VERSION);
	_tmp19_ = _tmp18_;
	_tmp20_ = g_strconcat (_tmp6_, "/", _tmp7_, " libsoup/", _tmp9_, ".", _tmp11_, ".", _tmp13_, " (", _tmp15_, ".", _tmp17_, ".", _tmp19_, ")", NULL);
	_tmp21_ = soup_session_new_with_options ("max-conns", 64, "max-conns-per-host", 64, NULL);
	soup_session_set_user_agent (_tmp21_, _tmp20_);
	_g_free0 (_tmp20_);
	_g_object_unref0 (tuba_helper_image_session);
	tuba_helper_image_session = _tmp21_;
	_g_free0 (_tmp19_);
	_g_free0 (_tmp17_);
	_g_free0 (_tmp15_);
	_g_free0 (_tmp13_);
	_g_free0 (_tmp11_);
	_g_free0 (_tmp9_);
	_tmp22_ = tuba_helper_image_session;
	_tmp23_ = tuba_helper_image_cache;
	soup_session_add_feature (_tmp22_, (SoupSessionFeature*) _tmp23_);
	_tmp24_ = tuba_app;
	g_signal_connect ((GObject*) _tmp24_, "notify::proxy", (GCallback) _tuba_helper_image_on_proxy_change_g_object_notify, NULL);
}

static void
tuba_helper_image_instance_init (TubaHelperImage * self,
                                 gpointer klass)
{
	self->ref_count = 1;
}

static void
tuba_helper_image_finalize (TubaHelperImage * obj)
{
	TubaHelperImage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_HELPER_TYPE_IMAGE, TubaHelperImage);
	g_signal_handlers_destroy (self);
}

 G_GNUC_NO_INLINE static GType
tuba_helper_image_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { tuba_helper_value_image_init, tuba_helper_value_image_free_value, tuba_helper_value_image_copy_value, tuba_helper_value_image_peek_pointer, "p", tuba_helper_value_image_collect_value, "p", tuba_helper_value_image_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (TubaHelperImageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_helper_image_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaHelperImage), 0, (GInstanceInitFunc) tuba_helper_image_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 tuba_helper_image_type_id;
	tuba_helper_image_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TubaHelperImage", &g_define_type_info, &g_define_type_fundamental_info, G_TYPE_FLAG_NONE);
	return tuba_helper_image_type_id;
}

GType
tuba_helper_image_get_type (void)
{
	static GType tuba_helper_image_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_helper_image_type_id__once)) {
		GType tuba_helper_image_type_id;
		tuba_helper_image_type_id = tuba_helper_image_get_type_once ();
		g_once_init_leave_pointer (&tuba_helper_image_type_id__once, tuba_helper_image_type_id);
	}
	return tuba_helper_image_type_id__once;
}

gpointer
tuba_helper_image_ref (gpointer instance)
{
	TubaHelperImage * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
tuba_helper_image_unref (gpointer instance)
{
	TubaHelperImage * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		TUBA_HELPER_IMAGE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

