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

#include <adwaita.h>
#include <glib-object.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>

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

#define TUBA_WIDGETS_ATTACHMENT_TYPE_ITEM (tuba_widgets_attachment_item_get_type ())
#define TUBA_WIDGETS_ATTACHMENT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_ATTACHMENT_TYPE_ITEM, TubaWidgetsAttachmentItem))
#define TUBA_WIDGETS_ATTACHMENT_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_ATTACHMENT_TYPE_ITEM, TubaWidgetsAttachmentItemClass))
#define TUBA_WIDGETS_ATTACHMENT_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_ATTACHMENT_TYPE_ITEM))
#define TUBA_WIDGETS_ATTACHMENT_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_ATTACHMENT_TYPE_ITEM))
#define TUBA_WIDGETS_ATTACHMENT_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_ATTACHMENT_TYPE_ITEM, TubaWidgetsAttachmentItemClass))

typedef struct _TubaWidgetsAttachmentItem TubaWidgetsAttachmentItem;
typedef struct _TubaWidgetsAttachmentItemClass TubaWidgetsAttachmentItemClass;
typedef struct _TubaWidgetsAttachmentItemPrivate TubaWidgetsAttachmentItemPrivate;

#define TUBA_WIDGETS_ATTACHMENT_TYPE_IMAGE (tuba_widgets_attachment_image_get_type ())
#define TUBA_WIDGETS_ATTACHMENT_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_ATTACHMENT_TYPE_IMAGE, TubaWidgetsAttachmentImage))
#define TUBA_WIDGETS_ATTACHMENT_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_ATTACHMENT_TYPE_IMAGE, TubaWidgetsAttachmentImageClass))
#define TUBA_WIDGETS_ATTACHMENT_IS_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_ATTACHMENT_TYPE_IMAGE))
#define TUBA_WIDGETS_ATTACHMENT_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_ATTACHMENT_TYPE_IMAGE))
#define TUBA_WIDGETS_ATTACHMENT_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_ATTACHMENT_TYPE_IMAGE, TubaWidgetsAttachmentImageClass))

typedef struct _TubaWidgetsAttachmentImage TubaWidgetsAttachmentImage;
typedef struct _TubaWidgetsAttachmentImageClass TubaWidgetsAttachmentImageClass;
typedef struct _TubaWidgetsAttachmentImagePrivate TubaWidgetsAttachmentImagePrivate;

#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;
enum  {
	TUBA_WIDGETS_ATTACHMENT_IMAGE_0_PROPERTY,
	TUBA_WIDGETS_ATTACHMENT_IMAGE_PIC_PROPERTY,
	TUBA_WIDGETS_ATTACHMENT_IMAGE_SPOILER_PROPERTY,
	TUBA_WIDGETS_ATTACHMENT_IMAGE_NUM_PROPERTIES
};
static GParamSpec* tuba_widgets_attachment_image_properties[TUBA_WIDGETS_ATTACHMENT_IMAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#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 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_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;
typedef enum  {
	TUBA_ATTACHMENT_MEDIA_TYPE_IMAGE,
	TUBA_ATTACHMENT_MEDIA_TYPE_VIDEO,
	TUBA_ATTACHMENT_MEDIA_TYPE_GIFV,
	TUBA_ATTACHMENT_MEDIA_TYPE_AUDIO,
	TUBA_ATTACHMENT_MEDIA_TYPE_UNKNOWN
} TubaAttachmentMediaType;

#define TUBA_ATTACHMENT_TYPE_MEDIA_TYPE (tuba_attachment_media_type_get_type ())

#define TUBA_API_ATTACHMENT_TYPE_META (tuba_api_attachment_meta_get_type ())
#define TUBA_API_ATTACHMENT_META(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_ATTACHMENT_TYPE_META, TubaAPIAttachmentMeta))
#define TUBA_API_ATTACHMENT_META_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_ATTACHMENT_TYPE_META, TubaAPIAttachmentMetaClass))
#define TUBA_API_ATTACHMENT_IS_META(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_ATTACHMENT_TYPE_META))
#define TUBA_API_ATTACHMENT_IS_META_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_ATTACHMENT_TYPE_META))
#define TUBA_API_ATTACHMENT_META_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_ATTACHMENT_TYPE_META, TubaAPIAttachmentMetaClass))

typedef struct _TubaAPIAttachmentMeta TubaAPIAttachmentMeta;
typedef struct _TubaAPIAttachmentMetaClass TubaAPIAttachmentMetaClass;

#define TUBA_API_ATTACHMENT_META_TYPE_FOCUS (tuba_api_attachment_meta_focus_get_type ())
#define TUBA_API_ATTACHMENT_META_FOCUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_ATTACHMENT_META_TYPE_FOCUS, TubaAPIAttachmentMetaFocus))
#define TUBA_API_ATTACHMENT_META_FOCUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_ATTACHMENT_META_TYPE_FOCUS, TubaAPIAttachmentMetaFocusClass))
#define TUBA_API_ATTACHMENT_META_IS_FOCUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_ATTACHMENT_META_TYPE_FOCUS))
#define TUBA_API_ATTACHMENT_META_IS_FOCUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_ATTACHMENT_META_TYPE_FOCUS))
#define TUBA_API_ATTACHMENT_META_FOCUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_ATTACHMENT_META_TYPE_FOCUS, TubaAPIAttachmentMetaFocusClass))

typedef struct _TubaAPIAttachmentMetaFocus TubaAPIAttachmentMetaFocus;
typedef struct _TubaAPIAttachmentMetaFocusClass TubaAPIAttachmentMetaFocusClass;
typedef void (*TubaHelperImageOnItemChangedFn) (GdkPaintable* data, gpointer user_data);
#define _g_free0(var) (var = (g_free (var), NULL))

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

typedef struct _TubaApplication TubaApplication;
typedef struct _TubaApplicationClass TubaApplicationClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef enum  {
	TUBA_APPLICATION_QUESTION_ANSWER_YES,
	TUBA_APPLICATION_QUESTION_ANSWER_NO,
	TUBA_APPLICATION_QUESTION_ANSWER_CLOSE
} TubaApplicationQuestionAnswer;

#define TUBA_APPLICATION_TYPE_QUESTION_ANSWER (tuba_application_question_answer_get_type ())

#define TUBA_APPLICATION_TYPE_QUESTION_TEXT (tuba_application_question_text_get_type ())
typedef struct _TubaApplicationQuestionText TubaApplicationQuestionText;

#define TUBA_APPLICATION_TYPE_QUESTION_BUTTONS (tuba_application_question_buttons_get_type ())
typedef struct _TubaApplicationQuestionButtons TubaApplicationQuestionButtons;

#define TUBA_APPLICATION_TYPE_QUESTION_BUTTON (tuba_application_question_button_get_type ())
typedef struct _TubaApplicationQuestionButton TubaApplicationQuestionButton;

#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 _TubaWidgetsAttachmentImageOnRemoteFetchMediaData TubaWidgetsAttachmentImageOnRemoteFetchMediaData;
enum  {
	TUBA_WIDGETS_ATTACHMENT_IMAGE_SPOILER_REVEALED_SIGNAL,
	TUBA_WIDGETS_ATTACHMENT_IMAGE_ON_ANY_ATTACHMENT_CLICK_SIGNAL,
	TUBA_WIDGETS_ATTACHMENT_IMAGE_NUM_SIGNALS
};
static guint tuba_widgets_attachment_image_signals[TUBA_WIDGETS_ATTACHMENT_IMAGE_NUM_SIGNALS] = {0};

struct _TubaWidgetsAttachmentItem {
	AdwBin parent_instance;
	TubaWidgetsAttachmentItemPrivate * priv;
	GtkOverlay* overlay;
	GtkButton* button;
	GtkButton* alt_btn;
	gulong alt_btn_clicked_id;
	GSimpleAction* copy_media_simple_action;
};

struct _TubaWidgetsAttachmentItemClass {
	AdwBinClass parent_class;
	void (*copy_media) (TubaWidgetsAttachmentItem* self);
	void (*on_rebind) (TubaWidgetsAttachmentItem* self);
	void (*on_click) (TubaWidgetsAttachmentItem* self);
	void (*on_secondary_click) (TubaWidgetsAttachmentItem* self, gint n_press, gdouble x, gdouble y);
};

struct _TubaWidgetsAttachmentImage {
	TubaWidgetsAttachmentItem parent_instance;
	TubaWidgetsAttachmentImagePrivate * priv;
	GtkOverlay* media_overlay;
	GtkImage* media_icon;
};

struct _TubaWidgetsAttachmentImageClass {
	TubaWidgetsAttachmentItemClass parent_class;
	void (*on_cache_response) (TubaWidgetsAttachmentImage* self, GdkPaintable* data);
};

struct _TubaWidgetsAttachmentImagePrivate {
	TubaWidgetsFocusPicture* _pic;
	gboolean _spoiler;
	gulong pic_paintable_id;
};

struct _TubaApplicationQuestionText {
	gchar* text;
	gboolean use_markup;
};

struct _TubaApplicationQuestionButton {
	gchar* label;
	AdwResponseAppearance appearance;
};

struct _TubaApplicationQuestionButtons {
	TubaApplicationQuestionButton yes;
	TubaApplicationQuestionButton no;
};

struct _TubaWidgetsAttachmentImageOnRemoteFetchMediaData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TubaWidgetsAttachmentImage* self;
	const gchar* _tmp0_;
	TubaAPIAttachment* _tmp1_;
	TubaAPIAttachment* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	TubaAPIAttachment* _tmp5_;
	TubaAPIAttachment* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	TubaAPIAttachment* _tmp9_;
	TubaAPIAttachment* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gboolean _tmp16_;
	TubaSettings* _tmp17_;
	gboolean _tmp18_;
	gboolean _tmp19_;
	TubaAPIAttachment* _tmp20_;
	TubaAPIAttachment* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	GtkCheckButton* checkbutton;
	gchar* _tmp24_;
	GtkCheckButton* _tmp25_;
	TubaApplicationQuestionAnswer res;
	TubaApplication* _tmp26_;
	TubaApplicationQuestionText _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	TubaApplicationQuestionText _tmp30_;
	TubaApplication* _tmp31_;
	TubaDialogsMainWindow* _tmp32_;
	TubaDialogsMainWindow* _tmp33_;
	TubaApplicationQuestionButtons _tmp34_;
	GtkCheckButton* _tmp35_;
	TubaApplicationQuestionAnswer _tmp36_;
	TubaSettings* _tmp37_;
	TubaSettings* _tmp38_;
	GtkCheckButton* _tmp39_;
	gboolean _tmp40_;
	gboolean _tmp41_;
	TubaSettings* _tmp42_;
	TubaAttachmentMediaType* _tmp43_;
	TubaAPIAttachment* _tmp44_;
	TubaAPIAttachment* _tmp45_;
	const gchar* _tmp46_;
	const gchar* _tmp47_;
	TubaAPIAttachment* _tmp48_;
	TubaAPIAttachment* _tmp49_;
	const gchar* _tmp50_;
	const gchar* _tmp51_;
	TubaAttachmentMediaType* _tmp52_;
	TubaAttachmentMediaType* media_type;
	TubaAttachmentMediaType* _tmp53_;
	gboolean _tmp54_;
	TubaSettings* _tmp55_;
	gboolean _tmp56_;
	gboolean _tmp57_;
	TubaAttachmentMediaType* _tmp58_;
	gboolean stream;
	TubaAttachmentMediaType* _tmp59_;
	TubaAttachmentMediaType _tmp60_;
	TubaApplication* _tmp61_;
	TubaDialogsMainWindow* _tmp62_;
	TubaDialogsMainWindow* _tmp63_;
	TubaAPIAttachment* _tmp64_;
	TubaAPIAttachment* _tmp65_;
	const gchar* _tmp66_;
	const gchar* _tmp67_;
	TubaAttachmentMediaType* _tmp68_;
	TubaAPIAttachment* _tmp69_;
	TubaAPIAttachment* _tmp70_;
	const gchar* _tmp71_;
	const gchar* _tmp72_;
	TubaAPIAttachment* _tmp73_;
	TubaAPIAttachment* _tmp74_;
	const gchar* _tmp75_;
	const gchar* _tmp76_;
};

