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

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

#define TOOTLE_WIDGETS_ATTACHMENT_TYPE_SLOT (tootle_widgets_attachment_slot_get_type ())
#define TOOTLE_WIDGETS_ATTACHMENT_SLOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_WIDGETS_ATTACHMENT_TYPE_SLOT, TootleWidgetsAttachmentSlot))
#define TOOTLE_WIDGETS_ATTACHMENT_SLOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_WIDGETS_ATTACHMENT_TYPE_SLOT, TootleWidgetsAttachmentSlotClass))
#define TOOTLE_WIDGETS_ATTACHMENT_IS_SLOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_WIDGETS_ATTACHMENT_TYPE_SLOT))
#define TOOTLE_WIDGETS_ATTACHMENT_IS_SLOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_WIDGETS_ATTACHMENT_TYPE_SLOT))
#define TOOTLE_WIDGETS_ATTACHMENT_SLOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_WIDGETS_ATTACHMENT_TYPE_SLOT, TootleWidgetsAttachmentSlotClass))

typedef struct _TootleWidgetsAttachmentSlot TootleWidgetsAttachmentSlot;
typedef struct _TootleWidgetsAttachmentSlotClass TootleWidgetsAttachmentSlotClass;
typedef struct _TootleWidgetsAttachmentSlotPrivate TootleWidgetsAttachmentSlotPrivate;

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

typedef struct _TootleEntity TootleEntity;
typedef struct _TootleEntityClass TootleEntityClass;

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

typedef struct _TootleAPIAttachment TootleAPIAttachment;
typedef struct _TootleAPIAttachmentClass TootleAPIAttachmentClass;
enum  {
	TOOTLE_WIDGETS_ATTACHMENT_SLOT_0_PROPERTY,
	TOOTLE_WIDGETS_ATTACHMENT_SLOT_ATTACHMENT_PROPERTY,
	TOOTLE_WIDGETS_ATTACHMENT_SLOT_NUM_PROPERTIES
};
static GParamSpec* tootle_widgets_attachment_slot_properties[TOOTLE_WIDGETS_ATTACHMENT_SLOT_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TOOTLE_WIDGETS_ATTACHMENT_TYPE_PICTURE (tootle_widgets_attachment_picture_get_type ())
#define TOOTLE_WIDGETS_ATTACHMENT_PICTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_WIDGETS_ATTACHMENT_TYPE_PICTURE, TootleWidgetsAttachmentPicture))
#define TOOTLE_WIDGETS_ATTACHMENT_PICTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_WIDGETS_ATTACHMENT_TYPE_PICTURE, TootleWidgetsAttachmentPictureClass))
#define TOOTLE_WIDGETS_ATTACHMENT_IS_PICTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_WIDGETS_ATTACHMENT_TYPE_PICTURE))
#define TOOTLE_WIDGETS_ATTACHMENT_IS_PICTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_WIDGETS_ATTACHMENT_TYPE_PICTURE))
#define TOOTLE_WIDGETS_ATTACHMENT_PICTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_WIDGETS_ATTACHMENT_TYPE_PICTURE, TootleWidgetsAttachmentPictureClass))

typedef struct _TootleWidgetsAttachmentPicture TootleWidgetsAttachmentPicture;
typedef struct _TootleWidgetsAttachmentPictureClass TootleWidgetsAttachmentPictureClass;
typedef struct _Block27Data Block27Data;
#define _g_free0(var) (var = (g_free (var), NULL))

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

typedef struct _TootleApplication TootleApplication;
typedef struct _TootleApplicationClass TootleApplicationClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _TootleWidgetsAttachmentSlot {
	GtkFlowBoxChild parent_instance;
	TootleWidgetsAttachmentSlotPrivate * priv;
};

struct _TootleWidgetsAttachmentSlotClass {
	GtkFlowBoxChildClass parent_class;
	void (*on_clicked) (TootleWidgetsAttachmentSlot* self);
};

struct _TootleWidgetsAttachmentSlotPrivate {
	GtkButton* button;
	GtkLabel* chip;
	GtkImage* play_icon;
	GtkStack* stack;
	TootleAPIAttachment* _attachment;
};

struct _Block27Data {
	int _ref_count_;
	TootleWidgetsAttachmentSlot* self;
	TootleWidgetsAttachmentPicture* img;
};

static gint TootleWidgetsAttachmentSlot_private_offset;
static gpointer tootle_widgets_attachment_slot_parent_class = NULL;
extern TootleApplication* tootle_app;

GType tootle_widgets_attachment_slot_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleWidgetsAttachmentSlot, g_object_unref)
GType tootle_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleEntity, g_object_unref)
GType tootle_api_attachment_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIAttachment, g_object_unref)
void tootle_widgets_attachment_slot_on_clicked (TootleWidgetsAttachmentSlot* self);
TootleWidgetsAttachmentSlot* tootle_widgets_attachment_slot_new (TootleAPIAttachment* obj);
TootleWidgetsAttachmentSlot* tootle_widgets_attachment_slot_construct (GType object_type,
                                                                       TootleAPIAttachment* obj);
