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

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

#define TOOTLE_DIALOGS_TYPE_COMPOSE (tootle_dialogs_compose_get_type ())
#define TOOTLE_DIALOGS_COMPOSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_DIALOGS_TYPE_COMPOSE, TootleDialogsCompose))
#define TOOTLE_DIALOGS_COMPOSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_DIALOGS_TYPE_COMPOSE, TootleDialogsComposeClass))
#define TOOTLE_DIALOGS_IS_COMPOSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_DIALOGS_TYPE_COMPOSE))
#define TOOTLE_DIALOGS_IS_COMPOSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_DIALOGS_TYPE_COMPOSE))
#define TOOTLE_DIALOGS_COMPOSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_DIALOGS_TYPE_COMPOSE, TootleDialogsComposeClass))

typedef struct _TootleDialogsCompose TootleDialogsCompose;
typedef struct _TootleDialogsComposeClass TootleDialogsComposeClass;
typedef struct _TootleDialogsComposePrivate TootleDialogsComposePrivate;

#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_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;

#define TOOTLE_WIDGETS_TYPE_VISIBILITY_POPOVER (tootle_widgets_visibility_popover_get_type ())
#define TOOTLE_WIDGETS_VISIBILITY_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_WIDGETS_TYPE_VISIBILITY_POPOVER, TootleWidgetsVisibilityPopover))
#define TOOTLE_WIDGETS_VISIBILITY_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_WIDGETS_TYPE_VISIBILITY_POPOVER, TootleWidgetsVisibilityPopoverClass))
#define TOOTLE_WIDGETS_IS_VISIBILITY_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_WIDGETS_TYPE_VISIBILITY_POPOVER))
#define TOOTLE_WIDGETS_IS_VISIBILITY_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_WIDGETS_TYPE_VISIBILITY_POPOVER))
#define TOOTLE_WIDGETS_VISIBILITY_POPOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_WIDGETS_TYPE_VISIBILITY_POPOVER, TootleWidgetsVisibilityPopoverClass))

typedef struct _TootleWidgetsVisibilityPopover TootleWidgetsVisibilityPopover;
typedef struct _TootleWidgetsVisibilityPopoverClass TootleWidgetsVisibilityPopoverClass;
enum  {
	TOOTLE_DIALOGS_COMPOSE_0_PROPERTY,
	TOOTLE_DIALOGS_COMPOSE_STATUS_PROPERTY,
	TOOTLE_DIALOGS_COMPOSE_STYLE_CLASS_PROPERTY,
	TOOTLE_DIALOGS_COMPOSE_LABEL_PROPERTY,
	TOOTLE_DIALOGS_COMPOSE_WORKING_PROPERTY,
	TOOTLE_DIALOGS_COMPOSE_CHAR_LIMIT_PROPERTY,
	TOOTLE_DIALOGS_COMPOSE_NUM_PROPERTIES
};
static GParamSpec* tootle_dialogs_compose_properties[TOOTLE_DIALOGS_COMPOSE_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))
typedef enum  {
	TOOTLE_API_VISIBILITY_PUBLIC,
	TOOTLE_API_VISIBILITY_UNLISTED,
	TOOTLE_API_VISIBILITY_PRIVATE,
	TOOTLE_API_VISIBILITY_DIRECT
} TootleAPIVisibility;

#define TOOTLE_API_TYPE_VISIBILITY (tootle_api_visibility_get_type ())

#define TOOTLE_API_TYPE_ATTACHMENT (tootle_api_attachment_get_type ())
#define TOOTLE_API_ATTACHMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_ATTACHMENT, TootleAPIAttachment))
#define TOOTLE_API_ATTACHMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_ATTACHMENT, TootleAPIAttachmentClass))
#define TOOTLE_API_IS_ATTACHMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_ATTACHMENT))
#define TOOTLE_API_IS_ATTACHMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_ATTACHMENT))
#define TOOTLE_API_ATTACHMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_ATTACHMENT, TootleAPIAttachmentClass))

typedef struct _TootleAPIAttachment TootleAPIAttachment;
typedef struct _TootleAPIAttachmentClass TootleAPIAttachmentClass;

#define TOOTLE_DIALOGS_COMPOSE_TYPE_MEDIA_ITEM (tootle_dialogs_compose_media_item_get_type ())
#define TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_DIALOGS_COMPOSE_TYPE_MEDIA_ITEM, TootleDialogsComposeMediaItem))
#define TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_DIALOGS_COMPOSE_TYPE_MEDIA_ITEM, TootleDialogsComposeMediaItemClass))
#define TOOTLE_DIALOGS_COMPOSE_IS_MEDIA_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_DIALOGS_COMPOSE_TYPE_MEDIA_ITEM))
#define TOOTLE_DIALOGS_COMPOSE_IS_MEDIA_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_DIALOGS_COMPOSE_TYPE_MEDIA_ITEM))
#define TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_DIALOGS_COMPOSE_TYPE_MEDIA_ITEM, TootleDialogsComposeMediaItemClass))

typedef struct _TootleDialogsComposeMediaItem TootleDialogsComposeMediaItem;
typedef struct _TootleDialogsComposeMediaItemClass TootleDialogsComposeMediaItemClass;

#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;
typedef struct _TootleDialogsComposeMediaItemPrivate TootleDialogsComposeMediaItemPrivate;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block31Data Block31Data;

#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;

#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_TYPE_ACCOUNTS (tootle_accounts_get_type ())
#define TOOTLE_ACCOUNTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_ACCOUNTS, TootleAccounts))
#define TOOTLE_ACCOUNTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_ACCOUNTS, TootleAccountsClass))
#define TOOTLE_IS_ACCOUNTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_ACCOUNTS))
#define TOOTLE_IS_ACCOUNTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_ACCOUNTS))
#define TOOTLE_ACCOUNTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_ACCOUNTS, TootleAccountsClass))

typedef struct _TootleAccounts TootleAccounts;
typedef struct _TootleAccountsClass TootleAccountsClass;

#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 __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
typedef struct _TootleDialogsComposeTransactionData TootleDialogsComposeTransactionData;
enum  {
	TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_0_PROPERTY,
	TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_ENTITY_PROPERTY,
	TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_SOURCE_PROPERTY,
	TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_NUM_PROPERTIES
};
static GParamSpec* tootle_dialogs_compose_media_item_properties[TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_NUM_PROPERTIES];
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

#define TOOTLE_TYPE_APPLICATION (tootle_application_get_type ())
#define TOOTLE_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_APPLICATION, TootleApplication))
#define TOOTLE_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_APPLICATION, TootleApplicationClass))
#define TOOTLE_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_APPLICATION))
#define TOOTLE_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_APPLICATION))
#define TOOTLE_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_APPLICATION, TootleApplicationClass))

typedef struct _TootleApplication TootleApplication;
typedef struct _TootleApplicationClass TootleApplicationClass;

#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 _TootleDialogsCompose {
	HdyWindow parent_instance;
	TootleDialogsComposePrivate * priv;
};

struct _TootleDialogsComposeClass {
	HdyWindowClass parent_class;
};

struct _TootleDialogsComposePrivate {
	TootleAPIStatus* _status;
	gchar* _style_class;
	gchar* _label;
	gboolean _working;
	HdyViewSwitcherTitle* mode_switcher;
	GtkButton* commit;
	GtkStack* commit_stack;
	GtkRevealer* cw_revealer;
	GtkToggleButton* cw_button;
	GtkEntry* cw;
	GtkLabel* counter;
	GtkMenuButton* visibility_button;
	GtkImage* visibility_icon;
	TootleWidgetsVisibilityPopover* visibility_popover;
	GtkTextView* content;
	GtkStack* mode;
	GtkListBox* media_list;
};

struct _TootleDialogsComposeMediaItem {
	GtkListBoxRow parent_instance;
	TootleDialogsComposeMediaItemPrivate * priv;
	GtkLabel* title_label;
	GtkEntry* description;
	GtkStack* icon;
};

struct _TootleDialogsComposeMediaItemClass {
	GtkListBoxRowClass parent_class;
};

struct _Block31Data {
	int _ref_count_;
	TootleDialogsCompose* self;
	GeeArrayList* pending_media;
	gpointer _async_data_;
};

struct _TootleDialogsComposeTransactionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TootleDialogsCompose* self;
	Block31Data* _data31_;
	TootleAPIStatus* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	TootleAPIStatus* _tmp3_;
	TootleRequest* _tmp4_;
	TootleRequest* _tmp5_;
	TootleRequest* _tmp6_;
	TootleRequest* _tmp7_;
	GeeArrayList* _tmp8_;
	GeeArrayList* media_ids;
	GeeArrayList* _tmp9_;
	GtkListBox* _tmp10_;
	gchar* media_param;
	gchar* _tmp11_;
	GeeArrayList* _tmp12_;
	gboolean _tmp13_;
	gboolean _tmp14_;
	GeeArrayList* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	TootleAPIStatus* _tmp22_;
	TootleAPIStatus* _tmp23_;
	GeeArrayList* _tmp24_;
	GeeArrayList* _tmp25_;
	GeeArrayList* _item_list;
	GeeArrayList* _tmp26_;
	gint _item_size;
	GeeArrayList* _tmp27_;
	gint _tmp28_;
	gint _tmp29_;
	gint _item_index;
	gint _tmp30_;
	gint _tmp31_;
	TootleDialogsComposeMediaItem* item;
	GeeArrayList* _tmp32_;
	gpointer _tmp33_;
	TootleDialogsComposeMediaItem* _tmp34_;
	TootleAPIAttachment* _tmp35_;
	TootleAPIAttachment* _tmp36_;
	TootleDialogsComposeMediaItem* _tmp37_;
	TootleAPIAttachment* _tmp38_;
	TootleAPIAttachment* _tmp39_;
	const gchar* _tmp40_;
	const gchar* _tmp41_;
	const gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	GeeArrayList* _tmp45_;
	TootleDialogsComposeMediaItem* _tmp46_;
	TootleAPIAttachment* _tmp47_;
	TootleAPIAttachment* _tmp48_;
	const gchar* _tmp49_;
	const gchar* _tmp50_;
	GtkStack* _tmp51_;
	TootleAPIAttachment* entity;
	TootleDialogsComposeMediaItem* _tmp52_;
	const gchar* _tmp53_;
	const gchar* _tmp54_;
	TootleDialogsComposeMediaItem* _tmp55_;
	GtkLabel* _tmp56_;
	const gchar* _tmp57_;
	const gchar* _tmp58_;
	TootleDialogsComposeMediaItem* _tmp59_;
	GtkEntry* _tmp60_;
	const gchar* _tmp61_;
	const gchar* _tmp62_;
	TootleAPIAttachment* _tmp63_;
	GeeArrayList* _tmp64_;
	TootleAPIAttachment* _tmp65_;
	const gchar* _tmp66_;
	const gchar* _tmp67_;
	TootleDialogsComposeMediaItem* _tmp68_;
	GtkStack* _tmp69_;
	GeeArrayList* _tmp70_;
	gchar* _tmp71_;
	const gchar* _tmp72_;
	gchar* _tmp73_;
	TootleAPIStatus* _tmp74_;
	GtkTextView* _tmp75_;
	GtkTextBuffer* _tmp76_;
	GtkTextBuffer* _tmp77_;
	gchar* _tmp78_;
	gchar* _tmp79_;
	gchar* _tmp80_;
	TootleAPIStatus* _tmp81_;
	GtkEntry* _tmp82_;
	const gchar* _tmp83_;
	const gchar* _tmp84_;
	TootleRequest* req;
	const gchar* _tmp85_;
	const gchar* _tmp86_;
	gchar* _tmp87_;
	gchar* _tmp88_;
	TootleRequest* _tmp89_;
	TootleRequest* _tmp90_;
	TootleAccounts* _tmp91_;
	TootleInstanceAccount* _tmp92_;
	TootleInstanceAccount* _tmp93_;
	TootleRequest* _tmp94_;
	TootleRequest* _tmp95_;
	TootleWidgetsVisibilityPopover* _tmp96_;
	TootleAPIVisibility _tmp97_;
	TootleAPIVisibility _tmp98_;
	gchar* _tmp99_;
	gchar* _tmp100_;
	TootleRequest* _tmp101_;
	TootleRequest* _tmp102_;
	TootleAPIStatus* _tmp103_;
	const gchar* _tmp104_;
	const gchar* _tmp105_;
	gchar* _tmp106_;
	gchar* _tmp107_;
	TootleRequest* _tmp108_;
	TootleRequest* _tmp109_;
	GtkToggleButton* _tmp110_;
	gboolean _tmp111_;
	gboolean _tmp112_;
	TootleRequest* _tmp113_;
	TootleRequest* _tmp114_;
	TootleRequest* _tmp115_;
	TootleRequest* _tmp116_;
	GtkEntry* _tmp117_;
	const gchar* _tmp118_;
	const gchar* _tmp119_;
	gchar* _tmp120_;
	gchar* _tmp121_;
	TootleRequest* _tmp122_;
	TootleRequest* _tmp123_;
	TootleAPIStatus* _tmp124_;
	const gchar* _tmp125_;
	const gchar* _tmp126_;
	TootleRequest* _tmp127_;
	TootleAPIStatus* _tmp128_;
	const gchar* _tmp129_;
	const gchar* _tmp130_;
	TootleRequest* _tmp131_;
	TootleRequest* _tmp132_;
	TootleAPIStatus* _tmp133_;
	const gchar* _tmp134_;
	const gchar* _tmp135_;
	TootleRequest* _tmp136_;
	TootleAPIStatus* _tmp137_;
	const gchar* _tmp138_;
	const gchar* _tmp139_;
	TootleRequest* _tmp140_;
	TootleRequest* _tmp141_;
	TootleRequest* _tmp142_;
	TootleRequest* _tmp143_;
	TootleRequest* _tmp144_;
	JsonNode* node;
	TootleNetwork* _tmp145_;
	TootleRequest* _tmp146_;
	JsonNode* _tmp147_;
	TootleAPIStatus* status;
	JsonNode* _tmp148_;
	TootleAPIStatus* _tmp149_;
	TootleAPIStatus* _tmp150_;
	const gchar* _tmp151_;
	const gchar* _tmp152_;
	const gchar* _tmp153_;
	gchar* _tmp154_;
	gchar* _tmp155_;
	GError* _inner_error0_;
};

