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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <libsoup/soup.h>
#include <json-glib/json-glib.h>
#include <gdk/gdk.h>
#include <gee.h>
#include <glib/gi18n-lib.h>

#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_WIDGETS_TYPE_BOOK_WYRM_PAGE (tuba_widgets_book_wyrm_page_get_type ())
#define TUBA_WIDGETS_BOOK_WYRM_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE, TubaWidgetsBookWyrmPage))
#define TUBA_WIDGETS_BOOK_WYRM_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE, TubaWidgetsBookWyrmPageClass))
#define TUBA_WIDGETS_IS_BOOK_WYRM_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE))
#define TUBA_WIDGETS_IS_BOOK_WYRM_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE))
#define TUBA_WIDGETS_BOOK_WYRM_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE, TubaWidgetsBookWyrmPageClass))

typedef struct _TubaWidgetsBookWyrmPage TubaWidgetsBookWyrmPage;
typedef struct _TubaWidgetsBookWyrmPageClass TubaWidgetsBookWyrmPageClass;
typedef struct _TubaWidgetsBookWyrmPagePrivate TubaWidgetsBookWyrmPagePrivate;

#define TUBA_TYPE_ENTITY (tuba_entity_get_type ())
#define TUBA_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ENTITY, TubaEntity))
#define TUBA_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ENTITY, TubaEntityClass))
#define TUBA_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ENTITY))
#define TUBA_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ENTITY))
#define TUBA_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ENTITY, TubaEntityClass))

typedef struct _TubaEntity TubaEntity;
typedef struct _TubaEntityClass TubaEntityClass;

#define TUBA_API_TYPE_BOOK_WYRM (tuba_api_book_wyrm_get_type ())
#define TUBA_API_BOOK_WYRM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_BOOK_WYRM, TubaAPIBookWyrm))
#define TUBA_API_BOOK_WYRM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_BOOK_WYRM, TubaAPIBookWyrmClass))
#define TUBA_API_IS_BOOK_WYRM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_BOOK_WYRM))
#define TUBA_API_IS_BOOK_WYRM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_BOOK_WYRM))
#define TUBA_API_BOOK_WYRM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_BOOK_WYRM, TubaAPIBookWyrmClass))

