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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <handy.h>
#include <gee.h>
#include <glib/gi18n-lib.h>
#include <libsoup/soup.h>
#include <json-glib/json-glib.h>
#include <float.h>
#include <math.h>

#define TOOTLE_VIEWS_TYPE_BASE (tootle_views_base_get_type ())
#define TOOTLE_VIEWS_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_VIEWS_TYPE_BASE, TootleViewsBase))
#define TOOTLE_VIEWS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_VIEWS_TYPE_BASE, TootleViewsBaseClass))
#define TOOTLE_VIEWS_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_VIEWS_TYPE_BASE))
#define TOOTLE_VIEWS_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_VIEWS_TYPE_BASE))
#define TOOTLE_VIEWS_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_VIEWS_TYPE_BASE, TootleViewsBaseClass))

typedef struct _TootleViewsBase TootleViewsBase;
typedef struct _TootleViewsBaseClass TootleViewsBaseClass;
typedef struct _TootleViewsBasePrivate TootleViewsBasePrivate;

#define TOOTLE_TYPE_IACCOUNT_LISTENER (tootle_iaccount_listener_get_type ())
#define TOOTLE_IACCOUNT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_IACCOUNT_LISTENER, TootleIAccountListener))
#define TOOTLE_IS_IACCOUNT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_IACCOUNT_LISTENER))
#define TOOTLE_IACCOUNT_LISTENER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TOOTLE_TYPE_IACCOUNT_LISTENER, TootleIAccountListenerIface))

typedef struct _TootleIAccountListener TootleIAccountListener;
typedef struct _TootleIAccountListenerIface TootleIAccountListenerIface;

#define TOOTLE_TYPE_ENTITY (tootle_entity_get_type ())
#define TOOTLE_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_ENTITY, TootleEntity))
#define TOOTLE_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_ENTITY, TootleEntityClass))
#define TOOTLE_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_ENTITY))
#define TOOTLE_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_ENTITY))
#define TOOTLE_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_ENTITY, TootleEntityClass))

typedef struct _TootleEntity TootleEntity;
typedef struct _TootleEntityClass TootleEntityClass;

#define TOOTLE_API_TYPE_ACCOUNT (tootle_api_account_get_type ())
#define TOOTLE_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccount))
#define TOOTLE_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccountClass))
#define TOOTLE_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_ACCOUNT))
#define TOOTLE_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_ACCOUNT))
#define TOOTLE_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccountClass))

typedef struct _TootleAPIAccount TootleAPIAccount;
typedef struct _TootleAPIAccountClass TootleAPIAccountClass;

#define TOOTLE_TYPE_INSTANCE_ACCOUNT (tootle_instance_account_get_type ())
#define TOOTLE_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccount))
#define TOOTLE_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccountClass))
#define TOOTLE_IS_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_INSTANCE_ACCOUNT))
#define TOOTLE_IS_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_INSTANCE_ACCOUNT))
#define TOOTLE_INSTANCE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccountClass))

typedef struct _TootleInstanceAccount TootleInstanceAccount;
typedef struct _TootleInstanceAccountClass TootleInstanceAccountClass;

#define TOOTLE_VIEWS_TYPE_THREAD (tootle_views_thread_get_type ())
#define TOOTLE_VIEWS_THREAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_VIEWS_TYPE_THREAD, TootleViewsThread))
#define TOOTLE_VIEWS_THREAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_VIEWS_TYPE_THREAD, TootleViewsThreadClass))
#define TOOTLE_VIEWS_IS_THREAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_VIEWS_TYPE_THREAD))
#define TOOTLE_VIEWS_IS_THREAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_VIEWS_TYPE_THREAD))
#define TOOTLE_VIEWS_THREAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_VIEWS_TYPE_THREAD, TootleViewsThreadClass))

typedef struct _TootleViewsThread TootleViewsThread;
typedef struct _TootleViewsThreadClass TootleViewsThreadClass;
typedef struct _TootleViewsThreadPrivate TootleViewsThreadPrivate;

#define TOOTLE_WIDGETS_TYPE_STATUS (tootle_widgets_status_get_type ())
#define TOOTLE_WIDGETS_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_WIDGETS_TYPE_STATUS, TootleWidgetsStatus))
#define TOOTLE_WIDGETS_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_WIDGETS_TYPE_STATUS, TootleWidgetsStatusClass))
#define TOOTLE_WIDGETS_IS_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_WIDGETS_TYPE_STATUS))
#define TOOTLE_WIDGETS_IS_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_WIDGETS_TYPE_STATUS))
#define TOOTLE_WIDGETS_STATUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_WIDGETS_TYPE_STATUS, TootleWidgetsStatusClass))

typedef struct _TootleWidgetsStatus TootleWidgetsStatus;
typedef struct _TootleWidgetsStatusClass TootleWidgetsStatusClass;

#define TOOTLE_API_TYPE_STATUS (tootle_api_status_get_type ())
#define TOOTLE_API_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_STATUS, TootleAPIStatus))
#define TOOTLE_API_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_STATUS, TootleAPIStatusClass))
#define TOOTLE_API_IS_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_STATUS))
#define TOOTLE_API_IS_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_STATUS))
#define TOOTLE_API_STATUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_STATUS, TootleAPIStatusClass))