static gint TubaWidgetsAttachmentImage_private_offset;
static gpointer tuba_widgets_attachment_image_parent_class = NULL;
VALA_EXTERN TubaSettings* tuba_settings;
VALA_EXTERN TubaApplication* tuba_app;

VALA_EXTERN GType tuba_widgets_attachment_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsAttachmentItem, g_object_unref)
VALA_EXTERN GType tuba_widgets_attachment_image_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsAttachmentImage, g_object_unref)
static void tuba_widgets_attachment_image_on_any_attachment_click (TubaWidgetsAttachmentImage* self,
                                                            const gchar* url);
VALA_EXTERN GType tuba_widgets_focus_picture_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsFocusPicture, g_object_unref)
VALA_EXTERN void tuba_widgets_attachment_item_on_rebind (TubaWidgetsAttachmentItem* self);
VALA_EXTERN void tuba_widgets_attachment_item_copy_media (TubaWidgetsAttachmentItem* self);
VALA_EXTERN void tuba_widgets_attachment_image_on_cache_response (TubaWidgetsAttachmentImage* self,
                                                      GdkPaintable* data);
VALA_EXTERN void tuba_widgets_attachment_item_on_click (TubaWidgetsAttachmentItem* self);
static void tuba_widgets_attachment_image_update_pic_content_fit (TubaWidgetsAttachmentImage* self);
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_letterbox_media (TubaSettings* self);
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_attachment_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAttachment, g_object_unref)
VALA_EXTERN TubaAPIAttachment* tuba_widgets_attachment_item_get_entity (TubaWidgetsAttachmentItem* self);
VALA_EXTERN gboolean tuba_api_attachment_get_tuba_is_report (TubaAPIAttachment* self);
VALA_EXTERN TubaWidgetsFocusPicture* tuba_widgets_attachment_image_get_pic (TubaWidgetsAttachmentImage* self);
VALA_EXTERN void tuba_widgets_focus_picture_set_content_fit (TubaWidgetsFocusPicture* self,
                                                 GtkContentFit value);
static void tuba_widgets_attachment_image_real_on_rebind (TubaWidgetsAttachmentItem* base);
VALA_EXTERN void tuba_widgets_focus_picture_set_alternative_text (TubaWidgetsFocusPicture* self,
                                                      const gchar* value);
VALA_EXTERN const gchar* tuba_api_attachment_get_tuba_translated_alt_text (TubaAPIAttachment* self);
VALA_EXTERN const gchar* tuba_api_attachment_get_description (TubaAPIAttachment* self);
VALA_EXTERN GType tuba_attachment_media_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TubaAttachmentMediaType tuba_widgets_attachment_item_get_media_kind (TubaWidgetsAttachmentItem* self);
VALA_EXTERN gboolean tuba_attachment_media_type_is_video (TubaAttachmentMediaType self);
static void tuba_widgets_attachment_image_on_audio_paintable_notify (TubaWidgetsAttachmentImage* self);
static void _tuba_widgets_attachment_image_on_audio_paintable_notify_g_object_notify (GObject* _sender,
                                                                               GParamSpec* pspec,
                                                                               gpointer self);
VALA_EXTERN GType tuba_api_attachment_meta_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAttachmentMeta, g_object_unref)
VALA_EXTERN TubaAPIAttachmentMeta* tuba_api_attachment_get_meta (TubaAPIAttachment* self);
VALA_EXTERN GType tuba_api_attachment_meta_focus_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAttachmentMetaFocus, g_object_unref)
VALA_EXTERN TubaAPIAttachmentMetaFocus* tuba_api_attachment_meta_get_focus (TubaAPIAttachmentMeta* self);
VALA_EXTERN gfloat tuba_api_attachment_meta_focus_get_x (TubaAPIAttachmentMetaFocus* self);
VALA_EXTERN void tuba_widgets_focus_picture_set_focus_x (TubaWidgetsFocusPicture* self,
                                             gdouble value);
VALA_EXTERN gfloat tuba_api_attachment_meta_focus_get_y (TubaAPIAttachmentMetaFocus* self);
VALA_EXTERN void tuba_widgets_focus_picture_set_focus_y (TubaWidgetsFocusPicture* self,
                                             gdouble value);
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);
VALA_EXTERN const gchar* tuba_api_attachment_get_preview_url (TubaAPIAttachment* self);
VALA_EXTERN const gchar* tuba_api_attachment_get_blurhash (TubaAPIAttachment* self);
static void _tuba_widgets_attachment_image_on_cache_response_tuba_helper_image_on_item_changed_fn (GdkPaintable* data,
                                                                                            gpointer self);
VALA_EXTERN gboolean tuba_attachment_media_type_can_copy (TubaAttachmentMediaType self);
VALA_EXTERN GdkPaintable* tuba_widgets_focus_picture_get_paintable (TubaWidgetsFocusPicture* self);
static void tuba_widgets_attachment_image_real_copy_media (TubaWidgetsAttachmentItem* base);
VALA_EXTERN void tuba_utils_host_download (const gchar* url,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_);
VALA_EXTERN gchar* tuba_utils_host_download_finish (GAsyncResult* _res_,
                                        GError** error);
VALA_EXTERN const gchar* tuba_api_attachment_get_url (TubaAPIAttachment* self);
static void __lambda36_ (TubaWidgetsAttachmentImage* self,
                  GObject* obj,
                  GAsyncResult* res);
VALA_EXTERN GType tuba_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaApplication, g_object_unref)
static void ___lambda36__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void tuba_widgets_attachment_image_real_on_cache_response (TubaWidgetsAttachmentImage* self,
                                                           GdkPaintable* data);
