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

#include <adwaita.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <glib/gi18n-lib.h>
#include <libsoup/soup.h>
#include <json-glib/json-glib.h>
#include <graphene-gobject.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gst/gst.h>

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

#define TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT (tuba_dialogs_composer_components_attachment_get_type ())
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, TubaDialogsComposerComponentsAttachment))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, TubaDialogsComposerComponentsAttachmentClass))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_IS_ATTACHMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_IS_ATTACHMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, TubaDialogsComposerComponentsAttachmentClass))

typedef struct _TubaDialogsComposerComponentsAttachment TubaDialogsComposerComponentsAttachment;
typedef struct _TubaDialogsComposerComponentsAttachmentClass TubaDialogsComposerComponentsAttachmentClass;
typedef struct _TubaDialogsComposerComponentsAttachmentPrivate TubaDialogsComposerComponentsAttachmentPrivate;
typedef enum  {
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_IMAGE,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_VIDEO,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_GIFV,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_AUDIO
} TubaDialogsComposerComponentsAttachmentMediaType;

#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_MEDIA_TYPE (tuba_dialogs_composer_components_attachment_media_type_get_type ())

#define TUBA_WIDGETS_TYPE_FOCUS_PICTURE (tuba_widgets_focus_picture_get_type ())
#define TUBA_WIDGETS_FOCUS_PICTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_FOCUS_PICTURE, TubaWidgetsFocusPicture))
#define TUBA_WIDGETS_FOCUS_PICTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_FOCUS_PICTURE, TubaWidgetsFocusPictureClass))
#define TUBA_WIDGETS_IS_FOCUS_PICTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_FOCUS_PICTURE))
#define TUBA_WIDGETS_IS_FOCUS_PICTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_FOCUS_PICTURE))
#define TUBA_WIDGETS_FOCUS_PICTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_FOCUS_PICTURE, TubaWidgetsFocusPictureClass))

typedef struct _TubaWidgetsFocusPicture TubaWidgetsFocusPicture;
typedef struct _TubaWidgetsFocusPictureClass TubaWidgetsFocusPictureClass;

#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ALT_INDICATOR (tuba_dialogs_composer_components_attachment_alt_indicator_get_type ())
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ALT_INDICATOR, TubaDialogsComposerComponentsAttachmentAltIndicator))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ALT_INDICATOR, TubaDialogsComposerComponentsAttachmentAltIndicatorClass))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_IS_ALT_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ALT_INDICATOR))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_IS_ALT_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ALT_INDICATOR))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_INDICATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ALT_INDICATOR, TubaDialogsComposerComponentsAttachmentAltIndicatorClass))

typedef struct _TubaDialogsComposerComponentsAttachmentAltIndicator TubaDialogsComposerComponentsAttachmentAltIndicator;
typedef struct _TubaDialogsComposerComponentsAttachmentAltIndicatorClass TubaDialogsComposerComponentsAttachmentAltIndicatorClass;

#define TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_DROP_OVERLAY (tuba_dialogs_composer_components_drop_overlay_get_type ())
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_DROP_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_DROP_OVERLAY, TubaDialogsComposerComponentsDropOverlay))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_DROP_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_DROP_OVERLAY, TubaDialogsComposerComponentsDropOverlayClass))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_IS_DROP_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_DROP_OVERLAY))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_IS_DROP_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_DROP_OVERLAY))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_DROP_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_DROP_OVERLAY, TubaDialogsComposerComponentsDropOverlayClass))

typedef struct _TubaDialogsComposerComponentsDropOverlay TubaDialogsComposerComponentsDropOverlay;
typedef struct _TubaDialogsComposerComponentsDropOverlayClass TubaDialogsComposerComponentsDropOverlayClass;
enum  {
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_0_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_KIND_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_UPLOADING_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_EDIT_MODE_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_ID_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_PAINTABLE_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_DONE_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_POS_X_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_POS_Y_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_TEXT_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_FILE_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_PROGRESS_ANIMATION_HACK_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_NUM_PROPERTIES
};
static GParamSpec* tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __vala_GdkRGBA_free0(var) ((var == NULL) ? NULL : (var = (_vala_GdkRGBA_free (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))

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

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

#define TUBA_REQUEST_V2_TYPE_METHOD (tuba_request_v2_method_get_type ())

#define TUBA_TYPE_ACCOUNT_STORE (tuba_account_store_get_type ())
#define TUBA_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStore))
#define TUBA_ACCOUNT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStoreClass))
#define TUBA_IS_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ACCOUNT_STORE))
#define TUBA_IS_ACCOUNT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ACCOUNT_STORE))
#define TUBA_ACCOUNT_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStoreClass))

typedef struct _TubaAccountStore TubaAccountStore;
typedef struct _TubaAccountStoreClass TubaAccountStoreClass;

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

typedef struct _TubaEntity TubaEntity;
typedef struct _TubaEntityClass TubaEntityClass;

#define TUBA_API_TYPE_ACCOUNT (tuba_api_account_get_type ())
#define TUBA_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccount))
#define TUBA_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))
#define TUBA_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))

typedef struct _TubaAPIAccount TubaAPIAccount;
typedef struct _TubaAPIAccountClass TubaAPIAccountClass;

#define TUBA_TYPE_INSTANCE_ACCOUNT (tuba_instance_account_get_type ())
#define TUBA_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccount))
#define TUBA_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))
#define TUBA_IS_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_IS_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_INSTANCE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))

typedef struct _TubaInstanceAccount TubaInstanceAccount;
typedef struct _TubaInstanceAccountClass TubaInstanceAccountClass;

#define TUBA_TYPE_OOPSIE (tuba_oopsie_get_type ())

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

typedef struct _TubaNetwork TubaNetwork;
typedef struct _TubaNetworkClass TubaNetworkClass;

#define TUBA_API_TYPE_ATTACHMENT (tuba_api_attachment_get_type ())
#define TUBA_API_ATTACHMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_ATTACHMENT, TubaAPIAttachment))
#define TUBA_API_ATTACHMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_ATTACHMENT, TubaAPIAttachmentClass))
#define TUBA_API_IS_ATTACHMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_ATTACHMENT))
#define TUBA_API_IS_ATTACHMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_ATTACHMENT))
#define TUBA_API_ATTACHMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_ATTACHMENT, TubaAPIAttachmentClass))

typedef struct _TubaAPIAttachment TubaAPIAttachment;
typedef struct _TubaAPIAttachmentClass TubaAPIAttachmentClass;
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))

#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ATTACHMENT_THUMBNAILER (tuba_dialogs_composer_components_attachment_attachment_thumbnailer_get_type ())
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ATTACHMENT_THUMBNAILER, TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ATTACHMENT_THUMBNAILER, TubaDialogsComposerComponentsAttachmentAttachmentThumbnailerClass))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_IS_ATTACHMENT_THUMBNAILER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ATTACHMENT_THUMBNAILER))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_IS_ATTACHMENT_THUMBNAILER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ATTACHMENT_THUMBNAILER))
#define TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ATTACHMENT_THUMBNAILER, TubaDialogsComposerComponentsAttachmentAttachmentThumbnailerClass))

typedef struct _TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer;
typedef struct _TubaDialogsComposerComponentsAttachmentAttachmentThumbnailerClass TubaDialogsComposerComponentsAttachmentAttachmentThumbnailerClass;
#define _g_thread_unref0(var) ((var == NULL) ? NULL : (var = (g_thread_unref (var), NULL)))
typedef struct _TubaDialogsComposerComponentsAttachmentUploadData TubaDialogsComposerComponentsAttachmentUploadData;

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

typedef struct _TubaApplication TubaApplication;
typedef struct _TubaApplicationClass TubaApplicationClass;

#define TUBA_DIALOGS_TYPE_MAIN_WINDOW (tuba_dialogs_main_window_get_type ())
#define TUBA_DIALOGS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_DIALOGS_TYPE_MAIN_WINDOW, TubaDialogsMainWindow))
#define TUBA_DIALOGS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_DIALOGS_TYPE_MAIN_WINDOW, TubaDialogsMainWindowClass))
#define TUBA_DIALOGS_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_DIALOGS_TYPE_MAIN_WINDOW))
#define TUBA_DIALOGS_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_DIALOGS_TYPE_MAIN_WINDOW))
#define TUBA_DIALOGS_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_DIALOGS_TYPE_MAIN_WINDOW, TubaDialogsMainWindowClass))

typedef struct _TubaDialogsMainWindow TubaDialogsMainWindow;
typedef struct _TubaDialogsMainWindowClass TubaDialogsMainWindowClass;
typedef struct _TubaDialogsComposerComponentsAttachmentUploadThumbnailRealData TubaDialogsComposerComponentsAttachmentUploadThumbnailRealData;

#define TUBA_API_TYPE_INSTANCE (tuba_api_instance_get_type ())
#define TUBA_API_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_INSTANCE, TubaAPIInstance))
#define TUBA_API_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_INSTANCE, TubaAPIInstanceClass))
#define TUBA_API_IS_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_INSTANCE))
#define TUBA_API_IS_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_INSTANCE))
#define TUBA_API_INSTANCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_INSTANCE, TubaAPIInstanceClass))

typedef struct _TubaAPIInstance TubaAPIInstance;
typedef struct _TubaAPIInstanceClass TubaAPIInstanceClass;
typedef struct _TubaDialogsComposerComponentsAttachmentPutAltTextData TubaDialogsComposerComponentsAttachmentPutAltTextData;
typedef void (*TubaHelperImageOnItemChangedFn) (GdkPaintable* data, gpointer user_data);
typedef struct _TubaDialogsComposerComponentsAttachmentAltIndicatorPrivate TubaDialogsComposerComponentsAttachmentAltIndicatorPrivate;
enum  {
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_INDICATOR_0_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_INDICATOR_VALID_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_INDICATOR_NUM_PROPERTIES
};
static GParamSpec* tuba_dialogs_composer_components_attachment_alt_indicator_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_INDICATOR_NUM_PROPERTIES];
typedef struct _TubaDialogsComposerComponentsAttachmentAttachmentThumbnailerPrivate TubaDialogsComposerComponentsAttachmentAttachmentThumbnailerPrivate;
enum  {
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_0_PROPERTY,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_NUM_PROPERTIES
};
static GParamSpec* tuba_dialogs_composer_components_attachment_attachment_thumbnailer_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_NUM_PROPERTIES];

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

typedef struct _TubaSettings TubaSettings;
typedef struct _TubaSettingsClass TubaSettingsClass;
#define _gst_sample_unref0(var) ((var == NULL) ? NULL : (var = (gst_sample_unref (var), NULL)))
#define _gst_caps_unref0(var) ((var == NULL) ? NULL : (var = (gst_caps_unref (var), NULL)))
#define _gst_buffer_unref0(var) ((var == NULL) ? NULL : (var = (gst_buffer_unref (var), NULL)))
enum  {
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_DONE_SIGNAL,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_EXTRACTED_ALT_SIGNAL,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_NUM_SIGNALS
};
static guint tuba_dialogs_composer_components_attachment_attachment_thumbnailer_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_NUM_SIGNALS] = {0};
enum  {
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_SWITCH_PLACE_SIGNAL,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_DELETE_ME_SIGNAL,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_EDIT_SIGNAL,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_UPLOAD_ERROR_SIGNAL,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TOAST_SIGNAL,
	TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_NUM_SIGNALS
};
static guint tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_NUM_SIGNALS] = {0};

struct _TubaDialogsComposerComponentsAttachment {
	AdwBin parent_instance;
	TubaDialogsComposerComponentsAttachmentPrivate * priv;
};

struct _TubaDialogsComposerComponentsAttachmentClass {
	AdwBinClass parent_class;
};

struct _TubaDialogsComposerComponentsAttachmentPrivate {
	TubaDialogsComposerComponentsAttachmentMediaType _kind;
	gboolean _uploading;
	gboolean _edit_mode;
	gchar* _media_id;
	gboolean _done;
	gdouble _progress;
	gchar* _alt_text;
	GFile* _file;
	AdwTimedAnimation* opacity_animation;
	TubaWidgetsFocusPicture* picture;
	GtkButton* delete_button;
	GtkButton* alt_button;
	TubaDialogsComposerComponentsAttachmentAltIndicator* alt_indicator;
	GtkButton* custom_thumbnail_button;
	GtkLabel* progress_label;
	GtkImage* media_icon;
	AdwTimedAnimation* animation;
	AdwTimedAnimation* progress_animation;
	TubaDialogsComposerComponentsDropOverlay* drop_overlay;
	GtkDropTarget* drop_target_controller;
	GdkRGBA color;
	gdouble drag_x;
	gdouble drag_y;
	gboolean being_dragged;
	guint bytes_written;
	gsize total_bytes;
};

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

struct _TubaDialogsComposerComponentsAttachmentUploadData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TubaDialogsComposerComponentsAttachment* self;
	GFile* file;
	gboolean _tmp0_;
	GBytes* buffer;
	gchar* mime;
	gchar* uri;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	guint8* contents;
	gint contents_length1;
	gint _contents_size_;
	guint8* _tmp6_;
	gsize _tmp7_;
	GFileInfo* type;
	GFileInfo* _tmp8_;
	GFileInfo* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	GError* e;
	const gchar* _tmp12_;
	GError* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	guint8* _tmp17_;
	gint _tmp17__length1;
	guint8* _tmp18_;
	gint _tmp18__length1;
	GBytes* _tmp19_;
	GBytes* _tmp20_;
	TubaRequestV2* msg;
	TubaAccountStore* _tmp21_;
	TubaInstanceAccount* _tmp22_;
	TubaInstanceAccount* _tmp23_;
	TubaInstanceAccount* _tmp24_;
	TubaRequestV2* _tmp25_;
	TubaRequestV2* _tmp26_;
	const gchar* _tmp27_;
	GBytes* _tmp28_;
	TubaRequestV2* _tmp29_;
	GInputStream* in_stream;
	GInputStream* _tmp30_;
	TubaRequestV2* _tmp31_;
	GInputStream* _tmp32_;
	GInputStream* _tmp33_;
	GInputStream* _tmp34_;
	GError* _tmp35_;
	GError* _vala1_e;
	GError* _tmp36_;
	const gchar* _tmp37_;
	JsonParser* parser;
	GInputStream* _tmp38_;
	JsonParser* _tmp39_;
	JsonNode* node;
	TubaNetwork* _tmp40_;
	JsonParser* _tmp41_;
	JsonNode* _tmp42_;
	TubaAPIAttachment* entity;
	TubaAccountStore* _tmp43_;
	TubaInstanceAccount* _tmp44_;
	TubaInstanceAccount* _tmp45_;
	JsonNode* _tmp46_;
	gpointer _tmp47_;
	TubaAPIAttachment* _tmp48_;
	const gchar* _tmp49_;
	const gchar* _tmp50_;
	TubaAPIAttachment* _tmp51_;
	const gchar* _tmp52_;
	const gchar* _tmp53_;
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* working_loader;
	const gchar* _tmp54_;
	TubaDialogsComposerComponentsAttachmentMediaType _tmp55_;
	TubaDialogsComposerComponentsAttachmentMediaType _tmp56_;
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _tmp57_;
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _tmp58_;
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _tmp59_;
	const gchar* _tmp60_;
	const gchar* _tmp61_;
	gchar* _tmp62_;
	gchar* _tmp63_;
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _tmp64_;
	GThread* _tmp65_;
	GThread* _tmp66_;
	GError* _vala2_e;
	const gchar* _tmp67_;
	GError* _tmp68_;
	const gchar* _tmp69_;
	TubaAPIAttachment* _tmp70_;
	const gchar* _tmp71_;
	const gchar* _tmp72_;
	const gchar* _tmp73_;
	gchar* _tmp74_;
	gchar* _tmp75_;
	GError* _vala3_e;
	GError* _tmp76_;
	const gchar* _tmp77_;
	GError* _tmp78_;
	const gchar* _tmp79_;
	GError* _inner_error0_;
};

struct _TubaDialogsComposerComponentsAttachmentUploadThumbnailRealData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TubaDialogsComposerComponentsAttachment* self;
	GtkButton* _tmp0_;
	GtkFileFilter* filter;
	gchar* _tmp1_;
	GtkFileFilter* _tmp2_;
	const gchar** mime_type_collection;
	gint mime_type_collection_length1;
	gint _mime_type_collection_size_;
	gint mime_type_it;
	const gchar* mime_type;
	const gchar* _tmp3_;
	GtkFileFilter* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GtkFileDialog* chooser;
	gchar* _tmp8_;
	GtkFileFilter* _tmp9_;
	GtkFileFilter* _tmp10_;
	GtkFileDialog* _tmp11_;
	GFile* file;
	GtkFileDialog* _tmp12_;
	TubaApplication* _tmp13_;
	TubaDialogsMainWindow* _tmp14_;
	TubaDialogsMainWindow* _tmp15_;
	GFile* _tmp16_;
	GBytes* buffer;
	gchar* mime;
	gchar* uri;
	GFile* _tmp17_;
	gchar* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	guint8* contents;
	gint contents_length1;
	gint _contents_size_;
	GFile* _tmp23_;
	guint8* _tmp24_;
	gsize _tmp25_;
	GFileInfo* type;
	GFile* _tmp26_;
	GFileInfo* _tmp27_;
	GFileInfo* _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	GError* e;
	GtkButton* _tmp31_;
	const gchar* _tmp32_;
	GError* _tmp33_;
	const gchar* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
	guint8* _tmp37_;
	gint _tmp37__length1;
	guint8* _tmp38_;
	gint _tmp38__length1;
	GBytes* _tmp39_;
	TubaRequestV2* msg;
	const gchar* _tmp40_;
	const gchar* _tmp41_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	TubaAccountStore* _tmp44_;
	TubaInstanceAccount* _tmp45_;
	TubaInstanceAccount* _tmp46_;
	TubaInstanceAccount* _tmp47_;
	TubaRequestV2* _tmp48_;
	TubaRequestV2* _tmp49_;
	TubaRequestV2* _tmp50_;
	const gchar* _tmp51_;
	GBytes* _tmp52_;
	GInputStream* in_stream;
	GInputStream* _tmp53_;
	TubaRequestV2* _tmp54_;
	GInputStream* _tmp55_;
	GInputStream* _tmp56_;
	GInputStream* _tmp57_;
	GError* _tmp58_;
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* working_loader;
	GFile* _tmp59_;
	gchar* _tmp60_;
	gchar* _tmp61_;
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _tmp62_;
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _tmp63_;
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _tmp64_;
	GFile* _tmp65_;
	gchar* _tmp66_;
	gchar* _tmp67_;
	const gchar* _tmp68_;
	gchar* _tmp69_;
	gchar* _tmp70_;
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _tmp71_;
	GThread* _tmp72_;
	GThread* _tmp73_;
	GError* _vala1_e;
	GFile* _tmp74_;
	gchar* _tmp75_;
	gchar* _tmp76_;
	GError* _tmp77_;
	const gchar* _tmp78_;
	GError* _vala2_e;
	GError* _tmp79_;
	const gchar* _tmp80_;
	GError* _vala3_e;
	GError* _tmp81_;
	const gchar* _tmp82_;
	const gchar* _tmp83_;
	gchar* _tmp84_;
	gchar* _tmp85_;
	GtkButton* _tmp86_;
	GError* _inner_error0_;
};

struct _TubaDialogsComposerComponentsAttachmentPutAltTextData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TubaDialogsComposerComponentsAttachment* self;
	gchar* limited_alt_text;
	JsonBuilder* builder;
	JsonBuilder* _tmp0_;
	TubaRequestV2* req;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	TubaAccountStore* _tmp5_;
	TubaInstanceAccount* _tmp6_;
	TubaInstanceAccount* _tmp7_;
	TubaInstanceAccount* _tmp8_;
	TubaRequestV2* _tmp9_;
	TubaRequestV2* _tmp10_;
	GInputStream* _tmp11_;
	GInputStream* _tmp12_;
	GError* e;
	const gchar* _tmp13_;
	GError* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	GError* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	GError* _inner_error0_;
};

struct _TubaDialogsComposerComponentsAttachmentAltIndicator {
	GtkBox parent_instance;
	TubaDialogsComposerComponentsAttachmentAltIndicatorPrivate * priv;
};

struct _TubaDialogsComposerComponentsAttachmentAltIndicatorClass {
	GtkBoxClass parent_class;
};

struct _TubaDialogsComposerComponentsAttachmentAltIndicatorPrivate {
	gboolean _valid;
	GtkImage* icon;
};

struct _TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer {
	GObject parent_instance;
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailerPrivate * priv;
};

struct _TubaDialogsComposerComponentsAttachmentAttachmentThumbnailerClass {
	GObjectClass parent_class;
};

struct _TubaDialogsComposerComponentsAttachmentAttachmentThumbnailerPrivate {
	gboolean can_extract_alt;
	GFile* file;
	TubaDialogsComposerComponentsAttachmentMediaType kind;
};

static gint TubaDialogsComposerComponentsAttachment_private_offset;
static gpointer tuba_dialogs_composer_components_attachment_parent_class = NULL;
VALA_EXTERN TubaAccountStore* tuba_accounts;
VALA_EXTERN TubaNetwork* tuba_network;
VALA_EXTERN TubaApplication* tuba_app;
static gint TubaDialogsComposerComponentsAttachmentAltIndicator_private_offset;
static gpointer tuba_dialogs_composer_components_attachment_alt_indicator_parent_class = NULL;
static gint TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer_private_offset;
static gpointer tuba_dialogs_composer_components_attachment_attachment_thumbnailer_parent_class = NULL;
VALA_EXTERN TubaSettings* tuba_settings;

VALA_EXTERN GType tuba_dialogs_composer_components_attachment_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaDialogsComposerComponentsAttachment, g_object_unref)
VALA_EXTERN GType tuba_dialogs_composer_components_attachment_media_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType tuba_widgets_focus_picture_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsFocusPicture, g_object_unref)
VALA_EXTERN GType tuba_dialogs_composer_components_attachment_alt_indicator_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaDialogsComposerComponentsAttachmentAltIndicator, g_object_unref)
VALA_EXTERN GType tuba_dialogs_composer_components_drop_overlay_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaDialogsComposerComponentsDropOverlay, g_object_unref)
VALA_EXTERN TubaDialogsComposerComponentsAttachmentMediaType tuba_dialogs_composer_components_attachment_media_type_from_string (const gchar* kind);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_cleanup (TubaDialogsComposerComponentsAttachment* self);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_play_animation (TubaDialogsComposerComponentsAttachment* self,
                                                                 gboolean reverse);