struct _TootleDialogsComposeMediaItemPrivate {
	TootleDialogsCompose* dialog;
	TootleAPIAttachment* _entity;
	gchar* _source;
};

static gint TootleDialogsCompose_private_offset;
static gpointer tootle_dialogs_compose_parent_class = NULL;
extern TootleAccounts* tootle_accounts;
extern TootleNetwork* tootle_network;
static gint TootleDialogsComposeMediaItem_private_offset;
static gpointer tootle_dialogs_compose_media_item_parent_class = NULL;
extern TootleApplication* tootle_app;
extern TootleDialogsMainWindow* tootle_window;

GType tootle_dialogs_compose_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleDialogsCompose, g_object_unref)
GType tootle_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleEntity, g_object_unref)
GType tootle_api_status_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIStatus, g_object_unref)
GType tootle_widgets_visibility_popover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleWidgetsVisibilityPopover, g_object_unref)
TootleDialogsCompose* tootle_dialogs_compose_new (TootleAPIStatus* template);
TootleDialogsCompose* tootle_dialogs_compose_construct (GType object_type,
                                                        TootleAPIStatus* template);
GType tootle_api_visibility_get_type (void) G_GNUC_CONST ;
static void tootle_dialogs_compose_set_visibility (TootleDialogsCompose* self,
                                            TootleAPIVisibility v);
TootleAPIStatus* tootle_dialogs_compose_get_status (TootleDialogsCompose* self);
TootleAPIVisibility tootle_api_status_get_visibility (TootleAPIStatus* self);
TootleDialogsCompose* tootle_dialogs_compose_new_redraft (TootleAPIStatus* status);
TootleDialogsCompose* tootle_dialogs_compose_construct_redraft (GType object_type,
                                                                TootleAPIStatus* status);
const gchar* tootle_api_status_get_id (TootleAPIStatus* self);
GType tootle_api_attachment_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIAttachment, g_object_unref)
GeeArrayList* tootle_api_status_get_media_attachments (TootleAPIStatus* self);
static gboolean __lambda58_ (TootleDialogsCompose* self,
                      TootleAPIAttachment* a);
TootleDialogsComposeMediaItem* tootle_dialogs_compose_media_item_new (TootleDialogsCompose* dialog,
                                                                      const gchar* source,
                                                                      TootleAPIAttachment* entity);
TootleDialogsComposeMediaItem* tootle_dialogs_compose_media_item_construct (GType object_type,
                                                                            TootleDialogsCompose* dialog,
                                                                            const gchar* source,
                                                                            TootleAPIAttachment* entity);
GType tootle_dialogs_compose_media_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleDialogsComposeMediaItem, g_object_unref)
static gboolean ___lambda58__gee_forall_func (gpointer g,
                                       gpointer self);
TootleDialogsCompose* tootle_dialogs_compose_new_reply (TootleAPIStatus* to);
TootleDialogsCompose* tootle_dialogs_compose_construct_reply (GType object_type,
                                                              TootleAPIStatus* to);
TootleAPIStatus* tootle_api_status_new_empty (void);
TootleAPIStatus* tootle_api_status_construct_empty (GType object_type);
void tootle_api_status_set_in_reply_to_id (TootleAPIStatus* self,
                                           const gchar* value);
GType tootle_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIAccount, g_object_unref)
TootleAPIAccount* tootle_api_status_get_account (TootleAPIStatus* self);
const gchar* tootle_api_account_get_id (TootleAPIAccount* self);
void tootle_api_status_set_in_reply_to_account_id (TootleAPIStatus* self,
                                                   const gchar* value);
const gchar* tootle_api_status_get_spoiler_text (TootleAPIStatus* self);
void tootle_api_status_set_spoiler_text (TootleAPIStatus* self,
                                         const gchar* value);
TootleAPIStatus* tootle_api_status_get_formal (TootleAPIStatus* self);
gchar* tootle_api_status_get_reply_mentions (TootleAPIStatus* self);
void tootle_api_status_set_content (TootleAPIStatus* self,
                                    const gchar* value);
const gchar* tootle_api_status_get_in_reply_to_id (TootleAPIStatus* self);
void tootle_widgets_visibility_popover_set_selected (TootleWidgetsVisibilityPopover* self,
                                                     TootleAPIVisibility value);
void tootle_widgets_visibility_popover_invalidate (TootleWidgetsVisibilityPopover* self);
static void tootle_dialogs_compose_set_media_mode (TootleDialogsCompose* self,
                                            gboolean has_media);
static void tootle_dialogs_compose_validate (TootleDialogsCompose* self);
gint tootle_dialogs_compose_get_char_limit (TootleDialogsCompose* self);
static void _tootle_dialogs_compose_validate_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                 gpointer self);
static void tootle_dialogs_compose_on_state_change (TootleDialogsCompose* self,
                                             GParamSpec* p);
gboolean tootle_dialogs_compose_get_working (TootleDialogsCompose* self);
static void __lambda59_ (TootleDialogsCompose* self,
                  GtkWidget* w);
static void ___lambda59__gtk_callback (GtkWidget* widget,
                                gpointer self);
static void tootle_dialogs_compose_on_select_media (TootleDialogsCompose* self);
static void _g_free0_ (gpointer var);
static inline void _g_slist_free__g_free0_ (GSList* self);
static void _tootle_dialogs_compose_on_select_media_gtk_button_clicked (GtkButton* _sender,
                                                                 gpointer self);
static void tootle_dialogs_compose_on_media_list_row_activated (TootleDialogsCompose* self,
                                                         GtkWidget* w);
static void _tootle_dialogs_compose_on_media_list_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                                     GtkListBoxRow* row,
                                                                                     gpointer self);
static void tootle_dialogs_compose_on_close (TootleDialogsCompose* self);
static void _tootle_dialogs_compose_on_close_gtk_button_clicked (GtkButton* _sender,
                                                          gpointer self);
static void tootle_dialogs_compose_on_error (TootleDialogsCompose* self,
                                      gint32 code,
                                      const gchar* reason);
void tootle_dialogs_compose_set_working (TootleDialogsCompose* self,
                                         gboolean value);
static void tootle_dialogs_compose_on_commit (TootleDialogsCompose* self);
static void tootle_dialogs_compose_transaction (TootleDialogsCompose* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void tootle_dialogs_compose_transaction_finish (TootleDialogsCompose* self,
                                                GAsyncResult* _res_,
                                                GError** error);
static void __lambda61_ (TootleDialogsCompose* self,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda61__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void _tootle_dialogs_compose_on_commit_gtk_button_clicked (GtkButton* _sender,
                                                           gpointer self);
static void tootle_dialogs_compose_transaction_data_free (gpointer _data);
static gboolean tootle_dialogs_compose_transaction_co (TootleDialogsComposeTransactionData* _data_);
static Block31Data* block31_data_ref (Block31Data* _data31_);
static void block31_data_unref (void * _userdata_);
GType tootle_request_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleRequest, g_object_unref)
TootleRequest* tootle_api_status_annihilate (TootleAPIStatus* self);
void tootle_request_await (TootleRequest* self,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_);
TootleRequest* tootle_request_await_finish (TootleRequest* self,
                                            GAsyncResult* _res_,
                                            GError** error);
static void tootle_dialogs_compose_transaction_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void __lambda60_ (Block31Data* _data31_,
                  GtkWidget* w);
static void ___lambda60__gtk_callback (GtkWidget* widget,
                                gpointer self);
gboolean tootle_api_status_has_media (TootleAPIStatus* self);
void tootle_api_status_set_media_attachments (TootleAPIStatus* self,
                                              GeeArrayList* value);
TootleAPIAttachment* tootle_dialogs_compose_media_item_get_entity (TootleDialogsComposeMediaItem* self);
const gchar* tootle_api_attachment_get_id (TootleAPIAttachment* self);
void tootle_api_attachment_upload (const gchar* uri,
                                   const gchar* title,
                                   const gchar* descr,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
TootleAPIAttachment* tootle_api_attachment_upload_finish (GAsyncResult* _res_,
                                                          GError** error);
const gchar* tootle_dialogs_compose_media_item_get_source (TootleDialogsComposeMediaItem* self);
gchar* tootle_request_array2string (GeeArrayList* array,
                                    const gchar* key);
TootleRequest* tootle_request_new_POST (const gchar* url);
TootleRequest* tootle_request_construct_POST (GType object_type,
                                              const gchar* url);
GType tootle_instance_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleInstanceAccount, g_object_unref)
TootleRequest* tootle_request_with_account (TootleRequest* self,
                                            TootleInstanceAccount* account);
GType tootle_accounts_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAccounts, g_object_unref)
TootleInstanceAccount* tootle_accounts_get_active (TootleAccounts* self);
TootleRequest* tootle_request_with_param (TootleRequest* self,
                                          const gchar* name,
                                          const gchar* val);
