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

#include "libdino.h"
#include <glib-object.h>
#include <gee.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.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_CONVERSATION_SUMMARY_TYPE_CONTENT_META_ITEM (dino_ui_conversation_summary_content_meta_item_get_type ())
#define DINO_UI_CONVERSATION_SUMMARY_CONTENT_META_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONTENT_META_ITEM, DinoUiConversationSummaryContentMetaItem))
#define DINO_UI_CONVERSATION_SUMMARY_CONTENT_META_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONTENT_META_ITEM, DinoUiConversationSummaryContentMetaItemClass))
#define DINO_UI_CONVERSATION_SUMMARY_IS_CONTENT_META_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONTENT_META_ITEM))
#define DINO_UI_CONVERSATION_SUMMARY_IS_CONTENT_META_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONTENT_META_ITEM))
#define DINO_UI_CONVERSATION_SUMMARY_CONTENT_META_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONTENT_META_ITEM, DinoUiConversationSummaryContentMetaItemClass))

typedef struct _DinoUiConversationSummaryContentMetaItem DinoUiConversationSummaryContentMetaItem;
typedef struct _DinoUiConversationSummaryContentMetaItemClass DinoUiConversationSummaryContentMetaItemClass;
typedef struct _DinoUiConversationSummaryContentMetaItemPrivate DinoUiConversationSummaryContentMetaItemPrivate;

#define DINO_UI_TYPE_FILE_META_ITEM (dino_ui_file_meta_item_get_type ())
#define DINO_UI_FILE_META_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_FILE_META_ITEM, DinoUiFileMetaItem))
#define DINO_UI_FILE_META_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_FILE_META_ITEM, DinoUiFileMetaItemClass))
#define DINO_UI_IS_FILE_META_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_FILE_META_ITEM))
#define DINO_UI_IS_FILE_META_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_FILE_META_ITEM))
#define DINO_UI_FILE_META_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_FILE_META_ITEM, DinoUiFileMetaItemClass))

typedef struct _DinoUiFileMetaItem DinoUiFileMetaItem;
typedef struct _DinoUiFileMetaItemClass DinoUiFileMetaItemClass;
typedef struct _DinoUiFileMetaItemPrivate DinoUiFileMetaItemPrivate;
enum  {
	DINO_UI_FILE_META_ITEM_0_PROPERTY,
	DINO_UI_FILE_META_ITEM_NUM_PROPERTIES
};
static GParamSpec* dino_ui_file_meta_item_properties[DINO_UI_FILE_META_ITEM_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define DINO_UI_TYPE_SIZE_REQUEST_BIN (dino_ui_size_request_bin_get_type ())
#define DINO_UI_SIZE_REQUEST_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_SIZE_REQUEST_BIN, DinoUiSizeRequestBin))
#define DINO_UI_SIZE_REQUEST_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_SIZE_REQUEST_BIN, DinoUiSizeRequestBinClass))
#define DINO_UI_IS_SIZE_REQUEST_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_SIZE_REQUEST_BIN))
#define DINO_UI_IS_SIZE_REQUEST_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_SIZE_REQUEST_BIN))
#define DINO_UI_SIZE_REQUEST_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_SIZE_REQUEST_BIN, DinoUiSizeRequestBinClass))

typedef struct _DinoUiSizeRequestBin DinoUiSizeRequestBin;
typedef struct _DinoUiSizeRequestBinClass DinoUiSizeRequestBinClass;

#define DINO_UI_TYPE_FILE_WIDGET (dino_ui_file_widget_get_type ())
#define DINO_UI_FILE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_FILE_WIDGET, DinoUiFileWidget))
#define DINO_UI_FILE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_FILE_WIDGET, DinoUiFileWidgetClass))
#define DINO_UI_IS_FILE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_FILE_WIDGET))
#define DINO_UI_IS_FILE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_FILE_WIDGET))
#define DINO_UI_FILE_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_FILE_WIDGET, DinoUiFileWidgetClass))

typedef struct _DinoUiFileWidget DinoUiFileWidget;
typedef struct _DinoUiFileWidgetClass DinoUiFileWidgetClass;

#define DINO_UI_TYPE_FILE_WIDGET_CONTROLLER (dino_ui_file_widget_controller_get_type ())
#define DINO_UI_FILE_WIDGET_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_FILE_WIDGET_CONTROLLER, DinoUiFileWidgetController))
#define DINO_UI_FILE_WIDGET_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_FILE_WIDGET_CONTROLLER, DinoUiFileWidgetControllerClass))
#define DINO_UI_IS_FILE_WIDGET_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_FILE_WIDGET_CONTROLLER))
#define DINO_UI_IS_FILE_WIDGET_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_FILE_WIDGET_CONTROLLER))
#define DINO_UI_FILE_WIDGET_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_FILE_WIDGET_CONTROLLER, DinoUiFileWidgetControllerClass))

typedef struct _DinoUiFileWidgetController DinoUiFileWidgetController;
typedef struct _DinoUiFileWidgetControllerClass DinoUiFileWidgetControllerClass;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _DinoUiSizeRequestBinPrivate DinoUiSizeRequestBinPrivate;
typedef struct _DinoUiFileWidgetPrivate DinoUiFileWidgetPrivate;
typedef enum  {
	DINO_UI_FILE_WIDGET_STATE_IMAGE,
	DINO_UI_FILE_WIDGET_STATE_DEFAULT
} DinoUiFileWidgetState;

#define DINO_UI_FILE_WIDGET_TYPE_STATE (dino_ui_file_widget_state_get_type ())

#define DINO_UI_TYPE_FILE_DEFAULT_WIDGET_CONTROLLER (dino_ui_file_default_widget_controller_get_type ())
#define DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_FILE_DEFAULT_WIDGET_CONTROLLER, DinoUiFileDefaultWidgetController))
#define DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_FILE_DEFAULT_WIDGET_CONTROLLER, DinoUiFileDefaultWidgetControllerClass))
#define DINO_UI_IS_FILE_DEFAULT_WIDGET_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_FILE_DEFAULT_WIDGET_CONTROLLER))
#define DINO_UI_IS_FILE_DEFAULT_WIDGET_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_FILE_DEFAULT_WIDGET_CONTROLLER))
#define DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_FILE_DEFAULT_WIDGET_CONTROLLER, DinoUiFileDefaultWidgetControllerClass))

typedef struct _DinoUiFileDefaultWidgetController DinoUiFileDefaultWidgetController;
typedef struct _DinoUiFileDefaultWidgetControllerClass DinoUiFileDefaultWidgetControllerClass;
enum  {
	DINO_UI_FILE_WIDGET_0_PROPERTY,
	DINO_UI_FILE_WIDGET_FILE_TRANSFER_STATE_PROPERTY,
	DINO_UI_FILE_WIDGET_FILE_TRANSFER_MIME_TYPE_PROPERTY,
	DINO_UI_FILE_WIDGET_NUM_PROPERTIES
};
static GParamSpec* dino_ui_file_widget_properties[DINO_UI_FILE_WIDGET_NUM_PROPERTIES];

#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 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 _DinoUiFileWidgetUpdateWidgetData DinoUiFileWidgetUpdateWidgetData;
enum  {
	DINO_UI_FILE_WIDGET_OPEN_FILE_SIGNAL,
	DINO_UI_FILE_WIDGET_SAVE_FILE_AS_SIGNAL,
	DINO_UI_FILE_WIDGET_START_DOWNLOAD_SIGNAL,
	DINO_UI_FILE_WIDGET_CANCEL_DOWNLOAD_SIGNAL,
	DINO_UI_FILE_WIDGET_NUM_SIGNALS
};
static guint dino_ui_file_widget_signals[DINO_UI_FILE_WIDGET_NUM_SIGNALS] = {0};
typedef struct _DinoUiFileWidgetControllerPrivate DinoUiFileWidgetControllerPrivate;
enum  {
	DINO_UI_FILE_WIDGET_CONTROLLER_0_PROPERTY,
	DINO_UI_FILE_WIDGET_CONTROLLER_NUM_PROPERTIES
};
static GParamSpec* dino_ui_file_widget_controller_properties[DINO_UI_FILE_WIDGET_CONTROLLER_NUM_PROPERTIES];
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block32Data Block32Data;
typedef struct _DinoUiFileDefaultWidgetControllerPrivate DinoUiFileDefaultWidgetControllerPrivate;
enum  {
	DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_0_PROPERTY,
	DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_STATE_PROPERTY,
	DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_MIME_TYPE_PROPERTY,
	DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_TRANSFERRED_BYTES_PROPERTY,
	DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_NUM_PROPERTIES
};
static GParamSpec* dino_ui_file_default_widget_controller_properties[DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_NUM_PROPERTIES];
typedef struct _DinoUiFileDefaultWidgetPrivate DinoUiFileDefaultWidgetPrivate;

struct _DinoUiConversationSummaryContentMetaItem {
	DinoPluginsMetaConversationItem parent_instance;
	DinoUiConversationSummaryContentMetaItemPrivate * priv;
	DinoContentItem* content_item;
};

struct _DinoUiConversationSummaryContentMetaItemClass {
	DinoPluginsMetaConversationItemClass parent_class;
};

struct _DinoUiFileMetaItem {
	DinoUiConversationSummaryContentMetaItem parent_instance;
	DinoUiFileMetaItemPrivate * priv;
};

struct _DinoUiFileMetaItemClass {
	DinoUiConversationSummaryContentMetaItemClass parent_class;
};

struct _DinoUiFileMetaItemPrivate {
	DinoStreamInteractor* stream_interactor;
	DinoFileItem* file_item;
	DinoEntitiesFileTransfer* file_transfer;
};

struct _DinoUiSizeRequestBin {
	GtkWidget parent_instance;
	DinoUiSizeRequestBinPrivate * priv;
};

struct _DinoUiSizeRequestBinClass {
	GtkWidgetClass parent_class;
};

struct _DinoUiFileWidget {
	DinoUiSizeRequestBin parent_instance;
	DinoUiFileWidgetPrivate * priv;
};

struct _DinoUiFileWidgetClass {
	DinoUiSizeRequestBinClass parent_class;
};

struct _DinoUiFileWidgetPrivate {
	DinoEntitiesFileTransfer* file_transfer;
	DinoEntitiesFileTransferState _file_transfer_state;
	gchar* _file_transfer_mime_type;
	DinoUiFileWidgetState* state;
	DinoUiFileDefaultWidgetController* default_widget_controller;
	GtkWidget* content;
};

struct _DinoUiFileWidgetUpdateWidgetData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoUiFileWidget* self;
	gboolean show_image;
	DinoEntitiesFileTransfer* _tmp0_;
	gboolean _tmp1_;
	DinoUiFileWidgetState* _tmp2_;
	DinoUiFileWidgetState _tmp3_;
	GtkWidget* content_bak;
	GtkWidget* _tmp4_;
	GtkWidget* _tmp5_;
	DinoUiFileImageWidget* file_image_widget;
	DinoUiFileImageWidget* _tmp6_;
	DinoUiFileImageWidget* _tmp7_;
	DinoEntitiesFileTransfer* _tmp8_;
	GtkWidget* _tmp9_;
	GtkWidget* _tmp10_;
	GtkWidget* _tmp11_;
	GtkWidget* _tmp12_;
	DinoUiFileImageWidget* _tmp13_;
	GtkWidget* _tmp14_;
	DinoUiFileWidgetState _tmp15_;
	DinoUiFileWidgetState* _tmp16_;
	GtkWidget* _tmp17_;
	gboolean _tmp18_;
	DinoUiFileWidgetState* _tmp19_;
	DinoUiFileWidgetState _tmp20_;
	GtkWidget* _tmp21_;
	GtkWidget* _tmp22_;
	DinoUiFileDefaultWidget* default_file_widget;
	DinoUiFileDefaultWidget* _tmp23_;
	DinoUiFileDefaultWidget* _tmp24_;
	DinoUiFileDefaultWidgetController* _tmp25_;
	DinoUiFileDefaultWidgetController* _tmp26_;
	DinoEntitiesFileTransfer* _tmp27_;
	DinoUiFileDefaultWidget* _tmp28_;
	GtkWidget* _tmp29_;
	DinoUiFileWidgetState _tmp30_;
	DinoUiFileWidgetState* _tmp31_;
	GtkWidget* _tmp32_;
	GError* _inner_error0_;
};

