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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <string.h>

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

#define DINO_UI_TYPE_CONVERSATION_VIEW (dino_ui_conversation_view_get_type ())
#define DINO_UI_CONVERSATION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_CONVERSATION_VIEW, DinoUiConversationView))
#define DINO_UI_CONVERSATION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_CONVERSATION_VIEW, DinoUiConversationViewClass))
#define DINO_UI_IS_CONVERSATION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_CONVERSATION_VIEW))
#define DINO_UI_IS_CONVERSATION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_CONVERSATION_VIEW))
#define DINO_UI_CONVERSATION_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_CONVERSATION_VIEW, DinoUiConversationViewClass))

typedef struct _DinoUiConversationView DinoUiConversationView;
typedef struct _DinoUiConversationViewClass DinoUiConversationViewClass;
typedef struct _DinoUiConversationViewPrivate DinoUiConversationViewPrivate;

#define DINO_UI_CHAT_INPUT_TYPE_VIEW (dino_ui_chat_input_view_get_type ())
#define DINO_UI_CHAT_INPUT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_CHAT_INPUT_TYPE_VIEW, DinoUiChatInputView))
#define DINO_UI_CHAT_INPUT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_CHAT_INPUT_TYPE_VIEW, DinoUiChatInputViewClass))
#define DINO_UI_CHAT_INPUT_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_CHAT_INPUT_TYPE_VIEW))
#define DINO_UI_CHAT_INPUT_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_CHAT_INPUT_TYPE_VIEW))
#define DINO_UI_CHAT_INPUT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_CHAT_INPUT_TYPE_VIEW, DinoUiChatInputViewClass))

typedef struct _DinoUiChatInputView DinoUiChatInputView;
typedef struct _DinoUiChatInputViewClass DinoUiChatInputViewClass;

#define DINO_UI_CONVERSATION_SUMMARY_TYPE_CONVERSATION_VIEW (dino_ui_conversation_summary_conversation_view_get_type ())
#define DINO_UI_CONVERSATION_SUMMARY_CONVERSATION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONVERSATION_VIEW, DinoUiConversationSummaryConversationView))
#define DINO_UI_CONVERSATION_SUMMARY_CONVERSATION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONVERSATION_VIEW, DinoUiConversationSummaryConversationViewClass))
#define DINO_UI_CONVERSATION_SUMMARY_IS_CONVERSATION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONVERSATION_VIEW))
#define DINO_UI_CONVERSATION_SUMMARY_IS_CONVERSATION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONVERSATION_VIEW))
#define DINO_UI_CONVERSATION_SUMMARY_CONVERSATION_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONVERSATION_VIEW, DinoUiConversationSummaryConversationViewClass))

typedef struct _DinoUiConversationSummaryConversationView DinoUiConversationSummaryConversationView;
typedef struct _DinoUiConversationSummaryConversationViewClass DinoUiConversationSummaryConversationViewClass;
enum  {
	DINO_UI_CONVERSATION_VIEW_0_PROPERTY,
	DINO_UI_CONVERSATION_VIEW_NUM_PROPERTIES
};
static GParamSpec* dino_ui_conversation_view_properties[DINO_UI_CONVERSATION_VIEW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _DinoUiConversationView {
	GtkWidget parent_instance;
	DinoUiConversationViewPrivate * priv;
	GtkOverlay* overlay;
	GtkRevealer* goto_end_revealer;
	GtkButton* goto_end_button;
	DinoUiChatInputView* chat_input;
	DinoUiConversationSummaryConversationView* conversation_frame;
	GtkRevealer* white_revealer;
	GtkRevealer* content_revealer;
	GtkListView* list_view;
	gboolean at_current_content;
};

struct _DinoUiConversationViewClass {
	GtkWidgetClass parent_class;
};

static gpointer dino_ui_conversation_view_parent_class = NULL;

VALA_EXTERN GType dino_ui_conversation_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiConversationView, g_object_unref)
VALA_EXTERN GType dino_ui_chat_input_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiChatInputView, g_object_unref)
VALA_EXTERN GType dino_ui_conversation_summary_conversation_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiConversationSummaryConversationView, g_object_unref)
VALA_EXTERN void dino_ui_conversation_view_add_overlay_dialog (DinoUiConversationView* self,
                                                   GtkWidget* widget);