static void tuba_dialogs_composer_components_attachment_on_animation_end (TubaDialogsComposerComponentsAttachment* self);
static void tuba_dialogs_composer_components_attachment_on_edit_clicked (TubaDialogsComposerComponentsAttachment* self);
VALA_EXTERN TubaDialogsComposerComponentsAttachment* tuba_dialogs_composer_components_attachment_new_from_paintable (GdkPaintable* paintable);
VALA_EXTERN TubaDialogsComposerComponentsAttachment* tuba_dialogs_composer_components_attachment_construct_from_paintable (GType object_type,
                                                                                                               GdkPaintable* paintable);
VALA_EXTERN void tuba_widgets_focus_picture_set_paintable (TubaWidgetsFocusPicture* self,
                                               GdkPaintable* value);
static void tuba_dialogs_composer_components_attachment_update_accent_color (TubaDialogsComposerComponentsAttachment* self);
static void _vala_GdkRGBA_free (GdkRGBA* self);
static gdouble tuba_dialogs_composer_components_attachment_get_progress (TubaDialogsComposerComponentsAttachment* self);
static GdkContentProvider* tuba_dialogs_composer_components_attachment_on_drag_prepare (TubaDialogsComposerComponentsAttachment* self,
                                                                                 gdouble x,
                                                                                 gdouble y);
VALA_EXTERN gboolean tuba_dialogs_composer_components_attachment_get_done (TubaDialogsComposerComponentsAttachment* self);
static void tuba_dialogs_composer_components_attachment_on_drag_begin (TubaDialogsComposerComponentsAttachment* self,
                                                                GtkDragSource* ds_controller,
                                                                GdkDrag* drag);
static void tuba_dialogs_composer_components_attachment_animate_opacity (TubaDialogsComposerComponentsAttachment* self,
                                                                  gboolean hide);
static void tuba_dialogs_composer_components_attachment_on_drag_end (TubaDialogsComposerComponentsAttachment* self,
                                                              GdkDrag* drag,
                                                              gboolean delete_data);
static gboolean tuba_dialogs_composer_components_attachment_on_drag_cancel (TubaDialogsComposerComponentsAttachment* self,
                                                                     GdkDrag* drag,
                                                                     GdkDragCancelReason reason);
static gboolean tuba_dialogs_composer_components_attachment_on_drop (TubaDialogsComposerComponentsAttachment* self,
                                                              GtkDropTarget* dt_controller,
                                                              GValue* value,
                                                              gdouble x,
                                                              gdouble y);
VALA_EXTERN void tuba_dialogs_composer_components_drop_overlay_set_dropping (TubaDialogsComposerComponentsDropOverlay* self,
                                                                 gboolean value);
static GdkDragAction tuba_dialogs_composer_components_attachment_on_drop_enter (TubaDialogsComposerComponentsAttachment* self,
                                                                         gdouble x,
                                                                         gdouble y);
static void tuba_dialogs_composer_components_attachment_on_drop_leave (TubaDialogsComposerComponentsAttachment* self);
static void tuba_dialogs_composer_components_attachment_upload_data_free (gpointer _data);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_upload (TubaDialogsComposerComponentsAttachment* self,
                                                         GFile* file,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_upload_finish (TubaDialogsComposerComponentsAttachment* self,
                                                                GAsyncResult* _res_);
static gboolean tuba_dialogs_composer_components_attachment_upload_co (TubaDialogsComposerComponentsAttachmentUploadData* _data_);
VALA_EXTERN gboolean tuba_dialogs_composer_components_attachment_get_uploading (TubaDialogsComposerComponentsAttachment* self);
static void tuba_dialogs_composer_components_attachment_set_uploading (TubaDialogsComposerComponentsAttachment* self,
                                                                gboolean value);
static guint8* _vala_array_dup21 (guint8* self,
                           gssize length);
VALA_EXTERN GType tuba_request_v2_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaRequestV2, g_object_unref)
VALA_EXTERN GType tuba_request_v2_method_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType tuba_account_store_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAccountStore, g_object_unref)
VALA_EXTERN GType tuba_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaEntity, g_object_unref)
VALA_EXTERN GType tuba_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAccount, g_object_unref)
VALA_EXTERN GType tuba_instance_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaInstanceAccount, g_object_unref)
VALA_EXTERN TubaInstanceAccount* tuba_account_store_get_active (TubaAccountStore* self);
VALA_EXTERN TubaRequestV2* tuba_request_v2_new (const gchar* url,
                                    TubaRequestV2Method method);
VALA_EXTERN TubaRequestV2* tuba_request_v2_construct (GType object_type,
                                          const gchar* url,
                                          TubaRequestV2Method method);
VALA_EXTERN void tuba_request_v2_set_account (TubaRequestV2* self,
                                  TubaInstanceAccount* value);
VALA_EXTERN void tuba_request_v2_set_track_written_body_data (TubaRequestV2* self,
                                                  gboolean value);
VALA_EXTERN void tuba_request_v2_add_form_data_file (TubaRequestV2* self,
                                         const gchar* name,
                                         const gchar* mime,
                                         GBytes* buffer);
static void tuba_dialogs_composer_components_attachment_on_upload_bytes_written (TubaDialogsComposerComponentsAttachment* self,
                                                                          guint chunk);
static void _tuba_dialogs_composer_components_attachment_on_upload_bytes_written_tuba_request_v2_wrote_body_data (TubaRequestV2* _sender,
                                                                                                           guint chunk_size,
                                                                                                           gpointer self);
VALA_EXTERN void tuba_request_v2_exec (TubaRequestV2* self,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_);
VALA_EXTERN GQuark tuba_oopsie_quark (void);
VALA_EXTERN GType tuba_oopsie_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GInputStream* tuba_request_v2_exec_finish (TubaRequestV2* self,
                                           GAsyncResult* _res_,
                                           SoupMessageHeaders** response_headers,
                                           GError** error);
static void tuba_dialogs_composer_components_attachment_upload_ready (GObject* source_object,
                                                               GAsyncResult* _res_,
                                                               gpointer _user_data_);
static void tuba_dialogs_composer_components_attachment_set_progress (TubaDialogsComposerComponentsAttachment* self,
                                                               gdouble value);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_set_file (TubaDialogsComposerComponentsAttachment* self,
                                                           GFile* value);
VALA_EXTERN void tuba_network_get_parser_from_inputstream_async (GInputStream* in_stream,
                                                     GCancellable* cancellable,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_);
VALA_EXTERN JsonParser* tuba_network_get_parser_from_inputstream_finish (GAsyncResult* _res_,
                                                             GError** error);
VALA_EXTERN GType tuba_network_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaNetwork, g_object_unref)
VALA_EXTERN JsonNode* tuba_network_parse_node (TubaNetwork* self,
                                   JsonParser* parser);
VALA_EXTERN GType tuba_api_attachment_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAttachment, g_object_unref)
VALA_EXTERN gpointer tuba_instance_account_create_entity (TubaInstanceAccount* self,
                                              GType t_type,
                                              GBoxedCopyFunc t_dup_func,
                                              GDestroyNotify t_destroy_func,
                                              JsonNode* node,
                                              GError** error);
static void _vala_JsonNode_free (JsonNode* self);
VALA_EXTERN const gchar* tuba_api_attachment_get_id (TubaAPIAttachment* self);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_set_media_id (TubaDialogsComposerComponentsAttachment* self,
                                                               const gchar* value);
VALA_EXTERN const gchar* tuba_api_attachment_get_kind (TubaAPIAttachment* self);
static void tuba_dialogs_composer_components_attachment_set_kind (TubaDialogsComposerComponentsAttachment* self,
                                                           TubaDialogsComposerComponentsAttachmentMediaType value);
static GType tuba_dialogs_composer_components_attachment_attachment_thumbnailer_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer, g_object_unref)
VALA_EXTERN TubaDialogsComposerComponentsAttachmentMediaType tuba_dialogs_composer_components_attachment_get_kind (TubaDialogsComposerComponentsAttachment* self);
static TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* tuba_dialogs_composer_components_attachment_attachment_thumbnailer_new (const gchar* file_uri,
                                                                                                                                      TubaDialogsComposerComponentsAttachmentMediaType kind);
static TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* tuba_dialogs_composer_components_attachment_attachment_thumbnailer_construct (GType object_type,
                                                                                                                                            const gchar* file_uri,
                                                                                                                                            TubaDialogsComposerComponentsAttachmentMediaType kind);
static void tuba_dialogs_composer_components_attachment_on_done (TubaDialogsComposerComponentsAttachment* self,
                                                          GdkPaintable* paintable);
static void _tuba_dialogs_composer_components_attachment_on_done_tuba_dialogs_composer_components_attachment_attachment_thumbnailer_done (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _sender,
                                                                                                                                   GdkPaintable* paintable,
                                                                                                                                   gpointer self);
static void tuba_dialogs_composer_components_attachment_on_extracted_alt_text (TubaDialogsComposerComponentsAttachment* self,
                                                                        const gchar* new_alt_text);
static void _tuba_dialogs_composer_components_attachment_on_extracted_alt_text_tuba_dialogs_composer_components_attachment_attachment_thumbnailer_extracted_alt (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _sender,
                                                                                                                                                          const gchar* extracted_alt_text,
                                                                                                                                                          gpointer self);
static void tuba_dialogs_composer_components_attachment_attachment_thumbnailer_fetch (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* self);
static gpointer _tuba_dialogs_composer_components_attachment_attachment_thumbnailer_fetch_gthread_func (gpointer self);
static void tuba_dialogs_composer_components_attachment_set_done (TubaDialogsComposerComponentsAttachment* self,
                                                           gboolean value);
static void tuba_dialogs_composer_components_attachment_update_aria_label (TubaDialogsComposerComponentsAttachment* self);
static void tuba_dialogs_composer_components_attachment_upload_thumbnail (TubaDialogsComposerComponentsAttachment* self);
static void tuba_dialogs_composer_components_attachment_upload_thumbnail_real (TubaDialogsComposerComponentsAttachment* self,
                                                                        GAsyncReadyCallback _callback_,
                                                                        gpointer _user_data_);
static void tuba_dialogs_composer_components_attachment_upload_thumbnail_real_finish (TubaDialogsComposerComponentsAttachment* self,
                                                                               GAsyncResult* _res_);
static void tuba_dialogs_composer_components_attachment_upload_thumbnail_real_data_free (gpointer _data);
static gboolean tuba_dialogs_composer_components_attachment_upload_thumbnail_real_co (TubaDialogsComposerComponentsAttachmentUploadThumbnailRealData* _data_);
VALA_EXTERN GType tuba_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaApplication, g_object_unref)
VALA_EXTERN GType tuba_dialogs_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaDialogsMainWindow, g_object_unref)
VALA_EXTERN TubaDialogsMainWindow* tuba_application_get_main_window (TubaApplication* self);
static void tuba_dialogs_composer_components_attachment_upload_thumbnail_real_ready (GObject* source_object,
                                                                              GAsyncResult* _res_,
                                                                              gpointer _user_data_);
static guint8* _vala_array_dup22 (guint8* self,
                           gssize length);
VALA_EXTERN const gchar* tuba_dialogs_composer_components_attachment_get_media_id (TubaDialogsComposerComponentsAttachment* self);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_set_paintable (TubaDialogsComposerComponentsAttachment* self,
                                                                GdkPaintable* value);
VALA_EXTERN const gchar* tuba_dialogs_composer_components_attachment_get_alt_text (TubaDialogsComposerComponentsAttachment* self);
VALA_EXTERN GType tuba_api_instance_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIInstance, g_object_unref)
VALA_EXTERN TubaAPIInstance* tuba_instance_account_get_instance_info (TubaInstanceAccount* self);
VALA_EXTERN gint64 tuba_api_instance_get_tuba_max_alt_chars (TubaAPIInstance* self);
static void tuba_dialogs_composer_components_attachment_put_alt_text (TubaDialogsComposerComponentsAttachment* self,
                                                               const gchar* limited_alt_text,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_);
static void tuba_dialogs_composer_components_attachment_put_alt_text_finish (TubaDialogsComposerComponentsAttachment* self,
                                                                      GAsyncResult* _res_);
static void tuba_dialogs_composer_components_attachment_put_alt_text_data_free (gpointer _data);
static gboolean tuba_dialogs_composer_components_attachment_put_alt_text_co (TubaDialogsComposerComponentsAttachmentPutAltTextData* _data_);
VALA_EXTERN void tuba_request_v2_set_body_from_json (TubaRequestV2* self,
                                         JsonBuilder* json_builder);
static void tuba_dialogs_composer_components_attachment_put_alt_text_ready (GObject* source_object,
                                                                     GAsyncResult* _res_,
                                                                     gpointer _user_data_);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_set_alt_text (TubaDialogsComposerComponentsAttachment* self,
                                                               const gchar* value);
static void tuba_dialogs_composer_components_attachment_real_snapshot (GtkWidget* base,
                                                                GtkSnapshot* snapshot);
static void tuba_dialogs_composer_components_attachment_on_delete (TubaDialogsComposerComponentsAttachment* self);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_preload (TubaDialogsComposerComponentsAttachment* self,
                                                          const gchar* media_id,
                                                          const gchar* url,
                                                          const gchar* preview,
                                                          TubaDialogsComposerComponentsAttachmentMediaType kind);
VALA_EXTERN void tuba_helper_image_request_paintable (const gchar* url,
                                          const gchar* blurhash,
                                          gboolean disable_cache,
                                          TubaHelperImageOnItemChangedFn cb,
                                          gpointer cb_target,
                                          GDestroyNotify cb_target_destroy_notify,
                                          GCancellable* cancellable);
static void _tuba_dialogs_composer_components_attachment_on_done_tuba_helper_image_on_item_changed_fn (GdkPaintable* data,
                                                                                                gpointer self);
VALA_EXTERN GFile* tuba_dialogs_composer_components_attachment_get_file (TubaDialogsComposerComponentsAttachment* self);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_saved (TubaDialogsComposerComponentsAttachment* self,
                                                        gfloat pos_x,
                                                        gfloat pos_y,
                                                        const gchar* alt_text);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_set_pos_x (TubaDialogsComposerComponentsAttachment* self,
                                                            gdouble value);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_set_pos_y (TubaDialogsComposerComponentsAttachment* self,
                                                            gdouble value);
VALA_EXTERN TubaDialogsComposerComponentsAttachment* tuba_dialogs_composer_components_attachment_new (void);
VALA_EXTERN TubaDialogsComposerComponentsAttachment* tuba_dialogs_composer_components_attachment_construct (GType object_type);
VALA_EXTERN gboolean tuba_dialogs_composer_components_attachment_get_edit_mode (TubaDialogsComposerComponentsAttachment* self);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_set_edit_mode (TubaDialogsComposerComponentsAttachment* self,
                                                                gboolean value);
VALA_EXTERN GdkPaintable* tuba_dialogs_composer_components_attachment_get_paintable (TubaDialogsComposerComponentsAttachment* self);
VALA_EXTERN GdkPaintable* tuba_widgets_focus_picture_get_paintable (TubaWidgetsFocusPicture* self);
VALA_EXTERN gdouble tuba_dialogs_composer_components_attachment_get_pos_x (TubaDialogsComposerComponentsAttachment* self);
VALA_EXTERN gdouble tuba_widgets_focus_picture_get_focus_x (TubaWidgetsFocusPicture* self);
VALA_EXTERN void tuba_widgets_focus_picture_set_focus_x (TubaWidgetsFocusPicture* self,
                                             gdouble value);
VALA_EXTERN gdouble tuba_dialogs_composer_components_attachment_get_pos_y (TubaDialogsComposerComponentsAttachment* self);
VALA_EXTERN gdouble tuba_widgets_focus_picture_get_focus_y (TubaWidgetsFocusPicture* self);
VALA_EXTERN void tuba_widgets_focus_picture_set_focus_y (TubaWidgetsFocusPicture* self,
                                             gdouble value);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_alt_indicator_set_valid (TubaDialogsComposerComponentsAttachmentAltIndicator* self,
                                                                          gboolean value);
VALA_EXTERN gboolean tuba_dialogs_composer_components_attachment_alt_indicator_get_valid (TubaDialogsComposerComponentsAttachmentAltIndicator* self);
VALA_EXTERN gdouble tuba_dialogs_composer_components_attachment_get_progress_animation_hack (TubaDialogsComposerComponentsAttachment* self);
VALA_EXTERN void tuba_dialogs_composer_components_attachment_set_progress_animation_hack (TubaDialogsComposerComponentsAttachment* self,
                                                                              gdouble value);
static void tuba_dialogs_composer_components_attachment_alt_indicator_update_valid (TubaDialogsComposerComponentsAttachmentAltIndicator* self);
VALA_EXTERN TubaDialogsComposerComponentsAttachmentAltIndicator* tuba_dialogs_composer_components_attachment_alt_indicator_new (void);
VALA_EXTERN TubaDialogsComposerComponentsAttachmentAltIndicator* tuba_dialogs_composer_components_attachment_alt_indicator_construct (GType object_type);
static GObject * tuba_dialogs_composer_components_attachment_alt_indicator_constructor (GType type,
                                                                                 guint n_construct_properties,
                                                                                 GObjectConstructParam * construct_properties);
static void tuba_dialogs_composer_components_attachment_alt_indicator_finalize (GObject * obj);
static GType tuba_dialogs_composer_components_attachment_alt_indicator_get_type_once (void);
static void _vala_tuba_dialogs_composer_components_attachment_alt_indicator_get_property (GObject * object,
                                                                                   guint property_id,
                                                                                   GValue * value,
                                                                                   GParamSpec * pspec);
static void _vala_tuba_dialogs_composer_components_attachment_alt_indicator_set_property (GObject * object,
                                                                                   guint property_id,
                                                                                   const GValue * value,
                                                                                   GParamSpec * pspec);
VALA_EXTERN GType tuba_settings_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaSettings, g_object_unref)
VALA_EXTERN gboolean tuba_settings_get_extract_alt_from_metadata (TubaSettings* self);
static guint8* _vala_array_dup23 (guint8* self,
                           gssize length);
VALA_EXTERN gchar* tuba_utils_exif_extract_alt_text (const gchar* path);
static void tuba_dialogs_composer_components_attachment_attachment_thumbnailer_finalize (GObject * obj);
static GType tuba_dialogs_composer_components_attachment_attachment_thumbnailer_get_type_once (void);
static GObject * tuba_dialogs_composer_components_attachment_constructor (GType type,
                                                                   guint n_construct_properties,
                                                                   GObjectConstructParam * construct_properties);
static void _tuba_dialogs_composer_components_attachment_on_animation_end_adw_animation_done (AdwAnimation* _sender,
                                                                                       gpointer self);
static void _tuba_dialogs_composer_components_attachment_update_accent_color_g_object_notify (GObject* _sender,
                                                                                       GParamSpec* pspec,
                                                                                       gpointer self);
VALA_EXTERN TubaWidgetsFocusPicture* tuba_widgets_focus_picture_new (void);
VALA_EXTERN TubaWidgetsFocusPicture* tuba_widgets_focus_picture_construct (GType object_type);
VALA_EXTERN void tuba_widgets_focus_picture_set_can_shrink (TubaWidgetsFocusPicture* self,
                                                gboolean value);
VALA_EXTERN void tuba_widgets_focus_picture_set_content_fit (TubaWidgetsFocusPicture* self,
                                                 GtkContentFit value);
static void _tuba_dialogs_composer_components_attachment_on_delete_gtk_button_clicked (GtkButton* _sender,
                                                                                gpointer self);
static void _tuba_dialogs_composer_components_attachment_on_edit_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                      gpointer self);
static void _tuba_dialogs_composer_components_attachment_upload_thumbnail_gtk_button_clicked (GtkButton* _sender,
                                                                                       gpointer self);
VALA_EXTERN TubaDialogsComposerComponentsDropOverlay* tuba_dialogs_composer_components_drop_overlay_new (void);
VALA_EXTERN TubaDialogsComposerComponentsDropOverlay* tuba_dialogs_composer_components_drop_overlay_construct (GType object_type);
VALA_EXTERN void tuba_dialogs_composer_components_drop_overlay_set_compact (TubaDialogsComposerComponentsDropOverlay* self,
                                                                gboolean value);
VALA_EXTERN void tuba_dialogs_composer_components_drop_overlay_set_overlay_child (TubaDialogsComposerComponentsDropOverlay* self,
                                                                      GtkWidget* value);
VALA_EXTERN void tuba_dialogs_composer_components_drop_overlay_set_icon_name (TubaDialogsComposerComponentsDropOverlay* self,
                                                                  const gchar* value);
static GdkContentProvider* _tuba_dialogs_composer_components_attachment_on_drag_prepare_gtk_drag_source_prepare (GtkDragSource* _sender,
                                                                                                          gdouble x,
                                                                                                          gdouble y,
                                                                                                          gpointer self);
static void _tuba_dialogs_composer_components_attachment_on_drag_begin_gtk_drag_source_drag_begin (GtkDragSource* _sender,
                                                                                            GdkDrag* drag,
                                                                                            gpointer self);
static void _tuba_dialogs_composer_components_attachment_on_drag_end_gtk_drag_source_drag_end (GtkDragSource* _sender,
                                                                                        GdkDrag* drag,
                                                                                        gboolean delete_data,
                                                                                        gpointer self);
static gboolean _tuba_dialogs_composer_components_attachment_on_drag_cancel_gtk_drag_source_drag_cancel (GtkDragSource* _sender,
                                                                                                  GdkDrag* drag,
                                                                                                  GdkDragCancelReason reason,
                                                                                                  gpointer self);
static GdkDragAction _tuba_dialogs_composer_components_attachment_on_drop_enter_gtk_drop_target_enter (GtkDropTarget* _sender,
                                                                                                gdouble x,
                                                                                                gdouble y,
                                                                                                gpointer self);
static void _tuba_dialogs_composer_components_attachment_on_drop_leave_gtk_drop_target_leave (GtkDropTarget* _sender,
                                                                                       gpointer self);