TootleAPIAttachment* tootle_widgets_attachment_slot_get_attachment (TootleWidgetsAttachmentSlot* self);
const gchar* tootle_api_attachment_get_preview_url (TootleAPIAttachment* self);
GType tootle_widgets_attachment_picture_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleWidgetsAttachmentPicture, g_object_unref)
static Block27Data* block27_data_ref (Block27Data* _data27_);
static void block27_data_unref (void * _userdata_);
TootleWidgetsAttachmentPicture* tootle_widgets_attachment_picture_new (const gchar* url);
TootleWidgetsAttachmentPicture* tootle_widgets_attachment_picture_construct (GType object_type,
                                                                             const gchar* url);
static void ___lambda34_ (Block27Data* _data27_);
static void ____lambda34__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
void tootle_widgets_attachment_picture_on_request (TootleWidgetsAttachmentPicture* self);
const gchar* tootle_api_attachment_get_kind (TootleAPIAttachment* self);
static void tootle_widgets_attachment_slot_open (TootleWidgetsAttachmentSlot* self);
void tootle_desktop_download (const gchar* url,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_);
gchar* tootle_desktop_download_finish (GAsyncResult* _res_,
                                       GError** error);
const gchar* tootle_api_attachment_get_url (TootleAPIAttachment* self);
static void __lambda35_ (TootleWidgetsAttachmentSlot* self,
                  GObject* obj,
                  GAsyncResult* res);
gboolean tootle_desktop_open_uri (const gchar* _uri);
GType tootle_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleApplication, g_object_unref)
static void ___lambda35__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void tootle_widgets_attachment_slot_real_on_clicked (TootleWidgetsAttachmentSlot* self);
static void _tootle_widgets_attachment_slot_on_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                    gpointer self);
void tootle_widgets_attachment_slot_set_attachment (TootleWidgetsAttachmentSlot* self,
                                                    TootleAPIAttachment* value);
static GObject * tootle_widgets_attachment_slot_constructor (GType type,
                                                      guint n_construct_properties,
                                                      GObjectConstructParam * construct_properties);
const gchar* tootle_api_attachment_get_description (TootleAPIAttachment* self);
static void tootle_widgets_attachment_slot_finalize (GObject * obj);
static GType tootle_widgets_attachment_slot_get_type_once (void);
static void _vala_tootle_widgets_attachment_slot_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec);
static void _vala_tootle_widgets_attachment_slot_set_property (GObject * object,
                                                        guint property_id,
                                                        const GValue * value,
                                                        GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
tootle_widgets_attachment_slot_get_instance_private (TootleWidgetsAttachmentSlot* self)
{
	return G_STRUCT_MEMBER_P (self, TootleWidgetsAttachmentSlot_private_offset);
}

static Block27Data*
block27_data_ref (Block27Data* _data27_)
{
	g_atomic_int_inc (&_data27_->_ref_count_);
	return _data27_;
}

static void
block27_data_unref (void * _userdata_)
{
	Block27Data* _data27_;
	_data27_ = (Block27Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data27_->_ref_count_)) {
		TootleWidgetsAttachmentSlot* self;
		self = _data27_->self;
		_g_object_unref0 (_data27_->img);
		_g_object_unref0 (self);
		g_slice_free (Block27Data, _data27_);
	}
}