struct _DinoUiFileWidgetController {
	GObject parent_instance;
	DinoUiFileWidgetControllerPrivate * priv;
};

struct _DinoUiFileWidgetControllerClass {
	GObjectClass parent_class;
};

struct _DinoUiFileWidgetControllerPrivate {
	GtkWidget* widget;
	DinoEntitiesFileTransfer* file_transfer;
	DinoStreamInteractor* stream_interactor;
};

struct _Block32Data {
	int _ref_count_;
	DinoUiFileWidgetController* self;
	GtkFileChooserNative* save_dialog;
};

struct _DinoUiFileDefaultWidgetController {
	GObject parent_instance;
	DinoUiFileDefaultWidgetControllerPrivate * priv;
};

struct _DinoUiFileDefaultWidgetControllerClass {
	GObjectClass parent_class;
};

struct _DinoUiFileDefaultWidgetControllerPrivate {
	DinoUiFileDefaultWidget* widget;
	DinoEntitiesFileTransfer* file_transfer;
	gchar* _file_transfer_state;
	gchar* _file_transfer_mime_type;
	gint64 _file_transfer_transferred_bytes;
	DinoEntitiesFileTransferState state;
};

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

static gint DinoUiFileMetaItem_private_offset;
static gpointer dino_ui_file_meta_item_parent_class = NULL;
static gint DinoUiFileWidget_private_offset;
static gpointer dino_ui_file_widget_parent_class = NULL;
static gint DinoUiFileWidgetController_private_offset;
static gpointer dino_ui_file_widget_controller_parent_class = NULL;
static gint DinoUiFileDefaultWidgetController_private_offset;
static gpointer dino_ui_file_default_widget_controller_parent_class = NULL;

VALA_EXTERN GType dino_ui_conversation_summary_content_meta_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiConversationSummaryContentMetaItem, g_object_unref)
VALA_EXTERN GType dino_ui_file_meta_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiFileMetaItem, g_object_unref)
VALA_EXTERN DinoUiFileMetaItem* dino_ui_file_meta_item_new (DinoContentItem* content_item,
                                                DinoStreamInteractor* stream_interactor);
VALA_EXTERN DinoUiFileMetaItem* dino_ui_file_meta_item_construct (GType object_type,
                                                      DinoContentItem* content_item,
                                                      DinoStreamInteractor* stream_interactor);
VALA_EXTERN DinoUiConversationSummaryContentMetaItem* dino_ui_conversation_summary_content_meta_item_construct (GType object_type,
                                                                                                    DinoContentItem* content_item);
static GObject* dino_ui_file_meta_item_real_get_widget (DinoPluginsMetaConversationItem* base,
                                                 DinoPluginsConversationItemWidgetInterface* outer,
                                                 DinoPluginsWidgetType type);
VALA_EXTERN GType dino_ui_size_request_bin_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiSizeRequestBin, g_object_unref)
VALA_EXTERN GType dino_ui_file_widget_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiFileWidget, g_object_unref)
VALA_EXTERN DinoUiFileWidget* dino_ui_file_widget_new (DinoEntitiesFileTransfer* file_transfer);
VALA_EXTERN DinoUiFileWidget* dino_ui_file_widget_construct (GType object_type,
                                                 DinoEntitiesFileTransfer* file_transfer);
VALA_EXTERN GType dino_ui_file_widget_controller_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiFileWidgetController, g_object_unref)
VALA_EXTERN DinoUiFileWidgetController* dino_ui_file_widget_controller_new (DinoUiFileWidget* widget,
                                                                DinoEntitiesFileTransfer* file_transfer,
                                                                DinoStreamInteractor* stream_interactor);
VALA_EXTERN DinoUiFileWidgetController* dino_ui_file_widget_controller_construct (GType object_type,
                                                                      DinoUiFileWidget* widget,
                                                                      DinoEntitiesFileTransfer* file_transfer,
                                                                      DinoStreamInteractor* stream_interactor);
static GeeList* dino_ui_file_meta_item_real_get_item_actions (DinoPluginsMetaConversationItem* base,
                                                       DinoPluginsWidgetType type);
VALA_EXTERN DinoPluginsMessageAction* dino_ui_get_reply_action (DinoContentItem* content_item,
                                                    DinoEntitiesConversation* conversation,
                                                    DinoStreamInteractor* stream_interactor);
VALA_EXTERN DinoPluginsMessageAction* dino_ui_get_reaction_action (DinoContentItem* content_item,
                                                       DinoEntitiesConversation* conversation,
                                                       DinoStreamInteractor* stream_interactor);