static gboolean _tuba_dialogs_composer_components_attachment_on_drop_gtk_drop_target_drop (GtkDropTarget* _sender,
                                                                                    GValue* value,
                                                                                    gdouble x,
                                                                                    gdouble y,
                                                                                    gpointer self);
static void tuba_dialogs_composer_components_attachment_finalize (GObject * obj);
static GType tuba_dialogs_composer_components_attachment_get_type_once (void);
static void _vala_tuba_dialogs_composer_components_attachment_get_property (GObject * object,
                                                                     guint property_id,
                                                                     GValue * value,
                                                                     GParamSpec * pspec);
static void _vala_tuba_dialogs_composer_components_attachment_set_property (GObject * object,
                                                                     guint property_id,
                                                                     const GValue * value,
                                                                     GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

VALA_EXTERN const gchar* TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENTS_BIN_SUPPORTED_MIMES[28];

static inline gpointer
tuba_dialogs_composer_components_attachment_get_instance_private (TubaDialogsComposerComponentsAttachment* self)
{
	return G_STRUCT_MEMBER_P (self, TubaDialogsComposerComponentsAttachment_private_offset);
}

TubaDialogsComposerComponentsAttachmentMediaType
tuba_dialogs_composer_components_attachment_media_type_from_string (const gchar* kind)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	GQuark _tmp3_ = 0U;
	static GQuark _tmp2_label0 = 0;
	static GQuark _tmp2_label1 = 0;
	static GQuark _tmp2_label2 = 0;
	TubaDialogsComposerComponentsAttachmentMediaType result;
	g_return_val_if_fail (kind != NULL, 0);
	_tmp0_ = g_utf8_strdown (kind, (gssize) -1);
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	g_free (_tmp1_);
	if (_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("audio")))) {
		switch (0) {
			default:
			{
				result = TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_AUDIO;
				return result;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("video")))) {
		switch (0) {
			default:
			{
				result = TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_VIDEO;
				return result;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label2) ? _tmp2_label2 : (_tmp2_label2 = g_quark_from_static_string ("gifv")))) {
		switch (0) {
			default:
			{
				result = TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_GIFV;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				result = TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_IMAGE;
				return result;
			}
		}
	}
}

 G_GNUC_NO_INLINE static GType
tuba_dialogs_composer_components_attachment_media_type_get_type_once (void)
{
	static const GEnumValue values[] = {{TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_IMAGE, "TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_IMAGE", "image"}, {TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_VIDEO, "TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_VIDEO", "video"}, {TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_GIFV, "TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_GIFV", "gifv"}, {TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_AUDIO, "TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_AUDIO", "audio"}, {0, NULL, NULL}};
	GType tuba_dialogs_composer_components_attachment_media_type_type_id;
	tuba_dialogs_composer_components_attachment_media_type_type_id = g_enum_register_static ("TubaDialogsComposerComponentsAttachmentMediaType", values);
	return tuba_dialogs_composer_components_attachment_media_type_type_id;
}

GType
tuba_dialogs_composer_components_attachment_media_type_get_type (void)
{
	static GType tuba_dialogs_composer_components_attachment_media_type_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_dialogs_composer_components_attachment_media_type_type_id__once)) {
		GType tuba_dialogs_composer_components_attachment_media_type_type_id;
		tuba_dialogs_composer_components_attachment_media_type_type_id = tuba_dialogs_composer_components_attachment_media_type_get_type_once ();
		g_once_init_leave_pointer (&tuba_dialogs_composer_components_attachment_media_type_type_id__once, tuba_dialogs_composer_components_attachment_media_type_type_id);
	}
	return tuba_dialogs_composer_components_attachment_media_type_type_id__once;
}

void
tuba_dialogs_composer_components_attachment_cleanup (TubaDialogsComposerComponentsAttachment* self)
{
	GtkDropTarget* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->drop_target_controller;
	if (((gpointer) gtk_drop_target_get_value (_tmp0_)) != NULL) {
		GtkDropTarget* _tmp1_;
		GValue _tmp2_;
		_tmp1_ = self->priv->drop_target_controller;
		_tmp2_ = *gtk_drop_target_get_value (_tmp1_);
		g_value_set_object (&_tmp2_, NULL);
	}
}

void
tuba_dialogs_composer_components_attachment_play_animation (TubaDialogsComposerComponentsAttachment* self,
                                                            gboolean reverse)
{
	AdwTimedAnimation* _tmp0_;
	AdwTimedAnimation* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->animation;
	adw_timed_animation_set_reverse (_tmp0_, reverse);
	_tmp1_ = self->priv->animation;
	adw_animation_play ((AdwAnimation*) _tmp1_);
}

static void
tuba_dialogs_composer_components_attachment_on_animation_end (TubaDialogsComposerComponentsAttachment* self)
{
	AdwTimedAnimation* _tmp0_;
	gdouble _tmp1_;
	gdouble _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->animation;
	_tmp1_ = adw_animation_get_value ((AdwAnimation*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == ((gdouble) 0)) {
		gtk_accessible_announce ((GtkAccessible*) self, _ ("Deleted Attachment"), GTK_ACCESSIBLE_ANNOUNCEMENT_PRIORITY_MEDIUM);
		g_signal_emit (self, tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_DELETE_ME_SIGNAL], 0);
	}
}

static void
tuba_dialogs_composer_components_attachment_on_edit_clicked (TubaDialogsComposerComponentsAttachment* self)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_EDIT_SIGNAL], 0);
}

TubaDialogsComposerComponentsAttachment*
tuba_dialogs_composer_components_attachment_construct_from_paintable (GType object_type,
                                                                      GdkPaintable* paintable)
{
	TubaDialogsComposerComponentsAttachment * self = NULL;
	TubaWidgetsFocusPicture* _tmp0_;
	self = (TubaDialogsComposerComponentsAttachment*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->picture;
	tuba_widgets_focus_picture_set_paintable (_tmp0_, paintable);
	return self;
}

TubaDialogsComposerComponentsAttachment*
tuba_dialogs_composer_components_attachment_new_from_paintable (GdkPaintable* paintable)
{
	return tuba_dialogs_composer_components_attachment_construct_from_paintable (TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, paintable);
}

static void
_vala_GdkRGBA_free (GdkRGBA* self)
{
	g_boxed_free (gdk_rgba_get_type (), self);
}

static void
tuba_dialogs_composer_components_attachment_update_accent_color (TubaDialogsComposerComponentsAttachment* self)
{
	AdwStyleManager* _tmp0_;
	GdkRGBA* _tmp1_;
	GdkRGBA* _tmp2_;
	gdouble _tmp3_;
	gdouble _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = adw_style_manager_get_default ();
	_tmp1_ = adw_style_manager_get_accent_color_rgba (_tmp0_);
	_tmp2_ = _tmp1_;
	self->priv->color = *_tmp2_;
	__vala_GdkRGBA_free0 (_tmp2_);
	self->priv->color.alpha = 0.5f;
	_tmp3_ = tuba_dialogs_composer_components_attachment_get_progress (self);
	_tmp4_ = _tmp3_;
	if (_tmp4_ != ((gdouble) 0)) {
		gtk_widget_queue_draw ((GtkWidget*) self);
	}
}

static GdkContentProvider*
tuba_dialogs_composer_components_attachment_on_drag_prepare (TubaDialogsComposerComponentsAttachment* self,
                                                             gdouble x,
                                                             gdouble y)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	GValue value = {0};
	GValue _tmp2_ = {0};
	GValue _tmp3_;
	GdkContentProvider* _tmp4_;
	GdkContentProvider* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = tuba_dialogs_composer_components_attachment_get_done (self);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		result = NULL;
		return result;
	}
	self->priv->drag_x = x;
	self->priv->drag_y = y;
	g_value_init (&_tmp2_, TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT);
	value = _tmp2_;
	g_value_set_object (&value, (GObject*) self);
	_tmp3_ = value;
	_tmp4_ = gdk_content_provider_new_for_value (&_tmp3_);
	result = _tmp4_;
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	return result;
}

static void
tuba_dialogs_composer_components_attachment_on_drag_begin (TubaDialogsComposerComponentsAttachment* self,
                                                           GtkDragSource* ds_controller,
                                                           GdkDrag* drag)
{
	GtkWidgetPaintable* _tmp0_;
	GtkWidgetPaintable* _tmp1_;
	GdkPaintable* _tmp2_;
	GdkPaintable* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (ds_controller != NULL);
	g_return_if_fail (drag != NULL);
	_tmp0_ = (GtkWidgetPaintable*) gtk_widget_paintable_new ((GtkWidget*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gdk_paintable_get_current_image ((GdkPaintable*) _tmp1_);
	_tmp3_ = _tmp2_;
	gtk_drag_source_set_icon (ds_controller, _tmp3_, (gint) self->priv->drag_x, (gint) self->priv->drag_y);
	_g_object_unref0 (_tmp3_);
	_g_object_unref0 (_tmp1_);
	self->priv->being_dragged = TRUE;
	tuba_dialogs_composer_components_attachment_animate_opacity (self, TRUE);
}

static void
tuba_dialogs_composer_components_attachment_on_drag_end (TubaDialogsComposerComponentsAttachment* self,
                                                         GdkDrag* drag,
                                                         gboolean delete_data)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (drag != NULL);
	self->priv->being_dragged = FALSE;
	tuba_dialogs_composer_components_attachment_animate_opacity (self, FALSE);
}

static gboolean
tuba_dialogs_composer_components_attachment_on_drag_cancel (TubaDialogsComposerComponentsAttachment* self,
                                                            GdkDrag* drag,
                                                            GdkDragCancelReason reason)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (drag != NULL, FALSE);
	self->priv->being_dragged = FALSE;
	tuba_dialogs_composer_components_attachment_animate_opacity (self, FALSE);
	result = FALSE;
	return result;
}

static gboolean
tuba_dialogs_composer_components_attachment_on_drop (TubaDialogsComposerComponentsAttachment* self,
                                                     GtkDropTarget* dt_controller,
                                                     GValue* value,
                                                     gdouble x,
                                                     gdouble y)
{
	TubaDialogsComposerComponentsDropOverlay* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_;
	gboolean _tmp4_;
	GValue _tmp7_;
	GObject* _tmp8_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (dt_controller != NULL, FALSE);
	g_return_val_if_fail (value != NULL, FALSE);
	_tmp0_ = self->priv->drop_overlay;
	tuba_dialogs_composer_components_drop_overlay_set_dropping (_tmp0_, FALSE);
	_tmp3_ = tuba_dialogs_composer_components_attachment_get_done (self);
	_tmp4_ = _tmp3_;
	if (!_tmp4_) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = ((gpointer) gtk_drop_target_get_value (dt_controller)) == NULL;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		GValue _tmp5_;
		GObject* _tmp6_;
		_tmp5_ = *gtk_drop_target_get_value (dt_controller);
		_tmp6_ = g_value_get_object (&_tmp5_);
		_tmp1_ = _tmp6_ == G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject);
	}
	if (_tmp1_) {
		result = FALSE;
		return result;
	}
	_tmp7_ = *gtk_drop_target_get_value (dt_controller);
	_tmp8_ = g_value_get_object (&_tmp7_);
	g_signal_emit (self, tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_SWITCH_PLACE_SIGNAL], 0, TUBA_DIALOGS_COMPOSER_COMPONENTS_IS_ATTACHMENT (_tmp8_) ? ((TubaDialogsComposerComponentsAttachment*) _tmp8_) : NULL);
	result = TRUE;
	return result;
}

static GdkDragAction
tuba_dialogs_composer_components_attachment_on_drop_enter (TubaDialogsComposerComponentsAttachment* self,
                                                           gdouble x,
                                                           gdouble y)
{
	TubaDialogsComposerComponentsDropOverlay* _tmp0_;
	GdkDragAction result;
	g_return_val_if_fail (self != NULL, 0U);
	_tmp0_ = self->priv->drop_overlay;
	tuba_dialogs_composer_components_drop_overlay_set_dropping (_tmp0_, !self->priv->being_dragged);
	result = GDK_ACTION_MOVE;
	return result;
}

static void
tuba_dialogs_composer_components_attachment_on_drop_leave (TubaDialogsComposerComponentsAttachment* self)
{
	TubaDialogsComposerComponentsDropOverlay* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->drop_overlay;
	tuba_dialogs_composer_components_drop_overlay_set_dropping (_tmp0_, FALSE);
}

static void
tuba_dialogs_composer_components_attachment_animate_opacity (TubaDialogsComposerComponentsAttachment* self,
                                                             gboolean hide)
{
	AdwTimedAnimation* _tmp0_;
	AdwAnimationState _tmp1_;
	AdwAnimationState _tmp2_;
	AdwTimedAnimation* _tmp4_;
	AdwTimedAnimation* _tmp5_;
	gdouble _tmp6_;
	gdouble _tmp7_;
	gint _tmp8_ = 0;
	AdwTimedAnimation* _tmp9_;
	AdwTimedAnimation* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->opacity_animation;
	_tmp1_ = adw_animation_get_state ((AdwAnimation*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == ADW_ANIMATION_PLAYING) {
		AdwTimedAnimation* _tmp3_;
		_tmp3_ = self->priv->opacity_animation;
		adw_animation_pause ((AdwAnimation*) _tmp3_);
	}
	_tmp4_ = self->priv->opacity_animation;
	_tmp5_ = self->priv->opacity_animation;
	_tmp6_ = adw_animation_get_value ((AdwAnimation*) _tmp5_);
	_tmp7_ = _tmp6_;
	adw_timed_animation_set_value_from (_tmp4_, _tmp7_);
	if (hide) {
		_tmp8_ = 0;
	} else {
		_tmp8_ = 1;
	}
	_tmp9_ = self->priv->opacity_animation;
	adw_timed_animation_set_value_to (_tmp9_, (gdouble) _tmp8_);
	_tmp10_ = self->priv->opacity_animation;
	adw_animation_play ((AdwAnimation*) _tmp10_);
}

static void
tuba_dialogs_composer_components_attachment_upload_data_free (gpointer _data)
{
	TubaDialogsComposerComponentsAttachmentUploadData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file);
	_g_object_unref0 (_data_->self);
	g_slice_free (TubaDialogsComposerComponentsAttachmentUploadData, _data_);
}

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

void
tuba_dialogs_composer_components_attachment_upload (TubaDialogsComposerComponentsAttachment* self,
                                                    GFile* file,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	TubaDialogsComposerComponentsAttachmentUploadData* _data_;
	TubaDialogsComposerComponentsAttachment* _tmp0_;
	GFile* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file != NULL);
	_data_ = g_slice_new0 (TubaDialogsComposerComponentsAttachmentUploadData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_dialogs_composer_components_attachment_upload_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (file);
	_g_object_unref0 (_data_->file);
	_data_->file = _tmp1_;
	tuba_dialogs_composer_components_attachment_upload_co (_data_);
}

