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

#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <gio/gio.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.h>
#include "libdino.h"
#include "dino_i18n.h"

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

#define DINO_UI_TYPE_FILE_SEND_OVERLAY (dino_ui_file_send_overlay_get_type ())
#define DINO_UI_FILE_SEND_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_FILE_SEND_OVERLAY, DinoUiFileSendOverlay))
#define DINO_UI_FILE_SEND_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_FILE_SEND_OVERLAY, DinoUiFileSendOverlayClass))
#define DINO_UI_IS_FILE_SEND_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_FILE_SEND_OVERLAY))
#define DINO_UI_IS_FILE_SEND_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_FILE_SEND_OVERLAY))
#define DINO_UI_FILE_SEND_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_FILE_SEND_OVERLAY, DinoUiFileSendOverlayClass))

typedef struct _DinoUiFileSendOverlay DinoUiFileSendOverlay;
typedef struct _DinoUiFileSendOverlayClass DinoUiFileSendOverlayClass;
typedef struct _DinoUiFileSendOverlayPrivate DinoUiFileSendOverlayPrivate;

#define DINO_UI_TYPE_SIZING_BIN (dino_ui_sizing_bin_get_type ())
#define DINO_UI_SIZING_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_SIZING_BIN, DinoUiSizingBin))
#define DINO_UI_SIZING_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_SIZING_BIN, DinoUiSizingBinClass))
#define DINO_UI_IS_SIZING_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_SIZING_BIN))
#define DINO_UI_IS_SIZING_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_SIZING_BIN))
#define DINO_UI_SIZING_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_SIZING_BIN, DinoUiSizingBinClass))