static void
___lambda34_ (Block27Data* _data27_)
{
	TootleWidgetsAttachmentSlot* self;
	const gchar* _tmp0_ = NULL;
	TootleWidgetsAttachmentPicture* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GtkStack* _tmp4_;
	self = _data27_->self;
	_tmp1_ = _data27_->img;
	_tmp2_ = gtk_widget_get_visible ((GtkWidget*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		_tmp0_ = "content";
	} else {
		_tmp0_ = "loading";
	}
	_tmp4_ = self->priv->stack;
	gtk_stack_set_visible_child_name (_tmp4_, _tmp0_);
}

static void
____lambda34__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	___lambda34_ (self);
}

TootleWidgetsAttachmentSlot*
tootle_widgets_attachment_slot_construct (GType object_type,
                                          TootleAPIAttachment* obj)
{
	TootleWidgetsAttachmentSlot * self = NULL;
	TootleAPIAttachment* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	TootleAPIAttachment* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	TootleAPIAttachment* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	GQuark _tmp24_ = 0U;
	static GQuark _tmp23_label0 = 0;
	static GQuark _tmp23_label1 = 0;
	static GQuark _tmp23_label2 = 0;
	g_return_val_if_fail (obj != NULL, NULL);
	self = (TootleWidgetsAttachmentSlot*) g_object_new (object_type, "attachment", obj, NULL);
	_tmp0_ = self->priv->_attachment;
	_tmp1_ = tootle_api_attachment_get_preview_url (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		Block27Data* _data27_;
		TootleAPIAttachment* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		TootleWidgetsAttachmentPicture* _tmp6_;
		TootleWidgetsAttachmentPicture* _tmp7_;
		GtkStack* _tmp8_;
		TootleWidgetsAttachmentPicture* _tmp9_;
		TootleWidgetsAttachmentPicture* _tmp10_;
		_data27_ = g_slice_new0 (Block27Data);
		_data27_->_ref_count_ = 1;
		_data27_->self = g_object_ref (self);
		_tmp3_ = self->priv->_attachment;
		_tmp4_ = tootle_api_attachment_get_preview_url (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = tootle_widgets_attachment_picture_new (_tmp5_);
		g_object_ref_sink (_tmp6_);
		_data27_->img = _tmp6_;
		_tmp7_ = _data27_->img;
		g_signal_connect_data ((GObject*) _tmp7_, "notify::visible", (GCallback) ____lambda34__g_object_notify, block27_data_ref (_data27_), (GClosureNotify) block27_data_unref, 0);
		_tmp8_ = self->priv->stack;
		_tmp9_ = _data27_->img;
		gtk_stack_add_named (_tmp8_, (GtkWidget*) _tmp9_, "content");
		_tmp10_ = _data27_->img;
		tootle_widgets_attachment_picture_on_request (_tmp10_);
		block27_data_unref (_data27_);
		_data27_ = NULL;
	}
	_tmp11_ = self->priv->_attachment;
	_tmp12_ = tootle_api_attachment_get_kind (_tmp11_);
	_tmp13_ = _tmp12_;
	if (g_strcmp0 (_tmp13_, "image") != 0) {
		GtkLabel* _tmp14_;
		TootleAPIAttachment* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		GtkLabel* _tmp18_;
		_tmp14_ = self->priv->chip;
		_tmp15_ = self->priv->_attachment;
		_tmp16_ = tootle_api_attachment_get_kind (_tmp15_);
		_tmp17_ = _tmp16_;
		gtk_label_set_label (_tmp14_, _tmp17_);
		_tmp18_ = self->priv->chip;
		gtk_widget_show ((GtkWidget*) _tmp18_);
	}
	_tmp19_ = self->priv->_attachment;
	_tmp20_ = tootle_api_attachment_get_kind (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = _tmp21_;
	_tmp24_ = (NULL == _tmp22_) ? 0 : g_quark_from_string (_tmp22_);
	if (((_tmp24_ == ((0 != _tmp23_label0) ? _tmp23_label0 : (_tmp23_label0 = g_quark_from_static_string ("audio")))) || (_tmp24_ == ((0 != _tmp23_label1) ? _tmp23_label1 : (_tmp23_label1 = g_quark_from_static_string ("video"))))) || (_tmp24_ == ((0 != _tmp23_label2) ? _tmp23_label2 : (_tmp23_label2 = g_quark_from_static_string ("gifv"))))) {
		switch (0) {
			default:
			{
				GtkImage* _tmp25_;
				_tmp25_ = self->priv->play_icon;
				gtk_widget_show ((GtkWidget*) _tmp25_);
				break;
			}
		}
	}
	return self;
}

TootleWidgetsAttachmentSlot*
tootle_widgets_attachment_slot_new (TootleAPIAttachment* obj)
{
	return tootle_widgets_attachment_slot_construct (TOOTLE_WIDGETS_ATTACHMENT_TYPE_SLOT, obj);
}

static void
__lambda35_ (TootleWidgetsAttachmentSlot* self,
             GObject* obj,
             GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		gchar* path = NULL;
		gchar* _tmp0_;
		_tmp0_ = tootle_desktop_download_finish (res, &_inner_error0_);
		path = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		tootle_desktop_open_uri (path);
		_g_free0 (path);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		TootleApplication* _tmp1_;
		GError* _tmp2_;
		const gchar* _tmp3_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = tootle_app;
		_tmp2_ = e;
		_tmp3_ = _tmp2_->message;
		g_signal_emit_by_name (_tmp1_, "error", _ ("Error"), _tmp3_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
___lambda35__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda35_ ((TootleWidgetsAttachmentSlot*) self, source_object, res);
	g_object_unref (self);
}

static void
tootle_widgets_attachment_slot_open (TootleWidgetsAttachmentSlot* self)
{
	TootleAPIAttachment* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_attachment;
	_tmp1_ = tootle_api_attachment_get_url (_tmp0_);
	_tmp2_ = _tmp1_;
	tootle_desktop_download (_tmp2_, ___lambda35__gasync_ready_callback, g_object_ref (self));
}

static void
tootle_widgets_attachment_slot_real_on_clicked (TootleWidgetsAttachmentSlot* self)
{
	tootle_widgets_attachment_slot_open (self);
}

void
tootle_widgets_attachment_slot_on_clicked (TootleWidgetsAttachmentSlot* self)
{
	TootleWidgetsAttachmentSlotClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = TOOTLE_WIDGETS_ATTACHMENT_SLOT_GET_CLASS (self);
	if (_klass_->on_clicked) {
		_klass_->on_clicked (self);
	}
}

static void
_tootle_widgets_attachment_slot_on_clicked_gtk_button_clicked (GtkButton* _sender,
                                                               gpointer self)
{
	tootle_widgets_attachment_slot_on_clicked ((TootleWidgetsAttachmentSlot*) self);
}

TootleAPIAttachment*
tootle_widgets_attachment_slot_get_attachment (TootleWidgetsAttachmentSlot* self)
{
	TootleAPIAttachment* result;
	TootleAPIAttachment* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_attachment;
	result = _tmp0_;
	return result;
}

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

void
tootle_widgets_attachment_slot_set_attachment (TootleWidgetsAttachmentSlot* self,
                                               TootleAPIAttachment* value)
{
	TootleAPIAttachment* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_widgets_attachment_slot_get_attachment (self);
	if (old_value != value) {
		TootleAPIAttachment* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_attachment);
		self->priv->_attachment = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_widgets_attachment_slot_properties[TOOTLE_WIDGETS_ATTACHMENT_SLOT_ATTACHMENT_PROPERTY]);
	}
}

static GObject *
tootle_widgets_attachment_slot_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TootleWidgetsAttachmentSlot * self;
	GtkButton* _tmp0_;
	TootleAPIAttachment* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	parent_class = G_OBJECT_CLASS (tootle_widgets_attachment_slot_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TOOTLE_WIDGETS_ATTACHMENT_TYPE_SLOT, TootleWidgetsAttachmentSlot);
	_tmp0_ = self->priv->button;
	_tmp1_ = self->priv->_attachment;
	_tmp2_ = tootle_api_attachment_get_description (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp0_, _tmp3_);
	return obj;
}