typedef struct _TubaAPIBookWyrm TubaAPIBookWyrm;
typedef struct _TubaAPIBookWyrmClass TubaAPIBookWyrmClass;
enum  {
	TUBA_WIDGETS_BOOK_WYRM_PAGE_0_PROPERTY,
	TUBA_WIDGETS_BOOK_WYRM_PAGE_BOOK_PROPERTY,
	TUBA_WIDGETS_BOOK_WYRM_PAGE_SELECTABLE_PROPERTY,
	TUBA_WIDGETS_BOOK_WYRM_PAGE_NUM_PROPERTIES
};
static GParamSpec* tuba_widgets_book_wyrm_page_properties[TUBA_WIDGETS_BOOK_WYRM_PAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define TUBA_TYPE_REQUEST_V2 (tuba_request_v2_get_type ())
#define TUBA_REQUEST_V2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_REQUEST_V2, TubaRequestV2))
#define TUBA_REQUEST_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_REQUEST_V2, TubaRequestV2Class))
#define TUBA_IS_REQUEST_V2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_REQUEST_V2))
#define TUBA_IS_REQUEST_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_REQUEST_V2))
#define TUBA_REQUEST_V2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_REQUEST_V2, TubaRequestV2Class))

typedef struct _TubaRequestV2 TubaRequestV2;
typedef struct _TubaRequestV2Class TubaRequestV2Class;
typedef enum  {
	TUBA_REQUEST_V2_METHOD_GET,
	TUBA_REQUEST_V2_METHOD_POST,
	TUBA_REQUEST_V2_METHOD_PUT,
	TUBA_REQUEST_V2_METHOD_DELETE,
	TUBA_REQUEST_V2_METHOD_PATCH
} TubaRequestV2Method;

#define TUBA_REQUEST_V2_TYPE_METHOD (tuba_request_v2_method_get_type ())

#define TUBA_TYPE_OOPSIE (tuba_oopsie_get_type ())

#define TUBA_TYPE_NETWORK (tuba_network_get_type ())
#define TUBA_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_NETWORK, TubaNetwork))
#define TUBA_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_NETWORK, TubaNetworkClass))
#define TUBA_IS_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_NETWORK))
#define TUBA_IS_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_NETWORK))
#define TUBA_NETWORK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_NETWORK, TubaNetworkClass))

typedef struct _TubaNetwork TubaNetwork;
typedef struct _TubaNetworkClass TubaNetworkClass;

#define TUBA_API_TYPE_BOOK_WYRM_AUTHOR (tuba_api_book_wyrm_author_get_type ())
#define TUBA_API_BOOK_WYRM_AUTHOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_BOOK_WYRM_AUTHOR, TubaAPIBookWyrmAuthor))
#define TUBA_API_BOOK_WYRM_AUTHOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_BOOK_WYRM_AUTHOR, TubaAPIBookWyrmAuthorClass))
#define TUBA_API_IS_BOOK_WYRM_AUTHOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_BOOK_WYRM_AUTHOR))
#define TUBA_API_IS_BOOK_WYRM_AUTHOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_BOOK_WYRM_AUTHOR))
#define TUBA_API_BOOK_WYRM_AUTHOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_BOOK_WYRM_AUTHOR, TubaAPIBookWyrmAuthorClass))

typedef struct _TubaAPIBookWyrmAuthor TubaAPIBookWyrmAuthor;
typedef struct _TubaAPIBookWyrmAuthorClass TubaAPIBookWyrmAuthorClass;
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
typedef struct _TubaWidgetsBookWyrmPageFetchAuthorData TubaWidgetsBookWyrmPageFetchAuthorData;

#define TUBA_API_TYPE_BOOK_WYRM_COVER (tuba_api_book_wyrm_cover_get_type ())
#define TUBA_API_BOOK_WYRM_COVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_BOOK_WYRM_COVER, TubaAPIBookWyrmCover))
#define TUBA_API_BOOK_WYRM_COVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_BOOK_WYRM_COVER, TubaAPIBookWyrmCoverClass))
#define TUBA_API_IS_BOOK_WYRM_COVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_BOOK_WYRM_COVER))
#define TUBA_API_IS_BOOK_WYRM_COVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_BOOK_WYRM_COVER))
#define TUBA_API_BOOK_WYRM_COVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_BOOK_WYRM_COVER, TubaAPIBookWyrmCoverClass))

typedef struct _TubaAPIBookWyrmCover TubaAPIBookWyrmCover;
typedef struct _TubaAPIBookWyrmCoverClass TubaAPIBookWyrmCoverClass;
typedef void (*TubaHelperImageOnItemChangedFn) (GdkPaintable* data, gpointer user_data);

struct _TubaWidgetsBookWyrmPage {
	GtkBox parent_instance;
	TubaWidgetsBookWyrmPagePrivate * priv;
};

struct _TubaWidgetsBookWyrmPageClass {
	GtkBoxClass parent_class;
};

struct _TubaWidgetsBookWyrmPagePrivate {
	TubaAPIBookWyrm* _book;
	GtkPicture* cover;
	GtkLabel* title;
	GtkLabel* authors;
	GtkLabel* isbn;
	GtkButton* ol_btn;
	GtkLabel* description;
	GtkLabel* date;
	gchar** author_labels;
	gint author_labels_length1;
	gint _author_labels_size_;
};

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 _TubaWidgetsBookWyrmPageFetchAuthorData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TubaWidgetsBookWyrmPage* self;
	gchar* author;
	TubaRequestV2* req;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	TubaRequestV2* _tmp3_;
	TubaRequestV2* _tmp4_;
	GInputStream* in_stream;
	TubaRequestV2* _tmp5_;
	GInputStream* _tmp6_;
	JsonParser* parser;
	GInputStream* _tmp7_;
	JsonParser* _tmp8_;
	JsonNode* node;
	TubaNetwork* _tmp9_;
	JsonParser* _tmp10_;
	JsonNode* _tmp11_;
	TubaAPIBookWyrmAuthor* author_obj;
	JsonNode* _tmp12_;
	TubaAPIBookWyrmAuthor* _tmp13_;
	TubaAPIBookWyrmAuthor* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	GtkLabel* _tmp17_;
	TubaAPIBookWyrmAuthor* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	TubaAPIBookWyrmAuthor* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	GtkLabel* _tmp26_;
	GError* _inner_error0_;
};

static gint TubaWidgetsBookWyrmPage_private_offset;
static gpointer tuba_widgets_book_wyrm_page_parent_class = NULL;
VALA_EXTERN TubaNetwork* tuba_network;

VALA_EXTERN GType tuba_widgets_book_wyrm_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsBookWyrmPage, g_object_unref)
VALA_EXTERN GType tuba_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaEntity, g_object_unref)
VALA_EXTERN GType tuba_api_book_wyrm_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIBookWyrm, g_object_unref)
static void tuba_widgets_book_wyrm_page_fetch_author_data_free (gpointer _data);
static void tuba_widgets_book_wyrm_page_fetch_author (TubaWidgetsBookWyrmPage* self,
                                               const gchar* author,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
static void tuba_widgets_book_wyrm_page_fetch_author_finish (TubaWidgetsBookWyrmPage* self,
                                                      GAsyncResult* _res_);
static gboolean tuba_widgets_book_wyrm_page_fetch_author_co (TubaWidgetsBookWyrmPageFetchAuthorData* _data_);
VALA_EXTERN GType tuba_request_v2_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaRequestV2, g_object_unref)
VALA_EXTERN GType tuba_request_v2_method_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TubaRequestV2* tuba_request_v2_new (const gchar* url,
                                    TubaRequestV2Method method);
VALA_EXTERN TubaRequestV2* tuba_request_v2_construct (GType object_type,
                                          const gchar* url,
                                          TubaRequestV2Method method);
VALA_EXTERN void tuba_request_v2_exec (TubaRequestV2* self,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_);
VALA_EXTERN GQuark tuba_oopsie_quark (void);
VALA_EXTERN GType tuba_oopsie_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GInputStream* tuba_request_v2_exec_finish (TubaRequestV2* self,
                                           GAsyncResult* _res_,
                                           SoupMessageHeaders** response_headers,
                                           GError** error);
static void tuba_widgets_book_wyrm_page_fetch_author_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_);
VALA_EXTERN void tuba_network_get_parser_from_inputstream_async (GInputStream* in_stream,
                                                     GCancellable* cancellable,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_);