TootleAPIVisibility tootle_widgets_visibility_popover_get_selected (TootleWidgetsVisibilityPopover* self);
gchar* tootle_api_visibility_to_string (TootleAPIVisibility self);
gchar* tootle_html_utils_uri_encode (const gchar* str);
const gchar* tootle_api_status_get_content (TootleAPIStatus* self);
const gchar* tootle_api_status_get_in_reply_to_account_id (TootleAPIStatus* self);
GType tootle_network_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleNetwork, g_object_unref)
JsonNode* tootle_network_parse_node (TootleNetwork* self,
                                     SoupMessage* msg,
                                     GError** error);
TootleAPIStatus* tootle_api_status_from (JsonNode* node,
                                         GError** error);
static void _vala_JsonNode_free (JsonNode* self);
void tootle_dialogs_compose_set_status (TootleDialogsCompose* self,
                                        TootleAPIStatus* value);
const gchar* tootle_dialogs_compose_get_style_class (TootleDialogsCompose* self);
void tootle_dialogs_compose_set_style_class (TootleDialogsCompose* self,
                                             const gchar* value);
const gchar* tootle_dialogs_compose_get_label (TootleDialogsCompose* self);
void tootle_dialogs_compose_set_label (TootleDialogsCompose* self,
                                       const gchar* value);
void tootle_dialogs_compose_media_item_set_source (TootleDialogsComposeMediaItem* self,
                                                   const gchar* value);
void tootle_dialogs_compose_media_item_set_entity (TootleDialogsComposeMediaItem* self,
                                                   TootleAPIAttachment* value);
const gchar* tootle_api_attachment_get_description (TootleAPIAttachment* self);
const gchar* tootle_api_attachment_get_url (TootleAPIAttachment* self);
static void tootle_dialogs_compose_media_item_on_remove (TootleDialogsComposeMediaItem* self);
GType tootle_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleApplication, g_object_unref)
gboolean tootle_application_question (TootleApplication* self,
                                      const gchar* text,
                                      const gchar* msg,
                                      GtkWindow* win);
static void _tootle_dialogs_compose_media_item_on_remove_gtk_button_clicked (GtkButton* _sender,
                                                                      gpointer self);
static void tootle_dialogs_compose_media_item_finalize (GObject * obj);
static GType tootle_dialogs_compose_media_item_get_type_once (void);
static void _vala_tootle_dialogs_compose_media_item_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec);
static void _vala_tootle_dialogs_compose_media_item_set_property (GObject * object,
                                                           guint property_id,
                                                           const GValue * value,
                                                           GParamSpec * pspec);
static GObject * tootle_dialogs_compose_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties);
GType tootle_dialogs_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleDialogsMainWindow, g_object_unref)
static void _tootle_dialogs_compose_on_state_change_g_object_notify (GObject* _sender,
                                                              GParamSpec* pspec,
                                                              gpointer self);
TootleWidgetsVisibilityPopover* tootle_widgets_visibility_popover_new_with_button (GtkMenuButton* w);
TootleWidgetsVisibilityPopover* tootle_widgets_visibility_popover_construct_with_button (GType object_type,
                                                                                         GtkMenuButton* w);
static gboolean _tootle_dialogs_compose___lambda62_ (TootleDialogsCompose* self,
                                              GBinding* b,
                                              GValue* src,
                                              GValue* target);
gchar* tootle_api_visibility_get_icon (TootleAPIVisibility self);
static gboolean __tootle_dialogs_compose___lambda62__gbinding_transform_func (GBinding* binding,
                                                                       GValue* from_value,
                                                                       GValue* to_value,
                                                                       gpointer self);
static void _tootle_dialogs_compose___lambda63_ (TootleDialogsCompose* self);
static void __tootle_dialogs_compose___lambda63__gtk_entry_buffer_deleted_text (GtkEntryBuffer* _sender,
                                                                         guint position,
                                                                         guint n_chars,
                                                                         gpointer self);
static void _tootle_dialogs_compose___lambda64_ (TootleDialogsCompose* self);
static void __tootle_dialogs_compose___lambda64__gtk_entry_buffer_inserted_text (GtkEntryBuffer* _sender,
                                                                          guint position,
                                                                          const gchar* chars,
                                                                          guint n_chars,
                                                                          gpointer self);
static void _tootle_dialogs_compose_validate_gtk_text_buffer_changed (GtkTextBuffer* _sender,
                                                               gpointer self);
gboolean tootle_api_status_get_has_spoiler (TootleAPIStatus* self);
gchar* tootle_html_utils_remove_tags (const gchar* content);
static void tootle_dialogs_compose_finalize (GObject * obj);
static GType tootle_dialogs_compose_get_type_once (void);
static void _vala_tootle_dialogs_compose_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec);
static void _vala_tootle_dialogs_compose_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

extern const gchar* TOOTLE_API_ATTACHMENT_SUPPORTED_MIMES[24];

static inline gpointer
tootle_dialogs_compose_get_instance_private (TootleDialogsCompose* self)
{
	return G_STRUCT_MEMBER_P (self, TootleDialogsCompose_private_offset);
}

TootleDialogsCompose*
tootle_dialogs_compose_construct (GType object_type,
                                  TootleAPIStatus* template)
{
	TootleDialogsCompose * self = NULL;
	TootleAPIStatus* _tmp0_;
	TootleAPIVisibility _tmp1_;
	TootleAPIVisibility _tmp2_;
	g_return_val_if_fail (template != NULL, NULL);
	self = (TootleDialogsCompose*) g_object_new (object_type, "status", template, "style-class", GTK_STYLE_CLASS_SUGGESTED_ACTION, "label", _ ("Compose"), NULL);
	g_message ("Compose.vala:127: Composing status template");
	_tmp0_ = self->priv->_status;
	_tmp1_ = tootle_api_status_get_visibility (_tmp0_);
	_tmp2_ = _tmp1_;
	tootle_dialogs_compose_set_visibility (self, _tmp2_);
	return self;
}

TootleDialogsCompose*
tootle_dialogs_compose_new (TootleAPIStatus* template)
{
	return tootle_dialogs_compose_construct (TOOTLE_DIALOGS_TYPE_COMPOSE, template);
}

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 gboolean
__lambda58_ (TootleDialogsCompose* self,
             TootleAPIAttachment* a)
{
	GtkListBox* _tmp0_;
	TootleDialogsComposeMediaItem* _tmp1_;
	TootleDialogsComposeMediaItem* _tmp2_;
	gboolean result = FALSE;
	g_return_val_if_fail (a != NULL, FALSE);
	_tmp0_ = self->priv->media_list;
	_tmp1_ = tootle_dialogs_compose_media_item_new (self, NULL, a);
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	gtk_list_box_insert (_tmp0_, (GtkWidget*) _tmp2_, 0);
	_g_object_unref0 (_tmp2_);
	result = TRUE;
	_g_object_unref0 (a);
	return result;
}

static gboolean
___lambda58__gee_forall_func (gpointer g,
                              gpointer self)
{
	gboolean result;
	result = __lambda58_ ((TootleDialogsCompose*) self, (TootleAPIAttachment*) g);
	return result;
}

TootleDialogsCompose*
tootle_dialogs_compose_construct_redraft (GType object_type,
                                          TootleAPIStatus* status)
{
	TootleDialogsCompose * self = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	TootleAPIVisibility _tmp5_;
	TootleAPIVisibility _tmp6_;
	GeeArrayList* _tmp7_;
	GeeArrayList* _tmp8_;
	g_return_val_if_fail (status != NULL, NULL);
	self = (TootleDialogsCompose*) g_object_new (object_type, "status", status, "style-class", GTK_STYLE_CLASS_DESTRUCTIVE_ACTION, "label", _ ("Redraft"), NULL);
	_tmp0_ = tootle_api_status_get_id (status);
	_tmp1_ = _tmp0_;
	_tmp2_ = string_to_string (_tmp1_);
	_tmp3_ = g_strconcat ("Redrafting status ", _tmp2_, NULL);
	_tmp4_ = _tmp3_;
	g_message ("Compose.vala:137: %s", _tmp4_);
	_g_free0 (_tmp4_);
	_tmp5_ = tootle_api_status_get_visibility (status);
	_tmp6_ = _tmp5_;
	tootle_dialogs_compose_set_visibility (self, _tmp6_);
	_tmp7_ = tootle_api_status_get_media_attachments (status);
	_tmp8_ = _tmp7_;
	gee_abstract_collection_foreach ((GeeAbstractCollection*) _tmp8_, ___lambda58__gee_forall_func, self);
	return self;
}

TootleDialogsCompose*
tootle_dialogs_compose_new_redraft (TootleAPIStatus* status)
{
	return tootle_dialogs_compose_construct_redraft (TOOTLE_DIALOGS_TYPE_COMPOSE, status);
}

TootleDialogsCompose*
tootle_dialogs_compose_construct_reply (GType object_type,
                                        TootleAPIStatus* to)
{
	TootleDialogsCompose * self = NULL;
	TootleAPIStatus* template = NULL;
	TootleAPIStatus* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	TootleAPIAccount* _tmp4_;
	TootleAPIAccount* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	TootleAPIStatus* _tmp11_;
	TootleAPIStatus* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	TootleAPIStatus* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	TootleAPIVisibility _tmp21_;
	TootleAPIVisibility _tmp22_;
	g_return_val_if_fail (to != NULL, NULL);
	_tmp0_ = tootle_api_status_new_empty ();
	template = _tmp0_;
	_tmp1_ = tootle_api_status_get_id (to);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_to_string (_tmp2_);
	tootle_api_status_set_in_reply_to_id (template, _tmp3_);
	_tmp4_ = tootle_api_status_get_account (to);
	_tmp5_ = _tmp4_;
	_tmp6_ = tootle_api_account_get_id (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = string_to_string (_tmp7_);
	tootle_api_status_set_in_reply_to_account_id (template, _tmp8_);
	_tmp9_ = tootle_api_status_get_spoiler_text (to);
	_tmp10_ = _tmp9_;
	tootle_api_status_set_spoiler_text (template, _tmp10_);
	_tmp11_ = tootle_api_status_get_formal (to);
	_tmp12_ = _tmp11_;
	_tmp13_ = tootle_api_status_get_reply_mentions (_tmp12_);
	_tmp14_ = _tmp13_;
	tootle_api_status_set_content (template, _tmp14_);
	_g_free0 (_tmp14_);
	self = (TootleDialogsCompose*) g_object_new (object_type, "status", template, "style-class", GTK_STYLE_CLASS_SUGGESTED_ACTION, "label", _ ("Reply"), NULL);
	_tmp15_ = self->priv->_status;
	_tmp16_ = tootle_api_status_get_in_reply_to_id (_tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = string_to_string (_tmp17_);
	_tmp19_ = g_strconcat ("Replying to status ", _tmp18_, NULL);
	_tmp20_ = _tmp19_;
	g_message ("Compose.vala:156: %s", _tmp20_);
	_g_free0 (_tmp20_);
	_tmp21_ = tootle_api_status_get_visibility (to);
	_tmp22_ = _tmp21_;
	tootle_dialogs_compose_set_visibility (self, _tmp22_);
	_g_object_unref0 (template);
	return self;
}

TootleDialogsCompose*
tootle_dialogs_compose_new_reply (TootleAPIStatus* to)
{
	return tootle_dialogs_compose_construct_reply (TOOTLE_DIALOGS_TYPE_COMPOSE, to);
}

static void
tootle_dialogs_compose_set_visibility (TootleDialogsCompose* self,
                                       TootleAPIVisibility v)
{
	TootleWidgetsVisibilityPopover* _tmp0_;
	TootleWidgetsVisibilityPopover* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->visibility_popover;
	tootle_widgets_visibility_popover_set_selected (_tmp0_, v);
	_tmp1_ = self->priv->visibility_popover;
	tootle_widgets_visibility_popover_invalidate (_tmp1_);
}

static void
tootle_dialogs_compose_set_media_mode (TootleDialogsCompose* self,
                                       gboolean has_media)
{
	HdyViewSwitcherTitle* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->mode_switcher;
	hdy_view_switcher_title_set_view_switcher_enabled (_tmp0_, has_media);
}

static void
tootle_dialogs_compose_validate (TootleDialogsCompose* self)
{
	gint remain = 0;
	gint _tmp0_;
	gint _tmp1_;
	GtkTextView* _tmp2_;
	GtkTextBuffer* _tmp3_;
	GtkTextBuffer* _tmp4_;
	GtkToggleButton* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	GtkLabel* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GtkButton* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tootle_dialogs_compose_get_char_limit (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->content;
	_tmp3_ = gtk_text_view_get_buffer (_tmp2_);
	_tmp4_ = _tmp3_;
	remain = _tmp1_ - gtk_text_buffer_get_char_count (_tmp4_);
	_tmp5_ = self->priv->cw_button;
	_tmp6_ = gtk_toggle_button_get_active (_tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp7_) {
		GtkEntry* _tmp8_;
		GtkEntryBuffer* _tmp9_;
		GtkEntryBuffer* _tmp10_;
		_tmp8_ = self->priv->cw;
		_tmp9_ = gtk_entry_get_buffer (_tmp8_);
		_tmp10_ = _tmp9_;
		remain -= (gint) gtk_entry_buffer_get_length (_tmp10_);
	}
	_tmp11_ = self->priv->counter;
	_tmp12_ = g_strdup_printf ("%i", remain);
	_tmp13_ = _tmp12_;
	gtk_label_set_label (_tmp11_, _tmp13_);
	_g_free0 (_tmp13_);
	_tmp14_ = self->priv->commit;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp14_, remain >= 0);
}

static void
_tootle_dialogs_compose_validate_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                            gpointer self)
{
	tootle_dialogs_compose_validate ((TootleDialogsCompose*) self);
}

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

static void
__lambda59_ (TootleDialogsCompose* self,
             GtkWidget* w)
{
	TootleDialogsComposeMediaItem* item = NULL;
	TootleDialogsComposeMediaItem* _tmp0_;
	TootleDialogsComposeMediaItem* _tmp1_;
	g_return_if_fail (w != NULL);
	_tmp0_ = _g_object_ref0 (TOOTLE_DIALOGS_COMPOSE_IS_MEDIA_ITEM (w) ? ((TootleDialogsComposeMediaItem*) w) : NULL);
	item = _tmp0_;
	_tmp1_ = item;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_ = NULL;
		gboolean _tmp3_;
		TootleDialogsComposeMediaItem* _tmp4_;
		GtkStack* _tmp5_;
		_tmp3_ = self->priv->_working;
		if (_tmp3_) {
			_tmp2_ = "upload";
		} else {
			_tmp2_ = "new";
		}
		_tmp4_ = item;
		_tmp5_ = _tmp4_->icon;
		gtk_stack_set_visible_child_name (_tmp5_, _tmp2_);
	}
	_g_object_unref0 (item);
}