VALA_EXTERN void dino_ui_conversation_view_remove_overlay_dialog (DinoUiConversationView* self);
VALA_EXTERN void dino_ui_chat_input_view_do_focus (DinoUiChatInputView* self);
static void dino_ui_conversation_view_on_child_revealed_changed (DinoUiConversationView* self);
VALA_EXTERN DinoUiConversationView* dino_ui_conversation_view_new (void);
VALA_EXTERN DinoUiConversationView* dino_ui_conversation_view_construct (GType object_type);
static GObject * dino_ui_conversation_view_constructor (GType type,
                                                 guint n_construct_properties,
                                                 GObjectConstructParam * construct_properties);
static void _dino_ui_conversation_view_on_child_revealed_changed_g_object_notify (GObject* _sender,
                                                                           GParamSpec* pspec,
                                                                           gpointer self);
static void dino_ui_conversation_view_finalize (GObject * obj);
static GType dino_ui_conversation_view_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

void
dino_ui_conversation_view_add_overlay_dialog (DinoUiConversationView* self,
                                              GtkWidget* widget)
{
	GtkRevealer* _tmp0_;
	GtkRevealer* _tmp1_;
	GtkRevealer* _tmp2_;
	GtkRevealer* _tmp3_;
	GtkRevealer* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->content_revealer;
	gtk_revealer_set_child (_tmp0_, widget);
	_tmp1_ = self->content_revealer;
	gtk_widget_set_visible ((GtkWidget*) _tmp1_, TRUE);
	_tmp2_ = self->content_revealer;
	gtk_revealer_set_reveal_child (_tmp2_, TRUE);
	_tmp3_ = self->white_revealer;
	gtk_widget_set_visible ((GtkWidget*) _tmp3_, TRUE);
	_tmp4_ = self->white_revealer;
	gtk_revealer_set_reveal_child (_tmp4_, TRUE);
}

void
dino_ui_conversation_view_remove_overlay_dialog (DinoUiConversationView* self)
{
	GtkRevealer* _tmp0_;
	GtkRevealer* _tmp1_;
	DinoUiChatInputView* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->white_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, FALSE);
	_tmp1_ = self->content_revealer;
	gtk_revealer_set_reveal_child (_tmp1_, FALSE);
	_tmp2_ = self->chat_input;
	dino_ui_chat_input_view_do_focus (_tmp2_);
}

static void
dino_ui_conversation_view_on_child_revealed_changed (DinoUiConversationView* self)
{
	GtkRevealer* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->white_revealer;
	_tmp1_ = gtk_revealer_get_child_revealed (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		GtkRevealer* _tmp3_;
		GtkRevealer* _tmp4_;
		GtkRevealer* _tmp5_;
		_tmp3_ = self->white_revealer;
		gtk_widget_set_visible ((GtkWidget*) _tmp3_, FALSE);
		_tmp4_ = self->content_revealer;
		gtk_widget_set_visible ((GtkWidget*) _tmp4_, FALSE);
		_tmp5_ = self->content_revealer;
		gtk_revealer_set_child (_tmp5_, NULL);
	}
}

DinoUiConversationView*
dino_ui_conversation_view_construct (GType object_type)
{
	DinoUiConversationView * self = NULL;
	self = (DinoUiConversationView*) g_object_new (object_type, NULL);
	return self;
}

DinoUiConversationView*
dino_ui_conversation_view_new (void)
{
	return dino_ui_conversation_view_construct (DINO_UI_TYPE_CONVERSATION_VIEW);
}