VALA_EXTERN JsonParser* tuba_network_get_parser_from_inputstream_finish (GAsyncResult* _res_,
                                                             GError** error);
VALA_EXTERN GType tuba_network_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaNetwork, g_object_unref)
VALA_EXTERN JsonNode* tuba_network_parse_node (TubaNetwork* self,
                                   JsonParser* parser);
VALA_EXTERN GType tuba_api_book_wyrm_author_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIBookWyrmAuthor, g_object_unref)
VALA_EXTERN TubaAPIBookWyrmAuthor* tuba_api_book_wyrm_author_from (JsonNode* node,
                                                       GError** error);
static void _vala_JsonNode_free (JsonNode* self);
VALA_EXTERN const gchar* tuba_api_book_wyrm_author_get_id (TubaAPIBookWyrmAuthor* self);
static gchar* tuba_widgets_book_wyrm_page_generate_authors_label (TubaWidgetsBookWyrmPage* self,
                                                           const gchar* author,
                                                           const gchar* author_url);
VALA_EXTERN const gchar* tuba_api_book_wyrm_author_get_name (TubaAPIBookWyrmAuthor* self);
VALA_EXTERN TubaWidgetsBookWyrmPage* tuba_widgets_book_wyrm_page_new (TubaAPIBookWyrm* t_obj);
VALA_EXTERN TubaWidgetsBookWyrmPage* tuba_widgets_book_wyrm_page_construct (GType object_type,
                                                                TubaAPIBookWyrm* t_obj);
static void tuba_widgets_book_wyrm_page_set_book (TubaWidgetsBookWyrmPage* self,
                                           TubaAPIBookWyrm* value);
VALA_EXTERN const gchar* tuba_api_book_wyrm_get_title (TubaAPIBookWyrm* self);
VALA_EXTERN GType tuba_api_book_wyrm_cover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIBookWyrmCover, g_object_unref)
VALA_EXTERN TubaAPIBookWyrmCover* tuba_api_book_wyrm_get_cover (TubaAPIBookWyrm* self);
VALA_EXTERN const gchar* tuba_api_book_wyrm_cover_get_url (TubaAPIBookWyrmCover* self);
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 void tuba_widgets_book_wyrm_page_on_cache_response (TubaWidgetsBookWyrmPage* self,
                                                    GdkPaintable* data);
static void _tuba_widgets_book_wyrm_page_on_cache_response_tuba_helper_image_on_item_changed_fn (GdkPaintable* data,
                                                                                          gpointer self);
VALA_EXTERN const gchar* tuba_api_book_wyrm_cover_get_name (TubaAPIBookWyrmCover* self);
VALA_EXTERN GeeArrayList* tuba_api_book_wyrm_get_authors (TubaAPIBookWyrm* self);
VALA_EXTERN const gchar* tuba_api_book_wyrm_get_isbn13 (TubaAPIBookWyrm* self);
VALA_EXTERN const gchar* tuba_api_book_wyrm_get_openlibraryKey (TubaAPIBookWyrm* self);
VALA_EXTERN const gchar* tuba_api_book_wyrm_get_description (TubaAPIBookWyrm* self);
VALA_EXTERN gchar* tuba_utils_htmlx_remove_tags (const gchar* content);
VALA_EXTERN const gchar* tuba_api_book_wyrm_get_publishedDate (TubaAPIBookWyrm* self);
static gchar* tuba_widgets_book_wyrm_page_authors_markup (TubaWidgetsBookWyrmPage* self,
                                                   const gchar* author,
                                                   const gchar* author_url);
static void _vala_array_add132 (gchar** * array,
                         gint* length,
                         gint* size,
                         gchar* value);
static void tuba_widgets_book_wyrm_page_open_on_openlibrary (TubaWidgetsBookWyrmPage* self);
VALA_EXTERN void tuba_utils_host_open_url (const gchar* _uri,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_);
VALA_EXTERN gboolean tuba_utils_host_open_url_finish (GAsyncResult* _res_);
VALA_EXTERN TubaAPIBookWyrm* tuba_widgets_book_wyrm_page_get_book (TubaWidgetsBookWyrmPage* self);
static void _tuba_widgets_book_wyrm_page_open_on_openlibrary_gtk_button_clicked (GtkButton* _sender,
                                                                          gpointer self);
static void tuba_widgets_book_wyrm_page_open_on_bw (TubaWidgetsBookWyrmPage* self);
VALA_EXTERN const gchar* tuba_api_book_wyrm_get_id (TubaAPIBookWyrm* self);
static void _tuba_widgets_book_wyrm_page_open_on_bw_gtk_button_clicked (GtkButton* _sender,
                                                                 gpointer self);
VALA_EXTERN void tuba_widgets_book_wyrm_page_set_selectable (TubaWidgetsBookWyrmPage* self,
                                                 gboolean value);
static void tuba_widgets_book_wyrm_page_finalize (GObject * obj);
static GType tuba_widgets_book_wyrm_page_get_type_once (void);
static void _vala_tuba_widgets_book_wyrm_page_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec);
static void _vala_tuba_widgets_book_wyrm_page_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
tuba_widgets_book_wyrm_page_get_instance_private (TubaWidgetsBookWyrmPage* self)
{
	return G_STRUCT_MEMBER_P (self, TubaWidgetsBookWyrmPage_private_offset);
}