static void
___lambda59__gtk_callback (GtkWidget* widget,
                           gpointer self)
{
	__lambda59_ ((TootleDialogsCompose*) self, widget);
}

static void
tootle_dialogs_compose_on_state_change (TootleDialogsCompose* self,
                                        GParamSpec* p)
{
	const gchar* _tmp0_ = NULL;
	gboolean _tmp1_;
	GtkStack* _tmp2_;
	GtkButton* _tmp3_;
	gboolean _tmp4_;
	GtkListBox* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_working;
	if (_tmp1_) {
		_tmp0_ = "working";
	} else {
		_tmp0_ = "ready";
	}
	_tmp2_ = self->priv->commit_stack;
	gtk_stack_set_visible_child_name (_tmp2_, _tmp0_);
	_tmp3_ = self->priv->commit;
	_tmp4_ = self->priv->_working;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, !_tmp4_);
	_tmp5_ = self->priv->media_list;
	gtk_container_foreach ((GtkContainer*) _tmp5_, ___lambda59__gtk_callback, self);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static inline void
_g_slist_free__g_free0_ (GSList* self)
{
	g_slist_free_full (self, (GDestroyNotify) _g_free0_);
}

static void
tootle_dialogs_compose_on_select_media (TootleDialogsCompose* self)
{
	GtkFileFilter* filter = NULL;
	GtkFileFilter* _tmp0_;
	GtkFileChooserNative* chooser = NULL;
	GtkFileChooserNative* _tmp4_;
	GtkFileChooserNative* _tmp5_;
	GtkFileChooserNative* _tmp6_;
	GtkFileFilter* _tmp7_;
	GtkFileChooserNative* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_file_filter_new ();
	g_object_ref_sink (_tmp0_);
	filter = _tmp0_;
	{
		const gchar** mime_collection = NULL;
		gint mime_collection_length1 = 0;
		gint _mime_collection_size_ = 0;
		gint mime_it = 0;
		mime_collection = TOOTLE_API_ATTACHMENT_SUPPORTED_MIMES;
		mime_collection_length1 = G_N_ELEMENTS (TOOTLE_API_ATTACHMENT_SUPPORTED_MIMES);
		for (mime_it = 0; mime_it < mime_collection_length1; mime_it = mime_it + 1) {
			gchar* _tmp1_;
			gchar* mime = NULL;
			_tmp1_ = g_strdup (mime_collection[mime_it]);
			mime = _tmp1_;
			{
				GtkFileFilter* _tmp2_;
				const gchar* _tmp3_;
				_tmp2_ = filter;
				_tmp3_ = mime;
				gtk_file_filter_add_mime_type (_tmp2_, _tmp3_);
				_g_free0 (mime);
			}
		}
	}
	_tmp4_ = gtk_file_chooser_native_new (_ ("Select media"), (GtkWindow*) self, GTK_FILE_CHOOSER_ACTION_OPEN, _ ("_Open"), _ ("_Cancel"));
	chooser = _tmp4_;
	_tmp5_ = chooser;
	gtk_file_chooser_set_select_multiple ((GtkFileChooser*) _tmp5_, TRUE);
	_tmp6_ = chooser;
	_tmp7_ = filter;
	gtk_file_chooser_set_filter ((GtkFileChooser*) _tmp6_, _tmp7_);
	_tmp8_ = chooser;
	if (gtk_native_dialog_run ((GtkNativeDialog*) _tmp8_) == ((gint) GTK_RESPONSE_ACCEPT)) {
		GtkFileChooserNative* _tmp9_;
		GSList* _tmp10_;
		GtkStack* _tmp15_;
		_tmp9_ = chooser;
		_tmp10_ = gtk_file_chooser_get_uris ((GtkFileChooser*) _tmp9_);
		{
			GSList* uri_collection = NULL;
			GSList* uri_it = NULL;
			uri_collection = _tmp10_;
			for (uri_it = uri_collection; uri_it != NULL; uri_it = uri_it->next) {
				const gchar* uri = NULL;
				uri = (const gchar*) uri_it->data;
				{
					GtkListBox* _tmp11_;
					const gchar* _tmp12_;
					TootleDialogsComposeMediaItem* _tmp13_;
					TootleDialogsComposeMediaItem* _tmp14_;
					_tmp11_ = self->priv->media_list;
					_tmp12_ = uri;
					_tmp13_ = tootle_dialogs_compose_media_item_new (self, _tmp12_, NULL);
					g_object_ref_sink (_tmp13_);
					_tmp14_ = _tmp13_;
					gtk_list_box_insert (_tmp11_, (GtkWidget*) _tmp14_, 0);
					_g_object_unref0 (_tmp14_);
				}
			}
			(uri_collection == NULL) ? NULL : (uri_collection = (_g_slist_free__g_free0_ (uri_collection), NULL));
		}
		_tmp15_ = self->priv->mode;
		gtk_stack_set_visible_child_name (_tmp15_, "media");
	}
	_g_object_unref0 (chooser);
	_g_object_unref0 (filter);
}

static void
_tootle_dialogs_compose_on_select_media_gtk_button_clicked (GtkButton* _sender,
                                                            gpointer self)
{
	tootle_dialogs_compose_on_select_media ((TootleDialogsCompose*) self);
}

static void
tootle_dialogs_compose_on_media_list_row_activated (TootleDialogsCompose* self,
                                                    GtkWidget* w)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (w != NULL);
	if (!TOOTLE_DIALOGS_COMPOSE_IS_MEDIA_ITEM (w)) {
		tootle_dialogs_compose_on_select_media (self);
	}
}

static void
_tootle_dialogs_compose_on_media_list_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                                GtkListBoxRow* row,
                                                                                gpointer self)
{
	tootle_dialogs_compose_on_media_list_row_activated ((TootleDialogsCompose*) self, row);
}

static void
tootle_dialogs_compose_on_close (TootleDialogsCompose* self)
{
	g_return_if_fail (self != NULL);
	gtk_widget_destroy ((GtkWidget*) self);
}

static void
_tootle_dialogs_compose_on_close_gtk_button_clicked (GtkButton* _sender,
                                                     gpointer self)
{
	tootle_dialogs_compose_on_close ((TootleDialogsCompose*) self);
}

static void
tootle_dialogs_compose_on_error (TootleDialogsCompose* self,
                                 gint32 code,
                                 const gchar* reason)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (reason != NULL);
	g_warning ("Compose.vala:226: %s", reason);
	tootle_dialogs_compose_set_working (self, FALSE);
}

static void
__lambda61_ (TootleDialogsCompose* self,
             GObject* obj,
             GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		tootle_dialogs_compose_transaction_finish (self, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		tootle_dialogs_compose_on_close (self);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		tootle_dialogs_compose_set_working (self, FALSE);
		_tmp0_ = e;
		_tmp1_ = _tmp0_->message;
		tootle_dialogs_compose_on_error (self, (gint32) 0, _tmp1_);
		_g_error_free0 (e);
	}
	__finally0:
	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;
	}
}

static void
___lambda61__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda61_ ((TootleDialogsCompose*) self, source_object, res);
	g_object_unref (self);
}

static void
tootle_dialogs_compose_on_commit (TootleDialogsCompose* self)
{
	g_return_if_fail (self != NULL);
	tootle_dialogs_compose_set_working (self, TRUE);
	tootle_dialogs_compose_transaction (self, ___lambda61__gasync_ready_callback, g_object_ref (self));
}

static void
_tootle_dialogs_compose_on_commit_gtk_button_clicked (GtkButton* _sender,
                                                      gpointer self)
{
	tootle_dialogs_compose_on_commit ((TootleDialogsCompose*) self);
}

static void
tootle_dialogs_compose_transaction_data_free (gpointer _data)
{
	TootleDialogsComposeTransactionData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (TootleDialogsComposeTransactionData, _data_);
}

static void
tootle_dialogs_compose_transaction (TootleDialogsCompose* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	TootleDialogsComposeTransactionData* _data_;
	TootleDialogsCompose* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TootleDialogsComposeTransactionData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tootle_dialogs_compose_transaction_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tootle_dialogs_compose_transaction_co (_data_);
}

static void
tootle_dialogs_compose_transaction_finish (TootleDialogsCompose* self,
                                           GAsyncResult* _res_,
                                           GError** error)
{
	TootleDialogsComposeTransactionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static Block31Data*
block31_data_ref (Block31Data* _data31_)
{
	g_atomic_int_inc (&_data31_->_ref_count_);
	return _data31_;
}

static void
block31_data_unref (void * _userdata_)
{
	Block31Data* _data31_;
	_data31_ = (Block31Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data31_->_ref_count_)) {
		TootleDialogsCompose* self;
		self = _data31_->self;
		_g_object_unref0 (_data31_->pending_media);
		_g_object_unref0 (self);
		g_slice_free (Block31Data, _data31_);
	}
}