VALA_EXTERN void tuba_widgets_focus_picture_set_paintable (TubaWidgetsFocusPicture* self,
                                               GdkPaintable* value);
static void tuba_widgets_attachment_image_real_on_click (TubaWidgetsAttachmentItem* base);
VALA_EXTERN gboolean tuba_widgets_focus_picture_get_spoilered (TubaWidgetsFocusPicture* self);
static void tuba_widgets_attachment_image_on_remote_fetch_media (TubaWidgetsAttachmentImage* self,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_);
static void tuba_widgets_attachment_image_on_remote_fetch_media_finish (TubaWidgetsAttachmentImage* self,
                                                                 GAsyncResult* _res_);
static void tuba_widgets_attachment_image_on_remote_fetch_media_data_free (gpointer _data);
static gboolean tuba_widgets_attachment_image_on_remote_fetch_media_co (TubaWidgetsAttachmentImageOnRemoteFetchMediaData* _data_);
VALA_EXTERN const gchar* tuba_api_attachment_get_remote_url (TubaAPIAttachment* self);
VALA_EXTERN gboolean tuba_settings_get_fetch_remote_media_reminder (TubaSettings* self);
VALA_EXTERN GType tuba_application_question_answer_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType tuba_application_question_text_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TubaApplicationQuestionText* tuba_application_question_text_dup (const TubaApplicationQuestionText* self);
VALA_EXTERN void tuba_application_question_text_free (TubaApplicationQuestionText* self);
VALA_EXTERN void tuba_application_question_text_copy (const TubaApplicationQuestionText* self,
                                          TubaApplicationQuestionText* dest);