static void
_dino_ui_conversation_view_on_child_revealed_changed_g_object_notify (GObject* _sender,
                                                                      GParamSpec* pspec,
                                                                      gpointer self)
{
	dino_ui_conversation_view_on_child_revealed_changed ((DinoUiConversationView*) self);
}

static GObject *
dino_ui_conversation_view_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DinoUiConversationView * self;
	GtkBinLayout* _tmp0_;
	GtkRevealer* _tmp1_;
	parent_class = G_OBJECT_CLASS (dino_ui_conversation_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_CONVERSATION_VIEW, DinoUiConversationView);
	_tmp0_ = (GtkBinLayout*) gtk_bin_layout_new ();
	gtk_widget_set_layout_manager ((GtkWidget*) self, (GtkLayoutManager*) _tmp0_);
	_tmp1_ = self->white_revealer;
	g_signal_connect_object ((GObject*) _tmp1_, "notify::child-revealed", (GCallback) _dino_ui_conversation_view_on_child_revealed_changed_g_object_notify, self, G_CONNECT_AFTER);
	return obj;
}

static void
dino_ui_conversation_view_class_init (DinoUiConversationViewClass * klass,
                                      gpointer klass_data)
{
	dino_ui_conversation_view_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = dino_ui_conversation_view_constructor;
	G_OBJECT_CLASS (klass)->finalize = dino_ui_conversation_view_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/im/dino/Dino/conversation_view.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "overlay", FALSE, G_STRUCT_OFFSET (DinoUiConversationView, overlay));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "goto_end_revealer", FALSE, G_STRUCT_OFFSET (DinoUiConversationView, goto_end_revealer));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "goto_end_button", FALSE, G_STRUCT_OFFSET (DinoUiConversationView, goto_end_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "chat_input", FALSE, G_STRUCT_OFFSET (DinoUiConversationView, chat_input));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "conversation_frame", FALSE, G_STRUCT_OFFSET (DinoUiConversationView, conversation_frame));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "white_revealer", FALSE, G_STRUCT_OFFSET (DinoUiConversationView, white_revealer));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "content_revealer", FALSE, G_STRUCT_OFFSET (DinoUiConversationView, content_revealer));
}

static void
dino_ui_conversation_view_instance_init (DinoUiConversationView * self,
                                         gpointer klass)
{
	GtkListView* _tmp0_;
	_tmp0_ = (GtkListView*) gtk_list_view_new (NULL, NULL);
	g_object_ref_sink (_tmp0_);
	self->list_view = _tmp0_;
	self->at_current_content = TRUE;
	g_type_ensure (DINO_UI_CHAT_INPUT_TYPE_VIEW);
	g_type_ensure (DINO_UI_CONVERSATION_SUMMARY_TYPE_CONVERSATION_VIEW);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
dino_ui_conversation_view_finalize (GObject * obj)
{
	DinoUiConversationView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_CONVERSATION_VIEW, DinoUiConversationView);
	_g_object_unref0 (self->list_view);
	G_OBJECT_CLASS (dino_ui_conversation_view_parent_class)->finalize (obj);
}

static GType
dino_ui_conversation_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiConversationViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_conversation_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiConversationView), 0, (GInstanceInitFunc) dino_ui_conversation_view_instance_init, NULL };
	GType dino_ui_conversation_view_type_id;
	dino_ui_conversation_view_type_id = g_type_register_static (gtk_widget_get_type (), "DinoUiConversationView", &g_define_type_info, 0);
	return dino_ui_conversation_view_type_id;
}

GType
dino_ui_conversation_view_get_type (void)
{
	static volatile gsize dino_ui_conversation_view_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_conversation_view_type_id__once)) {
		GType dino_ui_conversation_view_type_id;
		dino_ui_conversation_view_type_id = dino_ui_conversation_view_get_type_once ();
		g_once_init_leave (&dino_ui_conversation_view_type_id__once, dino_ui_conversation_view_type_id);
	}
	return dino_ui_conversation_view_type_id__once;
}

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