static void
tuba_widgets_book_wyrm_page_fetch_author_data_free (gpointer _data)
{
	TubaWidgetsBookWyrmPageFetchAuthorData* _data_;
	_data_ = _data;
	_g_free0 (_data_->author);
	_g_object_unref0 (_data_->self);
	g_slice_free (TubaWidgetsBookWyrmPageFetchAuthorData, _data_);
}

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

static void
tuba_widgets_book_wyrm_page_fetch_author (TubaWidgetsBookWyrmPage* self,
                                          const gchar* author,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	TubaWidgetsBookWyrmPageFetchAuthorData* _data_;
	TubaWidgetsBookWyrmPage* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (author != NULL);
	_data_ = g_slice_new0 (TubaWidgetsBookWyrmPageFetchAuthorData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_widgets_book_wyrm_page_fetch_author_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (author);
	_g_free0 (_data_->author);
	_data_->author = _tmp1_;
	tuba_widgets_book_wyrm_page_fetch_author_co (_data_);
}

static void
tuba_widgets_book_wyrm_page_fetch_author_finish (TubaWidgetsBookWyrmPage* self,
                                                 GAsyncResult* _res_)
{
	TubaWidgetsBookWyrmPageFetchAuthorData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

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_widgets_book_wyrm_page_fetch_author_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_)
{
	TubaWidgetsBookWyrmPageFetchAuthorData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_widgets_book_wyrm_page_fetch_author_co (_data_);
}

static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

static gboolean
tuba_widgets_book_wyrm_page_fetch_author_co (TubaWidgetsBookWyrmPageFetchAuthorData* _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_ = string_to_string (_data_->author);
	_data_->_tmp1_ = g_strconcat (_data_->_tmp0_, ".json", NULL);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = tuba_request_v2_new (_data_->_tmp2_, TUBA_REQUEST_V2_METHOD_GET);
	_data_->_tmp4_ = _data_->_tmp3_;
	_g_free0 (_data_->_tmp2_);
	_data_->req = _data_->_tmp4_;
	{
		_data_->_tmp5_ = _data_->req;
		_data_->_state_ = 1;
		tuba_request_v2_exec (_data_->_tmp5_, tuba_widgets_book_wyrm_page_fetch_author_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp6_ = tuba_request_v2_exec_finish (_data_->_tmp5_, _data_->_res_, NULL, &_data_->_inner_error0_);
		_data_->in_stream = _data_->_tmp6_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp7_ = _data_->in_stream;
		_data_->_state_ = 2;
		tuba_network_get_parser_from_inputstream_async (_data_->_tmp7_, NULL, tuba_widgets_book_wyrm_page_fetch_author_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp8_ = tuba_network_get_parser_from_inputstream_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->parser = _data_->_tmp8_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->in_stream);
			goto __catch0_g_error;
		}
		_data_->_tmp9_ = tuba_network;
		_data_->_tmp10_ = _data_->parser;
		_data_->_tmp11_ = tuba_network_parse_node (_data_->_tmp9_, _data_->_tmp10_);
		_data_->node = _data_->_tmp11_;
		_data_->_tmp12_ = _data_->node;
		_data_->_tmp13_ = tuba_api_book_wyrm_author_from (_data_->_tmp12_, &_data_->_inner_error0_);
		_data_->author_obj = _data_->_tmp13_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			__vala_JsonNode_free0 (_data_->node);
			_g_object_unref0 (_data_->parser);
			_g_object_unref0 (_data_->in_stream);
			goto __catch0_g_error;
		}
		_data_->_tmp14_ = _data_->author_obj;
		_data_->_tmp15_ = tuba_api_book_wyrm_author_get_id (_data_->_tmp14_);
		_data_->_tmp16_ = _data_->_tmp15_;
		if (g_strcmp0 (_data_->_tmp16_, _data_->author) == 0) {
			_data_->_tmp17_ = _data_->self->priv->authors;
			_data_->_tmp18_ = _data_->author_obj;
			_data_->_tmp19_ = tuba_api_book_wyrm_author_get_name (_data_->_tmp18_);
			_data_->_tmp20_ = _data_->_tmp19_;
			_data_->_tmp21_ = _data_->author_obj;
			_data_->_tmp22_ = tuba_api_book_wyrm_author_get_id (_data_->_tmp21_);
			_data_->_tmp23_ = _data_->_tmp22_;
			_data_->_tmp24_ = tuba_widgets_book_wyrm_page_generate_authors_label (_data_->self, _data_->_tmp20_, _data_->_tmp23_);
			_data_->_tmp25_ = _data_->_tmp24_;
			gtk_label_set_label (_data_->_tmp17_, _data_->_tmp25_);
			_g_free0 (_data_->_tmp25_);
		}
		_g_object_unref0 (_data_->author_obj);
		__vala_JsonNode_free0 (_data_->node);
		_g_object_unref0 (_data_->parser);
		_g_object_unref0 (_data_->in_stream);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
		_data_->_tmp26_ = _data_->self->priv->authors;
		gtk_widget_set_visible ((GtkWidget*) _data_->_tmp26_, FALSE);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->req);
		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;
	}
	_g_object_unref0 (_data_->req);
	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;
}

