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

#include <adwaita.h>
#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "dino_i18n.h"
#include <gio/gio.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 _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

VALA_EXTERN AdwHeaderBar* dino_ui_get_conversation_list_titlebar (void);
VALA_EXTERN void dino_ui_create_add_menu (GtkMenuButton* add_button,
                              GtkMenuButton* menu_button);
VALA_EXTERN gchar* dino_ui_util_string_if_tooltips_active (const gchar* s);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

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

AdwHeaderBar*
dino_ui_get_conversation_list_titlebar (void)
{
	GtkBuilder* builder = NULL;
	GtkBuilder* _tmp0_;
	GtkMenuButton* add_button = NULL;
	GObject* _tmp1_;
	GtkMenuButton* _tmp2_;
	GtkMenuButton* menu_button = NULL;
	GObject* _tmp3_;
	GtkMenuButton* _tmp4_;
	GObject* _tmp5_;
	AdwHeaderBar* _tmp6_;
	AdwHeaderBar* result;
	_tmp0_ = gtk_builder_new_from_resource ("/im/dino/Dino/conversation_list_titlebar.ui");
	builder = _tmp0_;
	_tmp1_ = gtk_builder_get_object (builder, "add_button");
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_menu_button_get_type (), GtkMenuButton));
	add_button = _tmp2_;
	_tmp3_ = gtk_builder_get_object (builder, "menu_button");
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, gtk_menu_button_get_type (), GtkMenuButton));
	menu_button = _tmp4_;
	dino_ui_create_add_menu (add_button, menu_button);
	_tmp5_ = gtk_builder_get_object (builder, "header_bar");
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, adw_header_bar_get_type (), AdwHeaderBar));
	result = _tmp6_;
	_g_object_unref0 (menu_button);
	_g_object_unref0 (add_button);
	_g_object_unref0 (builder);
	return result;
}

void
dino_ui_create_add_menu (GtkMenuButton* add_button,
                         GtkMenuButton* menu_button)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GtkBuilder* add_builder = NULL;
	GtkBuilder* _tmp3_;
	GMenuModel* add_menu_model = NULL;
	GObject* _tmp4_;
	GMenuModel* _tmp5_;
	GtkBuilder* menu_builder = NULL;
	GtkBuilder* _tmp6_;
	GMenuModel* menu_menu_model = NULL;
	GObject* _tmp7_;
	GMenuModel* _tmp8_;
	g_return_if_fail (add_button != NULL);
	g_return_if_fail (menu_button != NULL);
	_tmp0_ = dino_gettext ("Start Conversation");
	_tmp1_ = dino_ui_util_string_if_tooltips_active (_tmp0_);
	_tmp2_ = _tmp1_;
	gtk_widget_set_tooltip_text ((GtkWidget*) add_button, _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = gtk_builder_new_from_resource ("/im/dino/Dino/menu_add.ui");
	add_builder = _tmp3_;
	_tmp4_ = gtk_builder_get_object (add_builder, "menu_add");
	_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, g_menu_model_get_type ()) ? ((GMenuModel*) _tmp4_) : NULL);
	add_menu_model = _tmp5_;
	gtk_menu_button_set_menu_model (add_button, add_menu_model);
	_tmp6_ = gtk_builder_new_from_resource ("/im/dino/Dino/menu_app.ui");
	menu_builder = _tmp6_;
	_tmp7_ = gtk_builder_get_object (menu_builder, "menu_app");
	_tmp8_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, g_menu_model_get_type ()) ? ((GMenuModel*) _tmp7_) : NULL);
	menu_menu_model = _tmp8_;
	gtk_menu_button_set_menu_model (menu_button, menu_menu_model);
	_g_object_unref0 (menu_menu_model);
	_g_object_unref0 (menu_builder);
	_g_object_unref0 (add_menu_model);
	_g_object_unref0 (add_builder);
}

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