typedef struct _TootleAPIStatus TootleAPIStatus;
typedef struct _TootleAPIStatusClass TootleAPIStatusClass;
enum  {
	TOOTLE_VIEWS_THREAD_0_PROPERTY,
	TOOTLE_VIEWS_THREAD_ROOT_STATUS_PROPERTY,
	TOOTLE_VIEWS_THREAD_NUM_PROPERTIES
};
static GParamSpec* tootle_views_thread_properties[TOOTLE_VIEWS_THREAD_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TOOTLE_TYPE_WIDGETIZABLE (tootle_widgetizable_get_type ())
#define TOOTLE_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_WIDGETIZABLE, TootleWidgetizable))
#define TOOTLE_IS_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_WIDGETIZABLE))
#define TOOTLE_WIDGETIZABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TOOTLE_TYPE_WIDGETIZABLE, TootleWidgetizableIface))

typedef struct _TootleWidgetizable TootleWidgetizable;
typedef struct _TootleWidgetizableIface TootleWidgetizableIface;
typedef struct _Block38Data Block38Data;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _TootleWidgetsStatusPrivate TootleWidgetsStatusPrivate;

#define TOOTLE_WIDGETS_TYPE_RICH_LABEL (tootle_widgets_rich_label_get_type ())
#define TOOTLE_WIDGETS_RICH_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_WIDGETS_TYPE_RICH_LABEL, TootleWidgetsRichLabel))
#define TOOTLE_WIDGETS_RICH_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_WIDGETS_TYPE_RICH_LABEL, TootleWidgetsRichLabelClass))
#define TOOTLE_WIDGETS_IS_RICH_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_WIDGETS_TYPE_RICH_LABEL))
#define TOOTLE_WIDGETS_IS_RICH_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_WIDGETS_TYPE_RICH_LABEL))
#define TOOTLE_WIDGETS_RICH_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_WIDGETS_TYPE_RICH_LABEL, TootleWidgetsRichLabelClass))

typedef struct _TootleWidgetsRichLabel TootleWidgetsRichLabel;
typedef struct _TootleWidgetsRichLabelClass TootleWidgetsRichLabelClass;

#define TOOTLE_WIDGETS_TYPE_AVATAR (tootle_widgets_avatar_get_type ())
#define TOOTLE_WIDGETS_AVATAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_WIDGETS_TYPE_AVATAR, TootleWidgetsAvatar))
#define TOOTLE_WIDGETS_AVATAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_WIDGETS_TYPE_AVATAR, TootleWidgetsAvatarClass))
#define TOOTLE_WIDGETS_IS_AVATAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_WIDGETS_TYPE_AVATAR))
#define TOOTLE_WIDGETS_IS_AVATAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_WIDGETS_TYPE_AVATAR))
#define TOOTLE_WIDGETS_AVATAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_WIDGETS_TYPE_AVATAR, TootleWidgetsAvatarClass))

typedef struct _TootleWidgetsAvatar TootleWidgetsAvatar;
typedef struct _TootleWidgetsAvatarClass TootleWidgetsAvatarClass;

#define TOOTLE_WIDGETS_TYPE_MARKUP_VIEW (tootle_widgets_markup_view_get_type ())
#define TOOTLE_WIDGETS_MARKUP_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_WIDGETS_TYPE_MARKUP_VIEW, TootleWidgetsMarkupView))
#define TOOTLE_WIDGETS_MARKUP_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_WIDGETS_TYPE_MARKUP_VIEW, TootleWidgetsMarkupViewClass))
#define TOOTLE_WIDGETS_IS_MARKUP_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_WIDGETS_TYPE_MARKUP_VIEW))
#define TOOTLE_WIDGETS_IS_MARKUP_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_WIDGETS_TYPE_MARKUP_VIEW))
#define TOOTLE_WIDGETS_MARKUP_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_WIDGETS_TYPE_MARKUP_VIEW, TootleWidgetsMarkupViewClass))

typedef struct _TootleWidgetsMarkupView TootleWidgetsMarkupView;
typedef struct _TootleWidgetsMarkupViewClass TootleWidgetsMarkupViewClass;

#define TOOTLE_WIDGETS_ATTACHMENT_TYPE_BOX (tootle_widgets_attachment_box_get_type ())
#define TOOTLE_WIDGETS_ATTACHMENT_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_WIDGETS_ATTACHMENT_TYPE_BOX, TootleWidgetsAttachmentBox))
#define TOOTLE_WIDGETS_ATTACHMENT_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_WIDGETS_ATTACHMENT_TYPE_BOX, TootleWidgetsAttachmentBoxClass))
#define TOOTLE_WIDGETS_ATTACHMENT_IS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_WIDGETS_ATTACHMENT_TYPE_BOX))
#define TOOTLE_WIDGETS_ATTACHMENT_IS_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_WIDGETS_ATTACHMENT_TYPE_BOX))
#define TOOTLE_WIDGETS_ATTACHMENT_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_WIDGETS_ATTACHMENT_TYPE_BOX, TootleWidgetsAttachmentBoxClass))

typedef struct _TootleWidgetsAttachmentBox TootleWidgetsAttachmentBox;
typedef struct _TootleWidgetsAttachmentBoxClass TootleWidgetsAttachmentBoxClass;

#define TOOTLE_TYPE_REQUEST (tootle_request_get_type ())
#define TOOTLE_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_REQUEST, TootleRequest))
#define TOOTLE_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_REQUEST, TootleRequestClass))
#define TOOTLE_IS_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_REQUEST))
#define TOOTLE_IS_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_REQUEST))
#define TOOTLE_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_REQUEST, TootleRequestClass))

typedef struct _TootleRequest TootleRequest;
typedef struct _TootleRequestClass TootleRequestClass;
typedef void (*TootleNetworkSuccessCallback) (SoupSession* session, SoupMessage* msg, gpointer user_data, GError** error);

#define TOOTLE_TYPE_NETWORK (tootle_network_get_type ())
#define TOOTLE_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_NETWORK, TootleNetwork))
#define TOOTLE_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_NETWORK, TootleNetworkClass))
#define TOOTLE_IS_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_NETWORK))
#define TOOTLE_IS_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_NETWORK))
#define TOOTLE_NETWORK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_NETWORK, TootleNetworkClass))

typedef struct _TootleNetwork TootleNetwork;
typedef struct _TootleNetworkClass TootleNetworkClass;
#define _json_array_unref0(var) ((var == NULL) ? NULL : (var = (json_array_unref (var), NULL)))
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
typedef struct _Block39Data Block39Data;
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))

#define TOOTLE_DIALOGS_TYPE_MAIN_WINDOW (tootle_dialogs_main_window_get_type ())
#define TOOTLE_DIALOGS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_DIALOGS_TYPE_MAIN_WINDOW, TootleDialogsMainWindow))
#define TOOTLE_DIALOGS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_DIALOGS_TYPE_MAIN_WINDOW, TootleDialogsMainWindowClass))
#define TOOTLE_DIALOGS_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_DIALOGS_TYPE_MAIN_WINDOW))
#define TOOTLE_DIALOGS_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_DIALOGS_TYPE_MAIN_WINDOW))
#define TOOTLE_DIALOGS_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_DIALOGS_TYPE_MAIN_WINDOW, TootleDialogsMainWindowClass))

