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

#include <glib.h>
#include <gio/gio.h>
#include <gtk/gtk.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 _g_settings_schema_source_unref0(var) ((var == NULL) ? NULL : (var = (g_settings_schema_source_unref (var), NULL)))
#define _g_settings_schema_unref0(var) ((var == NULL) ? NULL : (var = (g_settings_schema_unref (var), NULL)))

VALA_EXTERN gboolean dc_gtk_emoji_chooser_available (void);
VALA_EXTERN GtkEmojiChooser* dc_create_emoji_chooser (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static gpointer
_g_settings_schema_source_ref0 (gpointer self)
{
	return self ? g_settings_schema_source_ref (self) : NULL;
}

gboolean
dc_gtk_emoji_chooser_available (void)
{
	GSettingsSchemaSource* source = NULL;
	GSettingsSchemaSource* _tmp0_;
	GSettingsSchemaSource* _tmp1_;
	GSettingsSchemaSource* _tmp2_;
	GSettingsSchema* schema = NULL;
	GSettingsSchemaSource* _tmp3_;
	GSettingsSchema* _tmp4_;
	GSettingsSchema* _tmp5_;
	GSettingsSchemaSource* _tmp6_;
	GSettingsSchema* _tmp7_;
	GSettingsSchema* _tmp8_;
	gboolean result;
	_tmp0_ = g_settings_schema_source_get_default ();
	_tmp1_ = _g_settings_schema_source_ref0 (_tmp0_);
	source = _tmp1_;
	_tmp2_ = source;
	if (_tmp2_ == NULL) {
		result = FALSE;
		_g_settings_schema_source_unref0 (source);
		return result;
	}
	_tmp3_ = source;
	_tmp4_ = g_settings_schema_source_lookup (_tmp3_, "org.gtk.gtk4.Settings.EmojiChooser", TRUE);
	schema = _tmp4_;
	_tmp5_ = schema;
	if (_tmp5_ != NULL) {
		result = TRUE;
		_g_settings_schema_unref0 (schema);
		_g_settings_schema_source_unref0 (source);
		return result;
	}
	_tmp6_ = source;
	_tmp7_ = g_settings_schema_source_lookup (_tmp6_, "org.gtk.Settings.EmojiChooser", TRUE);
	_g_settings_schema_unref0 (schema);
	schema = _tmp7_;
	_tmp8_ = schema;
	result = _tmp8_ != NULL;
	_g_settings_schema_unref0 (schema);
	_g_settings_schema_source_unref0 (source);
	return result;
}

GtkEmojiChooser*
dc_create_emoji_chooser (void)
{
	GtkEmojiChooser* _tmp0_;
	GtkEmojiChooser* result;
	if (!dc_gtk_emoji_chooser_available ()) {
		result = NULL;
		return result;
	}
	_tmp0_ = (GtkEmojiChooser*) gtk_emoji_chooser_new ();
	g_object_ref_sink (_tmp0_);
	result = _tmp0_;
	return result;
}

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