void
tuba_dialogs_composer_components_attachment_upload_finish (TubaDialogsComposerComponentsAttachment* self,
                                                           GAsyncResult* _res_)
{
	TubaDialogsComposerComponentsAttachmentUploadData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

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

static guint8*
_vala_array_dup21 (guint8* self,
                   gssize length)
{
	if (length > 0) {
		return g_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

static void
_tuba_dialogs_composer_components_attachment_on_upload_bytes_written_tuba_request_v2_wrote_body_data (TubaRequestV2* _sender,
                                                                                                      guint chunk_size,
                                                                                                      gpointer self)
{
	tuba_dialogs_composer_components_attachment_on_upload_bytes_written ((TubaDialogsComposerComponentsAttachment*) self, chunk_size);
}

static void
tuba_dialogs_composer_components_attachment_upload_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_)
{
	TubaDialogsComposerComponentsAttachmentUploadData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_dialogs_composer_components_attachment_upload_co (_data_);
}

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

static void
_tuba_dialogs_composer_components_attachment_on_done_tuba_dialogs_composer_components_attachment_attachment_thumbnailer_done (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _sender,
                                                                                                                              GdkPaintable* paintable,
                                                                                                                              gpointer self)
{
	tuba_dialogs_composer_components_attachment_on_done ((TubaDialogsComposerComponentsAttachment*) self, paintable);
}

static void
_tuba_dialogs_composer_components_attachment_on_extracted_alt_text_tuba_dialogs_composer_components_attachment_attachment_thumbnailer_extracted_alt (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _sender,
                                                                                                                                                     const gchar* extracted_alt_text,
                                                                                                                                                     gpointer self)
{
	tuba_dialogs_composer_components_attachment_on_extracted_alt_text ((TubaDialogsComposerComponentsAttachment*) self, extracted_alt_text);
}

static gpointer
_tuba_dialogs_composer_components_attachment_attachment_thumbnailer_fetch_gthread_func (gpointer self)
{
	gpointer result;
	tuba_dialogs_composer_components_attachment_attachment_thumbnailer_fetch ((TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer*) self);
	result = NULL;
	g_object_unref (self);
	return result;
}

static gboolean
tuba_dialogs_composer_components_attachment_upload_co (TubaDialogsComposerComponentsAttachmentUploadData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->_uploading;
	if (_data_->_tmp0_) {
		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;
	}
	_data_->self->priv->bytes_written = (guint) 0;
	_data_->self->priv->total_bytes = (gsize) 0;
	tuba_dialogs_composer_components_attachment_set_uploading (_data_->self, TRUE);
	_data_->_tmp1_ = g_file_get_uri (_data_->file);
	_data_->uri = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->uri;
	_data_->_tmp3_ = string_to_string (_data_->_tmp2_);
	_data_->_tmp4_ = g_strconcat ("Uploading new media: ", _data_->_tmp3_, "…", NULL);
	_data_->_tmp5_ = _data_->_tmp4_;
	g_debug ("Attachment.vala:430: %s", _data_->_tmp5_);
	_g_free0 (_data_->_tmp5_);
	{
		_data_->contents_length1 = 0;
		_data_->_contents_size_ = 0;
		{
			_data_->_tmp6_ = NULL;
			_data_->_tmp7_ = 0;
			g_file_load_contents (_data_->file, NULL, &_data_->_tmp6_, &_data_->_tmp7_, NULL, &_data_->_inner_error0_);
			_data_->contents = (g_free (_data_->contents), NULL);
			_data_->contents = _data_->_tmp6_;
			_data_->contents_length1 = _data_->_tmp7_;
			_data_->_contents_size_ = _data_->contents_length1;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->_tmp8_ = g_file_query_info (_data_->file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, 0, NULL, &_data_->_inner_error0_);
			_data_->type = _data_->_tmp8_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->_tmp9_ = _data_->type;
			_data_->_tmp10_ = g_file_info_get_content_type (_data_->_tmp9_);
			_data_->_tmp11_ = g_strdup (_data_->_tmp10_);
			_g_free0 (_data_->mime);
			_data_->mime = _data_->_tmp11_;
			_g_object_unref0 (_data_->type);
		}
		goto __finally0;
		__catch0_g_error:
		{
			_data_->e = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			tuba_dialogs_composer_components_attachment_set_uploading (_data_->self, FALSE);
			_data_->_tmp12_ = _data_->uri;
			_data_->_tmp13_ = _data_->e;
			_data_->_tmp14_ = _data_->_tmp13_->message;
			_data_->_tmp15_ = g_strdup_printf ("Can't open file %s:\n%s", _data_->_tmp12_, _data_->_tmp14_);
			_data_->_tmp16_ = _data_->_tmp15_;
			g_signal_emit (_data_->self, tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_UPLOAD_ERROR_SIGNAL], 0, _data_->_tmp16_);
			_g_free0 (_data_->_tmp16_);
			_g_error_free0 (_data_->e);
			_data_->contents = (g_free (_data_->contents), NULL);
			_g_free0 (_data_->uri);
			_g_free0 (_data_->mime);
			_g_bytes_unref0 (_data_->buffer);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		__finally0:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_data_->contents = (g_free (_data_->contents), NULL);
			_g_free0 (_data_->uri);
			_g_free0 (_data_->mime);
			_g_bytes_unref0 (_data_->buffer);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp17_ = _data_->contents;
		_data_->_tmp17__length1 = _data_->contents_length1;
		_data_->_tmp18_ = (_data_->_tmp17_ != NULL) ? _vala_array_dup21 (_data_->_tmp17_, _data_->_tmp17__length1) : _data_->_tmp17_;
		_data_->_tmp18__length1 = _data_->_tmp17__length1;
		_data_->_tmp19_ = g_bytes_new_take (_data_->_tmp18_, _data_->_tmp18__length1);
		_g_bytes_unref0 (_data_->buffer);
		_data_->buffer = _data_->_tmp19_;
		_data_->_tmp20_ = _data_->buffer;
		_data_->self->priv->total_bytes = g_bytes_get_size (_data_->_tmp20_);
		_data_->contents = (g_free (_data_->contents), NULL);
	}
	_data_->_tmp21_ = tuba_accounts;
	_data_->_tmp22_ = tuba_account_store_get_active (_data_->_tmp21_);
	_data_->_tmp23_ = _data_->_tmp22_;
	_data_->_tmp24_ = _g_object_ref0 (_data_->_tmp23_);
	_data_->_tmp25_ = NULL;
	_data_->_tmp25_ = tuba_request_v2_new ("/api/v1/media", TUBA_REQUEST_V2_METHOD_POST);
	tuba_request_v2_set_account (_data_->_tmp25_, _data_->_tmp24_);
	_g_object_unref0 (_data_->_tmp24_);
	tuba_request_v2_set_track_written_body_data (_data_->_tmp25_, TRUE);
	_data_->msg = _data_->_tmp25_;
	_data_->_tmp26_ = _data_->msg;
	_data_->_tmp27_ = _data_->mime;
	_data_->_tmp28_ = _data_->buffer;
	tuba_request_v2_add_form_data_file (_data_->_tmp26_, "file", _data_->_tmp27_, _data_->_tmp28_);
	_data_->_tmp29_ = _data_->msg;
	g_signal_connect_object (_data_->_tmp29_, "wrote-body-data", (GCallback) _tuba_dialogs_composer_components_attachment_on_upload_bytes_written_tuba_request_v2_wrote_body_data, _data_->self, 0);
	_data_->in_stream = NULL;
	{
		_data_->_tmp31_ = _data_->msg;
		_data_->_state_ = 1;
		tuba_request_v2_exec (_data_->_tmp31_, tuba_dialogs_composer_components_attachment_upload_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp32_ = tuba_request_v2_exec_finish (_data_->_tmp31_, _data_->_res_, NULL, &_data_->_inner_error0_);
		_data_->_tmp30_ = _data_->_tmp32_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch1_g_error;
		}
		_data_->_tmp33_ = _data_->_tmp30_;
		_data_->_tmp30_ = NULL;
		_g_object_unref0 (_data_->in_stream);
		_data_->in_stream = _data_->_tmp33_;
		_data_->_tmp34_ = _data_->in_stream;
		if (_data_->_tmp34_ == NULL) {
			_data_->_tmp35_ = g_error_new_literal (TUBA_OOPSIE, TUBA_OOPSIE_INSTANCE, "Broken Stream");
			_data_->_inner_error0_ = _data_->_tmp35_;
			_g_object_unref0 (_data_->_tmp30_);
			goto __catch1_g_error;
		}
		_g_object_unref0 (_data_->_tmp30_);
	}
	goto __finally1;
	__catch1_g_error:
	{
		_data_->_vala1_e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		tuba_dialogs_composer_components_attachment_set_uploading (_data_->self, FALSE);
		_data_->_tmp36_ = _data_->_vala1_e;
		_data_->_tmp37_ = _data_->_tmp36_->message;
		g_signal_emit (_data_->self, tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_UPLOAD_ERROR_SIGNAL], 0, _data_->_tmp37_);
		_g_error_free0 (_data_->_vala1_e);
		_g_object_unref0 (_data_->in_stream);
		_g_object_unref0 (_data_->msg);
		_g_free0 (_data_->uri);
		_g_free0 (_data_->mime);
		_g_bytes_unref0 (_data_->buffer);
		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;
	}
	__finally1:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->in_stream);
		_g_object_unref0 (_data_->msg);
		_g_free0 (_data_->uri);
		_g_free0 (_data_->mime);
		_g_bytes_unref0 (_data_->buffer);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	tuba_dialogs_composer_components_attachment_set_progress (_data_->self, (gdouble) 1);
	tuba_dialogs_composer_components_attachment_set_file (_data_->self, _data_->file);
	{
		_data_->_tmp38_ = _data_->in_stream;
		_data_->_state_ = 2;
		tuba_network_get_parser_from_inputstream_async (_data_->_tmp38_, NULL, tuba_dialogs_composer_components_attachment_upload_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp39_ = tuba_network_get_parser_from_inputstream_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->parser = _data_->_tmp39_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch2_g_error;
		}
		_data_->_tmp40_ = tuba_network;
		_data_->_tmp41_ = _data_->parser;
		_data_->_tmp42_ = tuba_network_parse_node (_data_->_tmp40_, _data_->_tmp41_);
		_data_->node = _data_->_tmp42_;
		_data_->_tmp43_ = tuba_accounts;
		_data_->_tmp44_ = tuba_account_store_get_active (_data_->_tmp43_);
		_data_->_tmp45_ = _data_->_tmp44_;
		_data_->_tmp46_ = _data_->node;
		_data_->_tmp47_ = tuba_instance_account_create_entity (_data_->_tmp45_, TUBA_API_TYPE_ATTACHMENT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp46_, &_data_->_inner_error0_);
		_data_->entity = (TubaAPIAttachment*) _data_->_tmp47_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			__vala_JsonNode_free0 (_data_->node);
			_g_object_unref0 (_data_->parser);
			goto __catch2_g_error;
		}
		_data_->_tmp48_ = _data_->entity;
		_data_->_tmp49_ = tuba_api_attachment_get_id (_data_->_tmp48_);
		_data_->_tmp50_ = _data_->_tmp49_;
		tuba_dialogs_composer_components_attachment_set_media_id (_data_->self, _data_->_tmp50_);
		_data_->_tmp51_ = _data_->entity;
		_data_->_tmp52_ = tuba_api_attachment_get_kind (_data_->_tmp51_);
		_data_->_tmp53_ = _data_->_tmp52_;
		tuba_dialogs_composer_components_attachment_set_kind (_data_->self, tuba_dialogs_composer_components_attachment_media_type_from_string (_data_->_tmp53_));
		_data_->_tmp54_ = _data_->uri;
		_data_->_tmp55_ = tuba_dialogs_composer_components_attachment_get_kind (_data_->self);
		_data_->_tmp56_ = _data_->_tmp55_;
		_data_->_tmp57_ = tuba_dialogs_composer_components_attachment_attachment_thumbnailer_new (_data_->_tmp54_, _data_->_tmp56_);
		_data_->working_loader = _data_->_tmp57_;
		_data_->_tmp58_ = _data_->working_loader;
		g_signal_connect_object (_data_->_tmp58_, "done", (GCallback) _tuba_dialogs_composer_components_attachment_on_done_tuba_dialogs_composer_components_attachment_attachment_thumbnailer_done, _data_->self, 0);
		_data_->_tmp59_ = _data_->working_loader;
		g_signal_connect_object (_data_->_tmp59_, "extracted-alt", (GCallback) _tuba_dialogs_composer_components_attachment_on_extracted_alt_text_tuba_dialogs_composer_components_attachment_attachment_thumbnailer_extracted_alt, _data_->self, 0);
		{
			_data_->_tmp60_ = _data_->uri;
			_data_->_tmp61_ = string_to_string (_data_->_tmp60_);
			_data_->_tmp62_ = g_strconcat ("Attachment Thumbnail ", _data_->_tmp61_, NULL);
			_data_->_tmp63_ = _data_->_tmp62_;
			_data_->_tmp64_ = _data_->working_loader;
			_data_->_tmp65_ = g_thread_try_new (_data_->_tmp63_, _tuba_dialogs_composer_components_attachment_attachment_thumbnailer_fetch_gthread_func, g_object_ref (_data_->_tmp64_), &_data_->_inner_error0_);
			_data_->_tmp66_ = _data_->_tmp65_;
			_g_thread_unref0 (_data_->_tmp66_);
			_g_free0 (_data_->_tmp63_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch3_g_error;
			}
		}
		goto __finally3;
		__catch3_g_error:
		{
			_data_->_vala2_e = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp67_ = _data_->uri;
			_data_->_tmp68_ = _data_->_vala2_e;
			_data_->_tmp69_ = _data_->_tmp68_->message;
			g_critical ("Attachment.vala:482: Couldn't spawn thumbnailer for %s: %s", _data_->_tmp67_, _data_->_tmp69_);
			_g_error_free0 (_data_->_vala2_e);
		}
		__finally3:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->working_loader);
			_g_object_unref0 (_data_->entity);
			__vala_JsonNode_free0 (_data_->node);
			_g_object_unref0 (_data_->parser);
			goto __catch2_g_error;
		}
		_data_->_tmp70_ = _data_->entity;
		_data_->_tmp71_ = tuba_api_attachment_get_id (_data_->_tmp70_);
		_data_->_tmp72_ = _data_->_tmp71_;
		_data_->_tmp73_ = string_to_string (_data_->_tmp72_);
		_data_->_tmp74_ = g_strconcat ("OK! ID ", _data_->_tmp73_, NULL);
		_data_->_tmp75_ = _data_->_tmp74_;
		g_debug ("Attachment.vala:485: %s", _data_->_tmp75_);
		_g_free0 (_data_->_tmp75_);
		_g_object_unref0 (_data_->working_loader);
		_g_object_unref0 (_data_->entity);
		__vala_JsonNode_free0 (_data_->node);
		_g_object_unref0 (_data_->parser);
	}
	goto __finally2;
	__catch2_g_error:
	{
		_data_->_vala3_e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp76_ = _data_->_vala3_e;
		_data_->_tmp77_ = _data_->_tmp76_->message;
		g_critical ("Attachment.vala:487: %s", _data_->_tmp77_);
		tuba_dialogs_composer_components_attachment_set_uploading (_data_->self, FALSE);
		_data_->_tmp78_ = _data_->_vala3_e;
		_data_->_tmp79_ = _data_->_tmp78_->message;
		g_signal_emit (_data_->self, tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_UPLOAD_ERROR_SIGNAL], 0, _data_->_tmp79_);
		_g_error_free0 (_data_->_vala3_e);
		_g_object_unref0 (_data_->in_stream);
		_g_object_unref0 (_data_->msg);
		_g_free0 (_data_->uri);
		_g_free0 (_data_->mime);
		_g_bytes_unref0 (_data_->buffer);
		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;
	}
	__finally2:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->in_stream);
		_g_object_unref0 (_data_->msg);
		_g_free0 (_data_->uri);
		_g_free0 (_data_->mime);
		_g_bytes_unref0 (_data_->buffer);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	tuba_dialogs_composer_components_attachment_set_done (_data_->self, TRUE);
	tuba_dialogs_composer_components_attachment_set_uploading (_data_->self, FALSE);
	tuba_dialogs_composer_components_attachment_update_aria_label (_data_->self);
	gtk_accessible_announce ((GtkAccessible*) _data_->self, _ ("Finished Uploading Attachment"), GTK_ACCESSIBLE_ANNOUNCEMENT_PRIORITY_LOW);
	_g_object_unref0 (_data_->in_stream);
	_g_object_unref0 (_data_->msg);
	_g_free0 (_data_->uri);
	_g_free0 (_data_->mime);
	_g_bytes_unref0 (_data_->buffer);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
tuba_dialogs_composer_components_attachment_upload_thumbnail (TubaDialogsComposerComponentsAttachment* self)
{
	g_return_if_fail (self != NULL);
	tuba_dialogs_composer_components_attachment_upload_thumbnail_real (self, NULL, NULL);
}

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

static void
tuba_dialogs_composer_components_attachment_upload_thumbnail_real (TubaDialogsComposerComponentsAttachment* self,
                                                                   GAsyncReadyCallback _callback_,
                                                                   gpointer _user_data_)
{
	TubaDialogsComposerComponentsAttachmentUploadThumbnailRealData* _data_;
	TubaDialogsComposerComponentsAttachment* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TubaDialogsComposerComponentsAttachmentUploadThumbnailRealData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_dialogs_composer_components_attachment_upload_thumbnail_real_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tuba_dialogs_composer_components_attachment_upload_thumbnail_real_co (_data_);
}

static void
tuba_dialogs_composer_components_attachment_upload_thumbnail_real_finish (TubaDialogsComposerComponentsAttachment* self,
                                                                          GAsyncResult* _res_)
{
	TubaDialogsComposerComponentsAttachmentUploadThumbnailRealData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
tuba_dialogs_composer_components_attachment_upload_thumbnail_real_ready (GObject* source_object,
                                                                         GAsyncResult* _res_,
                                                                         gpointer _user_data_)
{
	TubaDialogsComposerComponentsAttachmentUploadThumbnailRealData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_dialogs_composer_components_attachment_upload_thumbnail_real_co (_data_);
}

static guint8*
_vala_array_dup22 (guint8* self,
                   gssize length)
{
	if (length > 0) {
		return g_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

static gboolean
tuba_dialogs_composer_components_attachment_upload_thumbnail_real_co (TubaDialogsComposerComponentsAttachmentUploadThumbnailRealData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->custom_thumbnail_button;
	gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp0_, FALSE);
	_data_->_tmp1_ = g_strdup (_ ("All Supported Files"));
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = gtk_file_filter_new ();
	g_object_set (_data_->_tmp2_, "name", _data_->_tmp1_, NULL);
	_g_free0 (_data_->_tmp1_);
	_data_->filter = _data_->_tmp2_;
	{
		_data_->mime_type_collection_length1 = 0;
		_data_->_mime_type_collection_size_ = 0;
		_data_->mime_type_collection = TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENTS_BIN_SUPPORTED_MIMES;
		_data_->mime_type_collection_length1 = G_N_ELEMENTS (TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENTS_BIN_SUPPORTED_MIMES);
		for (_data_->mime_type_it = 0; _data_->mime_type_it < _data_->mime_type_collection_length1; _data_->mime_type_it = _data_->mime_type_it + 1) {
			_data_->mime_type = _data_->mime_type_collection[_data_->mime_type_it];
			{
				_data_->_tmp3_ = _data_->mime_type;
				if (g_str_has_prefix (_data_->_tmp3_, "image/")) {
					_data_->_tmp4_ = _data_->filter;
					_data_->_tmp5_ = _data_->mime_type;
					_data_->_tmp6_ = g_utf8_strdown (_data_->_tmp5_, (gssize) -1);
					_data_->_tmp7_ = _data_->_tmp6_;
					gtk_file_filter_add_mime_type (_data_->_tmp4_, _data_->_tmp7_);
					_g_free0 (_data_->_tmp7_);
				}
			}
		}
	}
	_data_->_tmp8_ = g_strdup (_ ("Open"));
	_data_->_tmp9_ = _data_->filter;
	_data_->_tmp10_ = _g_object_ref0 (_data_->_tmp9_);
	_data_->_tmp11_ = NULL;
	_data_->_tmp11_ = gtk_file_dialog_new ();
	gtk_file_dialog_set_title (_data_->_tmp11_, _data_->_tmp8_);
	_g_free0 (_data_->_tmp8_);
	gtk_file_dialog_set_modal (_data_->_tmp11_, TRUE);
	gtk_file_dialog_set_default_filter (_data_->_tmp11_, _data_->_tmp10_);
	_g_object_unref0 (_data_->_tmp10_);
	_data_->chooser = _data_->_tmp11_;
	{
		_data_->_tmp12_ = _data_->chooser;
		_data_->_tmp13_ = tuba_app;
		_data_->_tmp14_ = tuba_application_get_main_window (_data_->_tmp13_);
		_data_->_tmp15_ = _data_->_tmp14_;
		_data_->_state_ = 1;
		gtk_file_dialog_open (_data_->_tmp12_, (GtkWindow*) _data_->_tmp15_, NULL, tuba_dialogs_composer_components_attachment_upload_thumbnail_real_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp16_ = gtk_file_dialog_open_finish (_data_->_tmp12_, _data_->_res_, &_data_->_inner_error0_);
		_data_->file = _data_->_tmp16_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp17_ = _data_->file;
		_data_->_tmp18_ = g_file_get_uri (_data_->_tmp17_);
		_data_->uri = _data_->_tmp18_;
		_data_->_tmp19_ = _data_->uri;
		_data_->_tmp20_ = string_to_string (_data_->_tmp19_);
		_data_->_tmp21_ = g_strconcat ("Uploading new media: ", _data_->_tmp20_, "…", NULL);
		_data_->_tmp22_ = _data_->_tmp21_;
		g_debug ("Attachment.vala:528: %s", _data_->_tmp22_);
		_g_free0 (_data_->_tmp22_);
		{
			_data_->contents_length1 = 0;
			_data_->_contents_size_ = 0;
			{
				_data_->_tmp23_ = _data_->file;
				_data_->_tmp24_ = NULL;
				_data_->_tmp25_ = 0;
				g_file_load_contents (_data_->_tmp23_, NULL, &_data_->_tmp24_, &_data_->_tmp25_, NULL, &_data_->_inner_error0_);
				_data_->contents = (g_free (_data_->contents), NULL);
				_data_->contents = _data_->_tmp24_;
				_data_->contents_length1 = _data_->_tmp25_;
				_data_->_contents_size_ = _data_->contents_length1;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					goto __catch1_g_error;
				}
				_data_->_tmp26_ = _data_->file;
				_data_->_tmp27_ = g_file_query_info (_data_->_tmp26_, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, 0, NULL, &_data_->_inner_error0_);
				_data_->type = _data_->_tmp27_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					goto __catch1_g_error;
				}
				_data_->_tmp28_ = _data_->type;
				_data_->_tmp29_ = g_file_info_get_content_type (_data_->_tmp28_);
				_data_->_tmp30_ = g_strdup (_data_->_tmp29_);
				_g_free0 (_data_->mime);
				_data_->mime = _data_->_tmp30_;
				_g_object_unref0 (_data_->type);
			}
			goto __finally1;
			__catch1_g_error:
			{
				_data_->e = _data_->_inner_error0_;
				_data_->_inner_error0_ = NULL;
				_data_->_tmp31_ = _data_->self->priv->custom_thumbnail_button;
				gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp31_, TRUE);
				_data_->_tmp32_ = _data_->uri;
				_data_->_tmp33_ = _data_->e;
				_data_->_tmp34_ = _data_->_tmp33_->message;
				_data_->_tmp35_ = g_strdup_printf ("Can't open file %s:\n%s", _data_->_tmp32_, _data_->_tmp34_);
				_data_->_tmp36_ = _data_->_tmp35_;
				g_signal_emit (_data_->self, tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TOAST_SIGNAL], 0, _data_->_tmp36_);
				_g_free0 (_data_->_tmp36_);
				_g_error_free0 (_data_->e);
				_data_->contents = (g_free (_data_->contents), NULL);
				_g_free0 (_data_->uri);
				_g_free0 (_data_->mime);
				_g_bytes_unref0 (_data_->buffer);
				_g_object_unref0 (_data_->file);
				_g_object_unref0 (_data_->chooser);
				_g_object_unref0 (_data_->filter);
				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;
			}
			__finally1:
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_data_->contents = (g_free (_data_->contents), NULL);
				_g_free0 (_data_->uri);
				_g_free0 (_data_->mime);
				_g_bytes_unref0 (_data_->buffer);
				_g_object_unref0 (_data_->file);
				goto __catch0_g_error;
			}
			_data_->_tmp37_ = _data_->contents;
			_data_->_tmp37__length1 = _data_->contents_length1;
			_data_->_tmp38_ = (_data_->_tmp37_ != NULL) ? _vala_array_dup22 (_data_->_tmp37_, _data_->_tmp37__length1) : _data_->_tmp37_;
			_data_->_tmp38__length1 = _data_->_tmp37__length1;
			_data_->_tmp39_ = g_bytes_new_take (_data_->_tmp38_, _data_->_tmp38__length1);
			_g_bytes_unref0 (_data_->buffer);
			_data_->buffer = _data_->_tmp39_;
			_data_->contents = (g_free (_data_->contents), NULL);
		}
		_data_->_tmp40_ = _data_->self->priv->_media_id;
		_data_->_tmp41_ = string_to_string (_data_->_tmp40_);
		_data_->_tmp42_ = g_strconcat ("/api/v1/media/", _data_->_tmp41_, NULL);
		_data_->_tmp43_ = _data_->_tmp42_;
		_data_->_tmp44_ = tuba_accounts;
		_data_->_tmp45_ = tuba_account_store_get_active (_data_->_tmp44_);
		_data_->_tmp46_ = _data_->_tmp45_;
		_data_->_tmp47_ = _g_object_ref0 (_data_->_tmp46_);
		_data_->_tmp48_ = NULL;
		_data_->_tmp48_ = tuba_request_v2_new (_data_->_tmp43_, TUBA_REQUEST_V2_METHOD_PUT);
		tuba_request_v2_set_account (_data_->_tmp48_, _data_->_tmp47_);
		_g_object_unref0 (_data_->_tmp47_);
		_data_->_tmp49_ = _data_->_tmp48_;
		_g_free0 (_data_->_tmp43_);
		_data_->msg = _data_->_tmp49_;
		_data_->_tmp50_ = _data_->msg;
		_data_->_tmp51_ = _data_->mime;
		_data_->_tmp52_ = _data_->buffer;
		tuba_request_v2_add_form_data_file (_data_->_tmp50_, "thumbnail", _data_->_tmp51_, _data_->_tmp52_);
		_data_->in_stream = NULL;
		{
			_data_->_tmp54_ = _data_->msg;
			_data_->_state_ = 2;
			tuba_request_v2_exec (_data_->_tmp54_, tuba_dialogs_composer_components_attachment_upload_thumbnail_real_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp55_ = tuba_request_v2_exec_finish (_data_->_tmp54_, _data_->_res_, NULL, &_data_->_inner_error0_);
			_data_->_tmp53_ = _data_->_tmp55_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch2_g_error;
			}
			_data_->_tmp56_ = _data_->_tmp53_;
			_data_->_tmp53_ = NULL;
			_g_object_unref0 (_data_->in_stream);
			_data_->in_stream = _data_->_tmp56_;
			_data_->_tmp57_ = _data_->in_stream;
			if (_data_->_tmp57_ == NULL) {
				_data_->_tmp58_ = g_error_new_literal (TUBA_OOPSIE, TUBA_OOPSIE_INSTANCE, "Broken Stream");
				_data_->_inner_error0_ = _data_->_tmp58_;
				_g_object_unref0 (_data_->_tmp53_);
				goto __catch2_g_error;
			}
			g_signal_emit (_data_->self, tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TOAST_SIGNAL], 0, _ ("Successfully uploaded custom thumbnail"));
			_data_->_tmp59_ = _data_->file;
			_data_->_tmp60_ = g_file_get_uri (_data_->_tmp59_);
			_data_->_tmp61_ = _data_->_tmp60_;
			_data_->_tmp62_ = tuba_dialogs_composer_components_attachment_attachment_thumbnailer_new (_data_->_tmp61_, TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_IMAGE);
			_data_->_tmp63_ = _data_->_tmp62_;
			_g_free0 (_data_->_tmp61_);
			_data_->working_loader = _data_->_tmp63_;
			_data_->_tmp64_ = _data_->working_loader;
			g_signal_connect_object (_data_->_tmp64_, "done", (GCallback) _tuba_dialogs_composer_components_attachment_on_done_tuba_dialogs_composer_components_attachment_attachment_thumbnailer_done, _data_->self, 0);
			{
				_data_->_tmp65_ = _data_->file;
				_data_->_tmp66_ = g_file_get_uri (_data_->_tmp65_);
				_data_->_tmp67_ = _data_->_tmp66_;
				_data_->_tmp68_ = string_to_string (_data_->_tmp67_);
				_data_->_tmp69_ = g_strconcat ("Attachment Thumbnail ", _data_->_tmp68_, NULL);
				_data_->_tmp70_ = _data_->_tmp69_;
				_data_->_tmp71_ = _data_->working_loader;
				_data_->_tmp72_ = g_thread_try_new (_data_->_tmp70_, _tuba_dialogs_composer_components_attachment_attachment_thumbnailer_fetch_gthread_func, g_object_ref (_data_->_tmp71_), &_data_->_inner_error0_);
				_data_->_tmp73_ = _data_->_tmp72_;
				_g_thread_unref0 (_data_->_tmp73_);
				_g_free0 (_data_->_tmp70_);
				_g_free0 (_data_->_tmp67_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					goto __catch3_g_error;
				}
			}
			goto __finally3;
			__catch3_g_error:
			{
				_data_->_vala1_e = _data_->_inner_error0_;
				_data_->_inner_error0_ = NULL;
				_data_->_tmp74_ = _data_->file;
				_data_->_tmp75_ = g_file_get_uri (_data_->_tmp74_);
				_data_->_tmp76_ = _data_->_tmp75_;
				_data_->_tmp77_ = _data_->_vala1_e;
				_data_->_tmp78_ = _data_->_tmp77_->message;
				g_critical ("Attachment.vala:562: Couldn't spawn thumbnailer for %s: %s", _data_->_tmp76_, _data_->_tmp78_);
				_g_free0 (_data_->_tmp76_);
				_g_error_free0 (_data_->_vala1_e);
			}
			__finally3:
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_object_unref0 (_data_->working_loader);
				_g_object_unref0 (_data_->_tmp53_);
				goto __catch2_g_error;
			}
			_g_object_unref0 (_data_->working_loader);
			_g_object_unref0 (_data_->_tmp53_);
		}
		goto __finally2;
		__catch2_g_error:
		{
			_data_->_vala2_e = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp79_ = _data_->_vala2_e;
			_data_->_tmp80_ = _data_->_tmp79_->message;
			g_signal_emit (_data_->self, tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TOAST_SIGNAL], 0, _data_->_tmp80_);
			_g_error_free0 (_data_->_vala2_e);
		}
		__finally2:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->in_stream);
			_g_object_unref0 (_data_->msg);
			_g_free0 (_data_->uri);
			_g_free0 (_data_->mime);
			_g_bytes_unref0 (_data_->buffer);
			_g_object_unref0 (_data_->file);
			goto __catch0_g_error;
		}
		_g_object_unref0 (_data_->in_stream);
		_g_object_unref0 (_data_->msg);
		_g_free0 (_data_->uri);
		_g_free0 (_data_->mime);
		_g_bytes_unref0 (_data_->buffer);
		_g_object_unref0 (_data_->file);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_vala3_e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp81_ = _data_->_vala3_e;
		_data_->_tmp82_ = _data_->_tmp81_->message;
		_data_->_tmp83_ = string_to_string (_data_->_tmp82_);
		_data_->_tmp84_ = g_strconcat ("Couldn't get the result of FileDialog for AttachmentsBin: ", _data_->_tmp83_, NULL);
		_data_->_tmp85_ = _data_->_tmp84_;
		g_warning ("Attachment.vala:570: %s", _data_->_tmp85_);
		_g_free0 (_data_->_tmp85_);
		_g_error_free0 (_data_->_vala3_e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->chooser);
		_g_object_unref0 (_data_->filter);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp86_ = _data_->self->priv->custom_thumbnail_button;
	gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp86_, TRUE);
	_g_object_unref0 (_data_->chooser);
	_g_object_unref0 (_data_->filter);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