typedef struct _TootleDialogsMainWindow TootleDialogsMainWindow;
typedef struct _TootleDialogsMainWindowClass TootleDialogsMainWindowClass;

struct _TootleViewsBase {
	GtkBox parent_instance;
	TootleViewsBasePrivate * priv;
	HdyHeaderBar* header;
	GtkButton* back_button;
	GtkScrolledWindow* scrolled;
	GtkBox* view;
	HdyClamp* clamp;
	GtkBox* column_view;
	GtkStack* states;
	GtkBox* content_box;
	GtkListBox* content_list;
	GtkButton* status_button;
};

struct _TootleViewsBaseClass {
	GtkBoxClass parent_class;
	void (*build_header) (TootleViewsBase* self);
	void (*clear) (TootleViewsBase* self);
	void (*on_bottom_reached) (TootleViewsBase* self);
	void (*on_shown) (TootleViewsBase* self);
	void (*on_hidden) (TootleViewsBase* self);
	void (*on_content_changed) (TootleViewsBase* self);
	void (*on_error) (TootleViewsBase* self, gint32 code, const gchar* reason);
	void (*on_content_item_activated) (TootleViewsBase* self, GtkListBoxRow* row);
};

struct _TootleIAccountListenerIface {
	GTypeInterface parent_iface;
	void (*on_account_changed) (TootleIAccountListener* self, TootleInstanceAccount* account);
	void (*on_accounts_changed) (TootleIAccountListener* self, GeeArrayList* accounts);
};

struct _TootleViewsThread {
	TootleViewsBase parent_instance;
	TootleViewsThreadPrivate * priv;
	TootleInstanceAccount* account;
	TootleWidgetsStatus* root_widget;
};

struct _TootleViewsThreadClass {
	TootleViewsBaseClass parent_class;
};

struct _TootleViewsThreadPrivate {
	TootleAPIStatus* _root_status;
};

typedef enum  {
	TOOTLE_OOPSIE_USER,
	TOOTLE_OOPSIE_PARSING,
	TOOTLE_OOPSIE_INSTANCE,
	TOOTLE_OOPSIE_INTERNAL
} TootleOopsie;
#define TOOTLE_OOPSIE tootle_oopsie_quark ()
struct _TootleWidgetizableIface {
	GTypeInterface parent_iface;
	GtkWidget* (*to_widget) (TootleWidgetizable* self, GError** error);
	void (*open) (TootleWidgetizable* self);
	void (*resolve_open) (TootleWidgetizable* self, TootleInstanceAccount* account);
};

struct _Block38Data {
	int _ref_count_;
	TootleViewsThread* self;
	TootleWidgetsStatus* last_w;
	gchar* last_id;
};

struct _TootleWidgetsStatus {
	GtkListBoxRow parent_instance;
	TootleWidgetsStatusPrivate * priv;
	GtkGrid* grid;
	GtkImage* header_icon;
	TootleWidgetsRichLabel* header_label;
	GtkImage* thread_line;
	TootleWidgetsAvatar* avatar;
	TootleWidgetsRichLabel* name_label;
	GtkLabel* handle_label;
	GtkBox* indicators;
	GtkLabel* date_label;
	GtkImage* pin_indicator;
	GtkImage* indicator;
	GtkBox* content_column;
	GtkStack* spoiler_stack;
	GtkBox* content_box;
	TootleWidgetsMarkupView* content;
	TootleWidgetsAttachmentBox* attachments;
	GtkButton* spoiler_button;
	TootleWidgetsRichLabel* spoiler_label;
	GtkBox* actions;
	GtkButton* reply_button;
	GtkImage* reply_button_icon;
	GtkToggleButton* reblog_button;
	GtkImage* reblog_icon;
	GtkToggleButton* favorite_button;
	GtkToggleButton* bookmark_button;
	GtkButton* menu_button;
};

struct _TootleWidgetsStatusClass {
	GtkListBoxRowClass parent_class;
	void (*on_open) (TootleWidgetsStatus* self);
	void (*on_kind_changed) (TootleWidgetsStatus* self);
};

struct _Block39Data {
	int _ref_count_;
	gchar* q;
};

static gint TootleViewsThread_private_offset;
static gpointer tootle_views_thread_parent_class = NULL;
extern gchar* tootle_views_base_STATUS_LOADING;
extern TootleNetwork* tootle_network;
extern TootleDialogsMainWindow* tootle_window;
static TootleIAccountListenerIface * tootle_views_thread_tootle_iaccount_listener_parent_iface = NULL;

GType tootle_views_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleViewsBase, g_object_unref)
GType tootle_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleEntity, g_object_unref)
GType tootle_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIAccount, g_object_unref)
GType tootle_instance_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleInstanceAccount, g_object_unref)
GType tootle_iaccount_listener_get_type (void) G_GNUC_CONST ;
GType tootle_views_thread_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleViewsThread, g_object_unref)
GType tootle_widgets_status_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleWidgetsStatus, g_object_unref)
GType tootle_api_status_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIStatus, g_object_unref)
TootleViewsThread* tootle_views_thread_new (TootleAPIStatus* status);
TootleViewsThread* tootle_views_thread_construct (GType object_type,
                                                  TootleAPIStatus* status);
void tootle_iaccount_listener_account_listener_init (TootleIAccountListener* self);
static void tootle_views_thread_real_on_account_changed (TootleIAccountListener* base,
                                                  TootleInstanceAccount* acc);
void tootle_views_thread_request (TootleViewsThread* self);
static TootleWidgetsStatus* tootle_views_thread_append (TootleViewsThread* self,
                                                 TootleEntity* entity);
GQuark tootle_oopsie_quark (void);
GType tootle_widgetizable_get_type (void) G_GNUC_CONST ;
GtkWidget* tootle_widgetizable_to_widget (TootleWidgetizable* self,
                                          GError** error);