static void
tootle_widgets_attachment_slot_class_init (TootleWidgetsAttachmentSlotClass * klass,
                                           gpointer klass_data)
{
	tootle_widgets_attachment_slot_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TootleWidgetsAttachmentSlot_private_offset);
	((TootleWidgetsAttachmentSlotClass *) klass)->on_clicked = (void (*) (TootleWidgetsAttachmentSlot*)) tootle_widgets_attachment_slot_real_on_clicked;
	G_OBJECT_CLASS (klass)->get_property = _vala_tootle_widgets_attachment_slot_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tootle_widgets_attachment_slot_set_property;
	G_OBJECT_CLASS (klass)->constructor = tootle_widgets_attachment_slot_constructor;
	G_OBJECT_CLASS (klass)->finalize = tootle_widgets_attachment_slot_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_WIDGETS_ATTACHMENT_SLOT_ATTACHMENT_PROPERTY, tootle_widgets_attachment_slot_properties[TOOTLE_WIDGETS_ATTACHMENT_SLOT_ATTACHMENT_PROPERTY] = g_param_spec_object ("attachment", "attachment", "attachment", TOOTLE_API_TYPE_ATTACHMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/com/github/bleakgrey/tootle/ui/widgets/attachment_slot.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "button", FALSE, TootleWidgetsAttachmentSlot_private_offset + G_STRUCT_OFFSET (TootleWidgetsAttachmentSlotPrivate, button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "chip", FALSE, TootleWidgetsAttachmentSlot_private_offset + G_STRUCT_OFFSET (TootleWidgetsAttachmentSlotPrivate, chip));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "play_icon", FALSE, TootleWidgetsAttachmentSlot_private_offset + G_STRUCT_OFFSET (TootleWidgetsAttachmentSlotPrivate, play_icon));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "stack", FALSE, TootleWidgetsAttachmentSlot_private_offset + G_STRUCT_OFFSET (TootleWidgetsAttachmentSlotPrivate, stack));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_clicked", G_CALLBACK(_tootle_widgets_attachment_slot_on_clicked_gtk_button_clicked));
}