static void
_tuba_widgets_book_wyrm_page_on_cache_response_tuba_helper_image_on_item_changed_fn (GdkPaintable* data,
                                                                                     gpointer self)
{
	tuba_widgets_book_wyrm_page_on_cache_response ((TubaWidgetsBookWyrmPage*) self, data);
}

TubaWidgetsBookWyrmPage*
tuba_widgets_book_wyrm_page_construct (GType object_type,
                                       TubaAPIBookWyrm* t_obj)
{
	TubaWidgetsBookWyrmPage * self = NULL;
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	TubaAPIBookWyrmCover* _tmp5_;
	TubaAPIBookWyrmCover* _tmp6_;
	gboolean _tmp30_ = FALSE;
	GeeArrayList* _tmp31_;
	GeeArrayList* _tmp32_;
	const gchar* _tmp48_;
	const gchar* _tmp49_;
	const gchar* _tmp57_;
	const gchar* _tmp58_;
	const gchar* _tmp60_;
	const gchar* _tmp61_;
	const gchar* _tmp68_;
	const gchar* _tmp69_;
	g_return_val_if_fail (t_obj != NULL, NULL);
	self = (TubaWidgetsBookWyrmPage*) g_object_new (object_type, NULL);
	tuba_widgets_book_wyrm_page_set_book (self, t_obj);
	_tmp0_ = self->priv->title;
	_tmp1_ = tuba_api_book_wyrm_get_title (t_obj);
	_tmp2_ = _tmp1_;
	gtk_label_set_label (_tmp0_, _tmp2_);
	_tmp5_ = tuba_api_book_wyrm_get_cover (t_obj);
	_tmp6_ = _tmp5_;
	if (_tmp6_ != NULL) {
		TubaAPIBookWyrmCover* _tmp7_;
		TubaAPIBookWyrmCover* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		_tmp7_ = tuba_api_book_wyrm_get_cover (t_obj);
		_tmp8_ = _tmp7_;
		_tmp9_ = tuba_api_book_wyrm_cover_get_url (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp4_ = _tmp10_ != NULL;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		TubaAPIBookWyrmCover* _tmp11_;
		TubaAPIBookWyrmCover* _tmp12_;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		_tmp11_ = tuba_api_book_wyrm_get_cover (t_obj);
		_tmp12_ = _tmp11_;
		_tmp13_ = tuba_api_book_wyrm_cover_get_url (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp3_ = g_strcmp0 (_tmp14_, "") != 0;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		TubaAPIBookWyrmCover* _tmp15_;
		TubaAPIBookWyrmCover* _tmp16_;
		const gchar* _tmp17_;
		const gchar* _tmp18_;
		TubaAPIBookWyrmCover* _tmp19_;
		TubaAPIBookWyrmCover* _tmp20_;
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		_tmp15_ = tuba_api_book_wyrm_get_cover (t_obj);
		_tmp16_ = _tmp15_;
		_tmp17_ = tuba_api_book_wyrm_cover_get_url (_tmp16_);
		_tmp18_ = _tmp17_;
		tuba_helper_image_request_paintable (_tmp18_, NULL, FALSE, _tuba_widgets_book_wyrm_page_on_cache_response_tuba_helper_image_on_item_changed_fn, g_object_ref (self), g_object_unref, NULL);
		_tmp19_ = tuba_api_book_wyrm_get_cover (t_obj);
		_tmp20_ = _tmp19_;
		_tmp21_ = tuba_api_book_wyrm_cover_get_name (_tmp20_);
		_tmp22_ = _tmp21_;
		if (g_strcmp0 (_tmp22_, "") != 0) {
			GtkPicture* _tmp23_;
			GtkPicture* _tmp24_;
			TubaAPIBookWyrmCover* _tmp25_;
			TubaAPIBookWyrmCover* _tmp26_;
			const gchar* _tmp27_;
			const gchar* _tmp28_;
			_tmp23_ = self->priv->cover;
			_tmp24_ = self->priv->cover;
			_tmp25_ = tuba_api_book_wyrm_get_cover (t_obj);
			_tmp26_ = _tmp25_;
			_tmp27_ = tuba_api_book_wyrm_cover_get_name (_tmp26_);
			_tmp28_ = _tmp27_;
			gtk_widget_set_tooltip_text ((GtkWidget*) _tmp24_, _tmp28_);
			gtk_picture_set_alternative_text (_tmp23_, _tmp28_);
		}
	} else {
		GtkPicture* _tmp29_;
		_tmp29_ = self->priv->cover;
		gtk_widget_set_visible ((GtkWidget*) _tmp29_, FALSE);
	}
	_tmp31_ = tuba_api_book_wyrm_get_authors (t_obj);
	_tmp32_ = _tmp31_;
	if (_tmp32_ != NULL) {
		GeeArrayList* _tmp33_;
		GeeArrayList* _tmp34_;
		gint _tmp35_;
		gint _tmp36_;
		_tmp33_ = tuba_api_book_wyrm_get_authors (t_obj);
		_tmp34_ = _tmp33_;
		_tmp35_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp34_);
		_tmp36_ = _tmp35_;
		_tmp30_ = _tmp36_ > 0;
	} else {
		_tmp30_ = FALSE;
	}
	if (_tmp30_) {
		{
			GeeArrayList* _author_list = NULL;
			GeeArrayList* _tmp37_;
			GeeArrayList* _tmp38_;
			gint _author_size = 0;
			GeeArrayList* _tmp39_;
			gint _tmp40_;
			gint _tmp41_;
			gint _author_index = 0;
			_tmp37_ = tuba_api_book_wyrm_get_authors (t_obj);
			_tmp38_ = _tmp37_;
			_author_list = _tmp38_;
			_tmp39_ = _author_list;
			_tmp40_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp39_);
			_tmp41_ = _tmp40_;
			_author_size = _tmp41_;
			_author_index = -1;
			while (TRUE) {
				gint _tmp42_;
				gint _tmp43_;
				gchar* author = NULL;
				GeeArrayList* _tmp44_;
				gpointer _tmp45_;
				const gchar* _tmp46_;
				_author_index = _author_index + 1;
				_tmp42_ = _author_index;
				_tmp43_ = _author_size;
				if (!(_tmp42_ < _tmp43_)) {
					break;
				}
				_tmp44_ = _author_list;
				_tmp45_ = gee_abstract_list_get ((GeeAbstractList*) _tmp44_, _author_index);
				author = (gchar*) _tmp45_;
				_tmp46_ = author;
				tuba_widgets_book_wyrm_page_fetch_author (self, _tmp46_, NULL, NULL);
				_g_free0 (author);
			}
		}
	} else {
		GtkLabel* _tmp47_;
		_tmp47_ = self->priv->authors;
		gtk_widget_set_visible ((GtkWidget*) _tmp47_, FALSE);
	}
	_tmp48_ = tuba_api_book_wyrm_get_isbn13 (t_obj);
	_tmp49_ = _tmp48_;
	if (g_strcmp0 (_tmp49_, "") != 0) {
		GtkLabel* _tmp50_;
		const gchar* _tmp51_;
		const gchar* _tmp52_;
		const gchar* _tmp53_;
		gchar* _tmp54_;
		gchar* _tmp55_;
		_tmp50_ = self->priv->isbn;
		_tmp51_ = tuba_api_book_wyrm_get_isbn13 (t_obj);
		_tmp52_ = _tmp51_;
		_tmp53_ = string_to_string (_tmp52_);
		_tmp54_ = g_strconcat ("ISBN: ", _tmp53_, NULL);
		_tmp55_ = _tmp54_;
		gtk_label_set_label (_tmp50_, _tmp55_);
		_g_free0 (_tmp55_);
	} else {
		GtkLabel* _tmp56_;
		_tmp56_ = self->priv->isbn;
		gtk_widget_set_visible ((GtkWidget*) _tmp56_, FALSE);
	}
	_tmp57_ = tuba_api_book_wyrm_get_openlibraryKey (t_obj);
	_tmp58_ = _tmp57_;
	if (g_strcmp0 (_tmp58_, "") == 0) {
		GtkButton* _tmp59_;
		_tmp59_ = self->priv->ol_btn;
		gtk_widget_set_visible ((GtkWidget*) _tmp59_, FALSE);
	}
	_tmp60_ = tuba_api_book_wyrm_get_description (t_obj);
	_tmp61_ = _tmp60_;
	if (g_strcmp0 (_tmp61_, "") != 0) {
		GtkLabel* _tmp62_;
		const gchar* _tmp63_;
		const gchar* _tmp64_;
		gchar* _tmp65_;
		gchar* _tmp66_;
		_tmp62_ = self->priv->description;
		_tmp63_ = tuba_api_book_wyrm_get_description (t_obj);
		_tmp64_ = _tmp63_;
		_tmp65_ = tuba_utils_htmlx_remove_tags (_tmp64_);
		_tmp66_ = _tmp65_;
		gtk_label_set_label (_tmp62_, _tmp66_);
		_g_free0 (_tmp66_);
	} else {
		GtkLabel* _tmp67_;
		_tmp67_ = self->priv->description;
		gtk_widget_set_visible ((GtkWidget*) _tmp67_, FALSE);
	}
	_tmp68_ = tuba_api_book_wyrm_get_publishedDate (t_obj);
	_tmp69_ = _tmp68_;
	if (g_strcmp0 (_tmp69_, "") != 0) {
		GtkLabel* _tmp70_;
		const gchar* _tmp71_;
		const gchar* _tmp72_;
		gchar* _tmp73_;
		gchar* _tmp74_;
		_tmp70_ = self->priv->date;
		_tmp71_ = tuba_api_book_wyrm_get_publishedDate (t_obj);
		_tmp72_ = _tmp71_;
		_tmp73_ = g_strdup_printf (_ ("Published: %s"), _tmp72_);
		_tmp74_ = _tmp73_;
		gtk_label_set_label (_tmp70_, _tmp74_);
		_g_free0 (_tmp74_);
	} else {
		GtkLabel* _tmp75_;
		_tmp75_ = self->priv->date;
		gtk_widget_set_visible ((GtkWidget*) _tmp75_, FALSE);
	}
	return self;
}