void tootle_widgets_status_set_reveal_spoiler (TootleWidgetsStatus* self,
                                               gboolean value);
static void tootle_views_thread_connect_threads (TootleViewsThread* self);
static Block38Data* block38_data_ref (Block38Data* _data38_);
static void block38_data_unref (void * _userdata_);
GtkContainer* tootle_views_base_get_content (TootleViewsBase* self);
static void __lambda39_ (Block38Data* _data38_,
                  GtkWidget* i);
TootleAPIStatus* tootle_widgets_status_get_status (TootleWidgetsStatus* self);
TootleAPIStatus* tootle_api_status_get_formal (TootleAPIStatus* self);
const gchar* tootle_api_status_get_in_reply_to_id (TootleAPIStatus* self);
void tootle_widgets_status_thread_role_connect_posts (TootleWidgetsStatus* prev,
                                                      TootleWidgetsStatus* curr);
const gchar* tootle_api_status_get_id (TootleAPIStatus* self);
static void ___lambda39__gfunc (gconstpointer data,
                         gpointer self);
static void __lambda40_ (TootleViewsThread* self,
                  GtkWidget* i);
void tootle_widgets_status_install_thread_line (TootleWidgetsStatus* self);
static void ___lambda40__gfunc (gconstpointer data,
                         gpointer self);
GType tootle_widgets_rich_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleWidgetsRichLabel, g_object_unref)
GType tootle_widgets_avatar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleWidgetsAvatar, g_object_unref)
GType tootle_widgets_markup_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleWidgetsMarkupView, g_object_unref)
GType tootle_widgets_attachment_box_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleWidgetsAttachmentBox, g_object_unref)
TootleAPIStatus* tootle_views_thread_get_root_status (TootleViewsThread* self);
TootleRequest* tootle_request_new_GET (const gchar* url);
TootleRequest* tootle_request_construct_GET (GType object_type,
                                             const gchar* url);
GType tootle_request_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleRequest, g_object_unref)
TootleRequest* tootle_request_with_account (TootleRequest* self,
                                            TootleInstanceAccount* account);
TootleRequest* tootle_request_with_ctx (TootleRequest* self,
                                        GtkWidget* ctx);
TootleRequest* tootle_request_then (TootleRequest* self,
                                    TootleNetworkSuccessCallback cb,
                                    gpointer cb_target,
                                    GDestroyNotify cb_target_destroy_notify);
static void __lambda36_ (TootleViewsThread* self,
                  SoupSession* sess,
                  SoupMessage* msg,
                  GError** error);
GType tootle_network_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleNetwork, g_object_unref)
JsonObject* tootle_network_parse (TootleNetwork* self,
                                  SoupMessage* msg,
                                  GError** error);
static void __lambda37_ (TootleViewsThread* self,
                  JsonArray* array,
                  guint i,
                  JsonNode* node);
TootleEntity* tootle_entity_from_json (GType type,
                                       JsonNode* node,
                                       GError** error);
static void ___lambda37__json_array_foreach (JsonArray* array,
                                      guint index_,
                                      JsonNode* element_node,
                                      gpointer self);
void tootle_widgets_status_expand_root (TootleWidgetsStatus* self);
static void __lambda38_ (TootleViewsThread* self,
                  JsonArray* array,
                  guint i,
                  JsonNode* node);
static void ___lambda38__json_array_foreach (JsonArray* array,
                                      guint index_,
                                      JsonNode* element_node,
                                      gpointer self);
void tootle_views_base_on_content_changed (TootleViewsBase* self);
static void ___lambda36__tootle_network_success_callback (SoupSession* session,
                                                   SoupMessage* msg,
                                                   gpointer self,
                                                   GError** error);
TootleRequest* tootle_request_exec (TootleRequest* self);
void tootle_views_thread_open_from_link (const gchar* q);
static Block39Data* block39_data_ref (Block39Data* _data39_);
static void block39_data_unref (void * _userdata_);
TootleRequest* tootle_request_with_param (TootleRequest* self,
                                          const gchar* name,
                                          const gchar* val);
static void __lambda41_ (Block39Data* _data39_,
                  SoupSession* sess,
                  SoupMessage* msg,
                  GError** error);
static JsonNode* _vala_JsonNode_copy (JsonNode* self);
TootleAPIStatus* tootle_api_status_from (JsonNode* node,
                                         GError** error);
static void _vala_JsonNode_free (JsonNode* self);
GType tootle_dialogs_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleDialogsMainWindow, g_object_unref)
TootleViewsBase* tootle_dialogs_main_window_open_view (TootleDialogsMainWindow* self,
                                                       TootleViewsBase* view);
gboolean tootle_desktop_open_uri (const gchar* _uri);
static void ___lambda41__tootle_network_success_callback (SoupSession* session,
                                                   SoupMessage* msg,
                                                   gpointer self,
                                                   GError** error);
void tootle_views_thread_set_root_status (TootleViewsThread* self,
                                          TootleAPIStatus* value);
void tootle_iaccount_listener_on_account_changed (TootleIAccountListener* self,
                                                  TootleInstanceAccount* account);
static void tootle_views_thread_finalize (GObject * obj);
static GType tootle_views_thread_get_type_once (void);
static void _vala_tootle_views_thread_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_tootle_views_thread_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
tootle_views_thread_get_instance_private (TootleViewsThread* self)
{
	return G_STRUCT_MEMBER_P (self, TootleViewsThread_private_offset);
}

TootleViewsThread*
tootle_views_thread_construct (GType object_type,
                               TootleAPIStatus* status)
{
	TootleViewsThread * self = NULL;
	const gchar* _tmp0_;
	g_return_val_if_fail (status != NULL, NULL);
	_tmp0_ = tootle_views_base_STATUS_LOADING;
	self = (TootleViewsThread*) g_object_new (object_type, "root-status", status, "status-message", _tmp0_, "label", _ ("Conversation"), NULL);
	tootle_iaccount_listener_account_listener_init ((TootleIAccountListener*) self);
	return self;
}