tuba_dialogs_composer_components_attachment_on_done (TubaDialogsComposerComponentsAttachment* self,
                                                     GdkPaintable* paintable)
{
	g_return_if_fail (self != NULL);
	tuba_dialogs_composer_components_attachment_set_paintable (self, paintable);
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static void
tuba_dialogs_composer_components_attachment_on_extracted_alt_text (TubaDialogsComposerComponentsAttachment* self,
                                                                   const gchar* new_alt_text)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_ = NULL;
	gint _tmp4_;
	gint _tmp5_;
	TubaAccountStore* _tmp6_;
	TubaInstanceAccount* _tmp7_;
	TubaInstanceAccount* _tmp8_;
	TubaAPIInstance* _tmp9_;
	TubaAPIInstance* _tmp10_;
	gint64 _tmp11_;
	gint64 _tmp12_;
	gchar* limited_alt_text = NULL;
	gchar* _tmp22_;
	const gchar* _tmp23_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_alt_text != NULL);
	_tmp1_ = tuba_dialogs_composer_components_attachment_get_alt_text (self);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp2_, "") != 0) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (new_alt_text, "") == 0;
	}
	if (_tmp0_) {
		return;
	}
	_tmp4_ = strlen (new_alt_text);
	_tmp5_ = _tmp4_;
	_tmp6_ = tuba_accounts;
	_tmp7_ = tuba_account_store_get_active (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = tuba_instance_account_get_instance_info (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = tuba_api_instance_get_tuba_max_alt_chars (_tmp10_);
	_tmp12_ = _tmp11_;
	if (((gint64) _tmp5_) > _tmp12_) {
		TubaAccountStore* _tmp13_;
		TubaInstanceAccount* _tmp14_;
		TubaInstanceAccount* _tmp15_;
		TubaAPIInstance* _tmp16_;
		TubaAPIInstance* _tmp17_;
		gint64 _tmp18_;
		gint64 _tmp19_;
		gchar* _tmp20_;
		_tmp13_ = tuba_accounts;
		_tmp14_ = tuba_account_store_get_active (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = tuba_instance_account_get_instance_info (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = tuba_api_instance_get_tuba_max_alt_chars (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = string_slice (new_alt_text, (glong) 0, (glong) (_tmp19_ + 1));
		_g_free0 (_tmp3_);
		_tmp3_ = _tmp20_;
	} else {
		gchar* _tmp21_;
		_tmp21_ = g_strdup (new_alt_text);
		_g_free0 (_tmp3_);
		_tmp3_ = _tmp21_;
	}
	_tmp22_ = _tmp3_;
	_tmp3_ = NULL;
	limited_alt_text = _tmp22_;
	_tmp23_ = limited_alt_text;
	tuba_dialogs_composer_components_attachment_put_alt_text (self, _tmp23_, NULL, NULL);
	_g_free0 (limited_alt_text);
	_g_free0 (_tmp3_);
}

static void
tuba_dialogs_composer_components_attachment_put_alt_text_data_free (gpointer _data)
{
	TubaDialogsComposerComponentsAttachmentPutAltTextData* _data_;
	_data_ = _data;
	_g_free0 (_data_->limited_alt_text);
	_g_object_unref0 (_data_->self);
	g_slice_free (TubaDialogsComposerComponentsAttachmentPutAltTextData, _data_);
}

static void
tuba_dialogs_composer_components_attachment_put_alt_text (TubaDialogsComposerComponentsAttachment* self,
                                                          const gchar* limited_alt_text,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_)
{
	TubaDialogsComposerComponentsAttachmentPutAltTextData* _data_;
	TubaDialogsComposerComponentsAttachment* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (limited_alt_text != NULL);
	_data_ = g_slice_new0 (TubaDialogsComposerComponentsAttachmentPutAltTextData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_dialogs_composer_components_attachment_put_alt_text_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (limited_alt_text);
	_g_free0 (_data_->limited_alt_text);
	_data_->limited_alt_text = _tmp1_;
	tuba_dialogs_composer_components_attachment_put_alt_text_co (_data_);
}

static void
tuba_dialogs_composer_components_attachment_put_alt_text_finish (TubaDialogsComposerComponentsAttachment* self,
                                                                 GAsyncResult* _res_)
{
	TubaDialogsComposerComponentsAttachmentPutAltTextData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
tuba_dialogs_composer_components_attachment_put_alt_text_ready (GObject* source_object,
                                                                GAsyncResult* _res_,
                                                                gpointer _user_data_)
{
	TubaDialogsComposerComponentsAttachmentPutAltTextData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_dialogs_composer_components_attachment_put_alt_text_co (_data_);
}

static gboolean
tuba_dialogs_composer_components_attachment_put_alt_text_co (TubaDialogsComposerComponentsAttachmentPutAltTextData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = json_builder_new ();
	_data_->builder = _data_->_tmp0_;
	json_builder_begin_object (_data_->builder);
	json_builder_set_member_name (_data_->builder, "description");
	json_builder_add_string_value (_data_->builder, _data_->limited_alt_text);
	json_builder_end_object (_data_->builder);
	_data_->_tmp1_ = _data_->self->priv->_media_id;
	_data_->_tmp2_ = string_to_string (_data_->_tmp1_);
	_data_->_tmp3_ = g_strconcat ("/api/v1/media/", _data_->_tmp2_, NULL);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = tuba_accounts;
	_data_->_tmp6_ = tuba_account_store_get_active (_data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = _g_object_ref0 (_data_->_tmp7_);
	_data_->_tmp9_ = NULL;
	_data_->_tmp9_ = tuba_request_v2_new (_data_->_tmp4_, TUBA_REQUEST_V2_METHOD_PUT);
	tuba_request_v2_set_account (_data_->_tmp9_, _data_->_tmp8_);
	_g_object_unref0 (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_g_free0 (_data_->_tmp4_);
	_data_->req = _data_->_tmp10_;
	tuba_request_v2_set_body_from_json (_data_->req, _data_->builder);
	{
		_data_->_state_ = 1;
		tuba_request_v2_exec (_data_->req, tuba_dialogs_composer_components_attachment_put_alt_text_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp11_ = tuba_request_v2_exec_finish (_data_->req, _data_->_res_, NULL, &_data_->_inner_error0_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_g_object_unref0 (_data_->_tmp12_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		tuba_dialogs_composer_components_attachment_set_alt_text (_data_->self, _data_->limited_alt_text);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp13_ = string_to_string (_data_->limited_alt_text);
		_data_->_tmp14_ = _data_->e;
		_data_->_tmp15_ = g_strdup_printf ("%i", _data_->_tmp14_->code);
		_data_->_tmp16_ = _data_->_tmp15_;
		_data_->_tmp17_ = _data_->e;
		_data_->_tmp18_ = _data_->_tmp17_->message;
		_data_->_tmp19_ = string_to_string (_data_->_tmp18_);
		_data_->_tmp20_ = g_strconcat ("Couldn't set alt text (", _data_->_tmp13_, "): ", _data_->_tmp16_, " ", _data_->_tmp19_, NULL);
		_data_->_tmp21_ = _data_->_tmp20_;
		g_warning ("Attachment.vala:685: %s", _data_->_tmp21_);
		_g_free0 (_data_->_tmp21_);
		_g_free0 (_data_->_tmp16_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->req);
		_g_object_unref0 (_data_->builder);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->req);
	_g_object_unref0 (_data_->builder);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
tuba_dialogs_composer_components_attachment_on_upload_bytes_written (TubaDialogsComposerComponentsAttachment* self,
                                                                     guint chunk)
{
	g_return_if_fail (self != NULL);
	self->priv->bytes_written = self->priv->bytes_written + chunk;
	tuba_dialogs_composer_components_attachment_set_progress (self, CLAMP (((gdouble) self->priv->bytes_written) / ((gdouble) self->priv->total_bytes), (gdouble) 0, 0.999999999));
}

static void
tuba_dialogs_composer_components_attachment_real_snapshot (GtkWidget* base,
                                                           GtkSnapshot* snapshot)
{
	TubaDialogsComposerComponentsAttachment * self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	self = (TubaDialogsComposerComponentsAttachment*) base;
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = tuba_dialogs_composer_components_attachment_get_done (self);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		GdkRGBA _tmp2_;
		graphene_point_t _tmp3_ = {0};
		AdwTimedAnimation* _tmp4_;
		gdouble _tmp5_;
		gdouble _tmp6_;
		graphene_size_t _tmp7_ = {0};
		graphene_rect_t _tmp8_ = {0};
		_tmp2_ = self->priv->color;
		memset (&_tmp3_, 0, sizeof (graphene_point_t));
		_tmp3_.x = (gfloat) 0;
		_tmp3_.y = (gfloat) 0;
		_tmp4_ = self->priv->progress_animation;
		_tmp5_ = adw_animation_get_value ((AdwAnimation*) _tmp4_);
		_tmp6_ = _tmp5_;
		memset (&_tmp7_, 0, sizeof (graphene_size_t));
		_tmp7_.height = (gfloat) gtk_widget_get_height ((GtkWidget*) self);
		_tmp7_.width = (gfloat) (gtk_widget_get_width ((GtkWidget*) self) * _tmp6_);
		memset (&_tmp8_, 0, sizeof (graphene_rect_t));
		_tmp8_.origin = _tmp3_;
		_tmp8_.size = _tmp7_;
		gtk_snapshot_append_color (snapshot, &_tmp2_, &_tmp8_);
	}
	GTK_WIDGET_CLASS (tuba_dialogs_composer_components_attachment_parent_class)->snapshot ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_bin_get_type (), AdwBin), snapshot);
}

static void
tuba_dialogs_composer_components_attachment_on_delete (TubaDialogsComposerComponentsAttachment* self)
{
	g_return_if_fail (self != NULL);
	tuba_dialogs_composer_components_attachment_play_animation (self, TRUE);
}

static void
_tuba_dialogs_composer_components_attachment_on_done_tuba_helper_image_on_item_changed_fn (GdkPaintable* data,
                                                                                           gpointer self)
{
	tuba_dialogs_composer_components_attachment_on_done ((TubaDialogsComposerComponentsAttachment*) self, data);
}

void
tuba_dialogs_composer_components_attachment_preload (TubaDialogsComposerComponentsAttachment* self,
                                                     const gchar* media_id,
                                                     const gchar* url,
                                                     const gchar* preview,
                                                     TubaDialogsComposerComponentsAttachmentMediaType kind)
{
	TubaDialogsComposerComponentsAttachmentMediaType _tmp0_;
	TubaDialogsComposerComponentsAttachmentMediaType _tmp1_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (media_id != NULL);
	g_return_if_fail (url != NULL);
	tuba_dialogs_composer_components_attachment_set_kind (self, kind);
	tuba_dialogs_composer_components_attachment_set_media_id (self, media_id);
	_tmp0_ = tuba_dialogs_composer_components_attachment_get_kind (self);
	_tmp1_ = _tmp0_;
	switch (_tmp1_) {
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_AUDIO:
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_VIDEO:
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_GIFV:
		{
			GFile* _tmp14_;
			GFile* _tmp15_;
			if (preview == NULL) {
				TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* working_loader = NULL;
				TubaDialogsComposerComponentsAttachmentMediaType _tmp2_;
				TubaDialogsComposerComponentsAttachmentMediaType _tmp3_;
				TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _tmp4_;
				TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _tmp5_;
				_tmp2_ = tuba_dialogs_composer_components_attachment_get_kind (self);
				_tmp3_ = _tmp2_;
				_tmp4_ = tuba_dialogs_composer_components_attachment_attachment_thumbnailer_new (url, _tmp3_);
				working_loader = _tmp4_;
				_tmp5_ = working_loader;
				g_signal_connect_object (_tmp5_, "done", (GCallback) _tuba_dialogs_composer_components_attachment_on_done_tuba_dialogs_composer_components_attachment_attachment_thumbnailer_done, self, 0);
				{
					const gchar* _tmp6_;
					gchar* _tmp7_;
					gchar* _tmp8_;
					TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* _tmp9_;
					GThread* _tmp10_;
					GThread* _tmp11_;
					_tmp6_ = string_to_string (url);
					_tmp7_ = g_strconcat ("Attachment Thumbnail ", _tmp6_, NULL);
					_tmp8_ = _tmp7_;
					_tmp9_ = working_loader;
					_tmp10_ = g_thread_try_new (_tmp8_, _tuba_dialogs_composer_components_attachment_attachment_thumbnailer_fetch_gthread_func, g_object_ref (_tmp9_), &_inner_error0_);
					_tmp11_ = _tmp10_;
					_g_thread_unref0 (_tmp11_);
					_g_free0 (_tmp8_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
				}
				goto __finally0;
				__catch0_g_error:
				{
					GError* e = NULL;
					GError* _tmp12_;
					const gchar* _tmp13_;
					e = _inner_error0_;
					_inner_error0_ = NULL;
					_tmp12_ = e;
					_tmp13_ = _tmp12_->message;
					g_critical ("Attachment.vala:734: Couldn't spawn thumbnailer for %s: %s", url, _tmp13_);
					_g_error_free0 (e);
				}
				__finally0:
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_g_object_unref0 (working_loader);
					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;
				}
				_g_object_unref0 (working_loader);
			} else {
				tuba_helper_image_request_paintable (preview, NULL, FALSE, _tuba_dialogs_composer_components_attachment_on_done_tuba_helper_image_on_item_changed_fn, g_object_ref (self), g_object_unref, NULL);
			}
			_tmp14_ = g_file_new_for_uri (url);
			_tmp15_ = _tmp14_;
			tuba_dialogs_composer_components_attachment_set_file (self, _tmp15_);
			_g_object_unref0 (_tmp15_);
			break;
		}
		default:
		{
			tuba_helper_image_request_paintable (url, NULL, FALSE, _tuba_dialogs_composer_components_attachment_on_done_tuba_helper_image_on_item_changed_fn, g_object_ref (self), g_object_unref, NULL);
			break;
		}
	}
	tuba_dialogs_composer_components_attachment_set_done (self, TRUE);
	tuba_dialogs_composer_components_attachment_update_aria_label (self);
}

static void
tuba_dialogs_composer_components_attachment_update_aria_label (TubaDialogsComposerComponentsAttachment* self)
{
	GFile* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_file;
	if (_tmp0_ != NULL) {
		gchar* file_name = NULL;
		GFile* _tmp1_;
		gchar* _tmp2_;
		const gchar* _tmp3_;
		_tmp1_ = self->priv->_file;
		_tmp2_ = g_file_get_basename (_tmp1_);
		file_name = _tmp2_;
		_tmp3_ = file_name;
		if (_tmp3_ != NULL) {
			const gchar* _tmp4_;
			gchar* _tmp5_;
			gchar* _tmp6_;
			_tmp4_ = file_name;
			_tmp5_ = g_strdup_printf ("Media Attachment (%s)", _tmp4_);
			_tmp6_ = _tmp5_;
			gtk_accessible_update_property ((GtkAccessible*) self, GTK_ACCESSIBLE_PROPERTY_LABEL, _ (_tmp6_), -1, -1);
			_g_free0 (_tmp6_);
			_g_free0 (file_name);
			return;
		}
		_g_free0 (file_name);
	}
	gtk_accessible_update_property ((GtkAccessible*) self, GTK_ACCESSIBLE_PROPERTY_LABEL, _ ("Media Attachment"), -1, -1);
}

void
tuba_dialogs_composer_components_attachment_saved (TubaDialogsComposerComponentsAttachment* self,
                                                   gfloat pos_x,
                                                   gfloat pos_y,
                                                   const gchar* alt_text)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (alt_text != NULL);
	tuba_dialogs_composer_components_attachment_set_pos_x (self, (gdouble) pos_x);
	tuba_dialogs_composer_components_attachment_set_pos_y (self, (gdouble) pos_y);
	tuba_dialogs_composer_components_attachment_set_alt_text (self, alt_text);
}

TubaDialogsComposerComponentsAttachment*
tuba_dialogs_composer_components_attachment_construct (GType object_type)
{
	TubaDialogsComposerComponentsAttachment * self = NULL;
	self = (TubaDialogsComposerComponentsAttachment*) g_object_new (object_type, NULL);
	return self;
}

TubaDialogsComposerComponentsAttachment*
tuba_dialogs_composer_components_attachment_new (void)
{
	return tuba_dialogs_composer_components_attachment_construct (TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT);
}

TubaDialogsComposerComponentsAttachmentMediaType
tuba_dialogs_composer_components_attachment_get_kind (TubaDialogsComposerComponentsAttachment* self)
{
	TubaDialogsComposerComponentsAttachmentMediaType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_kind;
	return result;
}

static void
tuba_dialogs_composer_components_attachment_set_kind (TubaDialogsComposerComponentsAttachment* self,
                                                      TubaDialogsComposerComponentsAttachmentMediaType value)
{
	GtkImage* _tmp8_;
	g_return_if_fail (self != NULL);
	self->priv->_kind = value;
	switch (value) {
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_AUDIO:
		{
			GtkImage* _tmp0_;
			GtkButton* _tmp1_;
			GtkImage* _tmp2_;
			_tmp0_ = self->priv->media_icon;
			g_object_set (_tmp0_, "icon-name", "tuba-music-note-symbolic", NULL);
			_tmp1_ = self->priv->custom_thumbnail_button;
			_tmp2_ = self->priv->media_icon;
			gtk_widget_set_visible ((GtkWidget*) _tmp2_, TRUE);
			gtk_widget_set_visible ((GtkWidget*) _tmp1_, TRUE);
			break;
		}
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_VIDEO:
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_GIFV:
		{
			GtkImage* _tmp3_;
			GtkButton* _tmp4_;
			GtkImage* _tmp5_;
			_tmp3_ = self->priv->media_icon;
			g_object_set (_tmp3_, "icon-name", "media-playback-start-symbolic", NULL);
			_tmp4_ = self->priv->custom_thumbnail_button;
			_tmp5_ = self->priv->media_icon;
			gtk_widget_set_visible ((GtkWidget*) _tmp5_, TRUE);
			gtk_widget_set_visible ((GtkWidget*) _tmp4_, TRUE);
			break;
		}
		default:
		{
			GtkButton* _tmp6_;
			GtkImage* _tmp7_;
			_tmp6_ = self->priv->custom_thumbnail_button;
			_tmp7_ = self->priv->media_icon;
			gtk_widget_set_visible ((GtkWidget*) _tmp7_, FALSE);
			gtk_widget_set_visible ((GtkWidget*) _tmp6_, FALSE);
			break;
		}
	}
	_tmp8_ = self->priv->media_icon;
	gtk_image_set_icon_size (_tmp8_, GTK_ICON_SIZE_LARGE);
	g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_KIND_PROPERTY]);
}

gboolean
tuba_dialogs_composer_components_attachment_get_uploading (TubaDialogsComposerComponentsAttachment* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_uploading;
	return result;
}

static void
tuba_dialogs_composer_components_attachment_set_uploading (TubaDialogsComposerComponentsAttachment* self,
                                                           gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_dialogs_composer_components_attachment_get_uploading (self);
	if (old_value != value) {
		self->priv->_uploading = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_UPLOADING_PROPERTY]);
	}
}

gboolean
tuba_dialogs_composer_components_attachment_get_edit_mode (TubaDialogsComposerComponentsAttachment* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_edit_mode;
	return result;
}

void
tuba_dialogs_composer_components_attachment_set_edit_mode (TubaDialogsComposerComponentsAttachment* self,
                                                           gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_dialogs_composer_components_attachment_get_edit_mode (self);
	if (old_value != value) {
		self->priv->_edit_mode = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_EDIT_MODE_PROPERTY]);
	}
}

const gchar*
tuba_dialogs_composer_components_attachment_get_media_id (TubaDialogsComposerComponentsAttachment* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_media_id;
	result = _tmp0_;
	return result;
}

void
tuba_dialogs_composer_components_attachment_set_media_id (TubaDialogsComposerComponentsAttachment* self,
                                                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_dialogs_composer_components_attachment_get_media_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_media_id);
		self->priv->_media_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_ID_PROPERTY]);
	}
}