VALA_EXTERN void tuba_application_question_text_destroy (TubaApplicationQuestionText* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (TubaApplicationQuestionText, tuba_application_question_text_destroy)
VALA_EXTERN GType tuba_application_question_buttons_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType tuba_application_question_button_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TubaApplicationQuestionButton* tuba_application_question_button_dup (const TubaApplicationQuestionButton* self);
VALA_EXTERN void tuba_application_question_button_free (TubaApplicationQuestionButton* self);
VALA_EXTERN void tuba_application_question_button_copy (const TubaApplicationQuestionButton* self,
                                            TubaApplicationQuestionButton* dest);
VALA_EXTERN void tuba_application_question_button_destroy (TubaApplicationQuestionButton* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (TubaApplicationQuestionButton, tuba_application_question_button_destroy)
VALA_EXTERN TubaApplicationQuestionButtons* tuba_application_question_buttons_dup (const TubaApplicationQuestionButtons* self);
VALA_EXTERN void tuba_application_question_buttons_free (TubaApplicationQuestionButtons* self);
VALA_EXTERN void tuba_application_question_buttons_copy (const TubaApplicationQuestionButtons* self,
                                             TubaApplicationQuestionButtons* dest);
VALA_EXTERN void tuba_application_question_buttons_destroy (TubaApplicationQuestionButtons* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (TubaApplicationQuestionButtons, tuba_application_question_buttons_destroy)
VALA_EXTERN void tuba_application_question (TubaApplication* self,
                                TubaApplicationQuestionText* title,
                                TubaApplicationQuestionText* msg,
                                GtkWidget* win,
                                TubaApplicationQuestionButtons* buttons,
                                GtkWidget* child,
                                gboolean skip,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN TubaApplicationQuestionAnswer tuba_application_question_finish (TubaApplication* self,
                                                                GAsyncResult* _res_);
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_widgets_attachment_image_on_remote_fetch_media_ready (GObject* source_object,
                                                                GAsyncResult* _res_,
                                                                gpointer _user_data_);
VALA_EXTERN void tuba_settings_set_fetch_remote_media_default (TubaSettings* self,
                                                   gboolean value);
VALA_EXTERN void tuba_settings_set_fetch_remote_media_reminder (TubaSettings* self,
                                                    gboolean value);
static TubaAttachmentMediaType* tuba_widgets_attachment_image_media_type_from_url (TubaWidgetsAttachmentImage* self,
                                                                            const gchar* url);
VALA_EXTERN gboolean tuba_settings_get_fetch_remote_media_default (TubaSettings* self);
static gboolean _tuba_attachment_media_type_equal (const TubaAttachmentMediaType * s1,
                                            const TubaAttachmentMediaType * s2);
VALA_EXTERN void tuba_dialogs_main_window_show_media_viewer (TubaDialogsMainWindow* self,
                                                 const gchar* url,
                                                 TubaAttachmentMediaType media_type,
                                                 GdkPaintable* preview,
                                                 GtkWidget* source_widget,
                                                 gboolean as_is,
                                                 const gchar* alt_text,
                                                 const gchar* user_friendly_url,
                                                 const gchar* blurhash,
                                                 gboolean stream,
                                                 gboolean* load_and_scroll,
                                                 gboolean reveal_media_viewer);
static TubaAttachmentMediaType* _tuba_attachment_media_type_dup (TubaAttachmentMediaType* self);
VALA_EXTERN TubaWidgetsAttachmentImage* tuba_widgets_attachment_image_new (void);
VALA_EXTERN TubaWidgetsAttachmentImage* tuba_widgets_attachment_image_construct (GType object_type);
VALA_EXTERN TubaWidgetsAttachmentItem* tuba_widgets_attachment_item_new (void);
VALA_EXTERN TubaWidgetsAttachmentItem* tuba_widgets_attachment_item_construct (GType object_type);
static void tuba_widgets_attachment_image_set_pic (TubaWidgetsAttachmentImage* self,
                                            TubaWidgetsFocusPicture* value);
VALA_EXTERN gboolean tuba_widgets_attachment_image_get_spoiler (TubaWidgetsAttachmentImage* self);
VALA_EXTERN void tuba_widgets_attachment_image_set_spoiler (TubaWidgetsAttachmentImage* self,
                                                gboolean value);
VALA_EXTERN void tuba_widgets_focus_picture_set_spoilered (TubaWidgetsFocusPicture* self,
                                               gboolean value);
static GObject * tuba_widgets_attachment_image_constructor (GType type,
                                                     guint n_construct_properties,
                                                     GObjectConstructParam * construct_properties);
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);
static void _tuba_widgets_attachment_image_update_pic_content_fit_g_object_notify (GObject* _sender,
                                                                            GParamSpec* pspec,
                                                                            gpointer self);
static void tuba_widgets_attachment_image_finalize (GObject * obj);
static GType tuba_widgets_attachment_image_get_type_once (void);
static void _vala_tuba_widgets_attachment_image_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec);
static void _vala_tuba_widgets_attachment_image_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
tuba_widgets_attachment_image_get_instance_private (TubaWidgetsAttachmentImage* self)
{
	return G_STRUCT_MEMBER_P (self, TubaWidgetsAttachmentImage_private_offset);
}

static void
tuba_widgets_attachment_image_update_pic_content_fit (TubaWidgetsAttachmentImage* self)
{
	GtkContentFit _tmp0_ = 0;
	gboolean _tmp1_ = FALSE;
	TubaSettings* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	TubaWidgetsFocusPicture* _tmp12_;
	g_return_if_fail (self != NULL);
	_tmp2_ = tuba_settings;
	_tmp3_ = tuba_settings_get_letterbox_media (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		_tmp1_ = TRUE;
	} else {
		gboolean _tmp5_ = FALSE;
		TubaAPIAttachment* _tmp6_;
		TubaAPIAttachment* _tmp7_;
		_tmp6_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
		_tmp7_ = _tmp6_;
		if (_tmp7_ != NULL) {
			TubaAPIAttachment* _tmp8_;
			TubaAPIAttachment* _tmp9_;
			gboolean _tmp10_;
			gboolean _tmp11_;
			_tmp8_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
			_tmp9_ = _tmp8_;
			_tmp10_ = tuba_api_attachment_get_tuba_is_report (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp5_ = _tmp11_;
		} else {
			_tmp5_ = FALSE;
		}
		_tmp1_ = _tmp5_;
	}
	if (_tmp1_) {
		_tmp0_ = GTK_CONTENT_FIT_CONTAIN;
	} else {
		_tmp0_ = GTK_CONTENT_FIT_COVER;
	}
	_tmp12_ = self->priv->_pic;
	tuba_widgets_focus_picture_set_content_fit (_tmp12_, _tmp0_);
}

static void
_tuba_widgets_attachment_image_on_audio_paintable_notify_g_object_notify (GObject* _sender,
                                                                          GParamSpec* pspec,
                                                                          gpointer self)
{
	tuba_widgets_attachment_image_on_audio_paintable_notify ((TubaWidgetsAttachmentImage*) self);
}

static void
_tuba_widgets_attachment_image_on_cache_response_tuba_helper_image_on_item_changed_fn (GdkPaintable* data,
                                                                                       gpointer self)
{
	tuba_widgets_attachment_image_on_cache_response ((TubaWidgetsAttachmentImage*) self, data);
}

static void
tuba_widgets_attachment_image_real_on_rebind (TubaWidgetsAttachmentItem* base)
{
	TubaWidgetsAttachmentImage * self;
	TubaAPIAttachment* _tmp0_;
	TubaAPIAttachment* _tmp1_;
	gboolean _tmp18_ = FALSE;
	TubaAttachmentMediaType _tmp19_;
	TubaAttachmentMediaType _tmp20_;
	gboolean _tmp42_ = FALSE;
	TubaAPIAttachment* _tmp43_;
	TubaAPIAttachment* _tmp44_;
	TubaAPIAttachmentMeta* _tmp45_;
	TubaAPIAttachmentMeta* _tmp46_;
	gboolean _tmp71_ = FALSE;
	TubaAPIAttachment* _tmp72_;
	TubaAPIAttachment* _tmp73_;
	TubaAPIAttachment* _tmp78_;
	TubaAPIAttachment* _tmp79_;
	const gchar* _tmp80_;
	const gchar* _tmp81_;
	TubaAPIAttachment* _tmp82_;
	TubaAPIAttachment* _tmp83_;
	const gchar* _tmp84_;
	const gchar* _tmp85_;
	GSimpleAction* _tmp86_;
	TubaAttachmentMediaType _tmp87_;
	TubaAttachmentMediaType _tmp88_;
	self = (TubaWidgetsAttachmentImage*) base;
	TUBA_WIDGETS_ATTACHMENT_ITEM_CLASS (tuba_widgets_attachment_image_parent_class)->on_rebind (G_TYPE_CHECK_INSTANCE_CAST (self, TUBA_WIDGETS_ATTACHMENT_TYPE_ITEM, TubaWidgetsAttachmentItem));
	tuba_widgets_attachment_image_update_pic_content_fit (self);
	_tmp0_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		TubaWidgetsFocusPicture* _tmp2_;
		_tmp2_ = self->priv->_pic;
		tuba_widgets_focus_picture_set_alternative_text (_tmp2_, NULL);
	} else {
		TubaAPIAttachment* _tmp3_;
		TubaAPIAttachment* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		_tmp3_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
		_tmp4_ = _tmp3_;
		_tmp5_ = tuba_api_attachment_get_tuba_translated_alt_text (_tmp4_);
		_tmp6_ = _tmp5_;
		if (_tmp6_ != NULL) {
			TubaWidgetsFocusPicture* _tmp7_;
			TubaAPIAttachment* _tmp8_;
			TubaAPIAttachment* _tmp9_;
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			_tmp7_ = self->priv->_pic;
			_tmp8_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
			_tmp9_ = _tmp8_;
			_tmp10_ = tuba_api_attachment_get_tuba_translated_alt_text (_tmp9_);
			_tmp11_ = _tmp10_;
			tuba_widgets_focus_picture_set_alternative_text (_tmp7_, _tmp11_);
		} else {
			TubaWidgetsFocusPicture* _tmp12_;
			TubaAPIAttachment* _tmp13_;
			TubaAPIAttachment* _tmp14_;
			const gchar* _tmp15_;
			const gchar* _tmp16_;
			_tmp12_ = self->priv->_pic;
			_tmp13_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
			_tmp14_ = _tmp13_;
			_tmp15_ = tuba_api_attachment_get_description (_tmp14_);
			_tmp16_ = _tmp15_;
			tuba_widgets_focus_picture_set_alternative_text (_tmp12_, _tmp16_);
		}
	}
	if (self->priv->pic_paintable_id != ((gulong) 0)) {
		TubaWidgetsFocusPicture* _tmp17_;
		_tmp17_ = self->priv->_pic;
		g_signal_handler_disconnect ((GObject*) _tmp17_, self->priv->pic_paintable_id);
		self->priv->pic_paintable_id = (gulong) 0;
	}
	_tmp19_ = tuba_widgets_attachment_item_get_media_kind ((TubaWidgetsAttachmentItem*) self);
	_tmp20_ = _tmp19_;
	if (tuba_attachment_media_type_is_video (_tmp20_)) {
		_tmp18_ = TRUE;
	} else {
		TubaAttachmentMediaType _tmp21_;
		TubaAttachmentMediaType _tmp22_;
		_tmp21_ = tuba_widgets_attachment_item_get_media_kind ((TubaWidgetsAttachmentItem*) self);
		_tmp22_ = _tmp21_;
		_tmp18_ = _tmp22_ == TUBA_ATTACHMENT_MEDIA_TYPE_UNKNOWN;
	}
	if (_tmp18_) {
		GtkImage* _tmp23_ = NULL;
		TubaAttachmentMediaType _tmp24_;
		TubaAttachmentMediaType _tmp25_;
		GtkOverlay* _tmp39_;
		GtkImage* _tmp40_;
		GtkImage* _tmp41_;
		_tmp23_ = (GtkImage*) gtk_image_new ();
		gtk_widget_set_valign ((GtkWidget*) _tmp23_, GTK_ALIGN_CENTER);
		gtk_widget_set_halign ((GtkWidget*) _tmp23_, GTK_ALIGN_CENTER);
		g_object_ref_sink (_tmp23_);
		_g_object_unref0 (self->media_icon);
		self->media_icon = _tmp23_;
		_tmp24_ = tuba_widgets_attachment_item_get_media_kind ((TubaWidgetsAttachmentItem*) self);
		_tmp25_ = _tmp24_;
		if (_tmp25_ == TUBA_ATTACHMENT_MEDIA_TYPE_UNKNOWN) {
			GtkImage* _tmp26_;
			_tmp26_ = self->media_icon;
			g_object_set (_tmp26_, "icon-name", "tuba-paper-symbolic", NULL);
		} else {
			TubaAttachmentMediaType _tmp27_;
			TubaAttachmentMediaType _tmp28_;
			_tmp27_ = tuba_widgets_attachment_item_get_media_kind ((TubaWidgetsAttachmentItem*) self);
			_tmp28_ = _tmp27_;
			if (_tmp28_ != TUBA_ATTACHMENT_MEDIA_TYPE_AUDIO) {
				GtkImage* _tmp29_;
				gchar* _tmp30_;
				gchar* _tmp31_;
				gchar* _tmp32_;
				gchar** _tmp33_;
				gchar** _tmp34_;
				gint _tmp34__length1;
				GtkImage* _tmp35_;
				_tmp29_ = self->media_icon;
				_tmp30_ = g_strdup ("osd");
				_tmp31_ = g_strdup ("tuba-circular");
				_tmp32_ = g_strdup ("min-size-64");
				_tmp33_ = g_new0 (gchar*, 3 + 1);
				_tmp33_[0] = _tmp30_;
				_tmp33_[1] = _tmp31_;
				_tmp33_[2] = _tmp32_;
				_tmp34_ = _tmp33_;
				_tmp34__length1 = 3;
				gtk_widget_set_css_classes ((GtkWidget*) _tmp29_, _tmp34_);
				_tmp34_ = (_vala_array_free (_tmp34_, _tmp34__length1, (GDestroyNotify) g_free), NULL);
				_tmp35_ = self->media_icon;
				g_object_set (_tmp35_, "icon-name", "media-playback-start-symbolic", NULL);
			} else {
				TubaWidgetsFocusPicture* _tmp36_;
				gulong _tmp37_;
				GtkImage* _tmp38_;
				_tmp36_ = self->priv->_pic;
				_tmp37_ = g_signal_connect_object ((GObject*) _tmp36_, "notify::paintable", (GCallback) _tuba_widgets_attachment_image_on_audio_paintable_notify_g_object_notify, self, 0);
				self->priv->pic_paintable_id = _tmp37_;
				_tmp38_ = self->media_icon;
				g_object_set (_tmp38_, "icon-name", "tuba-music-note-symbolic", NULL);
			}
		}
		_tmp39_ = self->media_overlay;
		_tmp40_ = self->media_icon;
		gtk_overlay_add_overlay (_tmp39_, (GtkWidget*) _tmp40_);
		_tmp41_ = self->media_icon;
		gtk_image_set_icon_size (_tmp41_, GTK_ICON_SIZE_LARGE);
	}
	_tmp43_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
	_tmp44_ = _tmp43_;
	_tmp45_ = tuba_api_attachment_get_meta (_tmp44_);
	_tmp46_ = _tmp45_;
	if (_tmp46_ != NULL) {
		TubaAPIAttachment* _tmp47_;
		TubaAPIAttachment* _tmp48_;
		TubaAPIAttachmentMeta* _tmp49_;
		TubaAPIAttachmentMeta* _tmp50_;
		TubaAPIAttachmentMetaFocus* _tmp51_;
		TubaAPIAttachmentMetaFocus* _tmp52_;
		_tmp47_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
		_tmp48_ = _tmp47_;
		_tmp49_ = tuba_api_attachment_get_meta (_tmp48_);
		_tmp50_ = _tmp49_;
		_tmp51_ = tuba_api_attachment_meta_get_focus (_tmp50_);
		_tmp52_ = _tmp51_;
		_tmp42_ = _tmp52_ != NULL;
	} else {
		_tmp42_ = FALSE;
	}
	if (_tmp42_) {
		TubaWidgetsFocusPicture* _tmp53_;
		TubaAPIAttachment* _tmp54_;
		TubaAPIAttachment* _tmp55_;
		TubaAPIAttachmentMeta* _tmp56_;
		TubaAPIAttachmentMeta* _tmp57_;
		TubaAPIAttachmentMetaFocus* _tmp58_;
		TubaAPIAttachmentMetaFocus* _tmp59_;
		gfloat _tmp60_;
		gfloat _tmp61_;
		TubaWidgetsFocusPicture* _tmp62_;
		TubaAPIAttachment* _tmp63_;
		TubaAPIAttachment* _tmp64_;
		TubaAPIAttachmentMeta* _tmp65_;
		TubaAPIAttachmentMeta* _tmp66_;
		TubaAPIAttachmentMetaFocus* _tmp67_;
		TubaAPIAttachmentMetaFocus* _tmp68_;
		gfloat _tmp69_;
		gfloat _tmp70_;
		_tmp53_ = self->priv->_pic;
		_tmp54_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
		_tmp55_ = _tmp54_;
		_tmp56_ = tuba_api_attachment_get_meta (_tmp55_);
		_tmp57_ = _tmp56_;
		_tmp58_ = tuba_api_attachment_meta_get_focus (_tmp57_);
		_tmp59_ = _tmp58_;
		_tmp60_ = tuba_api_attachment_meta_focus_get_x (_tmp59_);
		_tmp61_ = _tmp60_;
		tuba_widgets_focus_picture_set_focus_x (_tmp53_, (gdouble) _tmp61_);
		_tmp62_ = self->priv->_pic;
		_tmp63_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
		_tmp64_ = _tmp63_;
		_tmp65_ = tuba_api_attachment_get_meta (_tmp64_);
		_tmp66_ = _tmp65_;
		_tmp67_ = tuba_api_attachment_meta_get_focus (_tmp66_);
		_tmp68_ = _tmp67_;
		_tmp69_ = tuba_api_attachment_meta_focus_get_y (_tmp68_);
		_tmp70_ = _tmp69_;
		tuba_widgets_focus_picture_set_focus_y (_tmp62_, (gdouble) _tmp70_);
	}
	_tmp72_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
	_tmp73_ = _tmp72_;
	if (_tmp73_ != NULL) {
		TubaAPIAttachment* _tmp74_;
		TubaAPIAttachment* _tmp75_;
		gboolean _tmp76_;
		gboolean _tmp77_;
		_tmp74_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
		_tmp75_ = _tmp74_;
		_tmp76_ = tuba_api_attachment_get_tuba_is_report (_tmp75_);
		_tmp77_ = _tmp76_;
		_tmp71_ = _tmp77_;
	} else {
		_tmp71_ = FALSE;
	}
	_tmp78_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
	_tmp79_ = _tmp78_;
	_tmp80_ = tuba_api_attachment_get_preview_url (_tmp79_);
	_tmp81_ = _tmp80_;
	_tmp82_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
	_tmp83_ = _tmp82_;
	_tmp84_ = tuba_api_attachment_get_blurhash (_tmp83_);
	_tmp85_ = _tmp84_;
	tuba_helper_image_request_paintable (_tmp81_, _tmp85_, _tmp71_, _tuba_widgets_attachment_image_on_cache_response_tuba_helper_image_on_item_changed_fn, g_object_ref (self), g_object_unref, NULL);
	_tmp86_ = ((TubaWidgetsAttachmentItem*) self)->copy_media_simple_action;
	_tmp87_ = tuba_widgets_attachment_item_get_media_kind ((TubaWidgetsAttachmentItem*) self);
	_tmp88_ = _tmp87_;
	g_simple_action_set_enabled (_tmp86_, tuba_attachment_media_type_can_copy (_tmp88_));
}

static void
tuba_widgets_attachment_image_on_audio_paintable_notify (TubaWidgetsAttachmentImage* self)
{
	GtkImage* _tmp0_;
	GtkImage* _tmp1_;
	TubaWidgetsFocusPicture* _tmp2_;
	GdkPaintable* _tmp3_;
	GdkPaintable* _tmp4_;
	GtkImage* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->media_icon;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->media_icon;
	gtk_image_set_icon_size (_tmp1_, GTK_ICON_SIZE_NORMAL);
	_tmp2_ = self->priv->_pic;
	_tmp3_ = tuba_widgets_focus_picture_get_paintable (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ == NULL) {
		GtkImage* _tmp5_;
		gchar** _tmp6_;
		gchar** _tmp7_;
		gint _tmp7__length1;
		_tmp5_ = self->media_icon;
		_tmp6_ = g_new0 (gchar*, 0 + 1);
		_tmp7_ = _tmp6_;
		_tmp7__length1 = 0;
		gtk_widget_set_css_classes ((GtkWidget*) _tmp5_, _tmp7_);
		_tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL);
	} else {
		GtkImage* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		gchar** _tmp12_;
		gchar** _tmp13_;
		gint _tmp13__length1;
		_tmp8_ = self->media_icon;
		_tmp9_ = g_strdup ("osd");
		_tmp10_ = g_strdup ("tuba-circular");
		_tmp11_ = g_strdup ("min-size-64");
		_tmp12_ = g_new0 (gchar*, 3 + 1);
		_tmp12_[0] = _tmp9_;
		_tmp12_[1] = _tmp10_;
		_tmp12_[2] = _tmp11_;
		_tmp13_ = _tmp12_;
		_tmp13__length1 = 3;
		gtk_widget_set_css_classes ((GtkWidget*) _tmp8_, _tmp13_);
		_tmp13_ = (_vala_array_free (_tmp13_, _tmp13__length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp14_ = self->media_icon;
	gtk_image_set_icon_size (_tmp14_, GTK_ICON_SIZE_LARGE);
}

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

static void
__lambda36_ (TubaWidgetsAttachmentImage* self,
             GObject* obj,
             GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		gchar* path = NULL;
		gchar* _tmp0_;
		GdkTexture* texture = NULL;
		const gchar* _tmp1_;
		GdkTexture* _tmp2_;
		GdkTexture* _tmp3_;
		GdkClipboard* clipboard = NULL;
		GdkDisplay* _tmp4_;
		GdkClipboard* _tmp5_;
		GdkClipboard* _tmp6_;
		GdkClipboard* _tmp7_;
		GdkTexture* _tmp8_;
		TubaApplication* _tmp9_;
		_tmp0_ = tuba_utils_host_download_finish (res, &_inner_error0_);
		path = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp1_ = path;
		_tmp2_ = gdk_texture_new_from_filename (_tmp1_, &_inner_error0_);
		texture = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (path);
			goto __catch0_g_error;
		}
		_tmp3_ = texture;
		if (_tmp3_ == NULL) {
			_g_object_unref0 (texture);
			_g_free0 (path);
			return;
		}
		_tmp4_ = gdk_display_get_default ();
		_tmp5_ = gdk_display_get_clipboard (_tmp4_);
		_tmp6_ = _g_object_ref0 (_tmp5_);
		clipboard = _tmp6_;
		_tmp7_ = clipboard;
		_tmp8_ = texture;
		gdk_clipboard_set_texture (_tmp7_, _tmp8_);
		_tmp9_ = tuba_app;
		g_signal_emit_by_name (_tmp9_, "toast", _ ("Copied image to clipboard"), (guint) 5, NULL, NULL, NULL);
		_g_object_unref0 (clipboard);
		_g_object_unref0 (texture);
		_g_free0 (path);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		TubaApplication* _tmp10_;
		GError* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp10_ = tuba_app;
		_tmp11_ = e;
		_tmp12_ = _tmp11_->message;
		_tmp13_ = g_strdup_printf ("%s: %s", _ ("Error"), _tmp12_);
		_tmp14_ = _tmp13_;
		g_signal_emit_by_name (_tmp10_, "toast", _tmp14_, (guint) 5, NULL, NULL, NULL);
		_g_free0 (_tmp14_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	g_debug ("Image.vala:120: End copy-media action");
}

static void
___lambda36__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda36_ ((TubaWidgetsAttachmentImage*) self, source_object, res);
	g_object_unref (self);
}

static void
tuba_widgets_attachment_image_real_copy_media (TubaWidgetsAttachmentItem* base)
{
	TubaWidgetsAttachmentImage * self;
	TubaAPIAttachment* _tmp0_;
	TubaAPIAttachment* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	self = (TubaWidgetsAttachmentImage*) base;
	g_debug ("Image.vala:104: Begin copy-media action");
	_tmp0_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = tuba_api_attachment_get_url (_tmp1_);
	_tmp3_ = _tmp2_;
	tuba_utils_host_download (_tmp3_, ___lambda36__gasync_ready_callback, g_object_ref (self));
}

static void
tuba_widgets_attachment_image_real_on_cache_response (TubaWidgetsAttachmentImage* self,
                                                      GdkPaintable* data)
{
	TubaWidgetsFocusPicture* _tmp0_;
	_tmp0_ = self->priv->_pic;
	tuba_widgets_focus_picture_set_paintable (_tmp0_, data);
}

void
tuba_widgets_attachment_image_on_cache_response (TubaWidgetsAttachmentImage* self,
                                                 GdkPaintable* data)
{
	TubaWidgetsAttachmentImageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = TUBA_WIDGETS_ATTACHMENT_IMAGE_GET_CLASS (self);
	if (_klass_->on_cache_response) {
		_klass_->on_cache_response (self, data);
	}
}

static void
tuba_widgets_attachment_image_real_on_click (TubaWidgetsAttachmentItem* base)
{
	TubaWidgetsAttachmentImage * self;
	TubaWidgetsFocusPicture* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	TubaAttachmentMediaType _tmp3_;
	TubaAttachmentMediaType _tmp4_;
	self = (TubaWidgetsAttachmentImage*) base;
	_tmp0_ = self->priv->_pic;
	_tmp1_ = tuba_widgets_focus_picture_get_spoilered (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		g_signal_emit (self, tuba_widgets_attachment_image_signals[TUBA_WIDGETS_ATTACHMENT_IMAGE_SPOILER_REVEALED_SIGNAL], 0);
		return;
	}
	_tmp3_ = tuba_widgets_attachment_item_get_media_kind ((TubaWidgetsAttachmentItem*) self);
	_tmp4_ = _tmp3_;
	if (_tmp4_ != TUBA_ATTACHMENT_MEDIA_TYPE_UNKNOWN) {
		TubaAPIAttachment* _tmp5_;
		TubaAPIAttachment* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		_tmp5_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) self);
		_tmp6_ = _tmp5_;
		_tmp7_ = tuba_api_attachment_get_url (_tmp6_);
		_tmp8_ = _tmp7_;
		g_signal_emit (self, tuba_widgets_attachment_image_signals[TUBA_WIDGETS_ATTACHMENT_IMAGE_ON_ANY_ATTACHMENT_CLICK_SIGNAL], 0, _tmp8_);
	} else {
		tuba_widgets_attachment_image_on_remote_fetch_media (self, NULL, NULL);
	}
}

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

static void
tuba_widgets_attachment_image_on_remote_fetch_media (TubaWidgetsAttachmentImage* self,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_)
{
	TubaWidgetsAttachmentImageOnRemoteFetchMediaData* _data_;
	TubaWidgetsAttachmentImage* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TubaWidgetsAttachmentImageOnRemoteFetchMediaData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_widgets_attachment_image_on_remote_fetch_media_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tuba_widgets_attachment_image_on_remote_fetch_media_co (_data_);
}

static void
tuba_widgets_attachment_image_on_remote_fetch_media_finish (TubaWidgetsAttachmentImage* self,
                                                            GAsyncResult* _res_)
{
	TubaWidgetsAttachmentImageOnRemoteFetchMediaData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

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

static void
tuba_widgets_attachment_image_on_remote_fetch_media_ready (GObject* source_object,
                                                           GAsyncResult* _res_,
                                                           gpointer _user_data_)
{
	TubaWidgetsAttachmentImageOnRemoteFetchMediaData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_widgets_attachment_image_on_remote_fetch_media_co (_data_);
}

static gboolean
_tuba_attachment_media_type_equal (const TubaAttachmentMediaType * s1,
                                   const TubaAttachmentMediaType * s2)
{
	if (s1 == s2) {
		return TRUE;
	}
	if (s1 == NULL) {
		return FALSE;
	}
	if (s2 == NULL) {
		return FALSE;
	}
	return (*s1) == (*s2);
}

static gboolean
tuba_widgets_attachment_image_on_remote_fetch_media_co (TubaWidgetsAttachmentImageOnRemoteFetchMediaData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) _data_->self);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = tuba_api_attachment_get_remote_url (_data_->_tmp2_);
	_data_->_tmp4_ = _data_->_tmp3_;
	if (_data_->_tmp4_ == NULL) {
		_data_->_tmp5_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) _data_->self);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp7_ = tuba_api_attachment_get_url (_data_->_tmp6_);
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_tmp0_ = _data_->_tmp8_;
	} else {
		_data_->_tmp9_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) _data_->self);
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp11_ = tuba_api_attachment_get_remote_url (_data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_tmp0_ = _data_->_tmp12_;
	}
	_data_->_tmp13_ = string_to_string (_data_->_tmp0_);
	_data_->_tmp14_ = g_strconcat ("Loading remote media ", _data_->_tmp13_, NULL);
	_data_->_tmp15_ = _data_->_tmp14_;
	g_debug ("Image.vala:143: %s", _data_->_tmp15_);
	_g_free0 (_data_->_tmp15_);
	_data_->_tmp17_ = tuba_settings;
	_data_->_tmp18_ = tuba_settings_get_fetch_remote_media_reminder (_data_->_tmp17_);
	_data_->_tmp19_ = _data_->_tmp18_;
	if (_data_->_tmp19_) {
		_data_->_tmp20_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) _data_->self);
		_data_->_tmp21_ = _data_->_tmp20_;
		_data_->_tmp22_ = tuba_api_attachment_get_remote_url (_data_->_tmp21_);
		_data_->_tmp23_ = _data_->_tmp22_;
		_data_->_tmp16_ = _data_->_tmp23_ != NULL;
	} else {
		_data_->_tmp16_ = FALSE;
	}
	if (_data_->_tmp16_) {
		_data_->_tmp24_ = g_strdup (_ ("Don't remind me again"));
		_data_->_tmp25_ = NULL;
		_data_->_tmp25_ = (GtkCheckButton*) gtk_check_button_new ();
		gtk_check_button_set_label (_data_->_tmp25_, _data_->_tmp24_);
		_g_free0 (_data_->_tmp24_);
		gtk_widget_set_halign ((GtkWidget*) _data_->_tmp25_, GTK_ALIGN_CENTER);
		g_object_ref_sink (_data_->_tmp25_);
		_data_->checkbutton = _data_->_tmp25_;
		_data_->_tmp26_ = tuba_app;
		memset (&_data_->_tmp27_, 0, sizeof (TubaApplicationQuestionText));
		_g_free0 (_data_->_tmp27_.text);
		_data_->_tmp27_.text = "Load remote media?";
		_data_->_tmp27_.use_markup = FALSE;
		_data_->_tmp28_ = g_strdup_printf (_ ("Your instance hasn't proxied or can't handle this attachment. %s can f" \
"etch it directly from the remote instance however."), BUILD_NAME);
		_data_->_tmp29_ = _data_->_tmp28_;
		memset (&_data_->_tmp30_, 0, sizeof (TubaApplicationQuestionText));
		_g_free0 (_data_->_tmp30_.text);
		_data_->_tmp30_.text = _data_->_tmp29_;
		_data_->_tmp30_.use_markup = FALSE;
		_data_->_tmp31_ = tuba_app;
		_data_->_tmp32_ = tuba_application_get_main_window (_data_->_tmp31_);
		_data_->_tmp33_ = _data_->_tmp32_;
		memset (&_data_->_tmp34_, 0, sizeof (TubaApplicationQuestionButtons));
		tuba_application_question_button_destroy (&_data_->_tmp34_.yes);
		_data_->_tmp34_.yes = (TubaApplicationQuestionButton) {"Load", ADW_RESPONSE_SUGGESTED};
		tuba_application_question_button_destroy (&_data_->_tmp34_.no);
		_data_->_tmp34_.no = (TubaApplicationQuestionButton) {_ ("Cancel"), ADW_RESPONSE_DEFAULT};
		_data_->_tmp35_ = _data_->checkbutton;
		_data_->_state_ = 1;
		tuba_application_question (_data_->_tmp26_, &_data_->_tmp27_, &_data_->_tmp30_, (GtkWidget*) _data_->_tmp33_, &_data_->_tmp34_, (GtkWidget*) _data_->_tmp35_, FALSE, tuba_widgets_attachment_image_on_remote_fetch_media_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp36_ = tuba_application_question_finish (_data_->_tmp26_, _data_->_res_);
		_g_free0 (_data_->_tmp29_);
		_data_->res = _data_->_tmp36_;
		if (_data_->res != TUBA_APPLICATION_QUESTION_ANSWER_YES) {
			_data_->_tmp37_ = tuba_settings;
			tuba_settings_set_fetch_remote_media_default (_data_->_tmp37_, FALSE);
			_g_object_unref0 (_data_->checkbutton);
			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_->_tmp38_ = tuba_settings;
		tuba_settings_set_fetch_remote_media_default (_data_->_tmp38_, TRUE);
		_data_->_tmp39_ = _data_->checkbutton;
		_data_->_tmp40_ = gtk_check_button_get_active (_data_->_tmp39_);
		_data_->_tmp41_ = _data_->_tmp40_;
		if (_data_->_tmp41_) {
			_data_->_tmp42_ = tuba_settings;
			tuba_settings_set_fetch_remote_media_reminder (_data_->_tmp42_, FALSE);
		}
		_g_object_unref0 (_data_->checkbutton);
	}
	_data_->_tmp44_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) _data_->self);
	_data_->_tmp45_ = _data_->_tmp44_;
	_data_->_tmp46_ = tuba_api_attachment_get_remote_url (_data_->_tmp45_);
	_data_->_tmp47_ = _data_->_tmp46_;
	if (_data_->_tmp47_ == NULL) {
		_g_free0 (_data_->_tmp43_);
		_data_->_tmp43_ = NULL;
	} else {
		_data_->_tmp48_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) _data_->self);
		_data_->_tmp49_ = _data_->_tmp48_;
		_data_->_tmp50_ = tuba_api_attachment_get_remote_url (_data_->_tmp49_);
		_data_->_tmp51_ = _data_->_tmp50_;
		_data_->_tmp52_ = tuba_widgets_attachment_image_media_type_from_url (_data_->self, _data_->_tmp51_);
		_g_free0 (_data_->_tmp43_);
		_data_->_tmp43_ = _data_->_tmp52_;
	}
	_data_->_tmp53_ = _data_->_tmp43_;
	_data_->_tmp43_ = NULL;
	_data_->media_type = _data_->_tmp53_;
	_data_->_tmp55_ = tuba_settings;
	_data_->_tmp56_ = tuba_settings_get_fetch_remote_media_default (_data_->_tmp55_);
	_data_->_tmp57_ = _data_->_tmp56_;
	if (_data_->_tmp57_) {
		_data_->_tmp58_ = _data_->media_type;
		_data_->_tmp54_ = _data_->_tmp58_ != NULL;
	} else {
		_data_->_tmp54_ = FALSE;
	}
	if (_data_->_tmp54_) {
		_data_->stream = FALSE;
		_data_->_tmp59_ = _data_->media_type;
		_data_->_tmp60_ = TUBA_ATTACHMENT_MEDIA_TYPE_AUDIO;
		if (_tuba_attachment_media_type_equal (_data_->_tmp59_, &_data_->_tmp60_) == TRUE) {
			_data_->stream = TRUE;
		}
		_data_->_tmp61_ = tuba_app;
		_data_->_tmp62_ = tuba_application_get_main_window (_data_->_tmp61_);
		_data_->_tmp63_ = _data_->_tmp62_;
		_data_->_tmp64_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) _data_->self);
		_data_->_tmp65_ = _data_->_tmp64_;
		_data_->_tmp66_ = tuba_api_attachment_get_remote_url (_data_->_tmp65_);
		_data_->_tmp67_ = _data_->_tmp66_;
		_data_->_tmp68_ = _data_->media_type;
		_data_->_tmp69_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) _data_->self);
		_data_->_tmp70_ = _data_->_tmp69_;
		_data_->_tmp71_ = tuba_api_attachment_get_description (_data_->_tmp70_);
		_data_->_tmp72_ = _data_->_tmp71_;
		_data_->_tmp73_ = tuba_widgets_attachment_item_get_entity ((TubaWidgetsAttachmentItem*) _data_->self);
		_data_->_tmp74_ = _data_->_tmp73_;
		_data_->_tmp75_ = tuba_api_attachment_get_blurhash (_data_->_tmp74_);
		_data_->_tmp76_ = _data_->_tmp75_;
		tuba_dialogs_main_window_show_media_viewer (_data_->_tmp63_, _data_->_tmp67_, *_data_->_tmp68_, NULL, NULL, FALSE, _data_->_tmp72_, NULL, _data_->_tmp76_, _data_->stream, NULL, TRUE);
		_g_free0 (_data_->media_type);
		_g_free0 (_data_->_tmp43_);
		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;
	}
	TUBA_WIDGETS_ATTACHMENT_ITEM_CLASS (tuba_widgets_attachment_image_parent_class)->on_click (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, TUBA_WIDGETS_ATTACHMENT_TYPE_ITEM, TubaWidgetsAttachmentItem));
	_g_free0 (_data_->media_type);
	_g_free0 (_data_->_tmp43_);
	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 TubaAttachmentMediaType*