TootleViewsThread*
tootle_views_thread_new (TootleAPIStatus* status)
{
	return tootle_views_thread_construct (TOOTLE_VIEWS_TYPE_THREAD, status);
}

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

static void
tootle_views_thread_real_on_account_changed (TootleIAccountListener* base,
                                             TootleInstanceAccount* acc)
{
	TootleViewsThread * self;
	TootleInstanceAccount* _tmp0_;
	self = (TootleViewsThread*) base;
	_tmp0_ = _g_object_ref0 (acc);
	_g_object_unref0 (self->account);
	self->account = _tmp0_;
	tootle_views_thread_request (self);
}

static TootleWidgetsStatus*
tootle_views_thread_append (TootleViewsThread* self,
                            TootleEntity* entity)
{
	GtkWidget* _tmp0_ = NULL;
	GtkWidget* _tmp1_;
	TootleWidgetsStatus* w = NULL;
	TootleWidgetsStatus* _tmp2_;
	TootleWidgetsStatus* _tmp3_;
	GtkListBox* _tmp4_;
	TootleWidgetsStatus* _tmp5_;
	GError* _inner_error0_ = NULL;
	TootleWidgetsStatus* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entity != NULL, NULL);
	_tmp1_ = tootle_widgetizable_to_widget ((TootleWidgetizable*) entity, &_inner_error0_);
	_tmp0_ = _tmp1_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
	_tmp2_ = _g_object_ref0 (TOOTLE_WIDGETS_IS_STATUS (_tmp0_) ? ((TootleWidgetsStatus*) _tmp0_) : NULL);
	w = _tmp2_;
	_tmp3_ = w;
	tootle_widgets_status_set_reveal_spoiler (_tmp3_, TRUE);
	_tmp4_ = ((TootleViewsBase*) self)->content_list;
	_tmp5_ = w;
	gtk_list_box_insert (_tmp4_, (GtkWidget*) _tmp5_, -1);
	result = w;
	_g_object_unref0 (_tmp0_);
	return result;
}

static Block38Data*
block38_data_ref (Block38Data* _data38_)
{
	g_atomic_int_inc (&_data38_->_ref_count_);
	return _data38_;
}

static void
block38_data_unref (void * _userdata_)
{
	Block38Data* _data38_;
	_data38_ = (Block38Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data38_->_ref_count_)) {
		TootleViewsThread* self;
		self = _data38_->self;
		_g_free0 (_data38_->last_id);
		_g_object_unref0 (_data38_->last_w);
		_g_object_unref0 (self);
		g_slice_free (Block38Data, _data38_);
	}
}