static void
tootle_dialogs_compose_transaction_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	TootleDialogsComposeTransactionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tootle_dialogs_compose_transaction_co (_data_);
}

static void
__lambda60_ (Block31Data* _data31_,
             GtkWidget* w)
{
	TootleDialogsCompose* self;
	TootleDialogsComposeMediaItem* item = NULL;
	TootleDialogsComposeMediaItem* _tmp0_;
	TootleDialogsComposeMediaItem* _tmp1_;
	self = _data31_->self;
	g_return_if_fail (w != NULL);
	_tmp0_ = _g_object_ref0 (TOOTLE_DIALOGS_COMPOSE_IS_MEDIA_ITEM (w) ? ((TootleDialogsComposeMediaItem*) w) : NULL);
	item = _tmp0_;
	_tmp1_ = item;
	if (_tmp1_ != NULL) {
		GeeArrayList* _tmp2_;
		TootleDialogsComposeMediaItem* _tmp3_;
		_tmp2_ = _data31_->pending_media;
		_tmp3_ = item;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp2_, _tmp3_);
	}
	_g_object_unref0 (item);
}

static void
___lambda60__gtk_callback (GtkWidget* widget,
                           gpointer self)
{
	__lambda60_ (self, widget);
}

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

static gboolean
tootle_dialogs_compose_transaction_co (TootleDialogsComposeTransactionData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data31_ = g_slice_new0 (Block31Data);
	_data_->_data31_->_ref_count_ = 1;
	_data_->_data31_->self = g_object_ref (_data_->self);
	_data_->_data31_->_async_data_ = _data_;
	_data_->_tmp0_ = _data_->self->priv->_status;
	_data_->_tmp1_ = tootle_api_status_get_id (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (g_strcmp0 (_data_->_tmp2_, "") != 0) {
		g_message ("Compose.vala:247: Removing old status...");
		_data_->_tmp3_ = _data_->self->priv->_status;
		_data_->_tmp4_ = tootle_api_status_annihilate (_data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_state_ = 1;
		tootle_request_await (_data_->_tmp5_, tootle_dialogs_compose_transaction_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp6_ = tootle_request_await_finish (_data_->_tmp5_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_g_object_unref0 (_data_->_tmp7_);
		_g_object_unref0 (_data_->_tmp5_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			block31_data_unref (_data_->_data31_);
			_data_->_data31_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp8_ = gee_array_list_new (TOOTLE_DIALOGS_COMPOSE_TYPE_MEDIA_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_data_->_data31_->pending_media = _data_->_tmp8_;
	_data_->_tmp9_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	_data_->media_ids = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->self->priv->media_list;
	gtk_container_foreach ((GtkContainer*) _data_->_tmp10_, ___lambda60__gtk_callback, _data_->_data31_);
	_data_->_tmp11_ = g_strdup ("");
	_data_->media_param = _data_->_tmp11_;
	_data_->_tmp12_ = _data_->_data31_->pending_media;
	_data_->_tmp13_ = gee_collection_get_is_empty ((GeeCollection*) _data_->_tmp12_);
	_data_->_tmp14_ = _data_->_tmp13_;
	if (!_data_->_tmp14_) {
		_data_->_tmp15_ = _data_->_data31_->pending_media;
		_data_->_tmp16_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp15_);
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_tmp18_ = g_strdup_printf ("%i", _data_->_tmp17_);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp20_ = g_strconcat ("Processing ", _data_->_tmp19_, " attachments...", NULL);
		_data_->_tmp21_ = _data_->_tmp20_;
		g_message ("Compose.vala:261: %s", _data_->_tmp21_);
		_g_free0 (_data_->_tmp21_);
		_g_free0 (_data_->_tmp19_);
		_data_->_tmp22_ = _data_->self->priv->_status;
		if (!tootle_api_status_has_media (_data_->_tmp22_)) {
			_data_->_tmp23_ = _data_->self->priv->_status;
			_data_->_tmp24_ = gee_array_list_new (TOOTLE_API_TYPE_ATTACHMENT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
			_data_->_tmp25_ = _data_->_tmp24_;
			tootle_api_status_set_media_attachments (_data_->_tmp23_, _data_->_tmp25_);
			_g_object_unref0 (_data_->_tmp25_);
		}
		{
			_data_->_tmp26_ = _data_->_data31_->pending_media;
			_data_->_item_list = _data_->_tmp26_;
			_data_->_tmp27_ = _data_->_item_list;
			_data_->_tmp28_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp27_);
			_data_->_tmp29_ = _data_->_tmp28_;
			_data_->_item_size = _data_->_tmp29_;
			_data_->_item_index = -1;
			while (TRUE) {
				_data_->_item_index = _data_->_item_index + 1;
				_data_->_tmp30_ = _data_->_item_index;
				_data_->_tmp31_ = _data_->_item_size;
				if (!(_data_->_tmp30_ < _data_->_tmp31_)) {
					break;
				}
				_data_->_tmp32_ = _data_->_item_list;
				_data_->_tmp33_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp32_, _data_->_item_index);
				_data_->item = (TootleDialogsComposeMediaItem*) _data_->_tmp33_;
				_data_->_tmp34_ = _data_->item;
				_data_->_tmp35_ = tootle_dialogs_compose_media_item_get_entity (_data_->_tmp34_);
				_data_->_tmp36_ = _data_->_tmp35_;
				if (_data_->_tmp36_ != NULL) {
					_data_->_tmp37_ = _data_->item;
					_data_->_tmp38_ = tootle_dialogs_compose_media_item_get_entity (_data_->_tmp37_);
					_data_->_tmp39_ = _data_->_tmp38_;
					_data_->_tmp40_ = tootle_api_attachment_get_id (_data_->_tmp39_);
					_data_->_tmp41_ = _data_->_tmp40_;
					_data_->_tmp42_ = string_to_string (_data_->_tmp41_);
					_data_->_tmp43_ = g_strconcat ("Adding immutable media: ", _data_->_tmp42_, "...", NULL);
					_data_->_tmp44_ = _data_->_tmp43_;
					g_message ("Compose.vala:268: %s", _data_->_tmp44_);
					_g_free0 (_data_->_tmp44_);
					_data_->_tmp45_ = _data_->media_ids;
					_data_->_tmp46_ = _data_->item;
					_data_->_tmp47_ = tootle_dialogs_compose_media_item_get_entity (_data_->_tmp46_);
					_data_->_tmp48_ = _data_->_tmp47_;
					_data_->_tmp49_ = tootle_api_attachment_get_id (_data_->_tmp48_);
					_data_->_tmp50_ = _data_->_tmp49_;
					gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp45_, _data_->_tmp50_);
				} else {
					_data_->_tmp51_ = _data_->self->priv->mode;
					gtk_stack_set_visible_child_name (_data_->_tmp51_, "media");
					_data_->_tmp52_ = _data_->item;
					_data_->_tmp53_ = tootle_dialogs_compose_media_item_get_source (_data_->_tmp52_);
					_data_->_tmp54_ = _data_->_tmp53_;
					_data_->_tmp55_ = _data_->item;
					_data_->_tmp56_ = _data_->_tmp55_->title_label;
					_data_->_tmp57_ = gtk_label_get_label (_data_->_tmp56_);
					_data_->_tmp58_ = _data_->_tmp57_;
					_data_->_tmp59_ = _data_->item;
					_data_->_tmp60_ = _data_->_tmp59_->description;
					_data_->_tmp61_ = gtk_entry_get_text (_data_->_tmp60_);
					_data_->_tmp62_ = _data_->_tmp61_;
					_data_->_state_ = 2;
					tootle_api_attachment_upload (_data_->_tmp54_, _data_->_tmp58_, _data_->_tmp62_, tootle_dialogs_compose_transaction_ready, _data_);
					return FALSE;
					_state_2:
					_data_->_tmp63_ = tootle_api_attachment_upload_finish (_data_->_res_, &_data_->_inner_error0_);
					_data_->entity = _data_->_tmp63_;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
						_g_object_unref0 (_data_->item);
						_g_free0 (_data_->media_param);
						_g_object_unref0 (_data_->media_ids);
						block31_data_unref (_data_->_data31_);
						_data_->_data31_ = NULL;
						g_object_unref (_data_->_async_result);
						return FALSE;
					}
					_data_->_tmp64_ = _data_->media_ids;
					_data_->_tmp65_ = _data_->entity;
					_data_->_tmp66_ = tootle_api_attachment_get_id (_data_->_tmp65_);
					_data_->_tmp67_ = _data_->_tmp66_;
					gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp64_, _data_->_tmp67_);
					_g_object_unref0 (_data_->entity);
				}
				_data_->_tmp68_ = _data_->item;
				_data_->_tmp69_ = _data_->_tmp68_->icon;
				gtk_stack_set_visible_child_name (_data_->_tmp69_, "ok");
				_g_object_unref0 (_data_->item);
			}
		}
		_data_->_tmp70_ = _data_->media_ids;
		_data_->_tmp71_ = tootle_request_array2string (_data_->_tmp70_, "media_ids");
		_g_free0 (_data_->media_param);
		_data_->media_param = _data_->_tmp71_;
		_data_->_tmp72_ = _data_->media_param;
		_data_->_tmp73_ = g_strconcat (_data_->_tmp72_, "&", NULL);
		_g_free0 (_data_->media_param);
		_data_->media_param = _data_->_tmp73_;
	}
	g_message ("Compose.vala:287: Publishing status...");
	_data_->_tmp74_ = _data_->self->priv->_status;
	_data_->_tmp75_ = _data_->self->priv->content;
	_data_->_tmp76_ = gtk_text_view_get_buffer (_data_->_tmp75_);
	_data_->_tmp77_ = _data_->_tmp76_;
	g_object_get (_data_->_tmp77_, "text", &_data_->_tmp78_, NULL);
	_data_->_tmp79_ = _data_->_tmp78_;
	_data_->_tmp80_ = _data_->_tmp79_;
	tootle_api_status_set_content (_data_->_tmp74_, _data_->_tmp80_);
	_g_free0 (_data_->_tmp80_);
	_data_->_tmp81_ = _data_->self->priv->_status;
	_data_->_tmp82_ = _data_->self->priv->cw;
	_data_->_tmp83_ = gtk_entry_get_text (_data_->_tmp82_);
	_data_->_tmp84_ = _data_->_tmp83_;
	tootle_api_status_set_spoiler_text (_data_->_tmp81_, _data_->_tmp84_);
	_data_->_tmp85_ = _data_->media_param;
	_data_->_tmp86_ = string_to_string (_data_->_tmp85_);
	_data_->_tmp87_ = g_strconcat ("/api/v1/statuses?", _data_->_tmp86_, NULL);
	_data_->_tmp88_ = _data_->_tmp87_;
	_data_->_tmp89_ = tootle_request_new_POST (_data_->_tmp88_);
	_data_->_tmp90_ = _data_->_tmp89_;
	_data_->_tmp91_ = tootle_accounts;
	_data_->_tmp92_ = tootle_accounts_get_active (_data_->_tmp91_);
	_data_->_tmp93_ = _data_->_tmp92_;
	_data_->_tmp94_ = tootle_request_with_account (_data_->_tmp90_, _data_->_tmp93_);
	_data_->_tmp95_ = _data_->_tmp94_;
	_data_->_tmp96_ = _data_->self->priv->visibility_popover;
	_data_->_tmp97_ = tootle_widgets_visibility_popover_get_selected (_data_->_tmp96_);
	_data_->_tmp98_ = _data_->_tmp97_;
	_data_->_tmp99_ = tootle_api_visibility_to_string (_data_->_tmp98_);
	_data_->_tmp100_ = _data_->_tmp99_;
	_data_->_tmp101_ = tootle_request_with_param (_data_->_tmp95_, "visibility", _data_->_tmp100_);
	_data_->_tmp102_ = _data_->_tmp101_;
	_data_->_tmp103_ = _data_->self->priv->_status;
	_data_->_tmp104_ = tootle_api_status_get_content (_data_->_tmp103_);
	_data_->_tmp105_ = _data_->_tmp104_;
	_data_->_tmp106_ = tootle_html_utils_uri_encode (_data_->_tmp105_);
	_data_->_tmp107_ = _data_->_tmp106_;
	_data_->_tmp108_ = tootle_request_with_param (_data_->_tmp102_, "status", _data_->_tmp107_);
	_data_->_tmp109_ = _data_->_tmp108_;
	_g_free0 (_data_->_tmp107_);
	_g_object_unref0 (_data_->_tmp102_);
	_g_free0 (_data_->_tmp100_);
	_g_object_unref0 (_data_->_tmp95_);
	_g_object_unref0 (_data_->_tmp90_);
	_g_free0 (_data_->_tmp88_);
	_data_->req = _data_->_tmp109_;
	_data_->_tmp110_ = _data_->self->priv->cw_button;
	_data_->_tmp111_ = gtk_toggle_button_get_active (_data_->_tmp110_);
	_data_->_tmp112_ = _data_->_tmp111_;
	if (_data_->_tmp112_) {
		_data_->_tmp113_ = _data_->req;
		_data_->_tmp114_ = tootle_request_with_param (_data_->_tmp113_, "sensitive", "true");
		_data_->_tmp115_ = _data_->_tmp114_;
		_g_object_unref0 (_data_->_tmp115_);
		_data_->_tmp116_ = _data_->req;
		_data_->_tmp117_ = _data_->self->priv->cw;
		_data_->_tmp118_ = gtk_entry_get_text (_data_->_tmp117_);
		_data_->_tmp119_ = _data_->_tmp118_;
		_data_->_tmp120_ = tootle_html_utils_uri_encode (_data_->_tmp119_);
		_data_->_tmp121_ = _data_->_tmp120_;
		_data_->_tmp122_ = tootle_request_with_param (_data_->_tmp116_, "spoiler_text", _data_->_tmp121_);
		_data_->_tmp123_ = _data_->_tmp122_;
		_g_object_unref0 (_data_->_tmp123_);
		_g_free0 (_data_->_tmp121_);
	}
	_data_->_tmp124_ = _data_->self->priv->_status;
	_data_->_tmp125_ = tootle_api_status_get_in_reply_to_id (_data_->_tmp124_);
	_data_->_tmp126_ = _data_->_tmp125_;
	if (_data_->_tmp126_ != NULL) {
		_data_->_tmp127_ = _data_->req;
		_data_->_tmp128_ = _data_->self->priv->_status;
		_data_->_tmp129_ = tootle_api_status_get_in_reply_to_id (_data_->_tmp128_);
		_data_->_tmp130_ = _data_->_tmp129_;
		_data_->_tmp131_ = tootle_request_with_param (_data_->_tmp127_, "in_reply_to_id", _data_->_tmp130_);
		_data_->_tmp132_ = _data_->_tmp131_;
		_g_object_unref0 (_data_->_tmp132_);
	}
	_data_->_tmp133_ = _data_->self->priv->_status;
	_data_->_tmp134_ = tootle_api_status_get_in_reply_to_account_id (_data_->_tmp133_);
	_data_->_tmp135_ = _data_->_tmp134_;
	if (_data_->_tmp135_ != NULL) {
		_data_->_tmp136_ = _data_->req;
		_data_->_tmp137_ = _data_->self->priv->_status;
		_data_->_tmp138_ = tootle_api_status_get_in_reply_to_account_id (_data_->_tmp137_);
		_data_->_tmp139_ = _data_->_tmp138_;
		_data_->_tmp140_ = tootle_request_with_param (_data_->_tmp136_, "in_reply_to_account_id", _data_->_tmp139_);
		_data_->_tmp141_ = _data_->_tmp140_;
		_g_object_unref0 (_data_->_tmp141_);
	}
	_data_->_tmp142_ = _data_->req;
	_data_->_state_ = 3;
	tootle_request_await (_data_->_tmp142_, tootle_dialogs_compose_transaction_ready, _data_);
	return FALSE;
	_state_3:
	_data_->_tmp143_ = tootle_request_await_finish (_data_->_tmp142_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp144_ = _data_->_tmp143_;
	_g_object_unref0 (_data_->_tmp144_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->req);
		_g_free0 (_data_->media_param);
		_g_object_unref0 (_data_->media_ids);
		block31_data_unref (_data_->_data31_);
		_data_->_data31_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp145_ = tootle_network;
	_data_->_tmp146_ = _data_->req;
	_data_->_tmp147_ = tootle_network_parse_node (_data_->_tmp145_, (SoupMessage*) _data_->_tmp146_, &_data_->_inner_error0_);
	_data_->node = _data_->_tmp147_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->req);
		_g_free0 (_data_->media_param);
		_g_object_unref0 (_data_->media_ids);
		block31_data_unref (_data_->_data31_);
		_data_->_data31_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp148_ = _data_->node;
	_data_->_tmp149_ = tootle_api_status_from (_data_->_tmp148_, &_data_->_inner_error0_);
	_data_->status = _data_->_tmp149_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		__vala_JsonNode_free0 (_data_->node);
		_g_object_unref0 (_data_->req);
		_g_free0 (_data_->media_param);
		_g_object_unref0 (_data_->media_ids);
		block31_data_unref (_data_->_data31_);
		_data_->_data31_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp150_ = _data_->status;
	_data_->_tmp151_ = tootle_api_status_get_id (_data_->_tmp150_);
	_data_->_tmp152_ = _data_->_tmp151_;
	_data_->_tmp153_ = string_to_string (_data_->_tmp152_);
	_data_->_tmp154_ = g_strconcat ("OK: Published with ID ", _data_->_tmp153_, NULL);
	_data_->_tmp155_ = _data_->_tmp154_;
	g_message ("Compose.vala:309: %s", _data_->_tmp155_);
	_g_free0 (_data_->_tmp155_);
	tootle_dialogs_compose_on_close (_data_->self);
	_g_object_unref0 (_data_->status);
	__vala_JsonNode_free0 (_data_->node);
	_g_object_unref0 (_data_->req);
	_g_free0 (_data_->media_param);
	_g_object_unref0 (_data_->media_ids);
	block31_data_unref (_data_->_data31_);
	_data_->_data31_ = NULL;
	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;
}

TootleAPIStatus*
tootle_dialogs_compose_get_status (TootleDialogsCompose* self)
{
	TootleAPIStatus* result;
	TootleAPIStatus* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_status;
	result = _tmp0_;
	return result;
}

void
tootle_dialogs_compose_set_status (TootleDialogsCompose* self,
                                   TootleAPIStatus* value)
{
	TootleAPIStatus* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_dialogs_compose_get_status (self);
	if (old_value != value) {
		TootleAPIStatus* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_status);
		self->priv->_status = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_dialogs_compose_properties[TOOTLE_DIALOGS_COMPOSE_STATUS_PROPERTY]);
	}
}