GdkPaintable*
tuba_dialogs_composer_components_attachment_get_paintable (TubaDialogsComposerComponentsAttachment* self)
{
	GdkPaintable* result;
	TubaWidgetsFocusPicture* _tmp0_;
	GdkPaintable* _tmp1_;
	GdkPaintable* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->picture;
	_tmp1_ = tuba_widgets_focus_picture_get_paintable (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
tuba_dialogs_composer_components_attachment_set_paintable (TubaDialogsComposerComponentsAttachment* self,
                                                           GdkPaintable* value)
{
	TubaWidgetsFocusPicture* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->picture;
	tuba_widgets_focus_picture_set_paintable (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_PAINTABLE_PROPERTY]);
}

gboolean
tuba_dialogs_composer_components_attachment_get_done (TubaDialogsComposerComponentsAttachment* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_done;
	return result;
}

static void
tuba_dialogs_composer_components_attachment_set_done (TubaDialogsComposerComponentsAttachment* self,
                                                      gboolean value)
{
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	TubaDialogsComposerComponentsAttachmentAltIndicator* _tmp2_;
	GtkLabel* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->delete_button;
	_tmp1_ = self->priv->alt_button;
	_tmp2_ = self->priv->alt_indicator;
	gtk_widget_set_visible ((GtkWidget*) _tmp2_, value);
	gtk_widget_set_visible ((GtkWidget*) _tmp1_, value);
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, value);
	self->priv->_done = value;
	_tmp3_ = self->priv->progress_label;
	gtk_widget_set_visible ((GtkWidget*) _tmp3_, !value);
	g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_DONE_PROPERTY]);
}

static gdouble
tuba_dialogs_composer_components_attachment_get_progress (TubaDialogsComposerComponentsAttachment* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_progress;
	return result;
}

static void
tuba_dialogs_composer_components_attachment_set_progress (TubaDialogsComposerComponentsAttachment* self,
                                                          gdouble value)
{
	gdouble _tmp0_ = 0.0;
	AdwTimedAnimation* _tmp1_;
	AdwAnimationState _tmp2_;
	AdwAnimationState _tmp3_;
	AdwTimedAnimation* _tmp7_;
	GtkLabel* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	AdwTimedAnimation* _tmp13_;
	AdwTimedAnimation* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->progress_animation;
	_tmp2_ = adw_animation_get_state ((AdwAnimation*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == ADW_ANIMATION_PLAYING) {
		AdwTimedAnimation* _tmp4_;
		gdouble _tmp5_;
		gdouble _tmp6_;
		_tmp4_ = self->priv->progress_animation;
		_tmp5_ = adw_animation_get_value ((AdwAnimation*) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_;
	} else {
		_tmp0_ = self->priv->_progress;
	}
	_tmp7_ = self->priv->progress_animation;
	adw_timed_animation_set_value_from (_tmp7_, _tmp0_);
	self->priv->_progress = value;
	_tmp8_ = self->priv->progress_label;
	_tmp9_ = g_strdup_printf ("%i", (gint) (value * 100));
	_tmp10_ = _tmp9_;
	_tmp11_ = g_strconcat (_tmp10_, "%", NULL);
	_tmp12_ = _tmp11_;
	gtk_label_set_label (_tmp8_, _tmp12_);
	_g_free0 (_tmp12_);
	_g_free0 (_tmp10_);
	_tmp13_ = self->priv->progress_animation;
	adw_timed_animation_set_value_to (_tmp13_, value);
	_tmp14_ = self->priv->progress_animation;
	adw_animation_play ((AdwAnimation*) _tmp14_);
}

gdouble
tuba_dialogs_composer_components_attachment_get_pos_x (TubaDialogsComposerComponentsAttachment* self)
{
	gdouble result;
	TubaWidgetsFocusPicture* _tmp0_;
	gdouble _tmp1_;
	gdouble _tmp2_;
	g_return_val_if_fail (self != NULL, -1.0);
	_tmp0_ = self->priv->picture;
	_tmp1_ = tuba_widgets_focus_picture_get_focus_x (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
tuba_dialogs_composer_components_attachment_set_pos_x (TubaDialogsComposerComponentsAttachment* self,
                                                       gdouble value)
{
	TubaWidgetsFocusPicture* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->picture;
	tuba_widgets_focus_picture_set_focus_x (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_POS_X_PROPERTY]);
}

gdouble
tuba_dialogs_composer_components_attachment_get_pos_y (TubaDialogsComposerComponentsAttachment* self)
{
	gdouble result;
	TubaWidgetsFocusPicture* _tmp0_;
	gdouble _tmp1_;
	gdouble _tmp2_;
	g_return_val_if_fail (self != NULL, -1.0);
	_tmp0_ = self->priv->picture;
	_tmp1_ = tuba_widgets_focus_picture_get_focus_y (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
tuba_dialogs_composer_components_attachment_set_pos_y (TubaDialogsComposerComponentsAttachment* self,
                                                       gdouble value)
{
	TubaWidgetsFocusPicture* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->picture;
	tuba_widgets_focus_picture_set_focus_y (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_POS_Y_PROPERTY]);
}

const gchar*
tuba_dialogs_composer_components_attachment_get_alt_text (TubaDialogsComposerComponentsAttachment* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_alt_text;
	result = _tmp0_;
	return result;
}

void
tuba_dialogs_composer_components_attachment_set_alt_text (TubaDialogsComposerComponentsAttachment* self,
                                                          const gchar* value)
{
	gchar* _tmp0_;
	TubaDialogsComposerComponentsAttachmentAltIndicator* _tmp1_;
	TubaDialogsComposerComponentsAttachmentAltIndicator* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_alt_text);
	self->priv->_alt_text = _tmp0_;
	_tmp1_ = self->priv->alt_indicator;
	tuba_dialogs_composer_components_attachment_alt_indicator_set_valid (_tmp1_, g_strcmp0 (value, "") != 0);
	_tmp2_ = self->priv->alt_indicator;
	_tmp3_ = tuba_dialogs_composer_components_attachment_alt_indicator_get_valid (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		gtk_accessible_update_property ((GtkAccessible*) self, GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, value, -1, -1);
	} else {
		gtk_accessible_update_property ((GtkAccessible*) self, GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, "", -1, -1);
	}
	g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_TEXT_PROPERTY]);
}

GFile*
tuba_dialogs_composer_components_attachment_get_file (TubaDialogsComposerComponentsAttachment* self)
{
	GFile* result;
	GFile* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_file;
	result = _tmp0_;
	return result;
}

void
tuba_dialogs_composer_components_attachment_set_file (TubaDialogsComposerComponentsAttachment* self,
                                                      GFile* value)
{
	GFile* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_dialogs_composer_components_attachment_get_file (self);
	if (old_value != value) {
		GFile* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_file);
		self->priv->_file = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_FILE_PROPERTY]);
	}
}

gdouble
tuba_dialogs_composer_components_attachment_get_progress_animation_hack (TubaDialogsComposerComponentsAttachment* self)
{
	gdouble result;
	AdwTimedAnimation* _tmp0_;
	gdouble _tmp1_;
	gdouble _tmp2_;
	g_return_val_if_fail (self != NULL, -1.0);
	_tmp0_ = self->priv->progress_animation;
	_tmp1_ = adw_animation_get_value ((AdwAnimation*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
tuba_dialogs_composer_components_attachment_set_progress_animation_hack (TubaDialogsComposerComponentsAttachment* self,
                                                                         gdouble value)
{
	g_return_if_fail (self != NULL);
	gtk_widget_queue_draw ((GtkWidget*) self);
	g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_PROGRESS_ANIMATION_HACK_PROPERTY]);
}

static inline gpointer
tuba_dialogs_composer_components_attachment_alt_indicator_get_instance_private (TubaDialogsComposerComponentsAttachmentAltIndicator* self)
{
	return G_STRUCT_MEMBER_P (self, TubaDialogsComposerComponentsAttachmentAltIndicator_private_offset);
}

static void
tuba_dialogs_composer_components_attachment_alt_indicator_update_valid (TubaDialogsComposerComponentsAttachmentAltIndicator* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tuba_dialogs_composer_components_attachment_alt_indicator_get_valid (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		GtkImage* _tmp2_;
		if (gtk_widget_has_css_class ((GtkWidget*) self, "error")) {
			gtk_widget_remove_css_class ((GtkWidget*) self, "error");
		}
		if (!gtk_widget_has_css_class ((GtkWidget*) self, "success")) {
			gtk_widget_add_css_class ((GtkWidget*) self, "success");
		}
		_tmp2_ = self->priv->icon;
		g_object_set (_tmp2_, "icon-name", "tuba-check-plain-symbolic", NULL);
	} else {
		GtkImage* _tmp3_;
		if (!gtk_widget_has_css_class ((GtkWidget*) self, "error")) {
			gtk_widget_add_css_class ((GtkWidget*) self, "error");
		}
		if (gtk_widget_has_css_class ((GtkWidget*) self, "success")) {
			gtk_widget_remove_css_class ((GtkWidget*) self, "success");
		}
		_tmp3_ = self->priv->icon;
		g_object_set (_tmp3_, "icon-name", "tuba-cross-large-symbolic", NULL);
	}
}

TubaDialogsComposerComponentsAttachmentAltIndicator*
tuba_dialogs_composer_components_attachment_alt_indicator_construct (GType object_type)
{
	TubaDialogsComposerComponentsAttachmentAltIndicator * self = NULL;
	self = (TubaDialogsComposerComponentsAttachmentAltIndicator*) g_object_new (object_type, NULL);
	return self;
}

TubaDialogsComposerComponentsAttachmentAltIndicator*
tuba_dialogs_composer_components_attachment_alt_indicator_new (void)
{
	return tuba_dialogs_composer_components_attachment_alt_indicator_construct (TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ALT_INDICATOR);
}

gboolean
tuba_dialogs_composer_components_attachment_alt_indicator_get_valid (TubaDialogsComposerComponentsAttachmentAltIndicator* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_valid;
	return result;
}

void
tuba_dialogs_composer_components_attachment_alt_indicator_set_valid (TubaDialogsComposerComponentsAttachmentAltIndicator* self,
                                                                     gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_valid = value;
	tuba_dialogs_composer_components_attachment_alt_indicator_update_valid (self);
	g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_composer_components_attachment_alt_indicator_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_INDICATOR_VALID_PROPERTY]);
}

static GObject *
tuba_dialogs_composer_components_attachment_alt_indicator_constructor (GType type,
                                                                       guint n_construct_properties,
                                                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaDialogsComposerComponentsAttachmentAltIndicator * self;
	gchar* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	GtkImage* _tmp3_;
	GtkLabel* _tmp4_;
	GtkLabel* _tmp5_;
	GtkImage* _tmp6_;
	parent_class = G_OBJECT_CLASS (tuba_dialogs_composer_components_attachment_alt_indicator_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ALT_INDICATOR, TubaDialogsComposerComponentsAttachmentAltIndicator);
	gtk_widget_set_overflow ((GtkWidget*) self, GTK_OVERFLOW_HIDDEN);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_HORIZONTAL);
	gtk_box_set_spacing ((GtkBox*) self, 3);
	gtk_widget_set_focusable ((GtkWidget*) self, FALSE);
	gtk_widget_set_can_focus ((GtkWidget*) self, FALSE);
	_tmp0_ = g_strdup ("alt-indicator");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = 1;
	gtk_widget_set_css_classes ((GtkWidget*) self, _tmp2_);
	_tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
	_tmp3_ = (GtkImage*) gtk_image_new_from_icon_name ("tuba-cross-large-symbolic");
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->icon);
	self->priv->icon = _tmp3_;
	_tmp4_ = (GtkLabel*) gtk_label_new ("ALT");
	g_object_ref_sink (_tmp4_);
	_tmp5_ = _tmp4_;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp5_);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = self->priv->icon;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp6_);
	tuba_dialogs_composer_components_attachment_alt_indicator_update_valid (self);
	return obj;
}

static void
tuba_dialogs_composer_components_attachment_alt_indicator_class_init (TubaDialogsComposerComponentsAttachmentAltIndicatorClass * klass,
                                                                      gpointer klass_data)
{
	tuba_dialogs_composer_components_attachment_alt_indicator_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaDialogsComposerComponentsAttachmentAltIndicator_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_dialogs_composer_components_attachment_alt_indicator_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_dialogs_composer_components_attachment_alt_indicator_set_property;
	G_OBJECT_CLASS (klass)->constructor = tuba_dialogs_composer_components_attachment_alt_indicator_constructor;
	G_OBJECT_CLASS (klass)->finalize = tuba_dialogs_composer_components_attachment_alt_indicator_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_INDICATOR_VALID_PROPERTY, tuba_dialogs_composer_components_attachment_alt_indicator_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_INDICATOR_VALID_PROPERTY] = g_param_spec_boolean ("valid", "valid", "valid", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_accessible_role (GTK_WIDGET_CLASS (klass), GTK_ACCESSIBLE_ROLE_PRESENTATION);
}

static void
tuba_dialogs_composer_components_attachment_alt_indicator_instance_init (TubaDialogsComposerComponentsAttachmentAltIndicator * self,
                                                                         gpointer klass)
{
	self->priv = tuba_dialogs_composer_components_attachment_alt_indicator_get_instance_private (self);
	self->priv->_valid = FALSE;
}

static void
tuba_dialogs_composer_components_attachment_alt_indicator_finalize (GObject * obj)
{
	TubaDialogsComposerComponentsAttachmentAltIndicator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ALT_INDICATOR, TubaDialogsComposerComponentsAttachmentAltIndicator);
	g_debug ("Attachment.vala:27: Destroying AltIndicator");
	_g_object_unref0 (self->priv->icon);
	G_OBJECT_CLASS (tuba_dialogs_composer_components_attachment_alt_indicator_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_dialogs_composer_components_attachment_alt_indicator_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaDialogsComposerComponentsAttachmentAltIndicatorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_dialogs_composer_components_attachment_alt_indicator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaDialogsComposerComponentsAttachmentAltIndicator), 0, (GInstanceInitFunc) tuba_dialogs_composer_components_attachment_alt_indicator_instance_init, NULL };
	GType tuba_dialogs_composer_components_attachment_alt_indicator_type_id;
	tuba_dialogs_composer_components_attachment_alt_indicator_type_id = g_type_register_static (gtk_box_get_type (), "TubaDialogsComposerComponentsAttachmentAltIndicator", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaDialogsComposerComponentsAttachmentAltIndicator_private_offset = g_type_add_instance_private (tuba_dialogs_composer_components_attachment_alt_indicator_type_id, sizeof (TubaDialogsComposerComponentsAttachmentAltIndicatorPrivate));
	return tuba_dialogs_composer_components_attachment_alt_indicator_type_id;
}

GType
tuba_dialogs_composer_components_attachment_alt_indicator_get_type (void)
{
	static GType tuba_dialogs_composer_components_attachment_alt_indicator_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_dialogs_composer_components_attachment_alt_indicator_type_id__once)) {
		GType tuba_dialogs_composer_components_attachment_alt_indicator_type_id;
		tuba_dialogs_composer_components_attachment_alt_indicator_type_id = tuba_dialogs_composer_components_attachment_alt_indicator_get_type_once ();
		g_once_init_leave_pointer (&tuba_dialogs_composer_components_attachment_alt_indicator_type_id__once, tuba_dialogs_composer_components_attachment_alt_indicator_type_id);
	}
	return tuba_dialogs_composer_components_attachment_alt_indicator_type_id__once;
}