static void dino_ui_file_meta_item_finalize (GObject * obj);
static GType dino_ui_file_meta_item_get_type_once (void);
static GType dino_ui_file_widget_state_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
VALA_EXTERN GType dino_ui_file_default_widget_controller_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiFileDefaultWidgetController, g_object_unref)
VALA_EXTERN DinoUiSizeRequestBin* dino_ui_size_request_bin_new (void);
VALA_EXTERN DinoUiSizeRequestBin* dino_ui_size_request_bin_construct (GType object_type);
static void dino_ui_file_widget_update_widget (DinoUiFileWidget* self,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
static void dino_ui_file_widget_update_widget_finish (DinoUiFileWidget* self,
                                               GAsyncResult* _res_);
static void _dino_ui_file_widget_update_widget_g_object_notify (GObject* _sender,
                                                         GParamSpec* pspec,
                                                         gpointer self);
static void dino_ui_file_widget_update_widget_data_free (gpointer _data);
static gboolean dino_ui_file_widget_update_widget_co (DinoUiFileWidgetUpdateWidgetData* _data_);
VALA_EXTERN gboolean dino_ui_file_image_widget_can_display (DinoEntitiesFileTransfer* file_transfer);
static gboolean _dino_ui_file_widget_state_equal (const DinoUiFileWidgetState * s1,
                                           const DinoUiFileWidgetState * s2);
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_set_file_transfer (DinoUiFileImageWidget* self,
                                                  DinoEntitiesFileTransfer* file_transfer,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
VALA_EXTERN void dino_ui_file_image_widget_set_file_transfer_finish (DinoUiFileImageWidget* self,
                                                         GAsyncResult* _res_);
static void dino_ui_file_widget_update_widget_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
static DinoUiFileWidgetState* _dino_ui_file_widget_state_dup (DinoUiFileWidgetState* self);
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 DinoUiFileDefaultWidgetController* dino_ui_file_default_widget_controller_new (DinoUiFileDefaultWidget* widget);
VALA_EXTERN DinoUiFileDefaultWidgetController* dino_ui_file_default_widget_controller_construct (GType object_type,
                                                                                     DinoUiFileDefaultWidget* widget);
VALA_EXTERN void dino_ui_file_default_widget_controller_set_file_transfer (DinoUiFileDefaultWidgetController* self,
                                                               DinoEntitiesFileTransfer* file_transfer);
static void dino_ui_file_widget_real_dispose (GObject* base);
VALA_EXTERN DinoEntitiesFileTransferState dino_ui_file_widget_get_file_transfer_state (DinoUiFileWidget* self);
VALA_EXTERN void dino_ui_file_widget_set_file_transfer_state (DinoUiFileWidget* self,
                                                  DinoEntitiesFileTransferState value);
VALA_EXTERN const gchar* dino_ui_file_widget_get_file_transfer_mime_type (DinoUiFileWidget* self);
VALA_EXTERN void dino_ui_file_widget_set_file_transfer_mime_type (DinoUiFileWidget* self,
                                                      const gchar* value);
static GObject * dino_ui_file_widget_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties);
VALA_EXTERN void dino_ui_size_request_bin_set_size_request_mode (DinoUiSizeRequestBin* self,
                                                     GtkSizeRequestMode value);
static void _dino_ui_file_widget___lambda42_ (GtkWidget* widget,
                                       const gchar* action_name);
static void __dino_ui_file_widget___lambda42__gtk_widget_action_activate_func (GtkWidget* widget,
                                                                        const gchar* action_name,
                                                                        GVariant* parameter);
static void _dino_ui_file_widget___lambda43_ (GtkWidget* widget,
                                       const gchar* action_name);
static void __dino_ui_file_widget___lambda43__gtk_widget_action_activate_func (GtkWidget* widget,
                                                                        const gchar* action_name,
                                                                        GVariant* parameter);
static void _dino_ui_file_widget___lambda44_ (GtkWidget* widget,
                                       const gchar* action_name);
static void __dino_ui_file_widget___lambda44__gtk_widget_action_activate_func (GtkWidget* widget,
                                                                        const gchar* action_name,
                                                                        GVariant* parameter);
static void _dino_ui_file_widget___lambda45_ (GtkWidget* widget,
                                       const gchar* action_name);
static void __dino_ui_file_widget___lambda45__gtk_widget_action_activate_func (GtkWidget* widget,
                                                                        const gchar* action_name,
                                                                        GVariant* parameter);
static void dino_ui_file_widget_finalize (GObject * obj);
static GType dino_ui_file_widget_get_type_once (void);
static void _vala_dino_ui_file_widget_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_dino_ui_file_widget_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
static void __lambda46_ (DinoUiFileWidgetController* self);
static void ___lambda46__gweak_notify (gpointer self,
                                GObject* object);
static void dino_ui_file_widget_controller_open_file (DinoUiFileWidgetController* self);
static void _dino_ui_file_widget_controller_open_file_dino_ui_file_widget_open_file (DinoUiFileWidget* _sender,
                                                                              gpointer self);
static void dino_ui_file_widget_controller_save_file (DinoUiFileWidgetController* self);
static void _dino_ui_file_widget_controller_save_file_dino_ui_file_widget_save_file_as (DinoUiFileWidget* _sender,
                                                                                 gpointer self);
static void dino_ui_file_widget_controller_start_download (DinoUiFileWidgetController* self);
static void _dino_ui_file_widget_controller_start_download_dino_ui_file_widget_start_download (DinoUiFileWidget* _sender,
                                                                                        gpointer self);
static void dino_ui_file_widget_controller_cancel_download (DinoUiFileWidgetController* self);
static void _dino_ui_file_widget_controller_cancel_download_dino_ui_file_widget_cancel_download (DinoUiFileWidget* _sender,
                                                                                          gpointer self);
static Block32Data* block32_data_ref (Block32Data* _data32_);
static void block32_data_unref (void * _userdata_);
static void __lambda47_ (Block32Data* _data32_);
static void ___lambda47__gtk_native_dialog_response (GtkNativeDialog* _sender,
                                              gint response_id,
                                              gpointer self);
static void dino_ui_file_widget_controller_finalize (GObject * obj);
static GType dino_ui_file_widget_controller_get_type_once (void);
static void dino_ui_file_default_widget_controller_on_clicked (DinoUiFileDefaultWidgetController* self);
static void _dino_ui_file_default_widget_controller_on_clicked_dino_ui_file_default_widget_clicked (DinoUiFileDefaultWidget* _sender,
                                                                                             gpointer self);
static void dino_ui_file_default_widget_controller_update_file_info (DinoUiFileDefaultWidgetController* self);
static void _dino_ui_file_default_widget_controller_update_file_info_g_object_notify (GObject* _sender,
                                                                               GParamSpec* pspec,
                                                                               gpointer self);
VALA_EXTERN void dino_ui_file_default_widget_init_updating_file_info (DinoUiFileDefaultWidget* self);
VALA_EXTERN void dino_ui_file_default_widget_update_file_info (DinoUiFileDefaultWidget* self,
                                                   const gchar* mime_type,
                                                   DinoEntitiesFileTransferState state,
                                                   gboolean direction,
                                                   gint64 size,
                                                   gint64 transferred_bytes);
VALA_EXTERN const gchar* dino_ui_file_default_widget_controller_get_file_transfer_state (DinoUiFileDefaultWidgetController* self);
VALA_EXTERN void dino_ui_file_default_widget_controller_set_file_transfer_state (DinoUiFileDefaultWidgetController* self,
                                                                     const gchar* value);
VALA_EXTERN const gchar* dino_ui_file_default_widget_controller_get_file_transfer_mime_type (DinoUiFileDefaultWidgetController* self);
VALA_EXTERN void dino_ui_file_default_widget_controller_set_file_transfer_mime_type (DinoUiFileDefaultWidgetController* self,
                                                                         const gchar* value);
VALA_EXTERN gint64 dino_ui_file_default_widget_controller_get_file_transfer_transferred_bytes (DinoUiFileDefaultWidgetController* self);
VALA_EXTERN void dino_ui_file_default_widget_controller_set_file_transfer_transferred_bytes (DinoUiFileDefaultWidgetController* self,
                                                                                 gint64 value);
static void dino_ui_file_default_widget_controller_finalize (GObject * obj);
static GType dino_ui_file_default_widget_controller_get_type_once (void);
static void _vala_dino_ui_file_default_widget_controller_get_property (GObject * object,
                                                                guint property_id,
                                                                GValue * value,
                                                                GParamSpec * pspec);
static void _vala_dino_ui_file_default_widget_controller_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
dino_ui_file_meta_item_get_instance_private (DinoUiFileMetaItem* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiFileMetaItem_private_offset);
}

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

DinoUiFileMetaItem*
dino_ui_file_meta_item_construct (GType object_type,
                                  DinoContentItem* content_item,
                                  DinoStreamInteractor* stream_interactor)
{
	DinoUiFileMetaItem * self = NULL;
	DinoStreamInteractor* _tmp0_;
	DinoFileItem* _tmp1_;
	DinoFileItem* _tmp2_;
	DinoEntitiesFileTransfer* _tmp3_;
	DinoEntitiesFileTransfer* _tmp4_;
	g_return_val_if_fail (content_item != NULL, NULL);
	g_return_val_if_fail (stream_interactor != NULL, NULL);
	self = (DinoUiFileMetaItem*) dino_ui_conversation_summary_content_meta_item_construct (object_type, content_item);
	_tmp0_ = _g_object_ref0 (stream_interactor);
	_g_object_unref0 (self->priv->stream_interactor);
	self->priv->stream_interactor = _tmp0_;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (content_item, DINO_TYPE_FILE_ITEM) ? ((DinoFileItem*) content_item) : NULL);
	_g_object_unref0 (self->priv->file_item);
	self->priv->file_item = _tmp1_;
	_tmp2_ = self->priv->file_item;
	_tmp3_ = _tmp2_->file_transfer;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (self->priv->file_transfer);
	self->priv->file_transfer = _tmp4_;
	return self;
}

DinoUiFileMetaItem*
dino_ui_file_meta_item_new (DinoContentItem* content_item,
                            DinoStreamInteractor* stream_interactor)
{
	return dino_ui_file_meta_item_construct (DINO_UI_TYPE_FILE_META_ITEM, content_item, stream_interactor);
}

static GObject*
dino_ui_file_meta_item_real_get_widget (DinoPluginsMetaConversationItem* base,
                                        DinoPluginsConversationItemWidgetInterface* outer,
                                        DinoPluginsWidgetType type)
{
	DinoUiFileMetaItem * self;
	DinoUiFileWidget* widget = NULL;
	DinoEntitiesFileTransfer* _tmp0_;
	DinoUiFileWidget* _tmp1_;
	DinoUiFileWidgetController* widget_controller = NULL;
	DinoEntitiesFileTransfer* _tmp2_;
	DinoStreamInteractor* _tmp3_;
	DinoUiFileWidgetController* _tmp4_;
	GObject* result;
	self = (DinoUiFileMetaItem*) base;
	g_return_val_if_fail (outer != NULL, NULL);
	_tmp0_ = self->priv->file_transfer;
	_tmp1_ = dino_ui_file_widget_new (_tmp0_);
	g_object_ref_sink (_tmp1_);
	widget = _tmp1_;
	_tmp2_ = self->priv->file_transfer;
	_tmp3_ = self->priv->stream_interactor;
	_tmp4_ = dino_ui_file_widget_controller_new (widget, _tmp2_, _tmp3_);
	widget_controller = _tmp4_;
	result = (GObject*) widget;
	_g_object_unref0 (widget_controller);
	return result;
}