_tuba_attachment_media_type_dup (TubaAttachmentMediaType* self)
{
	TubaAttachmentMediaType* dup;
	dup = g_new0 (TubaAttachmentMediaType, 1);
	memcpy (dup, self, sizeof (TubaAttachmentMediaType));
	return dup;
}

static gpointer
__tuba_attachment_media_type_dup0 (gpointer self)
{
	return self ? _tuba_attachment_media_type_dup (self) : NULL;
}

static TubaAttachmentMediaType*
tuba_widgets_attachment_image_media_type_from_url (TubaWidgetsAttachmentImage* self,
                                                   const gchar* url)
{
	gchar* basename = NULL;
	gchar* _tmp0_;
	gchar* content_type = NULL;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* mime = NULL;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp10_;
	const gchar* _tmp13_;
	TubaAttachmentMediaType* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (url != NULL, NULL);
	_tmp0_ = g_path_get_basename (url);
	basename = _tmp0_;
	_tmp1_ = basename;
	_tmp2_ = g_content_type_guess (_tmp1_, NULL, (gsize) 0, NULL);
	content_type = _tmp2_;
	_tmp3_ = content_type;
	if (_tmp3_ == NULL) {
		result = NULL;
		_g_free0 (content_type);
		_g_free0 (basename);
		return result;
	}
	_tmp4_ = content_type;
	_tmp5_ = g_content_type_get_mime_type (_tmp4_);
	mime = _tmp5_;
	_tmp6_ = mime;
	if (_tmp6_ == NULL) {
		result = NULL;
		_g_free0 (mime);
		_g_free0 (content_type);
		_g_free0 (basename);
		return result;
	}
	_tmp7_ = mime;
	if (g_str_has_prefix (_tmp7_, "audio/")) {
		TubaAttachmentMediaType _tmp8_;
		TubaAttachmentMediaType* _tmp9_;
		_tmp8_ = TUBA_ATTACHMENT_MEDIA_TYPE_AUDIO;
		_tmp9_ = __tuba_attachment_media_type_dup0 (&_tmp8_);
		result = _tmp9_;
		_g_free0 (mime);
		_g_free0 (content_type);
		_g_free0 (basename);
		return result;
	}
	_tmp10_ = mime;
	if (g_str_has_prefix (_tmp10_, "image/")) {
		TubaAttachmentMediaType _tmp11_;
		TubaAttachmentMediaType* _tmp12_;
		_tmp11_ = TUBA_ATTACHMENT_MEDIA_TYPE_IMAGE;
		_tmp12_ = __tuba_attachment_media_type_dup0 (&_tmp11_);
		result = _tmp12_;
		_g_free0 (mime);
		_g_free0 (content_type);
		_g_free0 (basename);
		return result;
	}
	_tmp13_ = mime;
	if (g_str_has_prefix (_tmp13_, "video/")) {
		TubaAttachmentMediaType _tmp14_;
		TubaAttachmentMediaType* _tmp15_;
		_tmp14_ = TUBA_ATTACHMENT_MEDIA_TYPE_VIDEO;
		_tmp15_ = __tuba_attachment_media_type_dup0 (&_tmp14_);
		result = _tmp15_;
		_g_free0 (mime);
		_g_free0 (content_type);
		_g_free0 (basename);
		return result;
	}
	result = NULL;
	_g_free0 (mime);
	_g_free0 (content_type);
	_g_free0 (basename);
	return result;
}