const gchar*
tootle_dialogs_compose_get_style_class (TootleDialogsCompose* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_style_class;
	result = _tmp0_;
	return result;
}

void
tootle_dialogs_compose_set_style_class (TootleDialogsCompose* self,
                                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_dialogs_compose_get_style_class (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_style_class);
		self->priv->_style_class = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_dialogs_compose_properties[TOOTLE_DIALOGS_COMPOSE_STYLE_CLASS_PROPERTY]);
	}
}

const gchar*
tootle_dialogs_compose_get_label (TootleDialogsCompose* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_label;
	result = _tmp0_;
	return result;
}

void
tootle_dialogs_compose_set_label (TootleDialogsCompose* self,
                                  const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_dialogs_compose_get_label (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_label);
		self->priv->_label = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_dialogs_compose_properties[TOOTLE_DIALOGS_COMPOSE_LABEL_PROPERTY]);
	}
}

gboolean
tootle_dialogs_compose_get_working (TootleDialogsCompose* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_working;
	return result;
}

void
tootle_dialogs_compose_set_working (TootleDialogsCompose* self,
                                    gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_dialogs_compose_get_working (self);
	if (old_value != value) {
		self->priv->_working = value;
		g_object_notify_by_pspec ((GObject *) self, tootle_dialogs_compose_properties[TOOTLE_DIALOGS_COMPOSE_WORKING_PROPERTY]);
	}
}

gint
tootle_dialogs_compose_get_char_limit (TootleDialogsCompose* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = 500;
	return result;
}

static inline gpointer
tootle_dialogs_compose_media_item_get_instance_private (TootleDialogsComposeMediaItem* self)
{
	return G_STRUCT_MEMBER_P (self, TootleDialogsComposeMediaItem_private_offset);
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected 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;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected 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;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

TootleDialogsComposeMediaItem*
tootle_dialogs_compose_media_item_construct (GType object_type,
                                             TootleDialogsCompose* dialog,
                                             const gchar* source,
                                             TootleAPIAttachment* entity)
{
	TootleDialogsComposeMediaItem * self = NULL;
	TootleDialogsCompose* _tmp0_;
	const gchar* _tmp14_ = NULL;
	GtkLabel* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	g_return_val_if_fail (dialog != NULL, NULL);
	self = (TootleDialogsComposeMediaItem*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (dialog);
	_g_object_unref0 (self->priv->dialog);
	self->priv->dialog = _tmp0_;
	tootle_dialogs_compose_media_item_set_source (self, source);
	tootle_dialogs_compose_media_item_set_entity (self, entity);
	if (source != NULL) {
		const gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp1_ = string_to_string (source);
		_tmp2_ = g_strconcat ("Attached uri: ", _tmp1_, NULL);
		_tmp3_ = _tmp2_;
		g_message ("Compose.vala:65: %s", _tmp3_);
		_g_free0 (_tmp3_);
	} else {
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		const gchar* _tmp9_ = NULL;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		GtkEntry* _tmp12_;
		GtkEntry* _tmp13_;
		_tmp4_ = tootle_api_attachment_get_id (entity);
		_tmp5_ = _tmp4_;
		_tmp6_ = string_to_string (_tmp5_);
		_tmp7_ = g_strconcat ("Attached immutable ", _tmp6_, NULL);
		_tmp8_ = _tmp7_;
		g_message ("Compose.vala:67: %s", _tmp8_);
		_g_free0 (_tmp8_);
		_tmp10_ = tootle_api_attachment_get_description (entity);
		_tmp11_ = _tmp10_;
		_tmp9_ = _tmp11_;
		if (_tmp9_ == NULL) {
			_tmp9_ = " ";
		}
		_tmp12_ = self->description;
		gtk_entry_set_text (_tmp12_, _tmp9_);
		_tmp13_ = self->description;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp13_, FALSE);
	}
	tootle_dialogs_compose_set_media_mode (dialog, TRUE);
	_tmp14_ = source;
	if (_tmp14_ == NULL) {
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		_tmp15_ = tootle_api_attachment_get_url (entity);
		_tmp16_ = _tmp15_;
		_tmp14_ = _tmp16_;
	}
	_tmp17_ = self->title_label;
	_tmp18_ = g_path_get_basename (_tmp14_);
	_tmp19_ = _tmp18_;
	_tmp20_ = string_replace (_tmp19_, "%20", " ");
	_tmp21_ = _tmp20_;
	gtk_label_set_label (_tmp17_, _tmp21_);
	_g_free0 (_tmp21_);
	_g_free0 (_tmp19_);
	return self;
}

TootleDialogsComposeMediaItem*
tootle_dialogs_compose_media_item_new (TootleDialogsCompose* dialog,
                                       const gchar* source,
                                       TootleAPIAttachment* entity)
{
	return tootle_dialogs_compose_media_item_construct (TOOTLE_DIALOGS_COMPOSE_TYPE_MEDIA_ITEM, dialog, source, entity);
}

static void
tootle_dialogs_compose_media_item_on_remove (TootleDialogsComposeMediaItem* self)
{
	gboolean remove = FALSE;
	TootleApplication* _tmp0_;
	GtkLabel* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	TootleDialogsCompose* _tmp6_;
	gboolean _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tootle_app;
	_tmp1_ = self->title_label;
	_tmp2_ = gtk_label_get_label (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strdup_printf (_ ("Delete \"%s\"?"), _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->dialog;
	_tmp7_ = tootle_application_question (_tmp0_, _tmp5_, _ ("This action cannot be reverted."), (GtkWindow*) _tmp6_);
	_g_free0 (_tmp5_);
	remove = _tmp7_;
	if (remove) {
		gtk_widget_destroy ((GtkWidget*) self);
	}
}

static void
_tootle_dialogs_compose_media_item_on_remove_gtk_button_clicked (GtkButton* _sender,
                                                                 gpointer self)
{
	tootle_dialogs_compose_media_item_on_remove ((TootleDialogsComposeMediaItem*) self);
}

TootleAPIAttachment*
tootle_dialogs_compose_media_item_get_entity (TootleDialogsComposeMediaItem* self)
{
	TootleAPIAttachment* result;
	TootleAPIAttachment* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_entity;
	result = _tmp0_;
	return result;
}

void
tootle_dialogs_compose_media_item_set_entity (TootleDialogsComposeMediaItem* self,
                                              TootleAPIAttachment* value)
{
	TootleAPIAttachment* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_dialogs_compose_media_item_get_entity (self);
	if (old_value != value) {
		TootleAPIAttachment* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_entity);
		self->priv->_entity = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_dialogs_compose_media_item_properties[TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_ENTITY_PROPERTY]);
	}
}

const gchar*
tootle_dialogs_compose_media_item_get_source (TootleDialogsComposeMediaItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_source;
	result = _tmp0_;
	return result;
}

void
tootle_dialogs_compose_media_item_set_source (TootleDialogsComposeMediaItem* self,
                                              const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_dialogs_compose_media_item_get_source (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_source);
		self->priv->_source = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_dialogs_compose_media_item_properties[TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_SOURCE_PROPERTY]);
	}
}