static GeeList*
dino_ui_file_meta_item_real_get_item_actions (DinoPluginsMetaConversationItem* base,
                                              DinoPluginsWidgetType type)
{
	DinoUiFileMetaItem * self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	DinoEntitiesFileTransfer* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	GeeList* actions = NULL;
	GeeArrayList* _tmp11_;
	DinoStreamInteractor* _tmp12_;
	DinoModuleIdentity* _tmp13_;
	gpointer _tmp14_;
	DinoContentItemStore* _tmp15_;
	DinoFileItem* _tmp16_;
	DinoEntitiesConversation* _tmp17_;
	DinoContentItem* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gboolean _tmp21_;
	GeeList* result;
	self = (DinoUiFileMetaItem*) base;
	_tmp2_ = self->priv->file_transfer;
	_tmp3_ = dino_entities_file_transfer_get_provider (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ != DINO_FILE_MANAGER_HTTP_PROVIDER_ID) {
		DinoEntitiesFileTransfer* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		_tmp5_ = self->priv->file_transfer;
		_tmp6_ = dino_entities_file_transfer_get_provider (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp1_ = _tmp7_ != DINO_FILE_MANAGER_SFS_PROVIDER_ID;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		DinoEntitiesFileTransfer* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		_tmp8_ = self->priv->file_transfer;
		_tmp9_ = dino_entities_file_transfer_get_info (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp0_ = _tmp10_ == NULL;
	}
	if (_tmp0_) {
		result = NULL;
		return result;
	}
	_tmp11_ = gee_array_list_new (DINO_PLUGINS_TYPE_MESSAGE_ACTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	actions = (GeeList*) _tmp11_;
	_tmp12_ = self->priv->stream_interactor;
	_tmp13_ = dino_content_item_store_IDENTITY;
	_tmp14_ = dino_stream_interactor_get_module (_tmp12_, DINO_TYPE_CONTENT_ITEM_STORE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp13_);
	_tmp15_ = (DinoContentItemStore*) _tmp14_;
	_tmp16_ = self->priv->file_item;
	_tmp17_ = _tmp16_->conversation;
	_tmp18_ = ((DinoUiConversationSummaryContentMetaItem*) self)->content_item;
	_tmp19_ = dino_content_item_store_get_message_id_for_content_item (_tmp15_, _tmp17_, _tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = _tmp20_ != NULL;
	_g_free0 (_tmp20_);
	_g_object_unref0 (_tmp15_);
	if (_tmp21_) {
		GeeList* _tmp22_;
		DinoContentItem* _tmp23_;
		DinoFileItem* _tmp24_;
		DinoEntitiesConversation* _tmp25_;
		DinoStreamInteractor* _tmp26_;
		DinoPluginsMessageAction* _tmp27_;
		DinoPluginsMessageAction* _tmp28_;
		GeeList* _tmp29_;
		DinoContentItem* _tmp30_;
		DinoFileItem* _tmp31_;
		DinoEntitiesConversation* _tmp32_;
		DinoStreamInteractor* _tmp33_;
		DinoPluginsMessageAction* _tmp34_;
		DinoPluginsMessageAction* _tmp35_;
		_tmp22_ = actions;
		_tmp23_ = ((DinoUiConversationSummaryContentMetaItem*) self)->content_item;
		_tmp24_ = self->priv->file_item;
		_tmp25_ = _tmp24_->conversation;
		_tmp26_ = self->priv->stream_interactor;
		_tmp27_ = dino_ui_get_reply_action (_tmp23_, _tmp25_, _tmp26_);
		_tmp28_ = _tmp27_;
		gee_collection_add ((GeeCollection*) _tmp22_, _tmp28_);
		_g_object_unref0 (_tmp28_);
		_tmp29_ = actions;
		_tmp30_ = ((DinoUiConversationSummaryContentMetaItem*) self)->content_item;
		_tmp31_ = self->priv->file_item;
		_tmp32_ = _tmp31_->conversation;
		_tmp33_ = self->priv->stream_interactor;
		_tmp34_ = dino_ui_get_reaction_action (_tmp30_, _tmp32_, _tmp33_);
		_tmp35_ = _tmp34_;
		gee_collection_add ((GeeCollection*) _tmp29_, _tmp35_);
		_g_object_unref0 (_tmp35_);
	}
	result = actions;
	return result;
}

static void
dino_ui_file_meta_item_class_init (DinoUiFileMetaItemClass * klass,
                                   gpointer klass_data)
{
	dino_ui_file_meta_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiFileMetaItem_private_offset);
	((DinoPluginsMetaConversationItemClass *) klass)->get_widget = (GObject* (*) (DinoPluginsMetaConversationItem*, DinoPluginsConversationItemWidgetInterface*, DinoPluginsWidgetType)) dino_ui_file_meta_item_real_get_widget;
	((DinoPluginsMetaConversationItemClass *) klass)->get_item_actions = (GeeList* (*) (DinoPluginsMetaConversationItem*, DinoPluginsWidgetType)) dino_ui_file_meta_item_real_get_item_actions;
	G_OBJECT_CLASS (klass)->finalize = dino_ui_file_meta_item_finalize;
}

static void
dino_ui_file_meta_item_instance_init (DinoUiFileMetaItem * self,
                                      gpointer klass)
{
	self->priv = dino_ui_file_meta_item_get_instance_private (self);
}

static void
dino_ui_file_meta_item_finalize (GObject * obj)
{
	DinoUiFileMetaItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_FILE_META_ITEM, DinoUiFileMetaItem);
	_g_object_unref0 (self->priv->stream_interactor);
	_g_object_unref0 (self->priv->file_item);
	_g_object_unref0 (self->priv->file_transfer);
	G_OBJECT_CLASS (dino_ui_file_meta_item_parent_class)->finalize (obj);
}

static GType
dino_ui_file_meta_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiFileMetaItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_file_meta_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiFileMetaItem), 0, (GInstanceInitFunc) dino_ui_file_meta_item_instance_init, NULL };
	GType dino_ui_file_meta_item_type_id;
	dino_ui_file_meta_item_type_id = g_type_register_static (DINO_UI_CONVERSATION_SUMMARY_TYPE_CONTENT_META_ITEM, "DinoUiFileMetaItem", &g_define_type_info, 0);
	DinoUiFileMetaItem_private_offset = g_type_add_instance_private (dino_ui_file_meta_item_type_id, sizeof (DinoUiFileMetaItemPrivate));
	return dino_ui_file_meta_item_type_id;
}

GType
dino_ui_file_meta_item_get_type (void)
{
	static volatile gsize dino_ui_file_meta_item_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_file_meta_item_type_id__once)) {
		GType dino_ui_file_meta_item_type_id;
		dino_ui_file_meta_item_type_id = dino_ui_file_meta_item_get_type_once ();
		g_once_init_leave (&dino_ui_file_meta_item_type_id__once, dino_ui_file_meta_item_type_id);
	}
	return dino_ui_file_meta_item_type_id__once;
}

static inline gpointer
dino_ui_file_widget_get_instance_private (DinoUiFileWidget* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiFileWidget_private_offset);
}

static GType
dino_ui_file_widget_state_get_type_once (void)
{
	static const GEnumValue values[] = {{DINO_UI_FILE_WIDGET_STATE_IMAGE, "DINO_UI_FILE_WIDGET_STATE_IMAGE", "image"}, {DINO_UI_FILE_WIDGET_STATE_DEFAULT, "DINO_UI_FILE_WIDGET_STATE_DEFAULT", "default"}, {0, NULL, NULL}};
	GType dino_ui_file_widget_state_type_id;
	dino_ui_file_widget_state_type_id = g_enum_register_static ("DinoUiFileWidgetState", values);
	return dino_ui_file_widget_state_type_id;
}

static GType
dino_ui_file_widget_state_get_type (void)
{
	static volatile gsize dino_ui_file_widget_state_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_file_widget_state_type_id__once)) {
		GType dino_ui_file_widget_state_type_id;
		dino_ui_file_widget_state_type_id = dino_ui_file_widget_state_get_type_once ();
		g_once_init_leave (&dino_ui_file_widget_state_type_id__once, dino_ui_file_widget_state_type_id);
	}
	return dino_ui_file_widget_state_type_id__once;
}

static void
_dino_ui_file_widget_update_widget_g_object_notify (GObject* _sender,
                                                    GParamSpec* pspec,
                                                    gpointer self)
{
	dino_ui_file_widget_update_widget ((DinoUiFileWidget*) self, NULL, NULL);
}