typedef struct _DinoUiSizingBin DinoUiSizingBin;
typedef struct _DinoUiSizingBinClass DinoUiSizingBinClass;
enum  {
	DINO_UI_FILE_SEND_OVERLAY_0_PROPERTY,
	DINO_UI_FILE_SEND_OVERLAY_NUM_PROPERTIES
};
static GParamSpec* dino_ui_file_send_overlay_properties[DINO_UI_FILE_SEND_OVERLAY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define DINO_UI_TYPE_FILE_IMAGE_WIDGET (dino_ui_file_image_widget_get_type ())
#define DINO_UI_FILE_IMAGE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_FILE_IMAGE_WIDGET, DinoUiFileImageWidget))
#define DINO_UI_FILE_IMAGE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_FILE_IMAGE_WIDGET, DinoUiFileImageWidgetClass))
#define DINO_UI_IS_FILE_IMAGE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_FILE_IMAGE_WIDGET))
#define DINO_UI_IS_FILE_IMAGE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_FILE_IMAGE_WIDGET))
#define DINO_UI_FILE_IMAGE_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_FILE_IMAGE_WIDGET, DinoUiFileImageWidgetClass))

typedef struct _DinoUiFileImageWidget DinoUiFileImageWidget;
typedef struct _DinoUiFileImageWidgetClass DinoUiFileImageWidgetClass;
#define _g_free0(var) (var = (g_free (var), NULL))

#define DINO_UI_TYPE_FILE_DEFAULT_WIDGET (dino_ui_file_default_widget_get_type ())
#define DINO_UI_FILE_DEFAULT_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_FILE_DEFAULT_WIDGET, DinoUiFileDefaultWidget))
#define DINO_UI_FILE_DEFAULT_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_FILE_DEFAULT_WIDGET, DinoUiFileDefaultWidgetClass))
#define DINO_UI_IS_FILE_DEFAULT_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_FILE_DEFAULT_WIDGET))
#define DINO_UI_IS_FILE_DEFAULT_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_FILE_DEFAULT_WIDGET))
#define DINO_UI_FILE_DEFAULT_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_FILE_DEFAULT_WIDGET, DinoUiFileDefaultWidgetClass))

typedef struct _DinoUiFileDefaultWidget DinoUiFileDefaultWidget;
typedef struct _DinoUiFileDefaultWidgetClass DinoUiFileDefaultWidgetClass;
typedef struct _DinoUiFileDefaultWidgetPrivate DinoUiFileDefaultWidgetPrivate;
typedef struct _DinoUiFileSendOverlayLoadFileWidgetData DinoUiFileSendOverlayLoadFileWidgetData;
enum  {
	DINO_UI_FILE_SEND_OVERLAY_CLOSE_SIGNAL,
	DINO_UI_FILE_SEND_OVERLAY_SEND_FILE_SIGNAL,
	DINO_UI_FILE_SEND_OVERLAY_NUM_SIGNALS
};
static guint dino_ui_file_send_overlay_signals[DINO_UI_FILE_SEND_OVERLAY_NUM_SIGNALS] = {0};

struct _DinoUiFileSendOverlay {
	GObject parent_instance;
	DinoUiFileSendOverlayPrivate * priv;
	GtkBox* main_box;
	GtkButton* close_button;
	GtkButton* send_button;
	DinoUiSizingBin* file_widget_insert;
	GtkLabel* info_label;
};

struct _DinoUiFileSendOverlayClass {
	GObjectClass parent_class;
};

struct _DinoUiFileSendOverlayPrivate {
	gboolean can_send;
};

struct _DinoUiFileDefaultWidget {
	GtkBox parent_instance;
	DinoUiFileDefaultWidgetPrivate * priv;
	GtkStack* image_stack;
	GtkLabel* name_label;
	GtkLabel* mime_label;
	GtkImage* content_type_image;
	GtkSpinner* spinner;
	GtkMenuButton* file_menu;
};

struct _DinoUiFileDefaultWidgetClass {
	GtkBoxClass parent_class;
};

struct _DinoUiFileSendOverlayLoadFileWidgetData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoUiFileSendOverlay* self;
	GFile* file;
	GFileInfo* file_info;
	gchar* file_name;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* mime_type;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean is_image;
	const gchar* _tmp4_;
	GtkWidget* widget;
	DinoUiFileImageWidget* image_widget;
	DinoUiFileImageWidget* _tmp5_;
	DinoUiFileImageWidget* _tmp6_;
	const gchar* _tmp7_;
	DinoUiFileImageWidget* _tmp8_;
	GtkWidget* _tmp9_;
	GtkWidget* _tmp10_;
	DinoUiFileDefaultWidget* default_widget;
	DinoUiFileDefaultWidget* _tmp11_;
	DinoUiFileDefaultWidget* _tmp12_;
	GtkLabel* _tmp13_;
	const gchar* _tmp14_;
	DinoUiFileDefaultWidget* _tmp15_;
	const gchar* _tmp16_;
	DinoUiFileDefaultWidget* _tmp17_;
	GtkWidget* _tmp18_;
	GtkWidget* _tmp19_;
	DinoUiSizingBin* _tmp20_;
	GError* _inner_error0_;
};

static gint DinoUiFileSendOverlay_private_offset;
static gpointer dino_ui_file_send_overlay_parent_class = NULL;

VALA_EXTERN GType dino_ui_file_send_overlay_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiFileSendOverlay, g_object_unref)
VALA_EXTERN GType dino_ui_sizing_bin_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiSizingBin, g_object_unref)
VALA_EXTERN DinoUiFileSendOverlay* dino_ui_file_send_overlay_new (GFile* file,
                                                      GFileInfo* file_info);
VALA_EXTERN DinoUiFileSendOverlay* dino_ui_file_send_overlay_construct (GType object_type,
                                                            GFile* file,
                                                            GFileInfo* file_info);
static void __lambda201_ (DinoUiFileSendOverlay* self);
static void ___lambda201__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda202_ (DinoUiFileSendOverlay* self);
static void ___lambda202__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void dino_ui_file_send_overlay_load_file_widget (DinoUiFileSendOverlay* self,
                                                 GFile* file,
                                                 GFileInfo* file_info,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_);
static void dino_ui_file_send_overlay_load_file_widget_finish (DinoUiFileSendOverlay* self,
                                                        GAsyncResult* _res_);
static void __lambda203_ (DinoUiFileSendOverlay* self);
static void ___lambda203__gtk_widget_realize (GtkWidget* _sender,
                                       gpointer self);