TubaWidgetsBookWyrmPage*
tuba_widgets_book_wyrm_page_new (TubaAPIBookWyrm* t_obj)
{
	return tuba_widgets_book_wyrm_page_construct (TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE, t_obj);
}

static gchar*
tuba_widgets_book_wyrm_page_authors_markup (TubaWidgetsBookWyrmPage* self,
                                            const gchar* author,
                                            const gchar* author_url)
{
	gboolean _tmp0_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (author != NULL, NULL);
	if (author_url != NULL) {
		_tmp0_ = g_strcmp0 (author_url, "") != 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		const gchar* _tmp1_;
		const gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp1_ = string_to_string (author_url);
		_tmp2_ = string_to_string (author);
		_tmp3_ = g_strconcat ("<a href=\"", _tmp1_, "\">", _tmp2_, "</a>", NULL);
		result = _tmp3_;
		return result;
	}
	_tmp4_ = g_strdup (author);
	result = _tmp4_;
	return result;
}

static void
_vala_array_add132 (gchar** * array,
                    gint* length,
                    gint* size,
                    gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gchar*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

static gchar*
tuba_widgets_book_wyrm_page_generate_authors_label (TubaWidgetsBookWyrmPage* self,
                                                    const gchar* author,
                                                    const gchar* author_url)
{
	gchar* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (author != NULL, NULL);
	_tmp0_ = tuba_widgets_book_wyrm_page_authors_markup (self, author, author_url);
	_vala_array_add132 (&self->priv->author_labels, &self->priv->author_labels_length1, &self->priv->_author_labels_size_, _tmp0_);
	_tmp1_ = self->priv->author_labels;
	_tmp1__length1 = self->priv->author_labels_length1;
	_tmp2_ = _vala_g_strjoinv (", ", _tmp1_, (gint) _tmp1__length1);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strdup_printf (_ ("by %s"), _tmp3_);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp3_);
	result = _tmp5_;
	return result;
}