TubaWidgetsAttachmentImage*
tuba_widgets_attachment_image_construct (GType object_type)
{
	TubaWidgetsAttachmentImage * self = NULL;
	self = (TubaWidgetsAttachmentImage*) tuba_widgets_attachment_item_construct (object_type);
	return self;
}

TubaWidgetsAttachmentImage*
tuba_widgets_attachment_image_new (void)
{
	return tuba_widgets_attachment_image_construct (TUBA_WIDGETS_ATTACHMENT_TYPE_IMAGE);
}

TubaWidgetsFocusPicture*
tuba_widgets_attachment_image_get_pic (TubaWidgetsAttachmentImage* self)
{
	TubaWidgetsFocusPicture* result;
	TubaWidgetsFocusPicture* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_pic;
	result = _tmp0_;
	return result;
}

static void
tuba_widgets_attachment_image_set_pic (TubaWidgetsAttachmentImage* self,
                                       TubaWidgetsFocusPicture* value)
{
	TubaWidgetsFocusPicture* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_attachment_image_get_pic (self);
	if (old_value != value) {
		TubaWidgetsFocusPicture* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_pic);
		self->priv->_pic = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_attachment_image_properties[TUBA_WIDGETS_ATTACHMENT_IMAGE_PIC_PROPERTY]);
	}
}