static void
tootle_widgets_attachment_slot_instance_init (TootleWidgetsAttachmentSlot * self,
                                              gpointer klass)
{
	self->priv = tootle_widgets_attachment_slot_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
tootle_widgets_attachment_slot_finalize (GObject * obj)
{
	TootleWidgetsAttachmentSlot * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TOOTLE_WIDGETS_ATTACHMENT_TYPE_SLOT, TootleWidgetsAttachmentSlot);
	_g_object_unref0 (self->priv->_attachment);
	G_OBJECT_CLASS (tootle_widgets_attachment_slot_parent_class)->finalize (obj);
}

static GType
tootle_widgets_attachment_slot_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TootleWidgetsAttachmentSlotClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tootle_widgets_attachment_slot_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TootleWidgetsAttachmentSlot), 0, (GInstanceInitFunc) tootle_widgets_attachment_slot_instance_init, NULL };
	GType tootle_widgets_attachment_slot_type_id;
	tootle_widgets_attachment_slot_type_id = g_type_register_static (gtk_flow_box_child_get_type (), "TootleWidgetsAttachmentSlot", &g_define_type_info, 0);
	TootleWidgetsAttachmentSlot_private_offset = g_type_add_instance_private (tootle_widgets_attachment_slot_type_id, sizeof (TootleWidgetsAttachmentSlotPrivate));
	return tootle_widgets_attachment_slot_type_id;
}

GType
tootle_widgets_attachment_slot_get_type (void)
{
	static volatile gsize tootle_widgets_attachment_slot_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_widgets_attachment_slot_type_id__volatile)) {
		GType tootle_widgets_attachment_slot_type_id;
		tootle_widgets_attachment_slot_type_id = tootle_widgets_attachment_slot_get_type_once ();
		g_once_init_leave (&tootle_widgets_attachment_slot_type_id__volatile, tootle_widgets_attachment_slot_type_id);
	}
	return tootle_widgets_attachment_slot_type_id__volatile;
}

static void
_vala_tootle_widgets_attachment_slot_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec)
{
	TootleWidgetsAttachmentSlot * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_WIDGETS_ATTACHMENT_TYPE_SLOT, TootleWidgetsAttachmentSlot);
	switch (property_id) {
		case TOOTLE_WIDGETS_ATTACHMENT_SLOT_ATTACHMENT_PROPERTY:
		g_value_set_object (value, tootle_widgets_attachment_slot_get_attachment (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tootle_widgets_attachment_slot_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec)
{
	TootleWidgetsAttachmentSlot * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_WIDGETS_ATTACHMENT_TYPE_SLOT, TootleWidgetsAttachmentSlot);
	switch (property_id) {
		case TOOTLE_WIDGETS_ATTACHMENT_SLOT_ATTACHMENT_PROPERTY:
		tootle_widgets_attachment_slot_set_attachment (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