static void
tuba_widgets_book_wyrm_page_on_cache_response (TubaWidgetsBookWyrmPage* self,
                                               GdkPaintable* data)
{
	GtkPicture* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->cover;
	gtk_picture_set_paintable (_tmp0_, data);
}

static void
tuba_widgets_book_wyrm_page_open_on_openlibrary (TubaWidgetsBookWyrmPage* self)
{
	TubaAPIBookWyrm* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_book;
	_tmp1_ = tuba_api_book_wyrm_get_openlibraryKey (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_to_string (_tmp2_);
	_tmp4_ = g_strconcat ("https://openlibrary.org/books/", _tmp3_, NULL);
	_tmp5_ = _tmp4_;
	tuba_utils_host_open_url (_tmp5_, NULL, NULL);
	_g_free0 (_tmp5_);
}

static void
_tuba_widgets_book_wyrm_page_open_on_openlibrary_gtk_button_clicked (GtkButton* _sender,
                                                                     gpointer self)
{
	tuba_widgets_book_wyrm_page_open_on_openlibrary ((TubaWidgetsBookWyrmPage*) self);
}

static void
tuba_widgets_book_wyrm_page_open_on_bw (TubaWidgetsBookWyrmPage* self)
{
	TubaAPIBookWyrm* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_book;
	_tmp1_ = tuba_api_book_wyrm_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	tuba_utils_host_open_url (_tmp2_, NULL, NULL);
}

static void
_tuba_widgets_book_wyrm_page_open_on_bw_gtk_button_clicked (GtkButton* _sender,
                                                            gpointer self)
{
	tuba_widgets_book_wyrm_page_open_on_bw ((TubaWidgetsBookWyrmPage*) self);
}

TubaAPIBookWyrm*
tuba_widgets_book_wyrm_page_get_book (TubaWidgetsBookWyrmPage* self)
{
	TubaAPIBookWyrm* result;
	TubaAPIBookWyrm* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_book;
	result = _tmp0_;
	return result;
}

static void
tuba_widgets_book_wyrm_page_set_book (TubaWidgetsBookWyrmPage* self,
                                      TubaAPIBookWyrm* value)
{
	TubaAPIBookWyrm* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_book_wyrm_page_get_book (self);
	if (old_value != value) {
		TubaAPIBookWyrm* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_book);
		self->priv->_book = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_book_wyrm_page_properties[TUBA_WIDGETS_BOOK_WYRM_PAGE_BOOK_PROPERTY]);
	}
}

void
tuba_widgets_book_wyrm_page_set_selectable (TubaWidgetsBookWyrmPage* self,
                                            gboolean value)
{
	GtkLabel* _tmp0_;
	GtkLabel* _tmp1_;
	GtkLabel* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->title;
	_tmp1_ = self->priv->isbn;
	_tmp2_ = self->priv->description;
	gtk_label_set_selectable (_tmp2_, value);
	gtk_label_set_selectable (_tmp1_, value);
	gtk_label_set_selectable (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_book_wyrm_page_properties[TUBA_WIDGETS_BOOK_WYRM_PAGE_SELECTABLE_PROPERTY]);
}