gboolean
tuba_widgets_attachment_image_get_spoiler (TubaWidgetsAttachmentImage* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_spoiler;
	return result;
}

void
tuba_widgets_attachment_image_set_spoiler (TubaWidgetsAttachmentImage* self,
                                           gboolean value)
{
	TubaWidgetsFocusPicture* _tmp0_;
	GtkImage* _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->_spoiler = value;
	_tmp0_ = self->priv->_pic;
	tuba_widgets_focus_picture_set_spoilered (_tmp0_, value);
	_tmp1_ = self->media_icon;
	if (_tmp1_ != NULL) {
		GtkImage* _tmp2_;
		_tmp2_ = self->media_icon;
		gtk_widget_set_visible ((GtkWidget*) _tmp2_, !value);
	}
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_attachment_image_properties[TUBA_WIDGETS_ATTACHMENT_IMAGE_SPOILER_PROPERTY]);
}

static void
tuba_widgets_attachment_image_real_on_any_attachment_click (TubaWidgetsAttachmentImage* self,
                                                            const gchar* url)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (url != NULL);
}

static void
_tuba_widgets_attachment_image_update_pic_content_fit_g_object_notify (GObject* _sender,
                                                                       GParamSpec* pspec,
                                                                       gpointer self)
{
	tuba_widgets_attachment_image_update_pic_content_fit ((TubaWidgetsAttachmentImage*) self);
}