static void
tootle_dialogs_compose_media_item_class_init (TootleDialogsComposeMediaItemClass * klass,
                                              gpointer klass_data)
{
	tootle_dialogs_compose_media_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TootleDialogsComposeMediaItem_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tootle_dialogs_compose_media_item_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tootle_dialogs_compose_media_item_set_property;
	G_OBJECT_CLASS (klass)->finalize = tootle_dialogs_compose_media_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_ENTITY_PROPERTY, tootle_dialogs_compose_media_item_properties[TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_ENTITY_PROPERTY] = g_param_spec_object ("entity", "entity", "entity", TOOTLE_API_TYPE_ATTACHMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_SOURCE_PROPERTY, tootle_dialogs_compose_media_item_properties[TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_SOURCE_PROPERTY] = g_param_spec_string ("source", "source", "source", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/com/github/bleakgrey/tootle/ui/widgets/compose_attachment.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "title_label", FALSE, G_STRUCT_OFFSET (TootleDialogsComposeMediaItem, title_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "description", FALSE, G_STRUCT_OFFSET (TootleDialogsComposeMediaItem, description));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "icon", FALSE, G_STRUCT_OFFSET (TootleDialogsComposeMediaItem, icon));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_remove", G_CALLBACK(_tootle_dialogs_compose_media_item_on_remove_gtk_button_clicked));
}

static void
tootle_dialogs_compose_media_item_instance_init (TootleDialogsComposeMediaItem * self,
                                                 gpointer klass)
{
	self->priv = tootle_dialogs_compose_media_item_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
tootle_dialogs_compose_media_item_finalize (GObject * obj)
{
	TootleDialogsComposeMediaItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TOOTLE_DIALOGS_COMPOSE_TYPE_MEDIA_ITEM, TootleDialogsComposeMediaItem);
	_g_object_unref0 (self->priv->dialog);
	_g_object_unref0 (self->priv->_entity);
	_g_free0 (self->priv->_source);
	G_OBJECT_CLASS (tootle_dialogs_compose_media_item_parent_class)->finalize (obj);
}

static GType
tootle_dialogs_compose_media_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TootleDialogsComposeMediaItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tootle_dialogs_compose_media_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TootleDialogsComposeMediaItem), 0, (GInstanceInitFunc) tootle_dialogs_compose_media_item_instance_init, NULL };
	GType tootle_dialogs_compose_media_item_type_id;
	tootle_dialogs_compose_media_item_type_id = g_type_register_static (gtk_list_box_row_get_type (), "TootleDialogsComposeMediaItem", &g_define_type_info, 0);
	TootleDialogsComposeMediaItem_private_offset = g_type_add_instance_private (tootle_dialogs_compose_media_item_type_id, sizeof (TootleDialogsComposeMediaItemPrivate));
	return tootle_dialogs_compose_media_item_type_id;
}

GType
tootle_dialogs_compose_media_item_get_type (void)
{
	static volatile gsize tootle_dialogs_compose_media_item_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_dialogs_compose_media_item_type_id__volatile)) {
		GType tootle_dialogs_compose_media_item_type_id;
		tootle_dialogs_compose_media_item_type_id = tootle_dialogs_compose_media_item_get_type_once ();
		g_once_init_leave (&tootle_dialogs_compose_media_item_type_id__volatile, tootle_dialogs_compose_media_item_type_id);
	}
	return tootle_dialogs_compose_media_item_type_id__volatile;
}