static gboolean __lambda204_ (DinoUiFileSendOverlay* self,
                       guint keyval);
static gboolean ___lambda204__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                             guint keyval,
                                                             guint keycode,
                                                             GdkModifierType state,
                                                             gpointer self);
static void dino_ui_file_send_overlay_load_file_widget_data_free (gpointer _data);
static gboolean dino_ui_file_send_overlay_load_file_widget_co (DinoUiFileSendOverlayLoadFileWidgetData* _data_);
VALA_EXTERN GType dino_ui_file_image_widget_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiFileImageWidget, g_object_unref)
VALA_EXTERN DinoUiFileImageWidget* dino_ui_file_image_widget_new (gint MAX_WIDTH,
                                                      gint MAX_HEIGHT);
VALA_EXTERN DinoUiFileImageWidget* dino_ui_file_image_widget_construct (GType object_type,
                                                            gint MAX_WIDTH,
                                                            gint MAX_HEIGHT);
VALA_EXTERN void dino_ui_file_image_widget_load_from_file (DinoUiFileImageWidget* self,
                                               GFile* file,
                                               const gchar* file_name,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
VALA_EXTERN void dino_ui_file_image_widget_load_from_file_finish (DinoUiFileImageWidget* self,
                                                      GAsyncResult* _res_,
                                                      GError** error);
static void dino_ui_file_send_overlay_load_file_widget_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_);
VALA_EXTERN GType dino_ui_file_default_widget_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiFileDefaultWidget, g_object_unref)
VALA_EXTERN DinoUiFileDefaultWidget* dino_ui_file_default_widget_new (void);
VALA_EXTERN DinoUiFileDefaultWidget* dino_ui_file_default_widget_construct (GType object_type);
VALA_EXTERN void dino_ui_file_default_widget_set_static_file_info (DinoUiFileDefaultWidget* self,
                                                       const gchar* mime_type);
VALA_EXTERN void dino_ui_file_send_overlay_set_file_too_large (DinoUiFileSendOverlay* self);
VALA_EXTERN void dino_ui_util_force_error_color (GtkWidget* widget,
                                     const gchar* selector);
VALA_EXTERN GtkWidget* dino_ui_file_send_overlay_get_widget (DinoUiFileSendOverlay* self);
static void dino_ui_file_send_overlay_finalize (GObject * obj);
static GType dino_ui_file_send_overlay_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_ui_file_send_overlay_get_instance_private (DinoUiFileSendOverlay* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiFileSendOverlay_private_offset);
}

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

static void
__lambda201_ (DinoUiFileSendOverlay* self)
{
	g_signal_emit (self, dino_ui_file_send_overlay_signals[DINO_UI_FILE_SEND_OVERLAY_CLOSE_SIGNAL], 0);
}

static void
___lambda201__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda201_ ((DinoUiFileSendOverlay*) self);
}

static void
__lambda202_ (DinoUiFileSendOverlay* self)
{
	g_signal_emit (self, dino_ui_file_send_overlay_signals[DINO_UI_FILE_SEND_OVERLAY_SEND_FILE_SIGNAL], 0);
	g_signal_emit (self, dino_ui_file_send_overlay_signals[DINO_UI_FILE_SEND_OVERLAY_CLOSE_SIGNAL], 0);
}

static void
___lambda202__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda202_ ((DinoUiFileSendOverlay*) self);
}

static void
__lambda203_ (DinoUiFileSendOverlay* self)
{
	if (self->priv->can_send) {
		GtkButton* _tmp0_;
		_tmp0_ = self->send_button;
		gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
	} else {
		GtkButton* _tmp1_;
		_tmp1_ = self->close_button;
		gtk_widget_grab_focus ((GtkWidget*) _tmp1_);
	}
}

static void
___lambda203__gtk_widget_realize (GtkWidget* _sender,
                                  gpointer self)
{
	__lambda203_ ((DinoUiFileSendOverlay*) self);
}