static GObject *
tuba_widgets_attachment_image_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaWidgetsAttachmentImage * self;
	gchar* _tmp0_;
	gchar** _tmp1_;
	TubaWidgetsFocusPicture* _tmp2_ = NULL;
	TubaWidgetsFocusPicture* _tmp3_;
	TubaSettings* _tmp4_;
	GtkOverlay* _tmp5_;
	GtkOverlay* _tmp6_;
	TubaWidgetsFocusPicture* _tmp7_;
	GtkButton* _tmp8_;
	GtkOverlay* _tmp9_;
	parent_class = G_OBJECT_CLASS (tuba_widgets_attachment_image_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_ATTACHMENT_TYPE_IMAGE, TubaWidgetsAttachmentImage);
	_tmp0_ = g_strdup ("attachment-picture");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = tuba_widgets_focus_picture_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp2_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp2_, TRUE);
	tuba_widgets_focus_picture_set_can_shrink (_tmp2_, TRUE);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp2_, _tmp1_);
	_tmp1_ = (_vala_array_free (_tmp1_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp2_);
	_tmp3_ = _tmp2_;
	tuba_widgets_attachment_image_set_pic (self, _tmp3_);
	_g_object_unref0 (_tmp3_);
	tuba_widgets_attachment_image_update_pic_content_fit (self);
	_tmp4_ = tuba_settings;
	g_signal_connect_object ((GObject*) _tmp4_, "notify::letterbox-media", (GCallback) _tuba_widgets_attachment_image_update_pic_content_fit_g_object_notify, self, 0);
	_tmp5_ = (GtkOverlay*) gtk_overlay_new ();
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->media_overlay);
	self->media_overlay = _tmp5_;
	_tmp6_ = self->media_overlay;
	_tmp7_ = self->priv->_pic;
	gtk_overlay_set_child (_tmp6_, (GtkWidget*) _tmp7_);
	_tmp8_ = ((TubaWidgetsAttachmentItem*) self)->button;
	_tmp9_ = self->media_overlay;
	gtk_button_set_child (_tmp8_, (GtkWidget*) _tmp9_);
	return obj;
}

static void
tuba_widgets_attachment_image_class_init (TubaWidgetsAttachmentImageClass * klass,
                                          gpointer klass_data)
{
	tuba_widgets_attachment_image_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaWidgetsAttachmentImage_private_offset);
	((TubaWidgetsAttachmentItemClass *) klass)->on_rebind = (void (*) (TubaWidgetsAttachmentItem*)) tuba_widgets_attachment_image_real_on_rebind;
	((TubaWidgetsAttachmentItemClass *) klass)->copy_media = (void (*) (TubaWidgetsAttachmentItem*)) tuba_widgets_attachment_image_real_copy_media;
	((TubaWidgetsAttachmentImageClass *) klass)->on_cache_response = (void (*) (TubaWidgetsAttachmentImage*, GdkPaintable*)) tuba_widgets_attachment_image_real_on_cache_response;
	((TubaWidgetsAttachmentItemClass *) klass)->on_click = (void (*) (TubaWidgetsAttachmentItem*)) tuba_widgets_attachment_image_real_on_click;
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_widgets_attachment_image_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_widgets_attachment_image_set_property;
	G_OBJECT_CLASS (klass)->constructor = tuba_widgets_attachment_image_constructor;
	G_OBJECT_CLASS (klass)->finalize = tuba_widgets_attachment_image_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_ATTACHMENT_IMAGE_PIC_PROPERTY, tuba_widgets_attachment_image_properties[TUBA_WIDGETS_ATTACHMENT_IMAGE_PIC_PROPERTY] = g_param_spec_object ("pic", "pic", "pic", TUBA_WIDGETS_TYPE_FOCUS_PICTURE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_ATTACHMENT_IMAGE_SPOILER_PROPERTY, tuba_widgets_attachment_image_properties[TUBA_WIDGETS_ATTACHMENT_IMAGE_SPOILER_PROPERTY] = g_param_spec_boolean ("spoiler", "spoiler", "spoiler", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	tuba_widgets_attachment_image_signals[TUBA_WIDGETS_ATTACHMENT_IMAGE_SPOILER_REVEALED_SIGNAL] = g_signal_new ("spoiler-revealed", TUBA_WIDGETS_ATTACHMENT_TYPE_IMAGE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	tuba_widgets_attachment_image_signals[TUBA_WIDGETS_ATTACHMENT_IMAGE_ON_ANY_ATTACHMENT_CLICK_SIGNAL] = g_signal_new_class_handler ("on-any-attachment-click", TUBA_WIDGETS_ATTACHMENT_TYPE_IMAGE, G_SIGNAL_RUN_LAST, (GCallback) tuba_widgets_attachment_image_real_on_any_attachment_click, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
tuba_widgets_attachment_image_instance_init (TubaWidgetsAttachmentImage * self,
                                             gpointer klass)
{
	self->priv = tuba_widgets_attachment_image_get_instance_private (self);
	self->priv->_spoiler = FALSE;
	self->media_icon = NULL;
	self->priv->pic_paintable_id = (gulong) 0;
}

static void
tuba_widgets_attachment_image_finalize (GObject * obj)
{
	TubaWidgetsAttachmentImage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_ATTACHMENT_TYPE_IMAGE, TubaWidgetsAttachmentImage);
	_g_object_unref0 (self->priv->_pic);
	_g_object_unref0 (self->media_overlay);
	_g_object_unref0 (self->media_icon);
	G_OBJECT_CLASS (tuba_widgets_attachment_image_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_widgets_attachment_image_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaWidgetsAttachmentImageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_widgets_attachment_image_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaWidgetsAttachmentImage), 0, (GInstanceInitFunc) tuba_widgets_attachment_image_instance_init, NULL };
	GType tuba_widgets_attachment_image_type_id;
	tuba_widgets_attachment_image_type_id = g_type_register_static (TUBA_WIDGETS_ATTACHMENT_TYPE_ITEM, "TubaWidgetsAttachmentImage", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaWidgetsAttachmentImage_private_offset = g_type_add_instance_private (tuba_widgets_attachment_image_type_id, sizeof (TubaWidgetsAttachmentImagePrivate));
	return tuba_widgets_attachment_image_type_id;
}

GType
tuba_widgets_attachment_image_get_type (void)
{
	static GType tuba_widgets_attachment_image_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_widgets_attachment_image_type_id__once)) {
		GType tuba_widgets_attachment_image_type_id;
		tuba_widgets_attachment_image_type_id = tuba_widgets_attachment_image_get_type_once ();
		g_once_init_leave_pointer (&tuba_widgets_attachment_image_type_id__once, tuba_widgets_attachment_image_type_id);
	}
	return tuba_widgets_attachment_image_type_id__once;
}

static void
_vala_tuba_widgets_attachment_image_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec)
{
	TubaWidgetsAttachmentImage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_ATTACHMENT_TYPE_IMAGE, TubaWidgetsAttachmentImage);
	switch (property_id) {
		case TUBA_WIDGETS_ATTACHMENT_IMAGE_PIC_PROPERTY:
		g_value_set_object (value, tuba_widgets_attachment_image_get_pic (self));
		break;
		case TUBA_WIDGETS_ATTACHMENT_IMAGE_SPOILER_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_attachment_image_get_spoiler (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_widgets_attachment_image_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec)
{
	TubaWidgetsAttachmentImage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_ATTACHMENT_TYPE_IMAGE, TubaWidgetsAttachmentImage);
	switch (property_id) {
		case TUBA_WIDGETS_ATTACHMENT_IMAGE_PIC_PROPERTY:
		tuba_widgets_attachment_image_set_pic (self, g_value_get_object (value));
		break;
		case TUBA_WIDGETS_ATTACHMENT_IMAGE_SPOILER_PROPERTY:
		tuba_widgets_attachment_image_set_spoiler (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

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