static void
tuba_widgets_book_wyrm_page_class_init (TubaWidgetsBookWyrmPageClass * klass,
                                        gpointer klass_data)
{
	tuba_widgets_book_wyrm_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaWidgetsBookWyrmPage_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_widgets_book_wyrm_page_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_widgets_book_wyrm_page_set_property;
	G_OBJECT_CLASS (klass)->finalize = tuba_widgets_book_wyrm_page_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_BOOK_WYRM_PAGE_BOOK_PROPERTY, tuba_widgets_book_wyrm_page_properties[TUBA_WIDGETS_BOOK_WYRM_PAGE_BOOK_PROPERTY] = g_param_spec_object ("book", "book", "book", TUBA_API_TYPE_BOOK_WYRM, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_BOOK_WYRM_PAGE_SELECTABLE_PROPERTY, tuba_widgets_book_wyrm_page_properties[TUBA_WIDGETS_BOOK_WYRM_PAGE_SELECTABLE_PROPERTY] = g_param_spec_boolean ("selectable", "selectable", "selectable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/dev/geopjr/Tuba/ui/widgets/bookwyrmpage.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "cover", FALSE, TubaWidgetsBookWyrmPage_private_offset + G_STRUCT_OFFSET (TubaWidgetsBookWyrmPagePrivate, cover));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "title", FALSE, TubaWidgetsBookWyrmPage_private_offset + G_STRUCT_OFFSET (TubaWidgetsBookWyrmPagePrivate, title));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "authors", FALSE, TubaWidgetsBookWyrmPage_private_offset + G_STRUCT_OFFSET (TubaWidgetsBookWyrmPagePrivate, authors));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "isbn", FALSE, TubaWidgetsBookWyrmPage_private_offset + G_STRUCT_OFFSET (TubaWidgetsBookWyrmPagePrivate, isbn));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "ol_btn", FALSE, TubaWidgetsBookWyrmPage_private_offset + G_STRUCT_OFFSET (TubaWidgetsBookWyrmPagePrivate, ol_btn));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "description", FALSE, TubaWidgetsBookWyrmPage_private_offset + G_STRUCT_OFFSET (TubaWidgetsBookWyrmPagePrivate, description));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "date", FALSE, TubaWidgetsBookWyrmPage_private_offset + G_STRUCT_OFFSET (TubaWidgetsBookWyrmPagePrivate, date));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "open_on_openlibrary", G_CALLBACK(_tuba_widgets_book_wyrm_page_open_on_openlibrary_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "open_on_bw", G_CALLBACK(_tuba_widgets_book_wyrm_page_open_on_bw_gtk_button_clicked));
}

static void
tuba_widgets_book_wyrm_page_instance_init (TubaWidgetsBookWyrmPage * self,
                                           gpointer klass)
{
	gchar** _tmp0_;
	self->priv = tuba_widgets_book_wyrm_page_get_instance_private (self);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	self->priv->author_labels = _tmp0_;
	self->priv->author_labels_length1 = 0;
	self->priv->_author_labels_size_ = self->priv->author_labels_length1;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
tuba_widgets_book_wyrm_page_finalize (GObject * obj)
{
	TubaWidgetsBookWyrmPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE, TubaWidgetsBookWyrmPage);
	g_debug ("BookWyrmPage.vala:26: Destroying BookWyrmPage");
	_g_object_unref0 (self->priv->_book);
	self->priv->author_labels = (_vala_array_free (self->priv->author_labels, self->priv->author_labels_length1, (GDestroyNotify) g_free), NULL);
	G_OBJECT_CLASS (tuba_widgets_book_wyrm_page_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_widgets_book_wyrm_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaWidgetsBookWyrmPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_widgets_book_wyrm_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaWidgetsBookWyrmPage), 0, (GInstanceInitFunc) tuba_widgets_book_wyrm_page_instance_init, NULL };
	GType tuba_widgets_book_wyrm_page_type_id;
	tuba_widgets_book_wyrm_page_type_id = g_type_register_static (gtk_box_get_type (), "TubaWidgetsBookWyrmPage", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaWidgetsBookWyrmPage_private_offset = g_type_add_instance_private (tuba_widgets_book_wyrm_page_type_id, sizeof (TubaWidgetsBookWyrmPagePrivate));
	return tuba_widgets_book_wyrm_page_type_id;
}

GType
tuba_widgets_book_wyrm_page_get_type (void)
{
	static GType tuba_widgets_book_wyrm_page_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_widgets_book_wyrm_page_type_id__once)) {
		GType tuba_widgets_book_wyrm_page_type_id;
		tuba_widgets_book_wyrm_page_type_id = tuba_widgets_book_wyrm_page_get_type_once ();
		g_once_init_leave_pointer (&tuba_widgets_book_wyrm_page_type_id__once, tuba_widgets_book_wyrm_page_type_id);
	}
	return tuba_widgets_book_wyrm_page_type_id__once;
}

static void
_vala_tuba_widgets_book_wyrm_page_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec)
{
	TubaWidgetsBookWyrmPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE, TubaWidgetsBookWyrmPage);
	switch (property_id) {
		case TUBA_WIDGETS_BOOK_WYRM_PAGE_BOOK_PROPERTY:
		g_value_set_object (value, tuba_widgets_book_wyrm_page_get_book (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_widgets_book_wyrm_page_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec)
{
	TubaWidgetsBookWyrmPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE, TubaWidgetsBookWyrmPage);
	switch (property_id) {
		case TUBA_WIDGETS_BOOK_WYRM_PAGE_BOOK_PROPERTY:
		tuba_widgets_book_wyrm_page_set_book (self, g_value_get_object (value));
		break;
		case TUBA_WIDGETS_BOOK_WYRM_PAGE_SELECTABLE_PROPERTY:
		tuba_widgets_book_wyrm_page_set_selectable (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