DinoUiFileWidget*
dino_ui_file_widget_construct (GType object_type,
                               DinoEntitiesFileTransfer* file_transfer)
{
	DinoUiFileWidget * self = NULL;
	DinoEntitiesFileTransfer* _tmp0_;
	g_return_val_if_fail (file_transfer != NULL, NULL);
	self = (DinoUiFileWidget*) dino_ui_size_request_bin_construct (object_type);
	_tmp0_ = _g_object_ref0 (file_transfer);
	_g_object_unref0 (self->priv->file_transfer);
	self->priv->file_transfer = _tmp0_;
	dino_ui_file_widget_update_widget (self, NULL, NULL);
	g_object_bind_property_with_closures ((GObject*) file_transfer, "state", (GObject*) self, "file-transfer-state", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	g_object_bind_property_with_closures ((GObject*) file_transfer, "mime-type", (GObject*) self, "file-transfer-mime-type", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	g_signal_connect_object ((GObject*) self, "notify::file-transfer-state", (GCallback) _dino_ui_file_widget_update_widget_g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::file-transfer-mime-type", (GCallback) _dino_ui_file_widget_update_widget_g_object_notify, self, 0);
	return self;
}

DinoUiFileWidget*
dino_ui_file_widget_new (DinoEntitiesFileTransfer* file_transfer)
{
	return dino_ui_file_widget_construct (DINO_UI_TYPE_FILE_WIDGET, file_transfer);
}

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

static void
dino_ui_file_widget_update_widget (DinoUiFileWidget* self,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	DinoUiFileWidgetUpdateWidgetData* _data_;
	DinoUiFileWidget* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DinoUiFileWidgetUpdateWidgetData);
	_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_widget_update_widget_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dino_ui_file_widget_update_widget_co (_data_);
}

static void
dino_ui_file_widget_update_widget_finish (DinoUiFileWidget* self,
                                          GAsyncResult* _res_)
{
	DinoUiFileWidgetUpdateWidgetData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

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

static void
dino_ui_file_widget_update_widget_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	DinoUiFileWidgetUpdateWidgetData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_ui_file_widget_update_widget_co (_data_);
}

static DinoUiFileWidgetState*
_dino_ui_file_widget_state_dup (DinoUiFileWidgetState* self)
{
	DinoUiFileWidgetState* dup;
	dup = g_new0 (DinoUiFileWidgetState, 1);
	memcpy (dup, self, sizeof (DinoUiFileWidgetState));
	return dup;
}

static gpointer
__dino_ui_file_widget_state_dup0 (gpointer self)
{
	return self ? _dino_ui_file_widget_state_dup (self) : NULL;
}

static gboolean
dino_ui_file_widget_update_widget_co (DinoUiFileWidgetUpdateWidgetData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->file_transfer;
	_data_->show_image = dino_ui_file_image_widget_can_display (_data_->_tmp0_);
	if (_data_->show_image) {
		_data_->_tmp2_ = _data_->self->priv->state;
		_data_->_tmp3_ = DINO_UI_FILE_WIDGET_STATE_IMAGE;
		_data_->_tmp1_ = _dino_ui_file_widget_state_equal (_data_->_tmp2_, &_data_->_tmp3_) != TRUE;
	} else {
		_data_->_tmp1_ = FALSE;
	}
	if (_data_->_tmp1_) {
		_data_->_tmp4_ = _data_->self->priv->content;
		_data_->_tmp5_ = _g_object_ref0 (_data_->_tmp4_);
		_data_->content_bak = _data_->_tmp5_;
		_data_->file_image_widget = NULL;
		{
			_data_->_tmp6_ = dino_ui_file_image_widget_new (600, 300);
			g_object_ref_sink (_data_->_tmp6_);
			_g_object_unref0 (_data_->file_image_widget);
			_data_->file_image_widget = _data_->_tmp6_;
			_data_->_tmp7_ = _data_->file_image_widget;
			_data_->_tmp8_ = _data_->self->priv->file_transfer;
			_data_->_state_ = 1;
			dino_ui_file_image_widget_set_file_transfer (_data_->_tmp7_, _data_->_tmp8_, dino_ui_file_widget_update_widget_ready, _data_);
			return FALSE;
			_state_1:
			dino_ui_file_image_widget_set_file_transfer_finish (_data_->_tmp7_, _data_->_res_);
			_data_->_tmp9_ = _data_->self->priv->content;
			_data_->_tmp10_ = _data_->content_bak;
			if (_data_->_tmp9_ != _data_->_tmp10_) {
				_g_object_unref0 (_data_->file_image_widget);
				_g_object_unref0 (_data_->content_bak);
				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_->_tmp11_ = _data_->self->priv->content;
			if (_data_->_tmp11_ != NULL) {
				_data_->_tmp12_ = _data_->self->priv->content;
				gtk_widget_unparent (_data_->_tmp12_);
			}
			_data_->_tmp13_ = _data_->file_image_widget;
			_data_->_tmp14_ = _g_object_ref0 ((GtkWidget*) _data_->_tmp13_);
			_g_object_unref0 (_data_->self->priv->content);
			_data_->self->priv->content = _data_->_tmp14_;
			_data_->_tmp15_ = DINO_UI_FILE_WIDGET_STATE_IMAGE;
			_data_->_tmp16_ = __dino_ui_file_widget_state_dup0 (&_data_->_tmp15_);
			_g_free0 (_data_->self->priv->state);
			_data_->self->priv->state = _data_->_tmp16_;
			_data_->_tmp17_ = _data_->self->priv->content;
			gtk_widget_insert_after (_data_->_tmp17_, (GtkWidget*) _data_->self, NULL);
			_g_object_unref0 (_data_->file_image_widget);
			_g_object_unref0 (_data_->content_bak);
			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;
		}
		goto __finally0;
		__catch0_g_error:
		{
			g_clear_error (&_data_->_inner_error0_);
		}
		__finally0:
		_g_object_unref0 (_data_->file_image_widget);
		_g_object_unref0 (_data_->content_bak);
		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;
	}
	if (!_data_->show_image) {
		_data_->_tmp19_ = _data_->self->priv->state;
		_data_->_tmp20_ = DINO_UI_FILE_WIDGET_STATE_DEFAULT;
		_data_->_tmp18_ = _dino_ui_file_widget_state_equal (_data_->_tmp19_, &_data_->_tmp20_) != TRUE;
	} else {
		_data_->_tmp18_ = FALSE;
	}
	if (_data_->_tmp18_) {
		_data_->_tmp21_ = _data_->self->priv->content;
		if (_data_->_tmp21_ != NULL) {
			_data_->_tmp22_ = _data_->self->priv->content;
			gtk_widget_unparent (_data_->_tmp22_);
		}
		_data_->_tmp23_ = dino_ui_file_default_widget_new ();
		g_object_ref_sink (_data_->_tmp23_);
		_data_->default_file_widget = _data_->_tmp23_;
		_data_->_tmp24_ = _data_->default_file_widget;
		_data_->_tmp25_ = dino_ui_file_default_widget_controller_new (_data_->_tmp24_);
		_g_object_unref0 (_data_->self->priv->default_widget_controller);
		_data_->self->priv->default_widget_controller = _data_->_tmp25_;
		_data_->_tmp26_ = _data_->self->priv->default_widget_controller;
		_data_->_tmp27_ = _data_->self->priv->file_transfer;
		dino_ui_file_default_widget_controller_set_file_transfer (_data_->_tmp26_, _data_->_tmp27_);
		_data_->_tmp28_ = _data_->default_file_widget;
		_data_->_tmp29_ = _g_object_ref0 ((GtkWidget*) _data_->_tmp28_);
		_g_object_unref0 (_data_->self->priv->content);
		_data_->self->priv->content = _data_->_tmp29_;
		_data_->_tmp30_ = DINO_UI_FILE_WIDGET_STATE_DEFAULT;
		_data_->_tmp31_ = __dino_ui_file_widget_state_dup0 (&_data_->_tmp30_);
		_g_free0 (_data_->self->priv->state);
		_data_->self->priv->state = _data_->_tmp31_;
		_data_->_tmp32_ = _data_->self->priv->content;
		gtk_widget_insert_after (_data_->_tmp32_, (GtkWidget*) _data_->self, NULL);
		_g_object_unref0 (_data_->default_file_widget);
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dino_ui_file_widget_real_dispose (GObject* base)
{
	DinoUiFileWidget * self;
	DinoUiFileDefaultWidgetController* _tmp0_;
	GtkWidget* _tmp2_;
	self = (DinoUiFileWidget*) base;
	_tmp0_ = self->priv->default_widget_controller;
	if (_tmp0_ != NULL) {
		DinoUiFileDefaultWidgetController* _tmp1_;
		_tmp1_ = self->priv->default_widget_controller;
		g_object_run_dispose ((GObject*) _tmp1_);
	}
	_g_object_unref0 (self->priv->default_widget_controller);
	self->priv->default_widget_controller = NULL;
	_tmp2_ = self->priv->content;
	if (_tmp2_ != NULL) {
		GtkWidget* _tmp3_;
		GtkWidget* _tmp4_;
		_tmp3_ = self->priv->content;
		gtk_widget_unparent (_tmp3_);
		_tmp4_ = self->priv->content;
		g_object_run_dispose ((GObject*) _tmp4_);
		_g_object_unref0 (self->priv->content);
		self->priv->content = NULL;
	}
	G_OBJECT_CLASS (dino_ui_file_widget_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, DINO_UI_TYPE_SIZE_REQUEST_BIN, DinoUiSizeRequestBin));
}

DinoEntitiesFileTransferState
dino_ui_file_widget_get_file_transfer_state (DinoUiFileWidget* self)
{
	DinoEntitiesFileTransferState result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_file_transfer_state;
	return result;
}

void
dino_ui_file_widget_set_file_transfer_state (DinoUiFileWidget* self,
                                             DinoEntitiesFileTransferState value)
{
	DinoEntitiesFileTransferState old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_ui_file_widget_get_file_transfer_state (self);
	if (old_value != value) {
		self->priv->_file_transfer_state = value;
		g_object_notify_by_pspec ((GObject *) self, dino_ui_file_widget_properties[DINO_UI_FILE_WIDGET_FILE_TRANSFER_STATE_PROPERTY]);
	}
}

const gchar*
dino_ui_file_widget_get_file_transfer_mime_type (DinoUiFileWidget* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_file_transfer_mime_type;
	result = _tmp0_;
	return result;
}

void
dino_ui_file_widget_set_file_transfer_mime_type (DinoUiFileWidget* self,
                                                 const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_ui_file_widget_get_file_transfer_mime_type (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_file_transfer_mime_type);
		self->priv->_file_transfer_mime_type = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_ui_file_widget_properties[DINO_UI_FILE_WIDGET_FILE_TRANSFER_MIME_TYPE_PROPERTY]);
	}
}

static GObject *
dino_ui_file_widget_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DinoUiFileWidget * self;
	parent_class = G_OBJECT_CLASS (dino_ui_file_widget_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_FILE_WIDGET, DinoUiFileWidget);
	gtk_widget_set_margin_top ((GtkWidget*) self, 4);
	dino_ui_size_request_bin_set_size_request_mode ((DinoUiSizeRequestBin*) self, GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH);
	return obj;
}

static void
_dino_ui_file_widget___lambda42_ (GtkWidget* widget,
                                  const gchar* action_name)
{
	g_return_if_fail (widget != NULL);
	g_return_if_fail (action_name != NULL);
	g_signal_emit (G_TYPE_CHECK_INSTANCE_CAST (widget, DINO_UI_TYPE_FILE_WIDGET, DinoUiFileWidget), dino_ui_file_widget_signals[DINO_UI_FILE_WIDGET_OPEN_FILE_SIGNAL], 0);
}

static void
__dino_ui_file_widget___lambda42__gtk_widget_action_activate_func (GtkWidget* widget,
                                                                   const gchar* action_name,
                                                                   GVariant* parameter)
{
	_dino_ui_file_widget___lambda42_ (widget, action_name);
}

static void
_dino_ui_file_widget___lambda43_ (GtkWidget* widget,
                                  const gchar* action_name)
{
	g_return_if_fail (widget != NULL);
	g_return_if_fail (action_name != NULL);
	g_signal_emit (G_TYPE_CHECK_INSTANCE_CAST (widget, DINO_UI_TYPE_FILE_WIDGET, DinoUiFileWidget), dino_ui_file_widget_signals[DINO_UI_FILE_WIDGET_SAVE_FILE_AS_SIGNAL], 0);
}

static void
__dino_ui_file_widget___lambda43__gtk_widget_action_activate_func (GtkWidget* widget,
                                                                   const gchar* action_name,
                                                                   GVariant* parameter)
{
	_dino_ui_file_widget___lambda43_ (widget, action_name);
}

static void
_dino_ui_file_widget___lambda44_ (GtkWidget* widget,
                                  const gchar* action_name)
{
	g_return_if_fail (widget != NULL);
	g_return_if_fail (action_name != NULL);
	g_signal_emit (G_TYPE_CHECK_INSTANCE_CAST (widget, DINO_UI_TYPE_FILE_WIDGET, DinoUiFileWidget), dino_ui_file_widget_signals[DINO_UI_FILE_WIDGET_START_DOWNLOAD_SIGNAL], 0);
}

static void
__dino_ui_file_widget___lambda44__gtk_widget_action_activate_func (GtkWidget* widget,
                                                                   const gchar* action_name,
                                                                   GVariant* parameter)
{
	_dino_ui_file_widget___lambda44_ (widget, action_name);
}

static void
_dino_ui_file_widget___lambda45_ (GtkWidget* widget,
                                  const gchar* action_name)
{
	g_return_if_fail (widget != NULL);
	g_return_if_fail (action_name != NULL);
	g_signal_emit (G_TYPE_CHECK_INSTANCE_CAST (widget, DINO_UI_TYPE_FILE_WIDGET, DinoUiFileWidget), dino_ui_file_widget_signals[DINO_UI_FILE_WIDGET_CANCEL_DOWNLOAD_SIGNAL], 0);
}

static void
__dino_ui_file_widget___lambda45__gtk_widget_action_activate_func (GtkWidget* widget,
                                                                   const gchar* action_name,
                                                                   GVariant* parameter)
{
	_dino_ui_file_widget___lambda45_ (widget, action_name);
}

static void
dino_ui_file_widget_base_init (DinoUiFileWidgetClass * klass)
{
	gtk_widget_class_install_action (GTK_WIDGET_CLASS (klass), "file.open", NULL, __dino_ui_file_widget___lambda42__gtk_widget_action_activate_func);
	gtk_widget_class_install_action (GTK_WIDGET_CLASS (klass), "file.save_as", NULL, __dino_ui_file_widget___lambda43__gtk_widget_action_activate_func);
	gtk_widget_class_install_action (GTK_WIDGET_CLASS (klass), "file.download", NULL, __dino_ui_file_widget___lambda44__gtk_widget_action_activate_func);
	gtk_widget_class_install_action (GTK_WIDGET_CLASS (klass), "file.cancel", NULL, __dino_ui_file_widget___lambda45__gtk_widget_action_activate_func);
}

static void
dino_ui_file_widget_class_init (DinoUiFileWidgetClass * klass,
                                gpointer klass_data)
{
	dino_ui_file_widget_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiFileWidget_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) dino_ui_file_widget_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_ui_file_widget_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dino_ui_file_widget_set_property;
	G_OBJECT_CLASS (klass)->constructor = dino_ui_file_widget_constructor;
	G_OBJECT_CLASS (klass)->finalize = dino_ui_file_widget_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_FILE_WIDGET_FILE_TRANSFER_STATE_PROPERTY, dino_ui_file_widget_properties[DINO_UI_FILE_WIDGET_FILE_TRANSFER_STATE_PROPERTY] = g_param_spec_enum ("file-transfer-state", "file-transfer-state", "file-transfer-state", DINO_ENTITIES_FILE_TRANSFER_TYPE_STATE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_FILE_WIDGET_FILE_TRANSFER_MIME_TYPE_PROPERTY, dino_ui_file_widget_properties[DINO_UI_FILE_WIDGET_FILE_TRANSFER_MIME_TYPE_PROPERTY] = g_param_spec_string ("file-transfer-mime-type", "file-transfer-mime-type", "file-transfer-mime-type", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	dino_ui_file_widget_signals[DINO_UI_FILE_WIDGET_OPEN_FILE_SIGNAL] = g_signal_new ("open-file", DINO_UI_TYPE_FILE_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	dino_ui_file_widget_signals[DINO_UI_FILE_WIDGET_SAVE_FILE_AS_SIGNAL] = g_signal_new ("save-file-as", DINO_UI_TYPE_FILE_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	dino_ui_file_widget_signals[DINO_UI_FILE_WIDGET_START_DOWNLOAD_SIGNAL] = g_signal_new ("start-download", DINO_UI_TYPE_FILE_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	dino_ui_file_widget_signals[DINO_UI_FILE_WIDGET_CANCEL_DOWNLOAD_SIGNAL] = g_signal_new ("cancel-download", DINO_UI_TYPE_FILE_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
dino_ui_file_widget_instance_init (DinoUiFileWidget * self,
                                   gpointer klass)
{
	self->priv = dino_ui_file_widget_get_instance_private (self);
	self->priv->state = NULL;
	self->priv->content = NULL;
}

static void
dino_ui_file_widget_finalize (GObject * obj)
{
	DinoUiFileWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_FILE_WIDGET, DinoUiFileWidget);
	_g_object_unref0 (self->priv->file_transfer);
	_g_free0 (self->priv->_file_transfer_mime_type);
	_g_free0 (self->priv->state);
	_g_object_unref0 (self->priv->default_widget_controller);
	_g_object_unref0 (self->priv->content);
	G_OBJECT_CLASS (dino_ui_file_widget_parent_class)->finalize (obj);
}

static GType
dino_ui_file_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiFileWidgetClass), (GBaseInitFunc) dino_ui_file_widget_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_file_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiFileWidget), 0, (GInstanceInitFunc) dino_ui_file_widget_instance_init, NULL };
	GType dino_ui_file_widget_type_id;
	dino_ui_file_widget_type_id = g_type_register_static (DINO_UI_TYPE_SIZE_REQUEST_BIN, "DinoUiFileWidget", &g_define_type_info, 0);
	DinoUiFileWidget_private_offset = g_type_add_instance_private (dino_ui_file_widget_type_id, sizeof (DinoUiFileWidgetPrivate));
	return dino_ui_file_widget_type_id;
}

GType
dino_ui_file_widget_get_type (void)
{
	static volatile gsize dino_ui_file_widget_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_file_widget_type_id__once)) {
		GType dino_ui_file_widget_type_id;
		dino_ui_file_widget_type_id = dino_ui_file_widget_get_type_once ();
		g_once_init_leave (&dino_ui_file_widget_type_id__once, dino_ui_file_widget_type_id);
	}
	return dino_ui_file_widget_type_id__once;
}