static gboolean
__lambda204_ (DinoUiFileSendOverlay* self,
              guint keyval)
{
	gboolean result;
	if (keyval == GDK_KEY_Escape) {
		g_signal_emit (self, dino_ui_file_send_overlay_signals[DINO_UI_FILE_SEND_OVERLAY_CLOSE_SIGNAL], 0);
	}
	result = FALSE;
	return result;
}

static gboolean
___lambda204__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                    guint keyval,
                                                    guint keycode,
                                                    GdkModifierType state,
                                                    gpointer self)
{
	gboolean result;
	result = __lambda204_ ((DinoUiFileSendOverlay*) self, keyval);
	return result;
}

DinoUiFileSendOverlay*
dino_ui_file_send_overlay_construct (GType object_type,
                                     GFile* file,
                                     GFileInfo* file_info)
{
	DinoUiFileSendOverlay * self = NULL;
	GtkBuilder* builder = NULL;
	GtkBuilder* _tmp0_;
	GObject* _tmp1_;
	GtkBox* _tmp2_;
	GObject* _tmp3_;
	GObject* _tmp4_;
	GObject* _tmp5_;
	GObject* _tmp6_;
	GtkButton* _tmp7_;
	GtkButton* _tmp8_;
	GtkBox* _tmp9_;
	GtkEventControllerKey* key_events = NULL;
	GtkEventControllerKey* _tmp10_;
	GtkBox* _tmp11_;
	GtkEventController* _tmp12_;
	g_return_val_if_fail (file != NULL, NULL);
	g_return_val_if_fail (file_info != NULL, NULL);
	self = (DinoUiFileSendOverlay*) g_object_new (object_type, NULL);
	_tmp0_ = gtk_builder_new_from_resource ("/im/dino/Dino/file_send_overlay.ui");
	builder = _tmp0_;
	_tmp1_ = gtk_builder_get_object (builder, "main_box");
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_box_get_type (), GtkBox));
	_g_object_unref0 (self->main_box);
	self->main_box = _tmp2_;
	_tmp3_ = gtk_builder_get_object (builder, "close_button");
	self->close_button = G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, gtk_button_get_type (), GtkButton);
	_tmp4_ = gtk_builder_get_object (builder, "send_button");
	self->send_button = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, gtk_button_get_type (), GtkButton);
	_tmp5_ = gtk_builder_get_object (builder, "file_widget_insert");
	self->file_widget_insert = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, DINO_UI_TYPE_SIZING_BIN, DinoUiSizingBin);
	_tmp6_ = gtk_builder_get_object (builder, "info_label");
	self->info_label = G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_label_get_type (), GtkLabel);
	_tmp7_ = self->close_button;
	g_signal_connect_object (_tmp7_, "clicked", (GCallback) ___lambda201__gtk_button_clicked, self, 0);
	_tmp8_ = self->send_button;
	g_signal_connect_object (_tmp8_, "clicked", (GCallback) ___lambda202__gtk_button_clicked, self, 0);
	dino_ui_file_send_overlay_load_file_widget (self, file, file_info, NULL, NULL);
	_tmp9_ = self->main_box;
	g_signal_connect_object ((GtkWidget*) _tmp9_, "realize", (GCallback) ___lambda203__gtk_widget_realize, self, 0);
	_tmp10_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	key_events = _tmp10_;
	g_signal_connect_object (key_events, "key-pressed", (GCallback) ___lambda204__gtk_event_controller_key_key_pressed, self, 0);
	_tmp11_ = self->main_box;
	_tmp12_ = _g_object_ref0 ((GtkEventController*) key_events);
	gtk_widget_add_controller ((GtkWidget*) _tmp11_, _tmp12_);
	_g_object_unref0 (key_events);
	_g_object_unref0 (builder);
	return self;
}

DinoUiFileSendOverlay*
dino_ui_file_send_overlay_new (GFile* file,
                               GFileInfo* file_info)
{
	return dino_ui_file_send_overlay_construct (DINO_UI_TYPE_FILE_SEND_OVERLAY, file, file_info);
}

static void
dino_ui_file_send_overlay_load_file_widget_data_free (gpointer _data)
{
	DinoUiFileSendOverlayLoadFileWidgetData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file);
	_g_object_unref0 (_data_->file_info);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoUiFileSendOverlayLoadFileWidgetData, _data_);
}