static void
_vala_tuba_dialogs_composer_components_attachment_alt_indicator_get_property (GObject * object,
                                                                              guint property_id,
                                                                              GValue * value,
                                                                              GParamSpec * pspec)
{
	TubaDialogsComposerComponentsAttachmentAltIndicator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ALT_INDICATOR, TubaDialogsComposerComponentsAttachmentAltIndicator);
	switch (property_id) {
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_INDICATOR_VALID_PROPERTY:
		g_value_set_boolean (value, tuba_dialogs_composer_components_attachment_alt_indicator_get_valid (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_dialogs_composer_components_attachment_alt_indicator_set_property (GObject * object,
                                                                              guint property_id,
                                                                              const GValue * value,
                                                                              GParamSpec * pspec)
{
	TubaDialogsComposerComponentsAttachmentAltIndicator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ALT_INDICATOR, TubaDialogsComposerComponentsAttachmentAltIndicator);
	switch (property_id) {
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_INDICATOR_VALID_PROPERTY:
		tuba_dialogs_composer_components_attachment_alt_indicator_set_valid (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
tuba_dialogs_composer_components_attachment_attachment_thumbnailer_get_instance_private (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* self)
{
	return G_STRUCT_MEMBER_P (self, TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer_private_offset);
}

static TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer*
tuba_dialogs_composer_components_attachment_attachment_thumbnailer_construct (GType object_type,
                                                                              const gchar* file_uri,
                                                                              TubaDialogsComposerComponentsAttachmentMediaType kind)
{
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer * self = NULL;
	GFile* _tmp0_;
	g_return_val_if_fail (file_uri != NULL, NULL);
	self = (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer*) g_object_new (object_type, NULL);
	_tmp0_ = g_file_new_for_uri (file_uri);
	_g_object_unref0 (self->priv->file);
	self->priv->file = _tmp0_;
	self->priv->kind = kind;
	return self;
}

static TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer*
tuba_dialogs_composer_components_attachment_attachment_thumbnailer_new (const gchar* file_uri,
                                                                        TubaDialogsComposerComponentsAttachmentMediaType kind)
{
	return tuba_dialogs_composer_components_attachment_attachment_thumbnailer_construct (TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ATTACHMENT_THUMBNAILER, file_uri, kind);
}

static gpointer
_gst_buffer_ref0 (gpointer self)
{
	return self ? gst_buffer_ref (self) : NULL;
}

static guint8*
_vala_array_dup23 (guint8* self,
                   gssize length)
{
	if (length > 0) {
		return g_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

static void
tuba_dialogs_composer_components_attachment_attachment_thumbnailer_fetch (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer* self)
{
	gchar* file_uri = NULL;
	GFile* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp59_ = FALSE;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->file;
	_tmp1_ = g_file_get_uri (_tmp0_);
	file_uri = _tmp1_;
	_tmp2_ = file_uri;
	_tmp3_ = string_to_string (_tmp2_);
	_tmp4_ = g_strconcat ("Generating thumbnail for ", _tmp3_, NULL);
	_tmp5_ = _tmp4_;
	g_debug ("Attachment.vala:596: %s", _tmp5_);
	_g_free0 (_tmp5_);
	{
		switch (self->priv->kind) {
			case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_IMAGE:
			{
				const gchar* _tmp6_;
				_tmp6_ = file_uri;
				if (g_str_has_prefix (_tmp6_, "file://")) {
					GdkPixbuf* _tmp7_ = NULL;
					GFile* _tmp8_;
					gchar* _tmp9_;
					gchar* _tmp10_;
					GdkPixbuf* _tmp11_;
					GdkPixbuf* _tmp12_;
					GdkPixbuf* _tmp13_;
					GdkPixbuf* _tmp14_;
					GdkTexture* _tmp15_;
					GdkTexture* _tmp16_;
					_tmp8_ = self->priv->file;
					_tmp9_ = g_file_get_path (_tmp8_);
					_tmp10_ = _tmp9_;
					_tmp11_ = gdk_pixbuf_new_from_file (_tmp10_, &_inner_error0_);
					_tmp12_ = _tmp11_;
					_g_free0 (_tmp10_);
					_tmp7_ = _tmp12_;
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
					_tmp13_ = gdk_pixbuf_apply_embedded_orientation (_tmp7_);
					_tmp14_ = _tmp13_;
					_tmp15_ = gdk_texture_new_for_pixbuf (_tmp14_);
					_tmp16_ = _tmp15_;
					g_signal_emit (self, tuba_dialogs_composer_components_attachment_attachment_thumbnailer_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_DONE_SIGNAL], 0, (GdkPaintable*) _tmp16_);
					_g_object_unref0 (_tmp16_);
					_g_object_unref0 (_tmp14_);
					_g_object_unref0 (_tmp7_);
				} else {
					GdkTexture* _tmp17_ = NULL;
					GFile* _tmp18_;
					GdkTexture* _tmp19_;
					_tmp18_ = self->priv->file;
					_tmp19_ = gdk_texture_new_from_file (_tmp18_, &_inner_error0_);
					_tmp17_ = _tmp19_;
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
					g_signal_emit (self, tuba_dialogs_composer_components_attachment_attachment_thumbnailer_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_DONE_SIGNAL], 0, (GdkPaintable*) _tmp17_);
					_g_object_unref0 (_tmp17_);
				}
				break;
			}
			case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_VIDEO:
			case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_GIFV:
			{
				GstElement* playbin = NULL;
				GstElement* _tmp20_;
				GstElement* _tmp21_;
				GstElement* _tmp22_;
				GstElement* _tmp23_;
				GstElement* _tmp24_;
				GstElement* _tmp25_;
				GstElement* _tmp26_;
				GstElement* _tmp27_;
				const gchar* _tmp28_;
				GValue _tmp29_ = {0};
				GstElement* _tmp30_;
				GstElement* _tmp31_;
				GstElement* _tmp32_;
				GstElement* _tmp33_;
				GstSample* sample = NULL;
				GstCaps* cups = NULL;
				GstCaps* _tmp34_;
				GstElement* _tmp35_;
				GstCaps* _tmp36_;
				GstSample* _tmp37_ = NULL;
				GstSample* _tmp38_;
				GstBuffer* buffer = NULL;
				GstSample* _tmp39_;
				GstBuffer* _tmp40_;
				GstBuffer* _tmp41_;
				GstBuffer* _tmp42_;
				GstMapInfo map_info = {0};
				GstBuffer* _tmp43_;
				GstMapInfo _tmp44_ = {0};
				gboolean _tmp45_;
				GdkTexture* _tmp46_ = NULL;
				GstMapInfo _tmp47_;
				guint8* _tmp48_;
				gint _tmp48__length1;
				guint8* _tmp49_;
				gint _tmp49__length1;
				GBytes* _tmp50_;
				GBytes* _tmp51_;
				GdkTexture* _tmp52_;
				GdkTexture* _tmp53_;
				_tmp20_ = gst_element_factory_make ("playbin", NULL);
				if (_tmp20_ != NULL) {
					g_object_ref_sink (_tmp20_);
				}
				playbin = _tmp20_;
				_tmp21_ = playbin;
				_tmp22_ = gst_element_factory_make ("fakesink", NULL);
				if (_tmp22_ != NULL) {
					g_object_ref_sink (_tmp22_);
				}
				_tmp23_ = _tmp22_;
				g_object_set ((GObject*) _tmp21_, "video-sink", _tmp23_, NULL);
				_g_object_unref0 (_tmp23_);
				_tmp24_ = playbin;
				_tmp25_ = gst_element_factory_make ("fakesink", NULL);
				if (_tmp25_ != NULL) {
					g_object_ref_sink (_tmp25_);
				}
				_tmp26_ = _tmp25_;
				g_object_set ((GObject*) _tmp24_, "audio-sink", _tmp26_, NULL);
				_g_object_unref0 (_tmp26_);
				_tmp27_ = playbin;
				_tmp28_ = file_uri;
				g_value_init (&_tmp29_, G_TYPE_STRING);
				g_value_set_string (&_tmp29_, _tmp28_);
				g_object_set_property ((GObject*) _tmp27_, "uri", &_tmp29_);
				G_IS_VALUE (&_tmp29_) ? (g_value_unset (&_tmp29_), NULL) : NULL;
				_tmp30_ = playbin;
				gst_element_set_state (_tmp30_, GST_STATE_PAUSED);
				_tmp31_ = playbin;
				gst_element_get_state (_tmp31_, NULL, NULL, GST_CLOCK_TIME_NONE);
				_tmp32_ = playbin;
				if (!gst_element_seek_simple (_tmp32_, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, (gint64) (1 * GST_SECOND))) {
					_g_object_unref0 (playbin);
					_g_free0 (file_uri);
					return;
				}
				_tmp33_ = playbin;
				gst_element_get_state (_tmp33_, NULL, NULL, GST_CLOCK_TIME_NONE);
				sample = NULL;
				_tmp34_ = gst_caps_from_string ("image/png");
				cups = _tmp34_;
				_tmp35_ = playbin;
				_tmp36_ = cups;
				g_signal_emit_by_name (_tmp35_, "convert-sample", _tmp36_, &_tmp37_, NULL);
				_gst_sample_unref0 (sample);
				sample = _tmp37_;
				_tmp38_ = sample;
				if (_tmp38_ == NULL) {
					_gst_caps_unref0 (cups);
					_gst_sample_unref0 (sample);
					_g_object_unref0 (playbin);
					_g_free0 (file_uri);
					return;
				}
				_tmp39_ = sample;
				_tmp40_ = gst_sample_get_buffer (_tmp39_);
				_tmp41_ = _gst_buffer_ref0 (_tmp40_);
				buffer = _tmp41_;
				_tmp42_ = buffer;
				if (_tmp42_ == NULL) {
					_gst_buffer_unref0 (buffer);
					_gst_caps_unref0 (cups);
					_gst_sample_unref0 (sample);
					_g_object_unref0 (playbin);
					_g_free0 (file_uri);
					return;
				}
				_tmp43_ = buffer;
				_tmp45_ = gst_buffer_map (_tmp43_, &_tmp44_, GST_MAP_READ);
				map_info = _tmp44_;
				if (!_tmp45_) {
					_gst_buffer_unref0 (buffer);
					_gst_caps_unref0 (cups);
					_gst_sample_unref0 (sample);
					_g_object_unref0 (playbin);
					_g_free0 (file_uri);
					return;
				}
				_tmp47_ = map_info;
				_tmp48_ = _tmp47_.data;
				_tmp48__length1 = _tmp47_.size;
				_tmp49_ = (_tmp48_ != NULL) ? _vala_array_dup23 (_tmp48_, _tmp48__length1) : _tmp48_;
				_tmp49__length1 = _tmp48__length1;
				_tmp50_ = g_bytes_new_take (_tmp49_, _tmp49__length1);
				_tmp51_ = _tmp50_;
				_tmp52_ = gdk_texture_new_from_bytes (_tmp51_, &_inner_error0_);
				_tmp53_ = _tmp52_;
				_g_bytes_unref0 (_tmp51_);
				_tmp46_ = _tmp53_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_gst_buffer_unref0 (buffer);
					_gst_caps_unref0 (cups);
					_gst_sample_unref0 (sample);
					_g_object_unref0 (playbin);
					goto __catch0_g_error;
				}
				g_signal_emit (self, tuba_dialogs_composer_components_attachment_attachment_thumbnailer_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_DONE_SIGNAL], 0, (GdkPaintable*) _tmp46_);
				_g_object_unref0 (_tmp46_);
				_gst_buffer_unref0 (buffer);
				_gst_caps_unref0 (cups);
				_gst_sample_unref0 (sample);
				_g_object_unref0 (playbin);
				break;
			}
			default:
			{
				g_signal_emit (self, tuba_dialogs_composer_components_attachment_attachment_thumbnailer_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_DONE_SIGNAL], 0, NULL);
				break;
			}
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp54_;
		const gchar* _tmp55_;
		const gchar* _tmp56_;
		gchar* _tmp57_;
		gchar* _tmp58_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp54_ = e;
		_tmp55_ = _tmp54_->message;
		_tmp56_ = string_to_string (_tmp55_);
		_tmp57_ = g_strconcat ("Error while generating thumbnail: ", _tmp56_, NULL);
		_tmp58_ = _tmp57_;
		g_critical ("Attachment.vala:642: %s", _tmp58_);
		_g_free0 (_tmp58_);
		g_signal_emit (self, tuba_dialogs_composer_components_attachment_attachment_thumbnailer_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_DONE_SIGNAL], 0, NULL);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (file_uri);
		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;
	}
	if (self->priv->kind == TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_IMAGE) {
		_tmp59_ = self->priv->can_extract_alt;
	} else {
		_tmp59_ = FALSE;
	}
	if (_tmp59_) {
		const gchar* _tmp60_;
		const gchar* _tmp61_;
		gchar* _tmp62_;
		gchar* _tmp63_;
		gchar* extracted_alt_text = NULL;
		const gchar* _tmp64_;
		gchar* _tmp65_;
		const gchar* _tmp66_;
		_tmp60_ = file_uri;
		_tmp61_ = string_to_string (_tmp60_);
		_tmp62_ = g_strconcat ("Extracting alt text for ", _tmp61_, NULL);
		_tmp63_ = _tmp62_;
		g_debug ("Attachment.vala:648: %s", _tmp63_);
		_g_free0 (_tmp63_);
		_tmp64_ = file_uri;
		_tmp65_ = tuba_utils_exif_extract_alt_text (_tmp64_);
		extracted_alt_text = _tmp65_;
		_tmp66_ = extracted_alt_text;
		if (_tmp66_ != NULL) {
			const gchar* _tmp67_;
			_tmp67_ = extracted_alt_text;
			g_signal_emit (self, tuba_dialogs_composer_components_attachment_attachment_thumbnailer_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_EXTRACTED_ALT_SIGNAL], 0, _tmp67_);
		}
		_g_free0 (extracted_alt_text);
	}
	_g_free0 (file_uri);
}

static void
tuba_dialogs_composer_components_attachment_attachment_thumbnailer_class_init (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailerClass * klass,
                                                                               gpointer klass_data)
{
	tuba_dialogs_composer_components_attachment_attachment_thumbnailer_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer_private_offset);
	G_OBJECT_CLASS (klass)->finalize = tuba_dialogs_composer_components_attachment_attachment_thumbnailer_finalize;
	tuba_dialogs_composer_components_attachment_attachment_thumbnailer_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_DONE_SIGNAL] = g_signal_new ("done", TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ATTACHMENT_THUMBNAILER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, gdk_paintable_get_type ());
	tuba_dialogs_composer_components_attachment_attachment_thumbnailer_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ATTACHMENT_THUMBNAILER_EXTRACTED_ALT_SIGNAL] = g_signal_new ("extracted-alt", TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ATTACHMENT_THUMBNAILER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
tuba_dialogs_composer_components_attachment_attachment_thumbnailer_instance_init (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer * self,
                                                                                  gpointer klass)
{
	TubaSettings* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self->priv = tuba_dialogs_composer_components_attachment_attachment_thumbnailer_get_instance_private (self);
	_tmp0_ = tuba_settings;
	_tmp1_ = tuba_settings_get_extract_alt_from_metadata (_tmp0_);
	_tmp2_ = _tmp1_;
	self->priv->can_extract_alt = _tmp2_;
}

static void
tuba_dialogs_composer_components_attachment_attachment_thumbnailer_finalize (GObject * obj)
{
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_ATTACHMENT_THUMBNAILER, TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer);
	g_debug ("Attachment.vala:584: Destroying AttachmentThumbnailer");
	_g_object_unref0 (self->priv->file);
	G_OBJECT_CLASS (tuba_dialogs_composer_components_attachment_attachment_thumbnailer_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_dialogs_composer_components_attachment_attachment_thumbnailer_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_dialogs_composer_components_attachment_attachment_thumbnailer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer), 0, (GInstanceInitFunc) tuba_dialogs_composer_components_attachment_attachment_thumbnailer_instance_init, NULL };
	GType tuba_dialogs_composer_components_attachment_attachment_thumbnailer_type_id;
	tuba_dialogs_composer_components_attachment_attachment_thumbnailer_type_id = g_type_register_static (G_TYPE_OBJECT, "TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaDialogsComposerComponentsAttachmentAttachmentThumbnailer_private_offset = g_type_add_instance_private (tuba_dialogs_composer_components_attachment_attachment_thumbnailer_type_id, sizeof (TubaDialogsComposerComponentsAttachmentAttachmentThumbnailerPrivate));
	return tuba_dialogs_composer_components_attachment_attachment_thumbnailer_type_id;
}

static GType
tuba_dialogs_composer_components_attachment_attachment_thumbnailer_get_type (void)
{
	static GType tuba_dialogs_composer_components_attachment_attachment_thumbnailer_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_dialogs_composer_components_attachment_attachment_thumbnailer_type_id__once)) {
		GType tuba_dialogs_composer_components_attachment_attachment_thumbnailer_type_id;
		tuba_dialogs_composer_components_attachment_attachment_thumbnailer_type_id = tuba_dialogs_composer_components_attachment_attachment_thumbnailer_get_type_once ();
		g_once_init_leave_pointer (&tuba_dialogs_composer_components_attachment_attachment_thumbnailer_type_id__once, tuba_dialogs_composer_components_attachment_attachment_thumbnailer_type_id);
	}
	return tuba_dialogs_composer_components_attachment_attachment_thumbnailer_type_id__once;
}

static void
_tuba_dialogs_composer_components_attachment_on_animation_end_adw_animation_done (AdwAnimation* _sender,
                                                                                  gpointer self)
{
	tuba_dialogs_composer_components_attachment_on_animation_end ((TubaDialogsComposerComponentsAttachment*) self);
}

static void
_tuba_dialogs_composer_components_attachment_update_accent_color_g_object_notify (GObject* _sender,
                                                                                  GParamSpec* pspec,
                                                                                  gpointer self)
{
	tuba_dialogs_composer_components_attachment_update_accent_color ((TubaDialogsComposerComponentsAttachment*) self);
}

static void
_tuba_dialogs_composer_components_attachment_on_delete_gtk_button_clicked (GtkButton* _sender,
                                                                           gpointer self)
{
	tuba_dialogs_composer_components_attachment_on_delete ((TubaDialogsComposerComponentsAttachment*) self);
}

static void
_tuba_dialogs_composer_components_attachment_on_edit_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                 gpointer self)
{
	tuba_dialogs_composer_components_attachment_on_edit_clicked ((TubaDialogsComposerComponentsAttachment*) self);
}

static void
_tuba_dialogs_composer_components_attachment_upload_thumbnail_gtk_button_clicked (GtkButton* _sender,
                                                                                  gpointer self)
{
	tuba_dialogs_composer_components_attachment_upload_thumbnail ((TubaDialogsComposerComponentsAttachment*) self);
}

static GdkContentProvider*
_tuba_dialogs_composer_components_attachment_on_drag_prepare_gtk_drag_source_prepare (GtkDragSource* _sender,
                                                                                      gdouble x,
                                                                                      gdouble y,
                                                                                      gpointer self)
{
	GdkContentProvider* result;
	result = tuba_dialogs_composer_components_attachment_on_drag_prepare ((TubaDialogsComposerComponentsAttachment*) self, x, y);
	return result;
}

static void
_tuba_dialogs_composer_components_attachment_on_drag_begin_gtk_drag_source_drag_begin (GtkDragSource* _sender,
                                                                                       GdkDrag* drag,
                                                                                       gpointer self)
{
	tuba_dialogs_composer_components_attachment_on_drag_begin ((TubaDialogsComposerComponentsAttachment*) self, _sender, drag);
}

static void
_tuba_dialogs_composer_components_attachment_on_drag_end_gtk_drag_source_drag_end (GtkDragSource* _sender,
                                                                                   GdkDrag* drag,
                                                                                   gboolean delete_data,
                                                                                   gpointer self)
{
	tuba_dialogs_composer_components_attachment_on_drag_end ((TubaDialogsComposerComponentsAttachment*) self, drag, delete_data);
}

static gboolean
_tuba_dialogs_composer_components_attachment_on_drag_cancel_gtk_drag_source_drag_cancel (GtkDragSource* _sender,
                                                                                         GdkDrag* drag,
                                                                                         GdkDragCancelReason reason,
                                                                                         gpointer self)
{
	gboolean result;
	result = tuba_dialogs_composer_components_attachment_on_drag_cancel ((TubaDialogsComposerComponentsAttachment*) self, drag, reason);
	return result;
}

static GdkDragAction
_tuba_dialogs_composer_components_attachment_on_drop_enter_gtk_drop_target_enter (GtkDropTarget* _sender,
                                                                                  gdouble x,
                                                                                  gdouble y,
                                                                                  gpointer self)
{
	GdkDragAction result;
	result = tuba_dialogs_composer_components_attachment_on_drop_enter ((TubaDialogsComposerComponentsAttachment*) self, x, y);
	return result;
}

static void
_tuba_dialogs_composer_components_attachment_on_drop_leave_gtk_drop_target_leave (GtkDropTarget* _sender,
                                                                                  gpointer self)
{
	tuba_dialogs_composer_components_attachment_on_drop_leave ((TubaDialogsComposerComponentsAttachment*) self);
}

static gboolean
_tuba_dialogs_composer_components_attachment_on_drop_gtk_drop_target_drop (GtkDropTarget* _sender,
                                                                           GValue* value,
                                                                           gdouble x,
                                                                           gdouble y,
                                                                           gpointer self)
{
	gboolean result;
	result = tuba_dialogs_composer_components_attachment_on_drop ((TubaDialogsComposerComponentsAttachment*) self, _sender, value, x, y);
	return result;
}