static void
_vala_dino_ui_file_widget_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	DinoUiFileWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_FILE_WIDGET, DinoUiFileWidget);
	switch (property_id) {
		case DINO_UI_FILE_WIDGET_FILE_TRANSFER_STATE_PROPERTY:
		g_value_set_enum (value, dino_ui_file_widget_get_file_transfer_state (self));
		break;
		case DINO_UI_FILE_WIDGET_FILE_TRANSFER_MIME_TYPE_PROPERTY:
		g_value_set_string (value, dino_ui_file_widget_get_file_transfer_mime_type (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dino_ui_file_widget_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	DinoUiFileWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_FILE_WIDGET, DinoUiFileWidget);
	switch (property_id) {
		case DINO_UI_FILE_WIDGET_FILE_TRANSFER_STATE_PROPERTY:
		dino_ui_file_widget_set_file_transfer_state (self, g_value_get_enum (value));
		break;
		case DINO_UI_FILE_WIDGET_FILE_TRANSFER_MIME_TYPE_PROPERTY:
		dino_ui_file_widget_set_file_transfer_mime_type (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
dino_ui_file_widget_controller_get_instance_private (DinoUiFileWidgetController* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiFileWidgetController_private_offset);
}

static void
__lambda46_ (DinoUiFileWidgetController* self)
{
	self->priv->widget = NULL;
	g_object_unref ((GObject*) self);
}

static void
___lambda46__gweak_notify (gpointer self,
                           GObject* object)
{
	__lambda46_ ((DinoUiFileWidgetController*) self);
}

static void
_dino_ui_file_widget_controller_open_file_dino_ui_file_widget_open_file (DinoUiFileWidget* _sender,
                                                                         gpointer self)
{
	dino_ui_file_widget_controller_open_file ((DinoUiFileWidgetController*) self);
}

static void
_dino_ui_file_widget_controller_save_file_dino_ui_file_widget_save_file_as (DinoUiFileWidget* _sender,
                                                                            gpointer self)
{
	dino_ui_file_widget_controller_save_file ((DinoUiFileWidgetController*) self);
}

static void
_dino_ui_file_widget_controller_start_download_dino_ui_file_widget_start_download (DinoUiFileWidget* _sender,
                                                                                   gpointer self)
{
	dino_ui_file_widget_controller_start_download ((DinoUiFileWidgetController*) self);
}

static void
_dino_ui_file_widget_controller_cancel_download_dino_ui_file_widget_cancel_download (DinoUiFileWidget* _sender,
                                                                                     gpointer self)
{
	dino_ui_file_widget_controller_cancel_download ((DinoUiFileWidgetController*) self);
}

DinoUiFileWidgetController*
dino_ui_file_widget_controller_construct (GType object_type,
                                          DinoUiFileWidget* widget,
                                          DinoEntitiesFileTransfer* file_transfer,
                                          DinoStreamInteractor* stream_interactor)
{
	DinoUiFileWidgetController * self = NULL;
	GtkWidget* _tmp0_;
	DinoEntitiesFileTransfer* _tmp1_;
	DinoStreamInteractor* _tmp2_;
	g_return_val_if_fail (widget != NULL, NULL);
	g_return_val_if_fail (file_transfer != NULL, NULL);
	self = (DinoUiFileWidgetController*) g_object_new (object_type, NULL);
	self->priv->widget = (GtkWidget*) widget;
	g_object_ref ((GObject*) self);
	_tmp0_ = self->priv->widget;
	g_object_weak_ref ((GObject*) _tmp0_, ___lambda46__gweak_notify, self);
	_tmp1_ = _g_object_ref0 (file_transfer);
	_g_object_unref0 (self->priv->file_transfer);
	self->priv->file_transfer = _tmp1_;
	_tmp2_ = _g_object_ref0 (stream_interactor);
	_g_object_unref0 (self->priv->stream_interactor);
	self->priv->stream_interactor = _tmp2_;
	g_signal_connect_object (widget, "open-file", (GCallback) _dino_ui_file_widget_controller_open_file_dino_ui_file_widget_open_file, self, 0);
	g_signal_connect_object (widget, "save-file-as", (GCallback) _dino_ui_file_widget_controller_save_file_dino_ui_file_widget_save_file_as, self, 0);
	g_signal_connect_object (widget, "start-download", (GCallback) _dino_ui_file_widget_controller_start_download_dino_ui_file_widget_start_download, self, 0);
	g_signal_connect_object (widget, "cancel-download", (GCallback) _dino_ui_file_widget_controller_cancel_download_dino_ui_file_widget_cancel_download, self, 0);
	return self;
}

DinoUiFileWidgetController*
dino_ui_file_widget_controller_new (DinoUiFileWidget* widget,
                                    DinoEntitiesFileTransfer* file_transfer,
                                    DinoStreamInteractor* stream_interactor)
{
	return dino_ui_file_widget_controller_construct (DINO_UI_TYPE_FILE_WIDGET_CONTROLLER, widget, file_transfer, stream_interactor);
}

static void
dino_ui_file_widget_controller_open_file (DinoUiFileWidgetController* self)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		DinoEntitiesFileTransfer* _tmp0_;
		GFile* _tmp1_;
		GFile* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp0_ = self->priv->file_transfer;
		_tmp1_ = dino_entities_file_transfer_get_file (_tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = g_file_get_uri (_tmp2_);
		_tmp4_ = _tmp3_;
		g_app_info_launch_default_for_uri (_tmp4_, NULL, &_inner_error0_);
		_g_free0 (_tmp4_);
		_g_object_unref0 (_tmp2_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		DinoEntitiesFileTransfer* _tmp5_;
		GFile* _tmp6_;
		GFile* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		GError* _tmp10_;
		const gchar* _tmp11_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = self->priv->file_transfer;
		_tmp6_ = dino_entities_file_transfer_get_file (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = g_file_get_uri (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = err;
		_tmp11_ = _tmp10_->message;
		g_warning ("file_widget.vala:162: Failed to open %s - %s", _tmp9_, _tmp11_);
		_g_free0 (_tmp9_);
		_g_object_unref0 (_tmp7_);
		_g_error_free0 (err);
	}
	__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 Block32Data*
block32_data_ref (Block32Data* _data32_)
{
	g_atomic_int_inc (&_data32_->_ref_count_);
	return _data32_;
}

static void
block32_data_unref (void * _userdata_)
{
	Block32Data* _data32_;
	_data32_ = (Block32Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data32_->_ref_count_)) {
		DinoUiFileWidgetController* self;
		self = _data32_->self;
		_g_object_unref0 (_data32_->save_dialog);
		_g_object_unref0 (self);
		g_slice_free (Block32Data, _data32_);
	}
}

static void
__lambda47_ (Block32Data* _data32_)
{
	DinoUiFileWidgetController* self;
	GError* _inner_error0_ = NULL;
	self = _data32_->self;
	{
		DinoEntitiesFileTransfer* _tmp0_;
		GFile* _tmp1_;
		GFile* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GFile* _tmp5_;
		GFile* _tmp6_;
		GFile* _tmp7_;
		GFile* _tmp8_;
		_tmp0_ = self->priv->file_transfer;
		_tmp1_ = dino_entities_file_transfer_get_file (_tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = g_file_get_uri (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_file_new_for_uri (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = gtk_file_chooser_get_file ((GtkFileChooser*) _data32_->save_dialog);
		_tmp8_ = _tmp7_;
		g_file_copy (_tmp6_, _tmp8_, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &_inner_error0_);
		_g_object_unref0 (_tmp8_);
		_g_object_unref0 (_tmp6_);
		_g_free0 (_tmp4_);
		_g_object_unref0 (_tmp2_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		DinoEntitiesFileTransfer* _tmp9_;
		GFile* _tmp10_;
		GFile* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		GError* _tmp14_;
		const gchar* _tmp15_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp9_ = self->priv->file_transfer;
		_tmp10_ = dino_entities_file_transfer_get_file (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = g_file_get_uri (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = err;
		_tmp15_ = _tmp14_->message;
		g_warning ("file_widget.vala:175: Failed copy file %s - %s", _tmp13_, _tmp15_);
		_g_free0 (_tmp13_);
		_g_object_unref0 (_tmp11_);
		_g_error_free0 (err);
	}
	__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
___lambda47__gtk_native_dialog_response (GtkNativeDialog* _sender,
                                         gint response_id,
                                         gpointer self)
{
	__lambda47_ (self);
}

static void
dino_ui_file_widget_controller_save_file (DinoUiFileWidgetController* self)
{
	Block32Data* _data32_;
	const gchar* _tmp0_;
	GtkWidget* _tmp1_;
	GtkRoot* _tmp2_;
	GtkFileChooserNative* _tmp3_;
	DinoEntitiesFileTransfer* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	g_return_if_fail (self != NULL);
	_data32_ = g_slice_new0 (Block32Data);
	_data32_->_ref_count_ = 1;
	_data32_->self = g_object_ref (self);
	_tmp0_ = dino_gettext ("Save as…");
	_tmp1_ = self->priv->widget;
	_tmp2_ = gtk_widget_get_root (_tmp1_);
	_tmp3_ = gtk_file_chooser_native_new (_tmp0_, G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, gtk_window_get_type ()) ? ((GtkWindow*) _tmp2_) : NULL, GTK_FILE_CHOOSER_ACTION_SAVE, NULL, NULL);
	_data32_->save_dialog = _tmp3_;
	gtk_native_dialog_set_modal ((GtkNativeDialog*) _data32_->save_dialog, TRUE);
	_tmp4_ = self->priv->file_transfer;
	_tmp5_ = dino_entities_file_transfer_get_file_name (_tmp4_);
	_tmp6_ = _tmp5_;
	gtk_file_chooser_set_current_name ((GtkFileChooser*) _data32_->save_dialog, _tmp6_);
	g_signal_connect_data ((GtkNativeDialog*) _data32_->save_dialog, "response", (GCallback) ___lambda47__gtk_native_dialog_response, block32_data_ref (_data32_), (GClosureNotify) block32_data_unref, 0);
	gtk_native_dialog_show ((GtkNativeDialog*) _data32_->save_dialog);
	block32_data_unref (_data32_);
	_data32_ = NULL;
}

static void
dino_ui_file_widget_controller_start_download (DinoUiFileWidgetController* self)
{
	DinoStreamInteractor* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->stream_interactor;
	if (_tmp0_ != NULL) {
		DinoStreamInteractor* _tmp1_;
		DinoModuleIdentity* _tmp2_;
		gpointer _tmp3_;
		DinoFileManager* _tmp4_;
		DinoEntitiesFileTransfer* _tmp5_;
		_tmp1_ = self->priv->stream_interactor;
		_tmp2_ = dino_file_manager_IDENTITY;
		_tmp3_ = dino_stream_interactor_get_module (_tmp1_, DINO_TYPE_FILE_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp2_);
		_tmp4_ = (DinoFileManager*) _tmp3_;
		_tmp5_ = self->priv->file_transfer;
		dino_file_manager_download_file (_tmp4_, _tmp5_, NULL, NULL);
		_g_object_unref0 (_tmp4_);
	}
}

static void
dino_ui_file_widget_controller_cancel_download (DinoUiFileWidgetController* self)
{
	DinoEntitiesFileTransfer* _tmp0_;
	GCancellable* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->file_transfer;
	_tmp1_ = dino_entities_file_transfer_get_cancellable (_tmp0_);
	_tmp2_ = _tmp1_;
	g_cancellable_cancel (_tmp2_);
}

static void
dino_ui_file_widget_controller_class_init (DinoUiFileWidgetControllerClass * klass,
                                           gpointer klass_data)
{
	dino_ui_file_widget_controller_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiFileWidgetController_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dino_ui_file_widget_controller_finalize;
}

static void
dino_ui_file_widget_controller_instance_init (DinoUiFileWidgetController * self,
                                              gpointer klass)
{
	self->priv = dino_ui_file_widget_controller_get_instance_private (self);
}

static void
dino_ui_file_widget_controller_finalize (GObject * obj)
{
	DinoUiFileWidgetController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_FILE_WIDGET_CONTROLLER, DinoUiFileWidgetController);
	_g_object_unref0 (self->priv->file_transfer);
	_g_object_unref0 (self->priv->stream_interactor);
	G_OBJECT_CLASS (dino_ui_file_widget_controller_parent_class)->finalize (obj);
}

static GType
dino_ui_file_widget_controller_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiFileWidgetControllerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_file_widget_controller_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiFileWidgetController), 0, (GInstanceInitFunc) dino_ui_file_widget_controller_instance_init, NULL };
	GType dino_ui_file_widget_controller_type_id;
	dino_ui_file_widget_controller_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoUiFileWidgetController", &g_define_type_info, 0);
	DinoUiFileWidgetController_private_offset = g_type_add_instance_private (dino_ui_file_widget_controller_type_id, sizeof (DinoUiFileWidgetControllerPrivate));
	return dino_ui_file_widget_controller_type_id;
}

GType
dino_ui_file_widget_controller_get_type (void)
{
	static volatile gsize dino_ui_file_widget_controller_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_file_widget_controller_type_id__once)) {
		GType dino_ui_file_widget_controller_type_id;
		dino_ui_file_widget_controller_type_id = dino_ui_file_widget_controller_get_type_once ();
		g_once_init_leave (&dino_ui_file_widget_controller_type_id__once, dino_ui_file_widget_controller_type_id);
	}
	return dino_ui_file_widget_controller_type_id__once;
}

static inline gpointer
dino_ui_file_default_widget_controller_get_instance_private (DinoUiFileDefaultWidgetController* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiFileDefaultWidgetController_private_offset);
}

static void
_dino_ui_file_default_widget_controller_on_clicked_dino_ui_file_default_widget_clicked (DinoUiFileDefaultWidget* _sender,
                                                                                        gpointer self)
{
	dino_ui_file_default_widget_controller_on_clicked ((DinoUiFileDefaultWidgetController*) self);
}

static void
_dino_ui_file_default_widget_controller_update_file_info_g_object_notify (GObject* _sender,
                                                                          GParamSpec* pspec,
                                                                          gpointer self)
{
	dino_ui_file_default_widget_controller_update_file_info ((DinoUiFileDefaultWidgetController*) self);
}

DinoUiFileDefaultWidgetController*
dino_ui_file_default_widget_controller_construct (GType object_type,
                                                  DinoUiFileDefaultWidget* widget)
{
	DinoUiFileDefaultWidgetController * self = NULL;
	DinoUiFileDefaultWidget* _tmp0_;
	g_return_val_if_fail (widget != NULL, NULL);
	self = (DinoUiFileDefaultWidgetController*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (widget);
	_g_object_unref0 (self->priv->widget);
	self->priv->widget = _tmp0_;
	g_signal_connect_object (widget, "clicked", (GCallback) _dino_ui_file_default_widget_controller_on_clicked_dino_ui_file_default_widget_clicked, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::file-transfer-state", (GCallback) _dino_ui_file_default_widget_controller_update_file_info_g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::file-transfer-mime-type", (GCallback) _dino_ui_file_default_widget_controller_update_file_info_g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::file-transfer-transferred-bytes", (GCallback) _dino_ui_file_default_widget_controller_update_file_info_g_object_notify, self, 0);
	return self;
}

DinoUiFileDefaultWidgetController*
dino_ui_file_default_widget_controller_new (DinoUiFileDefaultWidget* widget)
{
	return dino_ui_file_default_widget_controller_construct (DINO_UI_TYPE_FILE_DEFAULT_WIDGET_CONTROLLER, widget);
}

void
dino_ui_file_default_widget_controller_set_file_transfer (DinoUiFileDefaultWidgetController* self,
                                                          DinoEntitiesFileTransfer* file_transfer)
{
	DinoEntitiesFileTransfer* _tmp0_;
	DinoUiFileDefaultWidget* _tmp1_;
	DinoUiFileDefaultWidget* _tmp2_;
	GtkLabel* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file_transfer != NULL);
	_tmp0_ = _g_object_ref0 (file_transfer);
	_g_object_unref0 (self->priv->file_transfer);
	self->priv->file_transfer = _tmp0_;
	_tmp1_ = self->priv->widget;
	dino_ui_file_default_widget_init_updating_file_info (_tmp1_);
	_tmp2_ = self->priv->widget;
	_tmp3_ = _tmp2_->name_label;
	_tmp4_ = dino_entities_file_transfer_get_file_name (file_transfer);
	_tmp5_ = _tmp4_;
	gtk_label_set_label (_tmp3_, _tmp5_);
	g_object_bind_property_with_closures ((GObject*) file_transfer, "state", (GObject*) self, "file-transfer-state", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	g_object_bind_property_with_closures ((GObject*) file_transfer, "mime-type", (GObject*) self, "file-transfer-mime-type", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	g_object_bind_property_with_closures ((GObject*) file_transfer, "transferred-bytes", (GObject*) self, "file-transfer-transferred-bytes", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	dino_ui_file_default_widget_controller_update_file_info (self);
}

static void
dino_ui_file_default_widget_controller_update_file_info (DinoUiFileDefaultWidgetController* self)
{
	DinoEntitiesFileTransfer* _tmp0_;
	DinoEntitiesFileTransferState _tmp1_;
	DinoEntitiesFileTransferState _tmp2_;
	DinoUiFileDefaultWidget* _tmp3_;
	DinoEntitiesFileTransfer* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	DinoEntitiesFileTransfer* _tmp7_;
	DinoEntitiesFileTransferState _tmp8_;
	DinoEntitiesFileTransferState _tmp9_;
	DinoEntitiesFileTransfer* _tmp10_;
	gboolean _tmp11_;
	gboolean _tmp12_;
	DinoEntitiesFileTransfer* _tmp13_;
	gint64 _tmp14_;
	gint64 _tmp15_;
	DinoEntitiesFileTransfer* _tmp16_;
	gint64 _tmp17_;
	gint64 _tmp18_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->file_transfer;
	_tmp1_ = dino_entities_file_transfer_get_state (_tmp0_);
	_tmp2_ = _tmp1_;
	self->priv->state = _tmp2_;
	_tmp3_ = self->priv->widget;
	_tmp4_ = self->priv->file_transfer;
	_tmp5_ = dino_entities_file_transfer_get_mime_type (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = self->priv->file_transfer;
	_tmp8_ = dino_entities_file_transfer_get_state (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = self->priv->file_transfer;
	_tmp11_ = dino_entities_file_transfer_get_direction (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = self->priv->file_transfer;
	_tmp14_ = dino_entities_file_transfer_get_size (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = self->priv->file_transfer;
	_tmp17_ = dino_entities_file_transfer_get_transferred_bytes (_tmp16_);
	_tmp18_ = _tmp17_;
	dino_ui_file_default_widget_update_file_info (_tmp3_, _tmp6_, _tmp9_, _tmp12_, _tmp15_, _tmp18_);
}

static void
dino_ui_file_default_widget_controller_on_clicked (DinoUiFileDefaultWidgetController* self)
{
	g_return_if_fail (self != NULL);
	switch (self->priv->state) {
		case DINO_ENTITIES_FILE_TRANSFER_STATE_COMPLETE:
		{
			DinoUiFileDefaultWidget* _tmp0_;
			_tmp0_ = self->priv->widget;
			gtk_widget_activate_action ((GtkWidget*) _tmp0_, "file.open", NULL, NULL);
			break;
		}
		case DINO_ENTITIES_FILE_TRANSFER_STATE_NOT_STARTED:
		{
			DinoUiFileDefaultWidget* _tmp1_;
			_tmp1_ = self->priv->widget;
			gtk_widget_activate_action ((GtkWidget*) _tmp1_, "file.download", NULL, NULL);
			break;
		}
		default:
		{
			break;
		}
	}
}

const gchar*
dino_ui_file_default_widget_controller_get_file_transfer_state (DinoUiFileDefaultWidgetController* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_file_transfer_state;
	result = _tmp0_;
	return result;
}

void
dino_ui_file_default_widget_controller_set_file_transfer_state (DinoUiFileDefaultWidgetController* self,
                                                                const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_ui_file_default_widget_controller_get_file_transfer_state (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_file_transfer_state);
		self->priv->_file_transfer_state = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_ui_file_default_widget_controller_properties[DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_STATE_PROPERTY]);
	}
}

const gchar*
dino_ui_file_default_widget_controller_get_file_transfer_mime_type (DinoUiFileDefaultWidgetController* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_file_transfer_mime_type;
	result = _tmp0_;
	return result;
}

void
dino_ui_file_default_widget_controller_set_file_transfer_mime_type (DinoUiFileDefaultWidgetController* self,
                                                                    const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_ui_file_default_widget_controller_get_file_transfer_mime_type (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_file_transfer_mime_type);
		self->priv->_file_transfer_mime_type = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_ui_file_default_widget_controller_properties[DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_MIME_TYPE_PROPERTY]);
	}
}

gint64
dino_ui_file_default_widget_controller_get_file_transfer_transferred_bytes (DinoUiFileDefaultWidgetController* self)
{
	gint64 result;
	g_return_val_if_fail (self != NULL, -1LL);
	result = self->priv->_file_transfer_transferred_bytes;
	return result;
}

void
dino_ui_file_default_widget_controller_set_file_transfer_transferred_bytes (DinoUiFileDefaultWidgetController* self,
                                                                            gint64 value)
{
	gint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_ui_file_default_widget_controller_get_file_transfer_transferred_bytes (self);
	if (old_value != value) {
		self->priv->_file_transfer_transferred_bytes = value;
		g_object_notify_by_pspec ((GObject *) self, dino_ui_file_default_widget_controller_properties[DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_TRANSFERRED_BYTES_PROPERTY]);
	}
}

static void
dino_ui_file_default_widget_controller_class_init (DinoUiFileDefaultWidgetControllerClass * klass,
                                                   gpointer klass_data)
{
	dino_ui_file_default_widget_controller_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiFileDefaultWidgetController_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_ui_file_default_widget_controller_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dino_ui_file_default_widget_controller_set_property;
	G_OBJECT_CLASS (klass)->finalize = dino_ui_file_default_widget_controller_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_STATE_PROPERTY, dino_ui_file_default_widget_controller_properties[DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_STATE_PROPERTY] = g_param_spec_string ("file-transfer-state", "file-transfer-state", "file-transfer-state", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_MIME_TYPE_PROPERTY, dino_ui_file_default_widget_controller_properties[DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_MIME_TYPE_PROPERTY] = g_param_spec_string ("file-transfer-mime-type", "file-transfer-mime-type", "file-transfer-mime-type", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_TRANSFERRED_BYTES_PROPERTY, dino_ui_file_default_widget_controller_properties[DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_TRANSFERRED_BYTES_PROPERTY] = g_param_spec_int64 ("file-transfer-transferred-bytes", "file-transfer-transferred-bytes", "file-transfer-transferred-bytes", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
dino_ui_file_default_widget_controller_instance_init (DinoUiFileDefaultWidgetController * self,
                                                      gpointer klass)
{
	self->priv = dino_ui_file_default_widget_controller_get_instance_private (self);
}

static void
dino_ui_file_default_widget_controller_finalize (GObject * obj)
{
	DinoUiFileDefaultWidgetController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_FILE_DEFAULT_WIDGET_CONTROLLER, DinoUiFileDefaultWidgetController);
	_g_object_unref0 (self->priv->widget);
	_g_object_unref0 (self->priv->file_transfer);
	_g_free0 (self->priv->_file_transfer_state);
	_g_free0 (self->priv->_file_transfer_mime_type);
	G_OBJECT_CLASS (dino_ui_file_default_widget_controller_parent_class)->finalize (obj);
}

static GType
dino_ui_file_default_widget_controller_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiFileDefaultWidgetControllerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_file_default_widget_controller_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiFileDefaultWidgetController), 0, (GInstanceInitFunc) dino_ui_file_default_widget_controller_instance_init, NULL };
	GType dino_ui_file_default_widget_controller_type_id;
	dino_ui_file_default_widget_controller_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoUiFileDefaultWidgetController", &g_define_type_info, 0);
	DinoUiFileDefaultWidgetController_private_offset = g_type_add_instance_private (dino_ui_file_default_widget_controller_type_id, sizeof (DinoUiFileDefaultWidgetControllerPrivate));
	return dino_ui_file_default_widget_controller_type_id;
}

GType
dino_ui_file_default_widget_controller_get_type (void)
{
	static volatile gsize dino_ui_file_default_widget_controller_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_file_default_widget_controller_type_id__once)) {
		GType dino_ui_file_default_widget_controller_type_id;
		dino_ui_file_default_widget_controller_type_id = dino_ui_file_default_widget_controller_get_type_once ();
		g_once_init_leave (&dino_ui_file_default_widget_controller_type_id__once, dino_ui_file_default_widget_controller_type_id);
	}
	return dino_ui_file_default_widget_controller_type_id__once;
}

static void
_vala_dino_ui_file_default_widget_controller_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec)
{
	DinoUiFileDefaultWidgetController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_FILE_DEFAULT_WIDGET_CONTROLLER, DinoUiFileDefaultWidgetController);
	switch (property_id) {
		case DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_STATE_PROPERTY:
		g_value_set_string (value, dino_ui_file_default_widget_controller_get_file_transfer_state (self));
		break;
		case DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_MIME_TYPE_PROPERTY:
		g_value_set_string (value, dino_ui_file_default_widget_controller_get_file_transfer_mime_type (self));
		break;
		case DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_TRANSFERRED_BYTES_PROPERTY:
		g_value_set_int64 (value, dino_ui_file_default_widget_controller_get_file_transfer_transferred_bytes (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dino_ui_file_default_widget_controller_set_property (GObject * object,
                                                           guint property_id,
                                                           const GValue * value,
                                                           GParamSpec * pspec)
{
	DinoUiFileDefaultWidgetController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_FILE_DEFAULT_WIDGET_CONTROLLER, DinoUiFileDefaultWidgetController);
	switch (property_id) {
		case DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_STATE_PROPERTY:
		dino_ui_file_default_widget_controller_set_file_transfer_state (self, g_value_get_string (value));
		break;
		case DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_MIME_TYPE_PROPERTY:
		dino_ui_file_default_widget_controller_set_file_transfer_mime_type (self, g_value_get_string (value));
		break;
		case DINO_UI_FILE_DEFAULT_WIDGET_CONTROLLER_FILE_TRANSFER_TRANSFERRED_BYTES_PROPERTY:
		dino_ui_file_default_widget_controller_set_file_transfer_transferred_bytes (self, g_value_get_int64 (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;
}