static void
__lambda39_ (Block38Data* _data38_,
             GtkWidget* i)
{
	TootleViewsThread* self;
	TootleWidgetsStatus* w = NULL;
	TootleWidgetsStatus* _tmp0_;
	gchar* id = NULL;
	TootleWidgetsStatus* _tmp1_;
	TootleAPIStatus* _tmp2_;
	TootleAPIStatus* _tmp3_;
	TootleAPIStatus* _tmp4_;
	TootleAPIStatus* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	TootleWidgetsStatus* _tmp11_;
	TootleWidgetsStatus* _tmp12_;
	TootleWidgetsStatus* _tmp13_;
	TootleAPIStatus* _tmp14_;
	TootleAPIStatus* _tmp15_;
	TootleAPIStatus* _tmp16_;
	TootleAPIStatus* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	self = _data38_->self;
	g_return_if_fail (i != NULL);
	_tmp0_ = _g_object_ref0 (TOOTLE_WIDGETS_IS_STATUS (i) ? ((TootleWidgetsStatus*) i) : NULL);
	w = _tmp0_;
	_tmp1_ = w;
	_tmp2_ = tootle_widgets_status_get_status (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = tootle_api_status_get_formal (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = tootle_api_status_get_in_reply_to_id (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strdup (_tmp7_);
	id = _tmp8_;
	_tmp9_ = id;
	if (g_strcmp0 (_tmp9_, _data38_->last_id) == 0) {
		TootleWidgetsStatus* _tmp10_;
		_tmp10_ = w;
		tootle_widgets_status_thread_role_connect_posts (_data38_->last_w, _tmp10_);
	}
	_tmp11_ = w;
	_tmp12_ = _g_object_ref0 (_tmp11_);
	_g_object_unref0 (_data38_->last_w);
	_data38_->last_w = _tmp12_;
	_tmp13_ = w;
	_tmp14_ = tootle_widgets_status_get_status (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = tootle_api_status_get_formal (_tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = tootle_api_status_get_id (_tmp17_);
	_tmp19_ = _tmp18_;
	_tmp20_ = g_strdup (_tmp19_);
	_g_free0 (_data38_->last_id);
	_data38_->last_id = _tmp20_;
	_g_free0 (id);
	_g_object_unref0 (w);
}

static void
___lambda39__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda39_ (self, (GtkWidget*) data);
}

static void
__lambda40_ (TootleViewsThread* self,
             GtkWidget* i)
{
	TootleWidgetsStatus* w = NULL;
	TootleWidgetsStatus* _tmp0_;
	g_return_if_fail (i != NULL);
	_tmp0_ = _g_object_ref0 (TOOTLE_WIDGETS_IS_STATUS (i) ? ((TootleWidgetsStatus*) i) : NULL);
	w = _tmp0_;
	tootle_widgets_status_install_thread_line (w);
	_g_object_unref0 (w);
}

static void
___lambda40__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda40_ ((TootleViewsThread*) self, (GtkWidget*) data);
}

static void
tootle_views_thread_connect_threads (TootleViewsThread* self)
{
	Block38Data* _data38_;
	GtkContainer* _tmp0_;
	GtkContainer* _tmp1_;
	GList* _tmp2_;
	GList* _tmp3_;
	GtkContainer* _tmp4_;
	GtkContainer* _tmp5_;
	GList* _tmp6_;
	GList* _tmp7_;
	TootleWidgetsStatus* _tmp8_;
	GtkImage* _tmp9_;
	g_return_if_fail (self != NULL);
	_data38_ = g_slice_new0 (Block38Data);
	_data38_->_ref_count_ = 1;
	_data38_->self = g_object_ref (self);
	_data38_->last_w = NULL;
	_data38_->last_id = NULL;
	_tmp0_ = tootle_views_base_get_content ((TootleViewsBase*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gtk_container_get_children (_tmp1_);
	_tmp3_ = _tmp2_;
	g_list_foreach (_tmp3_, ___lambda39__gfunc, _data38_);
	(_tmp3_ == NULL) ? NULL : (_tmp3_ = (g_list_free (_tmp3_), NULL));
	_tmp4_ = tootle_views_base_get_content ((TootleViewsBase*) self);
	_tmp5_ = _tmp4_;
	_tmp6_ = gtk_container_get_children (_tmp5_);
	_tmp7_ = _tmp6_;
	g_list_foreach (_tmp7_, ___lambda40__gfunc, self);
	(_tmp7_ == NULL) ? NULL : (_tmp7_ = (g_list_free (_tmp7_), NULL));
	_tmp8_ = self->root_widget;
	_tmp9_ = _tmp8_->thread_line;
	gtk_widget_hide ((GtkWidget*) _tmp9_);
	block38_data_unref (_data38_);
	_data38_ = NULL;
}

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

static gpointer
_json_array_ref0 (gpointer self)
{
	return self ? json_array_ref (self) : NULL;
}

static void
__lambda37_ (TootleViewsThread* self,
             JsonArray* array,
             guint i,
             JsonNode* node)
{
	TootleEntity* status = NULL;
	TootleEntity* _tmp0_;
	TootleWidgetsStatus* _tmp1_;
	TootleWidgetsStatus* _tmp2_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (array != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = tootle_entity_from_json (TOOTLE_API_TYPE_STATUS, node, &_inner_error0_);
	status = _tmp0_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
	_tmp1_ = tootle_views_thread_append (self, status);
	_tmp2_ = _tmp1_;
	_g_object_unref0 (_tmp2_);
	_g_object_unref0 (status);
}

static void
___lambda37__json_array_foreach (JsonArray* array,
                                 guint index_,
                                 JsonNode* element_node,
                                 gpointer self)
{
	__lambda37_ ((TootleViewsThread*) self, array, index_, element_node);
}

static void
__lambda38_ (TootleViewsThread* self,
             JsonArray* array,
             guint i,
             JsonNode* node)
{
	TootleEntity* status = NULL;
	TootleEntity* _tmp0_;
	TootleWidgetsStatus* _tmp1_;
	TootleWidgetsStatus* _tmp2_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (array != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = tootle_entity_from_json (TOOTLE_API_TYPE_STATUS, node, &_inner_error0_);
	status = _tmp0_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
	_tmp1_ = tootle_views_thread_append (self, status);
	_tmp2_ = _tmp1_;
	_g_object_unref0 (_tmp2_);
	_g_object_unref0 (status);
}

static void
___lambda38__json_array_foreach (JsonArray* array,
                                 guint index_,
                                 JsonNode* element_node,
                                 gpointer self)
{
	__lambda38_ ((TootleViewsThread*) self, array, index_, element_node);
}

static void
__lambda36_ (TootleViewsThread* self,
             SoupSession* sess,
             SoupMessage* msg,
             GError** error)
{
	JsonObject* root = NULL;
	TootleNetwork* _tmp0_;
	JsonObject* _tmp1_;
	JsonArray* ancestors = NULL;
	JsonArray* _tmp2_;
	JsonArray* _tmp3_;
	JsonArray* _tmp4_;
	TootleAPIStatus* _tmp5_;
	TootleWidgetsStatus* _tmp6_;
	TootleWidgetsStatus* _tmp7_;
	TootleWidgetsStatus* _tmp8_;
	JsonArray* descendants = NULL;
	JsonArray* _tmp9_;
	JsonArray* _tmp10_;
	JsonArray* _tmp11_;
	gint x = 0;
	gint y = 0;
	TootleWidgetsStatus* _tmp12_;
	HdyHeaderBar* _tmp13_;
	gint _tmp14_ = 0;
	gint _tmp15_ = 0;
	GtkScrolledWindow* _tmp16_;
	GtkAdjustment* _tmp17_;
	GtkAdjustment* _tmp18_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (sess != NULL);
	g_return_if_fail (msg != NULL);
	_tmp0_ = tootle_network;
	_tmp1_ = tootle_network_parse (_tmp0_, msg, &_inner_error0_);
	root = _tmp1_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp2_ = json_object_get_array_member (root, "ancestors");
	_tmp3_ = _json_array_ref0 (_tmp2_);
	ancestors = _tmp3_;
	_tmp4_ = ancestors;
	json_array_foreach_element (_tmp4_, ___lambda37__json_array_foreach, self);
	_tmp5_ = self->priv->_root_status;
	_tmp6_ = tootle_views_thread_append (self, (TootleEntity*) _tmp5_);
	_tmp7_ = TOOTLE_WIDGETS_IS_STATUS (_tmp6_) ? ((TootleWidgetsStatus*) _tmp6_) : NULL;
	if (_tmp7_ == NULL) {
		_g_object_unref0 (_tmp6_);
	}
	_g_object_unref0 (self->root_widget);
	self->root_widget = _tmp7_;
	_tmp8_ = self->root_widget;
	tootle_widgets_status_expand_root (_tmp8_);
	_tmp9_ = json_object_get_array_member (root, "descendants");
	_tmp10_ = _json_array_ref0 (_tmp9_);
	descendants = _tmp10_;
	_tmp11_ = descendants;
	json_array_foreach_element (_tmp11_, ___lambda38__json_array_foreach, self);
	tootle_views_thread_connect_threads (self);
	tootle_views_base_on_content_changed ((TootleViewsBase*) self);
	_tmp12_ = self->root_widget;
	_tmp13_ = ((TootleViewsBase*) self)->header;
	gtk_widget_translate_coordinates ((GtkWidget*) self, (GtkWidget*) _tmp12_, 0, gtk_widget_get_allocated_height ((GtkWidget*) _tmp13_), &_tmp14_, &_tmp15_);
	x = _tmp14_;
	y = _tmp15_;
	_tmp16_ = ((TootleViewsBase*) self)->scrolled;
	_tmp17_ = gtk_scrolled_window_get_vadjustment (_tmp16_);
	_tmp18_ = _tmp17_;
	gtk_adjustment_set_value (_tmp18_, (gdouble) (y * -1));
	_json_array_unref0 (descendants);
	_json_array_unref0 (ancestors);
	_json_object_unref0 (root);
}

static void
___lambda36__tootle_network_success_callback (SoupSession* session,
                                              SoupMessage* msg,
                                              gpointer self,
                                              GError** error)
{
	__lambda36_ ((TootleViewsThread*) self, session, msg, error);
}

void
tootle_views_thread_request (TootleViewsThread* self)
{
	TootleAPIStatus* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	TootleRequest* _tmp6_;
	TootleRequest* _tmp7_;
	TootleInstanceAccount* _tmp8_;
	TootleRequest* _tmp9_;
	TootleRequest* _tmp10_;
	TootleRequest* _tmp11_;
	TootleRequest* _tmp12_;
	TootleRequest* _tmp13_;
	TootleRequest* _tmp14_;
	TootleRequest* _tmp15_;
	TootleRequest* _tmp16_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_root_status;
	_tmp1_ = tootle_api_status_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_to_string (_tmp2_);
	_tmp4_ = g_strconcat ("/api/v1/statuses/", _tmp3_, "/context", NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = tootle_request_new_GET (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = self->account;
	_tmp9_ = tootle_request_with_account (_tmp7_, _tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = tootle_request_with_ctx (_tmp10_, (GtkWidget*) self);
	_tmp12_ = _tmp11_;
	_tmp13_ = tootle_request_then (_tmp12_, ___lambda36__tootle_network_success_callback, g_object_ref (self), g_object_unref);
	_tmp14_ = _tmp13_;
	_tmp15_ = tootle_request_exec (_tmp14_);
	_tmp16_ = _tmp15_;
	_g_object_unref0 (_tmp16_);
	_g_object_unref0 (_tmp14_);
	_g_object_unref0 (_tmp12_);
	_g_object_unref0 (_tmp10_);
	_g_object_unref0 (_tmp7_);
	_g_free0 (_tmp5_);
}

static Block39Data*
block39_data_ref (Block39Data* _data39_)
{
	g_atomic_int_inc (&_data39_->_ref_count_);
	return _data39_;
}

static void
block39_data_unref (void * _userdata_)
{
	Block39Data* _data39_;
	_data39_ = (Block39Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data39_->_ref_count_)) {
		_g_free0 (_data39_->q);
		g_slice_free (Block39Data, _data39_);
	}
}

static JsonNode*
_vala_JsonNode_copy (JsonNode* self)
{
	return g_boxed_copy (json_node_get_type (), self);
}

static gpointer
__vala_JsonNode_copy0 (gpointer self)
{
	return self ? _vala_JsonNode_copy (self) : NULL;
}

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

static void
__lambda41_ (Block39Data* _data39_,
             SoupSession* sess,
             SoupMessage* msg,
             GError** error)
{
	JsonObject* root = NULL;
	TootleNetwork* _tmp0_;
	JsonObject* _tmp1_;
	JsonArray* statuses = NULL;
	JsonObject* _tmp2_;
	JsonArray* _tmp3_;
	JsonArray* _tmp4_;
	JsonNode* node = NULL;
	JsonArray* _tmp5_;
	JsonNode* _tmp6_;
	JsonNode* _tmp7_;
	JsonNode* _tmp8_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (sess != NULL);
	g_return_if_fail (msg != NULL);
	_tmp0_ = tootle_network;
	_tmp1_ = tootle_network_parse (_tmp0_, msg, &_inner_error0_);
	root = _tmp1_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp2_ = root;
	_tmp3_ = json_object_get_array_member (_tmp2_, "statuses");
	_tmp4_ = _json_array_ref0 (_tmp3_);
	statuses = _tmp4_;
	_tmp5_ = statuses;
	_tmp6_ = json_array_get_element (_tmp5_, (guint) 0);
	_tmp7_ = __vala_JsonNode_copy0 (_tmp6_);
	node = _tmp7_;
	_tmp8_ = node;
	if (_tmp8_ != NULL) {
		TootleAPIStatus* status = NULL;
		JsonNode* _tmp9_;
		TootleAPIStatus* _tmp10_;
		TootleDialogsMainWindow* _tmp11_;
		TootleAPIStatus* _tmp12_;
		TootleViewsThread* _tmp13_;
		TootleViewsThread* _tmp14_;
		TootleViewsBase* _tmp15_;
		TootleViewsBase* _tmp16_;
		_tmp9_ = node;
		_tmp10_ = tootle_api_status_from (_tmp9_, &_inner_error0_);
		status = _tmp10_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			__vala_JsonNode_free0 (node);
			_json_array_unref0 (statuses);
			_json_object_unref0 (root);
			return;
		}
		_tmp11_ = tootle_window;
		_tmp12_ = status;
		_tmp13_ = tootle_views_thread_new (_tmp12_);
		g_object_ref_sink (_tmp13_);
		_tmp14_ = _tmp13_;
		_tmp15_ = tootle_dialogs_main_window_open_view (_tmp11_, (TootleViewsBase*) _tmp14_);
		_tmp16_ = _tmp15_;
		_g_object_unref0 (_tmp16_);
		_g_object_unref0 (_tmp14_);
		_g_object_unref0 (status);
	} else {
		tootle_desktop_open_uri (_data39_->q);
	}
	__vala_JsonNode_free0 (node);
	_json_array_unref0 (statuses);
	_json_object_unref0 (root);
}

static void
___lambda41__tootle_network_success_callback (SoupSession* session,
                                              SoupMessage* msg,
                                              gpointer self,
                                              GError** error)
{
	__lambda41_ (self, session, msg, error);
}

void
tootle_views_thread_open_from_link (const gchar* q)
{
	Block39Data* _data39_;
	gchar* _tmp0_;
	TootleRequest* _tmp1_;
	TootleRequest* _tmp2_;
	TootleRequest* _tmp3_;
	TootleRequest* _tmp4_;
	TootleRequest* _tmp5_;
	TootleRequest* _tmp6_;
	TootleRequest* _tmp7_;
	TootleRequest* _tmp8_;
	TootleRequest* _tmp9_;
	TootleRequest* _tmp10_;
	TootleRequest* _tmp11_;
	TootleRequest* _tmp12_;
	g_return_if_fail (q != NULL);
	_data39_ = g_slice_new0 (Block39Data);
	_data39_->_ref_count_ = 1;
	_tmp0_ = g_strdup (q);
	_g_free0 (_data39_->q);
	_data39_->q = _tmp0_;
	_tmp1_ = tootle_request_new_GET ("/api/v1/search");
	_tmp2_ = _tmp1_;
	_tmp3_ = tootle_request_with_account (_tmp2_, NULL);
	_tmp4_ = _tmp3_;
	_tmp5_ = tootle_request_with_param (_tmp4_, "q", _data39_->q);
	_tmp6_ = _tmp5_;
	_tmp7_ = tootle_request_with_param (_tmp6_, "resolve", "true");
	_tmp8_ = _tmp7_;
	_tmp9_ = tootle_request_then (_tmp8_, ___lambda41__tootle_network_success_callback, block39_data_ref (_data39_), block39_data_unref);
	_tmp10_ = _tmp9_;
	_tmp11_ = tootle_request_exec (_tmp10_);
	_tmp12_ = _tmp11_;
	_g_object_unref0 (_tmp12_);
	_g_object_unref0 (_tmp10_);
	_g_object_unref0 (_tmp8_);
	_g_object_unref0 (_tmp6_);
	_g_object_unref0 (_tmp4_);
	_g_object_unref0 (_tmp2_);
	block39_data_unref (_data39_);
	_data39_ = NULL;
}

TootleAPIStatus*
tootle_views_thread_get_root_status (TootleViewsThread* self)
{
	TootleAPIStatus* result;
	TootleAPIStatus* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_root_status;
	result = _tmp0_;
	return result;
}

void
tootle_views_thread_set_root_status (TootleViewsThread* self,
                                     TootleAPIStatus* value)
{
	TootleAPIStatus* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_views_thread_get_root_status (self);
	if (old_value != value) {
		TootleAPIStatus* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_root_status);
		self->priv->_root_status = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_views_thread_properties[TOOTLE_VIEWS_THREAD_ROOT_STATUS_PROPERTY]);
	}
}

static void
tootle_views_thread_class_init (TootleViewsThreadClass * klass,
                                gpointer klass_data)
{
	tootle_views_thread_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TootleViewsThread_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tootle_views_thread_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tootle_views_thread_set_property;
	G_OBJECT_CLASS (klass)->finalize = tootle_views_thread_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_VIEWS_THREAD_ROOT_STATUS_PROPERTY, tootle_views_thread_properties[TOOTLE_VIEWS_THREAD_ROOT_STATUS_PROPERTY] = g_param_spec_object ("root-status", "root-status", "root-status", TOOTLE_API_TYPE_STATUS, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}

static void
tootle_views_thread_tootle_iaccount_listener_interface_init (TootleIAccountListenerIface * iface,
                                                             gpointer iface_data)
{
	tootle_views_thread_tootle_iaccount_listener_parent_iface = g_type_interface_peek_parent (iface);
	iface->on_account_changed = (void (*) (TootleIAccountListener*, TootleInstanceAccount*)) tootle_views_thread_real_on_account_changed;
}

static void
tootle_views_thread_instance_init (TootleViewsThread * self,
                                   gpointer klass)
{
	self->priv = tootle_views_thread_get_instance_private (self);
	self->account = NULL;
}

static void
tootle_views_thread_finalize (GObject * obj)
{
	TootleViewsThread * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TOOTLE_VIEWS_TYPE_THREAD, TootleViewsThread);
	_g_object_unref0 (self->priv->_root_status);
	_g_object_unref0 (self->account);
	_g_object_unref0 (self->root_widget);
	G_OBJECT_CLASS (tootle_views_thread_parent_class)->finalize (obj);
}

static GType
tootle_views_thread_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TootleViewsThreadClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tootle_views_thread_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TootleViewsThread), 0, (GInstanceInitFunc) tootle_views_thread_instance_init, NULL };
	static const GInterfaceInfo tootle_iaccount_listener_info = { (GInterfaceInitFunc) tootle_views_thread_tootle_iaccount_listener_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType tootle_views_thread_type_id;
	tootle_views_thread_type_id = g_type_register_static (TOOTLE_VIEWS_TYPE_BASE, "TootleViewsThread", &g_define_type_info, 0);
	g_type_add_interface_static (tootle_views_thread_type_id, TOOTLE_TYPE_IACCOUNT_LISTENER, &tootle_iaccount_listener_info);
	TootleViewsThread_private_offset = g_type_add_instance_private (tootle_views_thread_type_id, sizeof (TootleViewsThreadPrivate));
	return tootle_views_thread_type_id;
}

GType
tootle_views_thread_get_type (void)
{
	static volatile gsize tootle_views_thread_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_views_thread_type_id__volatile)) {
		GType tootle_views_thread_type_id;
		tootle_views_thread_type_id = tootle_views_thread_get_type_once ();
		g_once_init_leave (&tootle_views_thread_type_id__volatile, tootle_views_thread_type_id);
	}
	return tootle_views_thread_type_id__volatile;
}

static void
_vala_tootle_views_thread_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	TootleViewsThread * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_VIEWS_TYPE_THREAD, TootleViewsThread);
	switch (property_id) {
		case TOOTLE_VIEWS_THREAD_ROOT_STATUS_PROPERTY:
		g_value_set_object (value, tootle_views_thread_get_root_status (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tootle_views_thread_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	TootleViewsThread * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_VIEWS_TYPE_THREAD, TootleViewsThread);
	switch (property_id) {
		case TOOTLE_VIEWS_THREAD_ROOT_STATUS_PROPERTY:
		tootle_views_thread_set_root_status (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