static void
_vala_tootle_dialogs_compose_media_item_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec)
{
	TootleDialogsComposeMediaItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_DIALOGS_COMPOSE_TYPE_MEDIA_ITEM, TootleDialogsComposeMediaItem);
	switch (property_id) {
		case TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_ENTITY_PROPERTY:
		g_value_set_object (value, tootle_dialogs_compose_media_item_get_entity (self));
		break;
		case TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_SOURCE_PROPERTY:
		g_value_set_string (value, tootle_dialogs_compose_media_item_get_source (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tootle_dialogs_compose_media_item_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec)
{
	TootleDialogsComposeMediaItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_DIALOGS_COMPOSE_TYPE_MEDIA_ITEM, TootleDialogsComposeMediaItem);
	switch (property_id) {
		case TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_ENTITY_PROPERTY:
		tootle_dialogs_compose_media_item_set_entity (self, g_value_get_object (value));
		break;
		case TOOTLE_DIALOGS_COMPOSE_MEDIA_ITEM_SOURCE_PROPERTY:
		tootle_dialogs_compose_media_item_set_source (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_tootle_dialogs_compose_on_state_change_g_object_notify (GObject* _sender,
                                                         GParamSpec* pspec,
                                                         gpointer self)
{
	tootle_dialogs_compose_on_state_change ((TootleDialogsCompose*) self, pspec);
}

static gboolean
_tootle_dialogs_compose___lambda62_ (TootleDialogsCompose* self,
                                     GBinding* b,
                                     GValue* src,
                                     GValue* target)
{
	GValue _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean result = FALSE;
	g_return_val_if_fail (b != NULL, FALSE);
	g_return_val_if_fail (src != NULL, FALSE);
	g_return_val_if_fail (target != NULL, FALSE);
	_tmp0_ = *src;
	_tmp1_ = tootle_api_visibility_get_icon (g_value_get_enum (&_tmp0_));
	_tmp2_ = _tmp1_;
	g_value_set_string (target, _tmp2_);
	_g_free0 (_tmp2_);
	result = TRUE;
	return result;
}

static gboolean
__tootle_dialogs_compose___lambda62__gbinding_transform_func (GBinding* binding,
                                                              GValue* from_value,
                                                              GValue* to_value,
                                                              gpointer self)
{
	gboolean result;
	result = _tootle_dialogs_compose___lambda62_ ((TootleDialogsCompose*) self, binding, from_value, to_value);
	return result;
}

static void
_tootle_dialogs_compose___lambda63_ (TootleDialogsCompose* self)
{
	tootle_dialogs_compose_validate (self);
}

static void
__tootle_dialogs_compose___lambda63__gtk_entry_buffer_deleted_text (GtkEntryBuffer* _sender,
                                                                    guint position,
                                                                    guint n_chars,
                                                                    gpointer self)
{
	_tootle_dialogs_compose___lambda63_ ((TootleDialogsCompose*) self);
}

static void
_tootle_dialogs_compose___lambda64_ (TootleDialogsCompose* self)
{
	tootle_dialogs_compose_validate (self);
}

static void
__tootle_dialogs_compose___lambda64__gtk_entry_buffer_inserted_text (GtkEntryBuffer* _sender,
                                                                     guint position,
                                                                     const gchar* chars,
                                                                     guint n_chars,
                                                                     gpointer self)
{
	_tootle_dialogs_compose___lambda64_ ((TootleDialogsCompose*) self);
}

static void
_tootle_dialogs_compose_validate_gtk_text_buffer_changed (GtkTextBuffer* _sender,
                                                          gpointer self)
{
	tootle_dialogs_compose_validate ((TootleDialogsCompose*) self);
}

static GObject *
tootle_dialogs_compose_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TootleDialogsCompose * self;
	TootleDialogsMainWindow* _tmp0_;
	HdyViewSwitcherTitle* _tmp1_;
	const gchar* _tmp2_;
	GtkButton* _tmp3_;
	GtkStyleContext* _tmp4_;
	const gchar* _tmp5_;
	GtkMenuButton* _tmp6_;
	TootleWidgetsVisibilityPopover* _tmp7_;
	TootleWidgetsVisibilityPopover* _tmp8_;
	GtkImage* _tmp9_;
	GtkToggleButton* _tmp10_;
	GtkRevealer* _tmp11_;
	GtkEntry* _tmp12_;
	GtkEntryBuffer* _tmp13_;
	GtkEntryBuffer* _tmp14_;
	GtkEntry* _tmp15_;
	GtkEntryBuffer* _tmp16_;
	GtkEntryBuffer* _tmp17_;
	GtkTextView* _tmp18_;
	GtkTextBuffer* _tmp19_;
	GtkTextBuffer* _tmp20_;
	TootleAPIStatus* _tmp21_;
	gboolean _tmp22_;
	gboolean _tmp23_;
	GtkTextView* _tmp29_;
	GtkTextBuffer* _tmp30_;
	GtkTextBuffer* _tmp31_;
	TootleAPIStatus* _tmp32_;
	const gchar* _tmp33_;
	const gchar* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
	TootleAPIStatus* _tmp37_;
	GtkTextView* _tmp38_;
	parent_class = G_OBJECT_CLASS (tootle_dialogs_compose_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TOOTLE_DIALOGS_TYPE_COMPOSE, TootleDialogsCompose);
	_tmp0_ = tootle_window;
	gtk_window_set_transient_for ((GtkWindow*) self, (GtkWindow*) _tmp0_);
	g_signal_connect_object ((GObject*) self, "notify::working", (GCallback) _tootle_dialogs_compose_on_state_change_g_object_notify, self, 0);
	_tmp1_ = self->priv->mode_switcher;
	_tmp2_ = self->priv->_label;
	hdy_view_switcher_title_set_title (_tmp1_, _tmp2_);
	_tmp3_ = self->priv->commit;
	_tmp4_ = gtk_widget_get_style_context ((GtkWidget*) _tmp3_);
	_tmp5_ = self->priv->_style_class;
	gtk_style_context_add_class (_tmp4_, _tmp5_);
	_tmp6_ = self->priv->visibility_button;
	_tmp7_ = tootle_widgets_visibility_popover_new_with_button (_tmp6_);
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (self->priv->visibility_popover);
	self->priv->visibility_popover = _tmp7_;
	_tmp8_ = self->priv->visibility_popover;
	_tmp9_ = self->priv->visibility_icon;
	g_object_bind_property_with_closures ((GObject*) _tmp8_, "selected", (GObject*) _tmp9_, "icon-name", G_BINDING_SYNC_CREATE, (GClosure*) ((__tootle_dialogs_compose___lambda62__gbinding_transform_func == NULL) ? NULL : g_cclosure_new ((GCallback) __tootle_dialogs_compose___lambda62__gbinding_transform_func, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp10_ = self->priv->cw_button;
	_tmp11_ = self->priv->cw_revealer;
	g_object_bind_property_with_closures ((GObject*) _tmp10_, "active", (GObject*) _tmp11_, "reveal_child", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp12_ = self->priv->cw;
	_tmp13_ = gtk_entry_get_buffer (_tmp12_);
	_tmp14_ = _tmp13_;
	g_signal_connect_object (_tmp14_, "deleted-text", (GCallback) __tootle_dialogs_compose___lambda63__gtk_entry_buffer_deleted_text, self, 0);
	_tmp15_ = self->priv->cw;
	_tmp16_ = gtk_entry_get_buffer (_tmp15_);
	_tmp17_ = _tmp16_;
	g_signal_connect_object (_tmp17_, "inserted-text", (GCallback) __tootle_dialogs_compose___lambda64__gtk_entry_buffer_inserted_text, self, 0);
	_tmp18_ = self->priv->content;
	_tmp19_ = gtk_text_view_get_buffer (_tmp18_);
	_tmp20_ = _tmp19_;
	g_signal_connect_object (_tmp20_, "changed", (GCallback) _tootle_dialogs_compose_validate_gtk_text_buffer_changed, self, 0);
	_tmp21_ = self->priv->_status;
	_tmp22_ = tootle_api_status_get_has_spoiler (_tmp21_);
	_tmp23_ = _tmp22_;
	if (_tmp23_) {
		GtkEntry* _tmp24_;
		TootleAPIStatus* _tmp25_;
		const gchar* _tmp26_;
		const gchar* _tmp27_;
		GtkToggleButton* _tmp28_;
		_tmp24_ = self->priv->cw;
		_tmp25_ = self->priv->_status;
		_tmp26_ = tootle_api_status_get_spoiler_text (_tmp25_);
		_tmp27_ = _tmp26_;
		gtk_entry_set_text (_tmp24_, _tmp27_);
		_tmp28_ = self->priv->cw_button;
		gtk_toggle_button_set_active (_tmp28_, TRUE);
	}
	_tmp29_ = self->priv->content;
	_tmp30_ = gtk_text_view_get_buffer (_tmp29_);
	_tmp31_ = _tmp30_;
	_tmp32_ = self->priv->_status;
	_tmp33_ = tootle_api_status_get_content (_tmp32_);
	_tmp34_ = _tmp33_;
	_tmp35_ = tootle_html_utils_remove_tags (_tmp34_);
	_tmp36_ = _tmp35_;
	g_object_set (_tmp31_, "text", _tmp36_, NULL);
	_g_free0 (_tmp36_);
	tootle_dialogs_compose_validate (self);
	_tmp37_ = self->priv->_status;
	tootle_dialogs_compose_set_media_mode (self, tootle_api_status_has_media (_tmp37_));
	gtk_widget_show ((GtkWidget*) self);
	_tmp38_ = self->priv->content;
	gtk_widget_grab_focus ((GtkWidget*) _tmp38_);
	return obj;
}

static void
tootle_dialogs_compose_class_init (TootleDialogsComposeClass * klass,
                                   gpointer klass_data)
{
	tootle_dialogs_compose_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TootleDialogsCompose_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tootle_dialogs_compose_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tootle_dialogs_compose_set_property;
	G_OBJECT_CLASS (klass)->constructor = tootle_dialogs_compose_constructor;
	G_OBJECT_CLASS (klass)->finalize = tootle_dialogs_compose_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_DIALOGS_COMPOSE_STATUS_PROPERTY, tootle_dialogs_compose_properties[TOOTLE_DIALOGS_COMPOSE_STATUS_PROPERTY] = g_param_spec_object ("status", "status", "status", TOOTLE_API_TYPE_STATUS, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_DIALOGS_COMPOSE_STYLE_CLASS_PROPERTY, tootle_dialogs_compose_properties[TOOTLE_DIALOGS_COMPOSE_STYLE_CLASS_PROPERTY] = g_param_spec_string ("style-class", "style-class", "style-class", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_DIALOGS_COMPOSE_LABEL_PROPERTY, tootle_dialogs_compose_properties[TOOTLE_DIALOGS_COMPOSE_LABEL_PROPERTY] = g_param_spec_string ("label", "label", "label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_DIALOGS_COMPOSE_WORKING_PROPERTY, tootle_dialogs_compose_properties[TOOTLE_DIALOGS_COMPOSE_WORKING_PROPERTY] = g_param_spec_boolean ("working", "working", "working", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_DIALOGS_COMPOSE_CHAR_LIMIT_PROPERTY, tootle_dialogs_compose_properties[TOOTLE_DIALOGS_COMPOSE_CHAR_LIMIT_PROPERTY] = g_param_spec_int ("char-limit", "char-limit", "char-limit", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/com/github/bleakgrey/tootle/ui/dialogs/compose.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "mode_switcher", FALSE, TootleDialogsCompose_private_offset + G_STRUCT_OFFSET (TootleDialogsComposePrivate, mode_switcher));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "commit", FALSE, TootleDialogsCompose_private_offset + G_STRUCT_OFFSET (TootleDialogsComposePrivate, commit));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "commit_stack", FALSE, TootleDialogsCompose_private_offset + G_STRUCT_OFFSET (TootleDialogsComposePrivate, commit_stack));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "cw_revealer", FALSE, TootleDialogsCompose_private_offset + G_STRUCT_OFFSET (TootleDialogsComposePrivate, cw_revealer));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "cw_button", FALSE, TootleDialogsCompose_private_offset + G_STRUCT_OFFSET (TootleDialogsComposePrivate, cw_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "cw", FALSE, TootleDialogsCompose_private_offset + G_STRUCT_OFFSET (TootleDialogsComposePrivate, cw));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "counter", FALSE, TootleDialogsCompose_private_offset + G_STRUCT_OFFSET (TootleDialogsComposePrivate, counter));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "visibility_button", FALSE, TootleDialogsCompose_private_offset + G_STRUCT_OFFSET (TootleDialogsComposePrivate, visibility_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "visibility_icon", FALSE, TootleDialogsCompose_private_offset + G_STRUCT_OFFSET (TootleDialogsComposePrivate, visibility_icon));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "content", FALSE, TootleDialogsCompose_private_offset + G_STRUCT_OFFSET (TootleDialogsComposePrivate, content));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "mode", FALSE, TootleDialogsCompose_private_offset + G_STRUCT_OFFSET (TootleDialogsComposePrivate, mode));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "media_list", FALSE, TootleDialogsCompose_private_offset + G_STRUCT_OFFSET (TootleDialogsComposePrivate, media_list));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "validate", G_CALLBACK(_tootle_dialogs_compose_validate_gtk_toggle_button_toggled));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_select_media", G_CALLBACK(_tootle_dialogs_compose_on_select_media_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_media_list_row_activated", G_CALLBACK(_tootle_dialogs_compose_on_media_list_row_activated_gtk_list_box_row_activated));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_close", G_CALLBACK(_tootle_dialogs_compose_on_close_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_commit", G_CALLBACK(_tootle_dialogs_compose_on_commit_gtk_button_clicked));
}

static void
tootle_dialogs_compose_instance_init (TootleDialogsCompose * self,
                                      gpointer klass)
{
	self->priv = tootle_dialogs_compose_get_instance_private (self);
	self->priv->_working = FALSE;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
tootle_dialogs_compose_finalize (GObject * obj)
{
	TootleDialogsCompose * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TOOTLE_DIALOGS_TYPE_COMPOSE, TootleDialogsCompose);
	_g_object_unref0 (self->priv->_status);
	_g_free0 (self->priv->_style_class);
	_g_free0 (self->priv->_label);
	_g_object_unref0 (self->priv->visibility_popover);
	G_OBJECT_CLASS (tootle_dialogs_compose_parent_class)->finalize (obj);
}

static GType
tootle_dialogs_compose_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TootleDialogsComposeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tootle_dialogs_compose_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TootleDialogsCompose), 0, (GInstanceInitFunc) tootle_dialogs_compose_instance_init, NULL };
	GType tootle_dialogs_compose_type_id;
	tootle_dialogs_compose_type_id = g_type_register_static (hdy_window_get_type (), "TootleDialogsCompose", &g_define_type_info, 0);
	TootleDialogsCompose_private_offset = g_type_add_instance_private (tootle_dialogs_compose_type_id, sizeof (TootleDialogsComposePrivate));
	return tootle_dialogs_compose_type_id;
}

GType
tootle_dialogs_compose_get_type (void)
{
	static volatile gsize tootle_dialogs_compose_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_dialogs_compose_type_id__volatile)) {
		GType tootle_dialogs_compose_type_id;
		tootle_dialogs_compose_type_id = tootle_dialogs_compose_get_type_once ();
		g_once_init_leave (&tootle_dialogs_compose_type_id__volatile, tootle_dialogs_compose_type_id);
	}
	return tootle_dialogs_compose_type_id__volatile;
}

static void
_vala_tootle_dialogs_compose_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec)
{
	TootleDialogsCompose * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_DIALOGS_TYPE_COMPOSE, TootleDialogsCompose);
	switch (property_id) {
		case TOOTLE_DIALOGS_COMPOSE_STATUS_PROPERTY:
		g_value_set_object (value, tootle_dialogs_compose_get_status (self));
		break;
		case TOOTLE_DIALOGS_COMPOSE_STYLE_CLASS_PROPERTY:
		g_value_set_string (value, tootle_dialogs_compose_get_style_class (self));
		break;
		case TOOTLE_DIALOGS_COMPOSE_LABEL_PROPERTY:
		g_value_set_string (value, tootle_dialogs_compose_get_label (self));
		break;
		case TOOTLE_DIALOGS_COMPOSE_WORKING_PROPERTY:
		g_value_set_boolean (value, tootle_dialogs_compose_get_working (self));
		break;
		case TOOTLE_DIALOGS_COMPOSE_CHAR_LIMIT_PROPERTY:
		g_value_set_int (value, tootle_dialogs_compose_get_char_limit (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tootle_dialogs_compose_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec)
{
	TootleDialogsCompose * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_DIALOGS_TYPE_COMPOSE, TootleDialogsCompose);
	switch (property_id) {
		case TOOTLE_DIALOGS_COMPOSE_STATUS_PROPERTY:
		tootle_dialogs_compose_set_status (self, g_value_get_object (value));
		break;
		case TOOTLE_DIALOGS_COMPOSE_STYLE_CLASS_PROPERTY:
		tootle_dialogs_compose_set_style_class (self, g_value_get_string (value));
		break;
		case TOOTLE_DIALOGS_COMPOSE_LABEL_PROPERTY:
		tootle_dialogs_compose_set_label (self, g_value_get_string (value));
		break;
		case TOOTLE_DIALOGS_COMPOSE_WORKING_PROPERTY:
		tootle_dialogs_compose_set_working (self, g_value_get_boolean (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;
}