static GObject *
tuba_dialogs_composer_components_attachment_constructor (GType type,
                                                         guint n_construct_properties,
                                                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaDialogsComposerComponentsAttachment * self;
	gchar* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	AdwPropertyAnimationTarget* _tmp3_;
	AdwTimedAnimation* _tmp4_;
	AdwPropertyAnimationTarget* _tmp5_;
	AdwTimedAnimation* _tmp6_;
	AdwTimedAnimation* _tmp7_;
	AdwStyleManager* default_sm = NULL;
	AdwStyleManager* _tmp8_;
	AdwStyleManager* _tmp9_;
	AdwStyleManager* _tmp10_;
	gboolean _tmp11_;
	gboolean _tmp12_;
	TubaWidgetsFocusPicture* _tmp15_ = NULL;
	GtkOverlay* overlay = NULL;
	TubaWidgetsFocusPicture* _tmp16_;
	GtkWidget* _tmp17_;
	GtkOverlay* _tmp18_ = NULL;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar** _tmp21_;
	gchar* _tmp22_;
	GtkButton* _tmp23_ = NULL;
	GtkButton* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar** _tmp27_;
	gchar* _tmp28_;
	GtkButton* _tmp29_ = NULL;
	GtkButton* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar** _tmp33_;
	gchar* _tmp34_;
	GtkButton* _tmp35_ = NULL;
	GtkButton* _tmp36_;
	TubaDialogsComposerComponentsAttachmentAltIndicator* _tmp37_ = NULL;
	gchar* _tmp38_;
	gchar* _tmp39_;
	gchar** _tmp40_;
	GtkLabel* _tmp41_ = NULL;
	gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	gchar** _tmp45_;
	GtkImage* _tmp46_ = NULL;
	GtkOverlay* _tmp47_;
	GtkButton* _tmp48_;
	GtkOverlay* _tmp49_;
	GtkButton* _tmp50_;
	GtkOverlay* _tmp51_;
	GtkButton* _tmp52_;
	GtkOverlay* _tmp53_;
	TubaDialogsComposerComponentsAttachmentAltIndicator* _tmp54_;
	GtkOverlay* _tmp55_;
	GtkLabel* _tmp56_;
	GtkOverlay* _tmp57_;
	GtkImage* _tmp58_;
	GtkOverlay* _tmp59_;
	GtkWidget* _tmp60_;
	gchar* _tmp61_;
	TubaDialogsComposerComponentsDropOverlay* _tmp62_ = NULL;
	TubaDialogsComposerComponentsDropOverlay* _tmp63_;
	GtkDragSource* drag_source_controller = NULL;
	GtkDragSource* _tmp64_ = NULL;
	GtkDragSource* _tmp65_;
	GtkDragSource* _tmp66_;
	GtkDragSource* _tmp67_;
	GtkDragSource* _tmp68_;
	GtkDragSource* _tmp69_;
	GtkEventController* _tmp70_;
	GtkDropTarget* _tmp71_;
	GtkDropTarget* _tmp72_;
	GtkDropTarget* _tmp73_;
	GtkDropTarget* _tmp74_;
	GtkDropTarget* _tmp75_;
	GtkEventController* _tmp76_;
	AdwPropertyAnimationTarget* _tmp77_;
	AdwTimedAnimation* _tmp78_ = NULL;
	parent_class = G_OBJECT_CLASS (tuba_dialogs_composer_components_attachment_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, TubaDialogsComposerComponentsAttachment);
	_tmp0_ = g_strdup ("composer-attachment");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = 1;
	gtk_widget_set_css_classes ((GtkWidget*) self, _tmp2_);
	_tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_overflow ((GtkWidget*) self, GTK_OVERFLOW_HIDDEN);
	gtk_widget_set_opacity ((GtkWidget*) self, (gdouble) 0);
	_tmp3_ = (AdwPropertyAnimationTarget*) adw_property_animation_target_new ((GObject*) self, "progress-animation-hack");
	_tmp4_ = (AdwTimedAnimation*) adw_timed_animation_new ((GtkWidget*) self, (gdouble) 0, (gdouble) 1, (guint) 200, (AdwAnimationTarget*) _tmp3_);
	_g_object_unref0 (self->priv->progress_animation);
	self->priv->progress_animation = _tmp4_;
	_tmp5_ = (AdwPropertyAnimationTarget*) adw_property_animation_target_new ((GObject*) self, "opacity");
	_tmp6_ = (AdwTimedAnimation*) adw_timed_animation_new ((GtkWidget*) self, (gdouble) 0, (gdouble) 1, (guint) 250, (AdwAnimationTarget*) _tmp5_);
	_g_object_unref0 (self->priv->animation);
	self->priv->animation = _tmp6_;
	_tmp7_ = self->priv->animation;
	g_signal_connect_object ((AdwAnimation*) _tmp7_, "done", (GCallback) _tuba_dialogs_composer_components_attachment_on_animation_end_adw_animation_done, self, 0);
	_tmp8_ = adw_style_manager_get_default ();
	_tmp9_ = _g_object_ref0 (_tmp8_);
	default_sm = _tmp9_;
	_tmp10_ = default_sm;
	_tmp11_ = adw_style_manager_get_system_supports_accent_colors (_tmp10_);
	_tmp12_ = _tmp11_;
	if (_tmp12_) {
		AdwStyleManager* _tmp13_;
		_tmp13_ = default_sm;
		g_signal_connect_object ((GObject*) _tmp13_, "notify::accent-color-rgba", (GCallback) _tuba_dialogs_composer_components_attachment_update_accent_color_g_object_notify, self, 0);
		tuba_dialogs_composer_components_attachment_update_accent_color (self);
	} else {
		GdkRGBA _tmp14_ = {0};
		_tmp14_.red = 120 / 255.0f;
		_tmp14_.green = 174 / 255.0f;
		_tmp14_.blue = 237 / 255.0f;
		_tmp14_.alpha = 0.5f;
		self->priv->color = _tmp14_;
	}
	_tmp15_ = tuba_widgets_focus_picture_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp15_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp15_, TRUE);
	tuba_widgets_focus_picture_set_can_shrink (_tmp15_, TRUE);
	tuba_widgets_focus_picture_set_content_fit (_tmp15_, GTK_CONTENT_FIT_COVER);
	g_object_set ((GtkAccessible*) _tmp15_, "accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATION, NULL);
	g_object_ref_sink (_tmp15_);
	_g_object_unref0 (self->priv->picture);
	self->priv->picture = _tmp15_;
	_tmp16_ = self->priv->picture;
	_tmp17_ = _g_object_ref0 ((GtkWidget*) _tmp16_);
	_tmp18_ = (GtkOverlay*) gtk_overlay_new ();
	gtk_widget_set_vexpand ((GtkWidget*) _tmp18_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp18_, TRUE);
	gtk_overlay_set_child (_tmp18_, _tmp17_);
	_g_object_unref0 (_tmp17_);
	g_object_ref_sink (_tmp18_);
	overlay = _tmp18_;
	_tmp19_ = g_strdup ("osd");
	_tmp20_ = g_strdup ("circular");
	_tmp21_ = g_new0 (gchar*, 2 + 1);
	_tmp21_[0] = _tmp19_;
	_tmp21_[1] = _tmp20_;
	_tmp22_ = g_strdup (_ ("Remove Attachment"));
	_tmp23_ = (GtkButton*) gtk_button_new_from_icon_name ("user-trash-symbolic");
	gtk_widget_set_halign ((GtkWidget*) _tmp23_, GTK_ALIGN_END);
	gtk_widget_set_valign ((GtkWidget*) _tmp23_, GTK_ALIGN_START);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp23_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp23_, 6);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp23_, _tmp21_);
	_tmp21_ = (_vala_array_free (_tmp21_, 2, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_visible ((GtkWidget*) _tmp23_, FALSE);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp23_, _tmp22_);
	_g_free0 (_tmp22_);
	g_object_ref_sink (_tmp23_);
	_g_object_unref0 (self->priv->delete_button);
	self->priv->delete_button = _tmp23_;
	_tmp24_ = self->priv->delete_button;
	g_signal_connect_object (_tmp24_, "clicked", (GCallback) _tuba_dialogs_composer_components_attachment_on_delete_gtk_button_clicked, self, 0);
	_tmp25_ = g_strdup ("osd");
	_tmp26_ = g_strdup ("circular");
	_tmp27_ = g_new0 (gchar*, 2 + 1);
	_tmp27_[0] = _tmp25_;
	_tmp27_[1] = _tmp26_;
	_tmp28_ = g_strdup (_ ("Edit Metadata"));
	_tmp29_ = (GtkButton*) gtk_button_new_from_icon_name ("document-edit-symbolic");
	gtk_widget_set_halign ((GtkWidget*) _tmp29_, GTK_ALIGN_END);
	gtk_widget_set_valign ((GtkWidget*) _tmp29_, GTK_ALIGN_END);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp29_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp29_, 6);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp29_, _tmp27_);
	_tmp27_ = (_vala_array_free (_tmp27_, 2, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_visible ((GtkWidget*) _tmp29_, FALSE);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp29_, _tmp28_);
	_g_free0 (_tmp28_);
	g_object_ref_sink (_tmp29_);
	_g_object_unref0 (self->priv->alt_button);
	self->priv->alt_button = _tmp29_;
	_tmp30_ = self->priv->alt_button;
	g_signal_connect_object (_tmp30_, "clicked", (GCallback) _tuba_dialogs_composer_components_attachment_on_edit_clicked_gtk_button_clicked, self, 0);
	_tmp31_ = g_strdup ("osd");
	_tmp32_ = g_strdup ("circular");
	_tmp33_ = g_new0 (gchar*, 2 + 1);
	_tmp33_[0] = _tmp31_;
	_tmp33_[1] = _tmp32_;
	_tmp34_ = g_strdup (_ ("Upload Custom Thumbnail"));
	_tmp35_ = (GtkButton*) gtk_button_new_from_icon_name ("tuba-image-round-symbolic");
	gtk_widget_set_halign ((GtkWidget*) _tmp35_, GTK_ALIGN_START);
	gtk_widget_set_valign ((GtkWidget*) _tmp35_, GTK_ALIGN_START);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp35_, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp35_, 6);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp35_, _tmp33_);
	_tmp33_ = (_vala_array_free (_tmp33_, 2, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_visible ((GtkWidget*) _tmp35_, FALSE);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp35_, _tmp34_);
	_g_free0 (_tmp34_);
	g_object_ref_sink (_tmp35_);
	_g_object_unref0 (self->priv->custom_thumbnail_button);
	self->priv->custom_thumbnail_button = _tmp35_;
	_tmp36_ = self->priv->custom_thumbnail_button;
	g_signal_connect_object (_tmp36_, "clicked", (GCallback) _tuba_dialogs_composer_components_attachment_upload_thumbnail_gtk_button_clicked, self, 0);
	_tmp37_ = tuba_dialogs_composer_components_attachment_alt_indicator_new ();
	gtk_widget_set_halign ((GtkWidget*) _tmp37_, GTK_ALIGN_START);
	gtk_widget_set_valign ((GtkWidget*) _tmp37_, GTK_ALIGN_END);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp37_, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp37_, 6);
	gtk_widget_set_visible ((GtkWidget*) _tmp37_, FALSE);
	g_object_ref_sink (_tmp37_);
	_g_object_unref0 (self->priv->alt_indicator);
	self->priv->alt_indicator = _tmp37_;
	_tmp38_ = g_strdup ("font-bold");
	_tmp39_ = g_strdup ("numeric");
	_tmp40_ = g_new0 (gchar*, 2 + 1);
	_tmp40_[0] = _tmp38_;
	_tmp40_[1] = _tmp39_;
	_tmp41_ = (GtkLabel*) gtk_label_new ("0%");
	gtk_widget_set_halign ((GtkWidget*) _tmp41_, GTK_ALIGN_CENTER);
	gtk_widget_set_valign ((GtkWidget*) _tmp41_, GTK_ALIGN_CENTER);
	gtk_widget_set_visible ((GtkWidget*) _tmp41_, TRUE);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp41_, _tmp40_);
	_tmp40_ = (_vala_array_free (_tmp40_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp41_);
	_g_object_unref0 (self->priv->progress_label);
	self->priv->progress_label = _tmp41_;
	_tmp42_ = g_strdup ("osd");
	_tmp43_ = g_strdup ("tuba-circular");
	_tmp44_ = g_strdup ("min-size-64");
	_tmp45_ = g_new0 (gchar*, 3 + 1);
	_tmp45_[0] = _tmp42_;
	_tmp45_[1] = _tmp43_;
	_tmp45_[2] = _tmp44_;
	_tmp46_ = (GtkImage*) gtk_image_new_from_icon_name ("media-playback-start-symbolic");
	gtk_widget_set_valign ((GtkWidget*) _tmp46_, GTK_ALIGN_CENTER);
	gtk_widget_set_halign ((GtkWidget*) _tmp46_, GTK_ALIGN_CENTER);
	gtk_widget_set_visible ((GtkWidget*) _tmp46_, FALSE);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp46_, _tmp45_);
	_tmp45_ = (_vala_array_free (_tmp45_, 3, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp46_);
	_g_object_unref0 (self->priv->media_icon);
	self->priv->media_icon = _tmp46_;
	_tmp47_ = overlay;
	_tmp48_ = self->priv->delete_button;
	gtk_overlay_add_overlay (_tmp47_, (GtkWidget*) _tmp48_);
	_tmp49_ = overlay;
	_tmp50_ = self->priv->alt_button;
	gtk_overlay_add_overlay (_tmp49_, (GtkWidget*) _tmp50_);
	_tmp51_ = overlay;
	_tmp52_ = self->priv->custom_thumbnail_button;
	gtk_overlay_add_overlay (_tmp51_, (GtkWidget*) _tmp52_);
	_tmp53_ = overlay;
	_tmp54_ = self->priv->alt_indicator;
	gtk_overlay_add_overlay (_tmp53_, (GtkWidget*) _tmp54_);
	_tmp55_ = overlay;
	_tmp56_ = self->priv->progress_label;
	gtk_overlay_add_overlay (_tmp55_, (GtkWidget*) _tmp56_);
	_tmp57_ = overlay;
	_tmp58_ = self->priv->media_icon;
	gtk_overlay_add_overlay (_tmp57_, (GtkWidget*) _tmp58_);
	_tmp59_ = overlay;
	_tmp60_ = _g_object_ref0 ((GtkWidget*) _tmp59_);
	_tmp61_ = g_strdup ("");
	_tmp62_ = tuba_dialogs_composer_components_drop_overlay_new ();
	tuba_dialogs_composer_components_drop_overlay_set_compact (_tmp62_, TRUE);
	tuba_dialogs_composer_components_drop_overlay_set_overlay_child (_tmp62_, _tmp60_);
	_g_object_unref0 (_tmp60_);
	tuba_dialogs_composer_components_drop_overlay_set_icon_name (_tmp62_, _tmp61_);
	_g_free0 (_tmp61_);
	g_object_ref_sink (_tmp62_);
	_g_object_unref0 (self->priv->drop_overlay);
	self->priv->drop_overlay = _tmp62_;
	_tmp63_ = self->priv->drop_overlay;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp63_);
	g_object_set ((GtkWidget*) self, "height-request", 120, NULL);
	_tmp64_ = gtk_drag_source_new ();
	gtk_drag_source_set_actions (_tmp64_, GDK_ACTION_MOVE);
	drag_source_controller = _tmp64_;
	_tmp65_ = drag_source_controller;
	g_signal_connect_object (_tmp65_, "prepare", (GCallback) _tuba_dialogs_composer_components_attachment_on_drag_prepare_gtk_drag_source_prepare, self, 0);
	_tmp66_ = drag_source_controller;
	g_signal_connect_object (_tmp66_, "drag-begin", (GCallback) _tuba_dialogs_composer_components_attachment_on_drag_begin_gtk_drag_source_drag_begin, self, 0);
	_tmp67_ = drag_source_controller;
	g_signal_connect_object (_tmp67_, "drag-end", (GCallback) _tuba_dialogs_composer_components_attachment_on_drag_end_gtk_drag_source_drag_end, self, 0);
	_tmp68_ = drag_source_controller;
	g_signal_connect_object (_tmp68_, "drag-cancel", (GCallback) _tuba_dialogs_composer_components_attachment_on_drag_cancel_gtk_drag_source_drag_cancel, self, 0);
	_tmp69_ = drag_source_controller;
	_tmp70_ = _g_object_ref0 ((GtkEventController*) _tmp69_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp70_);
	_tmp71_ = gtk_drop_target_new (TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, GDK_ACTION_MOVE);
	_g_object_unref0 (self->priv->drop_target_controller);
	self->priv->drop_target_controller = _tmp71_;
	_tmp72_ = self->priv->drop_target_controller;
	g_signal_connect_object (_tmp72_, "enter", (GCallback) _tuba_dialogs_composer_components_attachment_on_drop_enter_gtk_drop_target_enter, self, 0);
	_tmp73_ = self->priv->drop_target_controller;
	g_signal_connect_object (_tmp73_, "leave", (GCallback) _tuba_dialogs_composer_components_attachment_on_drop_leave_gtk_drop_target_leave, self, 0);
	_tmp74_ = self->priv->drop_target_controller;
	g_signal_connect_object (_tmp74_, "drop", (GCallback) _tuba_dialogs_composer_components_attachment_on_drop_gtk_drop_target_drop, self, 0);
	_tmp75_ = self->priv->drop_target_controller;
	_tmp76_ = _g_object_ref0 ((GtkEventController*) _tmp75_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp76_);
	_tmp77_ = (AdwPropertyAnimationTarget*) adw_property_animation_target_new ((GObject*) self, "opacity");
	_tmp78_ = (AdwTimedAnimation*) adw_timed_animation_new ((GtkWidget*) self, (gdouble) 0, (gdouble) 1, (guint) 200, (AdwAnimationTarget*) _tmp77_);
	adw_timed_animation_set_easing (_tmp78_, ADW_LINEAR);
	_g_object_unref0 (self->priv->opacity_animation);
	self->priv->opacity_animation = _tmp78_;
	gtk_accessible_update_property ((GtkAccessible*) self, GTK_ACCESSIBLE_PROPERTY_LABEL, _ ("Media Attachment"), -1, -1);
	_g_object_unref0 (drag_source_controller);
	_g_object_unref0 (overlay);
	_g_object_unref0 (default_sm);
	return obj;
}

static void
tuba_dialogs_composer_components_attachment_class_init (TubaDialogsComposerComponentsAttachmentClass * klass,
                                                        gpointer klass_data)
{
	tuba_dialogs_composer_components_attachment_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaDialogsComposerComponentsAttachment_private_offset);
	((GtkWidgetClass *) klass)->snapshot = (void (*) (GtkWidget*, GtkSnapshot*)) tuba_dialogs_composer_components_attachment_real_snapshot;
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_dialogs_composer_components_attachment_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_dialogs_composer_components_attachment_set_property;
	G_OBJECT_CLASS (klass)->constructor = tuba_dialogs_composer_components_attachment_constructor;
	G_OBJECT_CLASS (klass)->finalize = tuba_dialogs_composer_components_attachment_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_KIND_PROPERTY, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_KIND_PROPERTY] = g_param_spec_enum ("kind", "kind", "kind", TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TYPE_MEDIA_TYPE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_UPLOADING_PROPERTY, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_UPLOADING_PROPERTY] = g_param_spec_boolean ("uploading", "uploading", "uploading", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_EDIT_MODE_PROPERTY, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_EDIT_MODE_PROPERTY] = g_param_spec_boolean ("edit-mode", "edit-mode", "edit-mode", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_ID_PROPERTY, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_ID_PROPERTY] = g_param_spec_string ("media-id", "media-id", "media-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_PAINTABLE_PROPERTY, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_PAINTABLE_PROPERTY] = g_param_spec_object ("paintable", "paintable", "paintable", gdk_paintable_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_DONE_PROPERTY, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_DONE_PROPERTY] = g_param_spec_boolean ("done", "done", "done", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_POS_X_PROPERTY, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_POS_X_PROPERTY] = g_param_spec_double ("pos-x", "pos-x", "pos-x", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_POS_Y_PROPERTY, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_POS_Y_PROPERTY] = g_param_spec_double ("pos-y", "pos-y", "pos-y", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_TEXT_PROPERTY, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_TEXT_PROPERTY] = g_param_spec_string ("alt-text", "alt-text", "alt-text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_FILE_PROPERTY, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_FILE_PROPERTY] = g_param_spec_object ("file", "file", "file", g_file_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_PROGRESS_ANIMATION_HACK_PROPERTY, tuba_dialogs_composer_components_attachment_properties[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_PROGRESS_ANIMATION_HACK_PROPERTY] = g_param_spec_double ("progress-animation-hack", "progress-animation-hack", "progress-animation-hack", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_SWITCH_PLACE_SIGNAL] = g_signal_new ("switch-place", TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT);
	tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_DELETE_ME_SIGNAL] = g_signal_new ("delete-me", TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_EDIT_SIGNAL] = g_signal_new ("edit", TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_UPLOAD_ERROR_SIGNAL] = g_signal_new ("upload-error", TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	tuba_dialogs_composer_components_attachment_signals[TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_TOAST_SIGNAL] = g_signal_new ("toast", TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	gtk_widget_class_set_accessible_role (GTK_WIDGET_CLASS (klass), GTK_ACCESSIBLE_ROLE_GROUP);
}

static void
tuba_dialogs_composer_components_attachment_instance_init (TubaDialogsComposerComponentsAttachment * self,
                                                           gpointer klass)
{
	gchar* _tmp0_;
	self->priv = tuba_dialogs_composer_components_attachment_get_instance_private (self);
	self->priv->_kind = TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_TYPE_IMAGE;
	self->priv->_uploading = FALSE;
	self->priv->_edit_mode = FALSE;
	self->priv->_media_id = NULL;
	self->priv->_done = FALSE;
	self->priv->_progress = (gdouble) 0;
	_tmp0_ = g_strdup ("");
	self->priv->_alt_text = _tmp0_;
	self->priv->_file = NULL;
	self->priv->color = (GdkRGBA) {120 / 255.0f, 174 / 255.0f, 237 / 255.0f, 0.5f};
	self->priv->drag_x = (gdouble) 0;
	self->priv->drag_y = (gdouble) 0;
	self->priv->being_dragged = FALSE;
	self->priv->bytes_written = (guint) 0;
	self->priv->total_bytes = (gsize) 0;
}

static void
tuba_dialogs_composer_components_attachment_finalize (GObject * obj)
{
	TubaDialogsComposerComponentsAttachment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, TubaDialogsComposerComponentsAttachment);
	g_debug ("Attachment.vala:9: Destroying Composer Component Attachment");
	_g_free0 (self->priv->_media_id);
	_g_free0 (self->priv->_alt_text);
	_g_object_unref0 (self->priv->_file);
	_g_object_unref0 (self->priv->opacity_animation);
	_g_object_unref0 (self->priv->picture);
	_g_object_unref0 (self->priv->delete_button);
	_g_object_unref0 (self->priv->alt_button);
	_g_object_unref0 (self->priv->alt_indicator);
	_g_object_unref0 (self->priv->custom_thumbnail_button);
	_g_object_unref0 (self->priv->progress_label);
	_g_object_unref0 (self->priv->media_icon);
	_g_object_unref0 (self->priv->animation);
	_g_object_unref0 (self->priv->progress_animation);
	_g_object_unref0 (self->priv->drop_overlay);
	_g_object_unref0 (self->priv->drop_target_controller);
	G_OBJECT_CLASS (tuba_dialogs_composer_components_attachment_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_dialogs_composer_components_attachment_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaDialogsComposerComponentsAttachmentClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_dialogs_composer_components_attachment_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaDialogsComposerComponentsAttachment), 0, (GInstanceInitFunc) tuba_dialogs_composer_components_attachment_instance_init, NULL };
	GType tuba_dialogs_composer_components_attachment_type_id;
	tuba_dialogs_composer_components_attachment_type_id = g_type_register_static (adw_bin_get_type (), "TubaDialogsComposerComponentsAttachment", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaDialogsComposerComponentsAttachment_private_offset = g_type_add_instance_private (tuba_dialogs_composer_components_attachment_type_id, sizeof (TubaDialogsComposerComponentsAttachmentPrivate));
	return tuba_dialogs_composer_components_attachment_type_id;
}

GType
tuba_dialogs_composer_components_attachment_get_type (void)
{
	static GType tuba_dialogs_composer_components_attachment_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_dialogs_composer_components_attachment_type_id__once)) {
		GType tuba_dialogs_composer_components_attachment_type_id;
		tuba_dialogs_composer_components_attachment_type_id = tuba_dialogs_composer_components_attachment_get_type_once ();
		g_once_init_leave_pointer (&tuba_dialogs_composer_components_attachment_type_id__once, tuba_dialogs_composer_components_attachment_type_id);
	}
	return tuba_dialogs_composer_components_attachment_type_id__once;
}

static void
_vala_tuba_dialogs_composer_components_attachment_get_property (GObject * object,
                                                                guint property_id,
                                                                GValue * value,
                                                                GParamSpec * pspec)
{
	TubaDialogsComposerComponentsAttachment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, TubaDialogsComposerComponentsAttachment);
	switch (property_id) {
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_KIND_PROPERTY:
		g_value_set_enum (value, tuba_dialogs_composer_components_attachment_get_kind (self));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_UPLOADING_PROPERTY:
		g_value_set_boolean (value, tuba_dialogs_composer_components_attachment_get_uploading (self));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_EDIT_MODE_PROPERTY:
		g_value_set_boolean (value, tuba_dialogs_composer_components_attachment_get_edit_mode (self));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_ID_PROPERTY:
		g_value_set_string (value, tuba_dialogs_composer_components_attachment_get_media_id (self));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_PAINTABLE_PROPERTY:
		g_value_set_object (value, tuba_dialogs_composer_components_attachment_get_paintable (self));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_DONE_PROPERTY:
		g_value_set_boolean (value, tuba_dialogs_composer_components_attachment_get_done (self));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_POS_X_PROPERTY:
		g_value_set_double (value, tuba_dialogs_composer_components_attachment_get_pos_x (self));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_POS_Y_PROPERTY:
		g_value_set_double (value, tuba_dialogs_composer_components_attachment_get_pos_y (self));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_TEXT_PROPERTY:
		g_value_set_string (value, tuba_dialogs_composer_components_attachment_get_alt_text (self));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_FILE_PROPERTY:
		g_value_set_object (value, tuba_dialogs_composer_components_attachment_get_file (self));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_PROGRESS_ANIMATION_HACK_PROPERTY:
		g_value_set_double (value, tuba_dialogs_composer_components_attachment_get_progress_animation_hack (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_dialogs_composer_components_attachment_set_property (GObject * object,
                                                                guint property_id,
                                                                const GValue * value,
                                                                GParamSpec * pspec)
{
	TubaDialogsComposerComponentsAttachment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_DIALOGS_COMPOSER_COMPONENTS_TYPE_ATTACHMENT, TubaDialogsComposerComponentsAttachment);
	switch (property_id) {
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_KIND_PROPERTY:
		tuba_dialogs_composer_components_attachment_set_kind (self, g_value_get_enum (value));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_UPLOADING_PROPERTY:
		tuba_dialogs_composer_components_attachment_set_uploading (self, g_value_get_boolean (value));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_EDIT_MODE_PROPERTY:
		tuba_dialogs_composer_components_attachment_set_edit_mode (self, g_value_get_boolean (value));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_MEDIA_ID_PROPERTY:
		tuba_dialogs_composer_components_attachment_set_media_id (self, g_value_get_string (value));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_PAINTABLE_PROPERTY:
		tuba_dialogs_composer_components_attachment_set_paintable (self, g_value_get_object (value));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_DONE_PROPERTY:
		tuba_dialogs_composer_components_attachment_set_done (self, g_value_get_boolean (value));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_POS_X_PROPERTY:
		tuba_dialogs_composer_components_attachment_set_pos_x (self, g_value_get_double (value));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_POS_Y_PROPERTY:
		tuba_dialogs_composer_components_attachment_set_pos_y (self, g_value_get_double (value));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_ALT_TEXT_PROPERTY:
		tuba_dialogs_composer_components_attachment_set_alt_text (self, g_value_get_string (value));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_FILE_PROPERTY:
		tuba_dialogs_composer_components_attachment_set_file (self, g_value_get_object (value));
		break;
		case TUBA_DIALOGS_COMPOSER_COMPONENTS_ATTACHMENT_PROGRESS_ANIMATION_HACK_PROPERTY:
		tuba_dialogs_composer_components_attachment_set_progress_animation_hack (self, g_value_get_double (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

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