static void
dino_ui_file_send_overlay_load_file_widget (DinoUiFileSendOverlay* self,
                                            GFile* file,
                                            GFileInfo* file_info,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_)
{
	DinoUiFileSendOverlayLoadFileWidgetData* _data_;
	DinoUiFileSendOverlay* _tmp0_;
	GFile* _tmp1_;
	GFileInfo* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file != NULL);
	g_return_if_fail (file_info != NULL);
	_data_ = g_slice_new0 (DinoUiFileSendOverlayLoadFileWidgetData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_ui_file_send_overlay_load_file_widget_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (file);
	_g_object_unref0 (_data_->file);
	_data_->file = _tmp1_;
	_tmp2_ = _g_object_ref0 (file_info);
	_g_object_unref0 (_data_->file_info);
	_data_->file_info = _tmp2_;
	dino_ui_file_send_overlay_load_file_widget_co (_data_);
}

static void
dino_ui_file_send_overlay_load_file_widget_finish (DinoUiFileSendOverlay* self,
                                                   GAsyncResult* _res_)
{
	DinoUiFileSendOverlayLoadFileWidgetData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dino_ui_file_send_overlay_load_file_widget_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_)
{
	DinoUiFileSendOverlayLoadFileWidgetData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_ui_file_send_overlay_load_file_widget_co (_data_);
}

static gboolean
dino_ui_file_send_overlay_load_file_widget_co (DinoUiFileSendOverlayLoadFileWidgetData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_file_info_get_display_name (_data_->file_info);
	_data_->_tmp1_ = g_strdup (_data_->_tmp0_);
	_data_->file_name = _data_->_tmp1_;
	_data_->_tmp2_ = g_file_info_get_content_type (_data_->file_info);
	_data_->_tmp3_ = g_strdup (_data_->_tmp2_);
	_data_->mime_type = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->mime_type;
	_data_->is_image = dino_util_is_pixbuf_supported_mime_type (_data_->_tmp4_);
	_data_->widget = NULL;
	if (_data_->is_image) {
		_data_->_tmp5_ = dino_ui_file_image_widget_new (600, 300);
		g_object_ref_sink (_data_->_tmp5_);
		_data_->image_widget = _data_->_tmp5_;
		{
			_data_->_tmp6_ = _data_->image_widget;
			_data_->_tmp7_ = _data_->file_name;
			_data_->_state_ = 1;
			dino_ui_file_image_widget_load_from_file (_data_->_tmp6_, _data_->file, _data_->_tmp7_, dino_ui_file_send_overlay_load_file_widget_ready, _data_);
			return FALSE;
			_state_1:
			dino_ui_file_image_widget_load_from_file_finish (_data_->_tmp6_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->_tmp8_ = _data_->image_widget;
			_data_->_tmp9_ = _g_object_ref0 ((GtkWidget*) _data_->_tmp8_);
			_g_object_unref0 (_data_->widget);
			_data_->widget = _data_->_tmp9_;
		}
		goto __finally0;
		__catch0_g_error:
		{
			g_clear_error (&_data_->_inner_error0_);
		}
		__finally0:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->image_widget);
			_g_object_unref0 (_data_->widget);
			_g_free0 (_data_->mime_type);
			_g_free0 (_data_->file_name);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_g_object_unref0 (_data_->image_widget);
	}
	_data_->_tmp10_ = _data_->widget;
	if (_data_->_tmp10_ == NULL) {
		_data_->_tmp11_ = dino_ui_file_default_widget_new ();
		g_object_ref_sink (_data_->_tmp11_);
		_data_->default_widget = _data_->_tmp11_;
		_data_->_tmp12_ = _data_->default_widget;
		_data_->_tmp13_ = _data_->_tmp12_->name_label;
		_data_->_tmp14_ = _data_->file_name;
		gtk_label_set_label (_data_->_tmp13_, _data_->_tmp14_);
		_data_->_tmp15_ = _data_->default_widget;
		_data_->_tmp16_ = _data_->mime_type;
		dino_ui_file_default_widget_set_static_file_info (_data_->_tmp15_, _data_->_tmp16_);
		_data_->_tmp17_ = _data_->default_widget;
		_data_->_tmp18_ = _g_object_ref0 ((GtkWidget*) _data_->_tmp17_);
		_g_object_unref0 (_data_->widget);
		_data_->widget = _data_->_tmp18_;
		_g_object_unref0 (_data_->default_widget);
	}
	_data_->_tmp19_ = _data_->widget;
	_data_->_tmp20_ = _data_->self->file_widget_insert;
	gtk_widget_set_parent (_data_->_tmp19_, (GtkWidget*) _data_->_tmp20_);
	_g_object_unref0 (_data_->widget);
	_g_free0 (_data_->mime_type);
	_g_free0 (_data_->file_name);
	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;
}

void
dino_ui_file_send_overlay_set_file_too_large (DinoUiFileSendOverlay* self)
{
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	GtkLabel* _tmp2_;
	GtkButton* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->info_label;
	_tmp1_ = dino_gettext ("The file exceeds the server's maximum upload size.");
	gtk_label_set_label (_tmp0_, _tmp1_);
	_tmp2_ = self->info_label;
	dino_ui_util_force_error_color ((GtkWidget*) _tmp2_, "*");
	_tmp3_ = self->send_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, FALSE);
	self->priv->can_send = FALSE;
}

GtkWidget*
dino_ui_file_send_overlay_get_widget (DinoUiFileSendOverlay* self)
{
	GtkBox* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->main_box;
	_tmp1_ = _g_object_ref0 ((GtkWidget*) _tmp0_);
	result = _tmp1_;
	return result;
}

static void
dino_ui_file_send_overlay_class_init (DinoUiFileSendOverlayClass * klass,
                                      gpointer klass_data)
{
	dino_ui_file_send_overlay_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiFileSendOverlay_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dino_ui_file_send_overlay_finalize;
	dino_ui_file_send_overlay_signals[DINO_UI_FILE_SEND_OVERLAY_CLOSE_SIGNAL] = g_signal_new ("close", DINO_UI_TYPE_FILE_SEND_OVERLAY, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	dino_ui_file_send_overlay_signals[DINO_UI_FILE_SEND_OVERLAY_SEND_FILE_SIGNAL] = g_signal_new ("send-file", DINO_UI_TYPE_FILE_SEND_OVERLAY, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
dino_ui_file_send_overlay_instance_init (DinoUiFileSendOverlay * self,
                                         gpointer klass)
{
	self->priv = dino_ui_file_send_overlay_get_instance_private (self);
	self->priv->can_send = TRUE;
}

static void
dino_ui_file_send_overlay_finalize (GObject * obj)
{
	DinoUiFileSendOverlay * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_FILE_SEND_OVERLAY, DinoUiFileSendOverlay);
	_g_object_unref0 (self->main_box);
	G_OBJECT_CLASS (dino_ui_file_send_overlay_parent_class)->finalize (obj);
}

static GType
dino_ui_file_send_overlay_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiFileSendOverlayClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_file_send_overlay_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiFileSendOverlay), 0, (GInstanceInitFunc) dino_ui_file_send_overlay_instance_init, NULL };
	GType dino_ui_file_send_overlay_type_id;
	dino_ui_file_send_overlay_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoUiFileSendOverlay", &g_define_type_info, 0);
	DinoUiFileSendOverlay_private_offset = g_type_add_instance_private (dino_ui_file_send_overlay_type_id, sizeof (DinoUiFileSendOverlayPrivate));
	return dino_ui_file_send_overlay_type_id;
}

GType
dino_ui_file_send_overlay_get_type (void)
{
	static volatile gsize dino_ui_file_send_overlay_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_file_send_overlay_type_id__once)) {
		GType dino_ui_file_send_overlay_type_id;
		dino_ui_file_send_overlay_type_id = dino_ui_file_send_overlay_get_type_once ();
		g_once_init_leave (&dino_ui_file_send_overlay_type_id__once, dino_ui_file_send_overlay_type_id);
	}
	return dino_ui_file_send_overlay_type_id__once;
}

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

