/* CustomEmojiChooser.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from CustomEmojiChooser.vala, do not modify */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <adwaita.h>
#include <pango/pango.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 TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER (tuba_widgets_custom_emoji_chooser_get_type ())
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER, TubaWidgetsCustomEmojiChooser))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER, TubaWidgetsCustomEmojiChooserClass))
#define TUBA_WIDGETS_IS_CUSTOM_EMOJI_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER))
#define TUBA_WIDGETS_IS_CUSTOM_EMOJI_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER, TubaWidgetsCustomEmojiChooserClass))

typedef struct _TubaWidgetsCustomEmojiChooser TubaWidgetsCustomEmojiChooser;
typedef struct _TubaWidgetsCustomEmojiChooserClass TubaWidgetsCustomEmojiChooserClass;
typedef struct _TubaWidgetsCustomEmojiChooserPrivate TubaWidgetsCustomEmojiChooserPrivate;

#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_TYPE_EMOJI_CATEGORY (tuba_widgets_custom_emoji_chooser_emoji_category_get_type ())
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserEmojiCategory))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserEmojiCategoryClass))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_IS_EMOJI_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_TYPE_EMOJI_CATEGORY))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_IS_EMOJI_CATEGORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_TYPE_EMOJI_CATEGORY))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserEmojiCategoryClass))

typedef struct _TubaWidgetsCustomEmojiChooserEmojiCategory TubaWidgetsCustomEmojiChooserEmojiCategory;
typedef struct _TubaWidgetsCustomEmojiChooserEmojiCategoryClass TubaWidgetsCustomEmojiChooserEmojiCategoryClass;
enum  {
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_0_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_QUERY_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_IS_POPULATED_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_NUM_PROPERTIES
};
static GParamSpec* tuba_widgets_custom_emoji_chooser_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TUBA_TYPE_ENTITY (tuba_entity_get_type ())
#define TUBA_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ENTITY, TubaEntity))
#define TUBA_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ENTITY, TubaEntityClass))
#define TUBA_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ENTITY))
#define TUBA_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ENTITY))
#define TUBA_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ENTITY, TubaEntityClass))

typedef struct _TubaEntity TubaEntity;
typedef struct _TubaEntityClass TubaEntityClass;

#define TUBA_API_TYPE_EMOJI (tuba_api_emoji_get_type ())
#define TUBA_API_EMOJI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_EMOJI, TubaAPIEmoji))
#define TUBA_API_EMOJI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_EMOJI, TubaAPIEmojiClass))
#define TUBA_API_IS_EMOJI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_EMOJI))
#define TUBA_API_IS_EMOJI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_EMOJI))
#define TUBA_API_EMOJI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_EMOJI, TubaAPIEmojiClass))

typedef struct _TubaAPIEmoji TubaAPIEmoji;
typedef struct _TubaAPIEmojiClass TubaAPIEmojiClass;
typedef struct _Block120Data Block120Data;

#define TUBA_TYPE_ACCOUNT_STORE (tuba_account_store_get_type ())
#define TUBA_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStore))
#define TUBA_ACCOUNT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStoreClass))
#define TUBA_IS_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ACCOUNT_STORE))
#define TUBA_IS_ACCOUNT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ACCOUNT_STORE))
#define TUBA_ACCOUNT_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStoreClass))

typedef struct _TubaAccountStore TubaAccountStore;
typedef struct _TubaAccountStoreClass TubaAccountStoreClass;

#define TUBA_API_TYPE_ACCOUNT (tuba_api_account_get_type ())
#define TUBA_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccount))
#define TUBA_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))
#define TUBA_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))

typedef struct _TubaAPIAccount TubaAPIAccount;
typedef struct _TubaAPIAccountClass TubaAPIAccountClass;

#define TUBA_TYPE_INSTANCE_ACCOUNT (tuba_instance_account_get_type ())
#define TUBA_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccount))
#define TUBA_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))
#define TUBA_IS_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_IS_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_INSTANCE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))

typedef struct _TubaInstanceAccount TubaInstanceAccount;
typedef struct _TubaInstanceAccountClass TubaInstanceAccountClass;
typedef struct _Block121Data Block121Data;

#define TUBA_TYPE_SETTINGS (tuba_settings_get_type ())
#define TUBA_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_SETTINGS, TubaSettings))
#define TUBA_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_SETTINGS, TubaSettingsClass))
#define TUBA_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_SETTINGS))
#define TUBA_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_SETTINGS))
#define TUBA_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_SETTINGS, TubaSettingsClass))

typedef struct _TubaSettings TubaSettings;
typedef struct _TubaSettingsClass TubaSettingsClass;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
typedef struct _Block122Data Block122Data;
typedef struct _TubaWidgetsCustomEmojiChooserEmojiCategoryPrivate TubaWidgetsCustomEmojiChooserEmojiCategoryPrivate;
enum  {
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_0_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_LABEL_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_NUM_PROPERTIES
};
static GParamSpec* tuba_widgets_custom_emoji_chooser_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_NUM_PROPERTIES];

#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_TYPE_EMOJI_BUTTON (tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_get_type ())
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_TYPE_EMOJI_BUTTON, TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_TYPE_EMOJI_BUTTON, TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButtonClass))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_IS_EMOJI_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_TYPE_EMOJI_BUTTON))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_IS_EMOJI_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_TYPE_EMOJI_BUTTON))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_TYPE_EMOJI_BUTTON, TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButtonClass))

typedef struct _TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton;
typedef struct _TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButtonClass TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButtonClass;
typedef struct _TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButtonPrivate TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButtonPrivate;
enum  {
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_BUTTON_0_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_BUTTON_NUM_PROPERTIES
};
static GParamSpec* tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_BUTTON_NUM_PROPERTIES];

#define TUBA_WIDGETS_TYPE_EMOJI (tuba_widgets_emoji_get_type ())
#define TUBA_WIDGETS_EMOJI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_EMOJI, TubaWidgetsEmoji))
#define TUBA_WIDGETS_EMOJI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_EMOJI, TubaWidgetsEmojiClass))
#define TUBA_WIDGETS_IS_EMOJI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_EMOJI))
#define TUBA_WIDGETS_IS_EMOJI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_EMOJI))
#define TUBA_WIDGETS_EMOJI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_EMOJI, TubaWidgetsEmojiClass))

typedef struct _TubaWidgetsEmoji TubaWidgetsEmoji;
typedef struct _TubaWidgetsEmojiClass TubaWidgetsEmojiClass;
enum  {
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_BUTTON_EMOJI_SELECTED_SIGNAL,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_BUTTON_NUM_SIGNALS
};
static guint tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_signals[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_BUTTON_NUM_SIGNALS] = {0};
enum  {
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_SELECTED_SIGNAL,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_NUM_SIGNALS
};
static guint tuba_widgets_custom_emoji_chooser_emoji_category_signals[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_NUM_SIGNALS] = {0};
enum  {
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_PICKED_SIGNAL,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_NUM_SIGNALS
};
static guint tuba_widgets_custom_emoji_chooser_signals[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_NUM_SIGNALS] = {0};

struct _TubaWidgetsCustomEmojiChooser {
	GtkPopover parent_instance;
	TubaWidgetsCustomEmojiChooserPrivate * priv;
};

struct _TubaWidgetsCustomEmojiChooserClass {
	GtkPopoverClass parent_class;
};

struct _TubaWidgetsCustomEmojiChooserPrivate {
	gchar* _query;
	gboolean _is_populated;
	GtkBox* custom_emojis_box;
	GtkSearchEntry* entry;
	GtkScrolledWindow* custom_emojis_scrolled;
	TubaWidgetsCustomEmojiChooserEmojiCategory* recents;
	TubaWidgetsCustomEmojiChooserEmojiCategory* results;
};

struct _Block120Data {
	int _ref_count_;
	TubaWidgetsCustomEmojiChooser* self;
	GeeHashMap* res;
};

struct _Block121Data {
	int _ref_count_;
	TubaWidgetsCustomEmojiChooser* self;
	GeeHashMap* recents_to_api;
	gint total;
};

struct _Block122Data {
	int _ref_count_;
	TubaWidgetsCustomEmojiChooser* self;
	gboolean at_least_one;
};

struct _TubaWidgetsCustomEmojiChooserEmojiCategory {
	GtkBox parent_instance;
	TubaWidgetsCustomEmojiChooserEmojiCategoryPrivate * priv;
};

struct _TubaWidgetsCustomEmojiChooserEmojiCategoryClass {
	GtkBoxClass parent_class;
};

struct _TubaWidgetsCustomEmojiChooserEmojiCategoryPrivate {
	GtkLabel* title_label;
	GtkFlowBox* emoji_box;
};

struct _TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton {
	GtkButton parent_instance;
	TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButtonPrivate * priv;
};

struct _TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButtonClass {
	GtkButtonClass parent_class;
};

struct _TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButtonPrivate {
	gchar* shortcode;
};

static gint TubaWidgetsCustomEmojiChooser_private_offset;
static gpointer tuba_widgets_custom_emoji_chooser_parent_class = NULL;
static gint tuba_widgets_custom_emoji_chooser_max_recents;
static gint tuba_widgets_custom_emoji_chooser_max_recents = 12;
VALA_EXTERN TubaAccountStore* tuba_accounts;
VALA_EXTERN TubaSettings* tuba_settings;
static gint TubaWidgetsCustomEmojiChooserEmojiCategory_private_offset;
static gpointer tuba_widgets_custom_emoji_chooser_emoji_category_parent_class = NULL;
static gint TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton_private_offset;
static gpointer tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_parent_class = NULL;

VALA_EXTERN GType tuba_widgets_custom_emoji_chooser_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsCustomEmojiChooser, g_object_unref)
static GType tuba_widgets_custom_emoji_chooser_emoji_category_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsCustomEmojiChooserEmojiCategory, g_object_unref)
VALA_EXTERN GType tuba_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaEntity, g_object_unref)
VALA_EXTERN GType tuba_api_emoji_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIEmoji, g_object_unref)
static GeeHashMap* tuba_widgets_custom_emoji_chooser_gen_emojis_cat_map (TubaWidgetsCustomEmojiChooser* self);
static Block120Data* block120_data_ref (Block120Data* _data120_);
static void block120_data_unref (void * _userdata_);
VALA_EXTERN GType tuba_account_store_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAccountStore, g_object_unref)
VALA_EXTERN GType tuba_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAccount, g_object_unref)
VALA_EXTERN GType tuba_instance_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaInstanceAccount, g_object_unref)
VALA_EXTERN TubaInstanceAccount* tuba_account_store_get_active (TubaAccountStore* self);
VALA_EXTERN GeeArrayList* tuba_instance_account_get_instance_emojis (TubaInstanceAccount* self);
static gboolean ___lambda79_ (Block120Data* _data120_,
                       TubaAPIEmoji* e);
VALA_EXTERN gboolean tuba_api_emoji_get_visible_in_picker (TubaAPIEmoji* self);
VALA_EXTERN const gchar* tuba_api_emoji_get_category (TubaAPIEmoji* self);
static gboolean ____lambda79__gee_forall_func (gpointer g,
                                        gpointer self);
static gboolean ___lambda80_ (TubaWidgetsCustomEmojiChooser* self,
                       GeeMapEntry* e);
static gint tuba_widgets_custom_emoji_chooser_sort_emojis (TubaWidgetsCustomEmojiChooser* self,
                                                    TubaAPIEmoji* a,
                                                    TubaAPIEmoji* b);
static gint _tuba_widgets_custom_emoji_chooser_sort_emojis_gcompare_data_func (gconstpointer a,
                                                                        gconstpointer b,
                                                                        gpointer self);
static gboolean ____lambda80__gee_forall_func (gpointer g,
                                        gpointer self);
VALA_EXTERN const gchar* tuba_api_emoji_get_shortcode (TubaAPIEmoji* self);
static void tuba_widgets_custom_emoji_chooser_populate_recents (TubaWidgetsCustomEmojiChooser* self);
static Block121Data* block121_data_ref (Block121Data* _data121_);
static void block121_data_unref (void * _userdata_);
static void tuba_widgets_custom_emoji_chooser_emoji_category_remove_all (TubaWidgetsCustomEmojiChooserEmojiCategory* self);
VALA_EXTERN GType tuba_settings_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaSettings, g_object_unref)
VALA_EXTERN gchar** tuba_settings_get_recently_used_custom_emojis (TubaSettings* self,
                                                       gint* result_length1);
static gboolean __lambda81_ (Block121Data* _data121_,
                      TubaAPIEmoji* e);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
static gboolean ___lambda81__gee_forall_func (gpointer g,
                                       gpointer self);
static gboolean tuba_widgets_custom_emoji_chooser_emoji_category_add_emoji (TubaWidgetsCustomEmojiChooserEmojiCategory* self,
                                                                     TubaAPIEmoji* emoji);
static void tuba_widgets_custom_emoji_chooser_update_recents (TubaWidgetsCustomEmojiChooser* self,
                                                       const gchar* shortcode);
static void _vala_array_add105 (gchar** * array,
                         gint* length,
                         gint* size,
                         gchar* value);
static void _vala_array_add106 (gchar** * array,
                         gint* length,
                         gint* size,
                         gchar* value);
static void _vala_array_add107 (gchar** * array,
                         gint* length,
                         gint* size,
                         gchar* value);
VALA_EXTERN void tuba_settings_set_recently_used_custom_emojis (TubaSettings* self,
                                                    gchar** value,
                                                    gint value_length1);
VALA_EXTERN void tuba_widgets_custom_emoji_chooser_search (TubaWidgetsCustomEmojiChooser* self);
VALA_EXTERN void tuba_widgets_custom_emoji_chooser_set_query (TubaWidgetsCustomEmojiChooser* self,
                                                  const gchar* value);
VALA_EXTERN const gchar* tuba_widgets_custom_emoji_chooser_get_query (TubaWidgetsCustomEmojiChooser* self);
static Block122Data* block122_data_ref (Block122Data* _data122_);
static void block122_data_unref (void * _userdata_);
static gboolean ___lambda82_ (Block122Data* _data122_,
                       TubaAPIEmoji* e);
static gboolean ____lambda82__gee_forall_func (gpointer g,
                                        gpointer self);
static void tuba_widgets_custom_emoji_chooser_emoji_category_set_label (TubaWidgetsCustomEmojiChooserEmojiCategory* self,
                                                                 const gchar* value);
VALA_EXTERN void tuba_widgets_custom_emoji_chooser_on_custom_emoji_picked (TubaWidgetsCustomEmojiChooser* self,
                                                               const gchar* shortcode);
VALA_EXTERN void tuba_widgets_custom_emoji_chooser_on_close (TubaWidgetsCustomEmojiChooser* self);
static void tuba_widgets_custom_emoji_chooser_real_show (GtkWidget* base);
static gboolean tuba_widgets_custom_emoji_chooser_show_idle (TubaWidgetsCustomEmojiChooser* self);
static gboolean _tuba_widgets_custom_emoji_chooser_show_idle_gsource_func (gpointer self);
VALA_EXTERN gboolean tuba_widgets_custom_emoji_chooser_get_is_populated (TubaWidgetsCustomEmojiChooser* self);
VALA_EXTERN void tuba_widgets_custom_emoji_chooser_populate_chooser (TubaWidgetsCustomEmojiChooser* self);
static gint tuba_widgets_custom_emoji_chooser_sort_strings (TubaWidgetsCustomEmojiChooser* self,
                                                     const gchar* a,
                                                     const gchar* b);
static gint _tuba_widgets_custom_emoji_chooser_sort_strings_gcompare_data_func (gconstpointer a,
                                                                         gconstpointer b,
                                                                         gpointer self);
static TubaWidgetsCustomEmojiChooserEmojiCategory* tuba_widgets_custom_emoji_chooser_emoji_category_new (const gchar* title);
static TubaWidgetsCustomEmojiChooserEmojiCategory* tuba_widgets_custom_emoji_chooser_emoji_category_construct (GType object_type,
                                                                                                        const gchar* title);
static void tuba_widgets_custom_emoji_chooser_emoji_category_add_emojis (TubaWidgetsCustomEmojiChooserEmojiCategory* self,
                                                                  GeeArrayList* emojis);
static void _tuba_widgets_custom_emoji_chooser_on_custom_emoji_picked_tuba_widgets_custom_emoji_chooser_emoji_category_emoji_selected (TubaWidgetsCustomEmojiChooserEmojiCategory* _sender,
                                                                                                                                const gchar* shortcode,
                                                                                                                                gpointer self);
VALA_EXTERN void tuba_widgets_custom_emoji_chooser_set_is_populated (TubaWidgetsCustomEmojiChooser* self,
                                                         gboolean value);
VALA_EXTERN TubaWidgetsCustomEmojiChooser* tuba_widgets_custom_emoji_chooser_new (void);
VALA_EXTERN TubaWidgetsCustomEmojiChooser* tuba_widgets_custom_emoji_chooser_construct (GType object_type);
static gboolean _tuba_widgets_custom_emoji_chooser_emoji_category_add_emoji_gee_forall_func (gpointer g,
                                                                                      gpointer self);
static GType tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton, g_object_unref)
static TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton* tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_new (TubaAPIEmoji* emoji);
static TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton* tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_construct (GType object_type,
                                                                                                                                TubaAPIEmoji* emoji);
static void tuba_widgets_custom_emoji_chooser_emoji_category_on_custom_emoji_picked (TubaWidgetsCustomEmojiChooserEmojiCategory* self,
                                                                              const gchar* shortcode);
static void _tuba_widgets_custom_emoji_chooser_emoji_category_on_custom_emoji_picked_tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_emoji_selected (TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton* _sender,
                                                                                                                                                            const gchar* shortcode,
                                                                                                                                                            gpointer self);
static const gchar* tuba_widgets_custom_emoji_chooser_emoji_category_get_label (TubaWidgetsCustomEmojiChooserEmojiCategory* self);
VALA_EXTERN const gchar* tuba_api_emoji_get_url (TubaAPIEmoji* self);
VALA_EXTERN GType tuba_widgets_emoji_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsEmoji, g_object_unref)
VALA_EXTERN TubaWidgetsEmoji* tuba_widgets_emoji_new (const gchar* emoji_url,
                                          const gchar* t_shortcode);
VALA_EXTERN TubaWidgetsEmoji* tuba_widgets_emoji_construct (GType object_type,
                                                const gchar* emoji_url,
                                                const gchar* t_shortcode);
VALA_EXTERN void tuba_widgets_emoji_set_icon_size (TubaWidgetsEmoji* self,
                                       GtkIconSize value);
static void tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_on_custom_emoji_picked (TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton* self);
static void _tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_on_custom_emoji_picked_gtk_button_clicked (GtkButton* _sender,
                                                                                                               gpointer self);
static GObject * tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_constructor (GType type,
                                                                                     guint n_construct_properties,
                                                                                     GObjectConstructParam * construct_properties);
static void tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_finalize (GObject * obj);
static GType tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_get_type_once (void);
static GObject * tuba_widgets_custom_emoji_chooser_emoji_category_constructor (GType type,
                                                                        guint n_construct_properties,
                                                                        GObjectConstructParam * construct_properties);
static void tuba_widgets_custom_emoji_chooser_emoji_category_finalize (GObject * obj);
static GType tuba_widgets_custom_emoji_chooser_emoji_category_get_type_once (void);
static void _vala_tuba_widgets_custom_emoji_chooser_emoji_category_get_property (GObject * object,
                                                                          guint property_id,
                                                                          GValue * value,
                                                                          GParamSpec * pspec);
static void _vala_tuba_widgets_custom_emoji_chooser_emoji_category_set_property (GObject * object,
                                                                          guint property_id,
                                                                          const GValue * value,
                                                                          GParamSpec * pspec);
static GObject * tuba_widgets_custom_emoji_chooser_constructor (GType type,
                                                         guint n_construct_properties,
                                                         GObjectConstructParam * construct_properties);
static void _tuba_widgets_custom_emoji_chooser_search_gtk_search_entry_activate (GtkSearchEntry* _sender,
                                                                          gpointer self);
static void _tuba_widgets_custom_emoji_chooser_search_gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                                                gpointer self);
static void _tuba_widgets_custom_emoji_chooser_on_close_gtk_search_entry_stop_search (GtkSearchEntry* _sender,
                                                                               gpointer self);
static void tuba_widgets_custom_emoji_chooser_finalize (GObject * obj);
static GType tuba_widgets_custom_emoji_chooser_get_type_once (void);
static void _vala_tuba_widgets_custom_emoji_chooser_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec);
static void _vala_tuba_widgets_custom_emoji_chooser_set_property (GObject * object,
                                                           guint property_id,
                                                           const GValue * value,
                                                           GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
tuba_widgets_custom_emoji_chooser_get_instance_private (TubaWidgetsCustomEmojiChooser* self)
{
	return G_STRUCT_MEMBER_P (self, TubaWidgetsCustomEmojiChooser_private_offset);
}

static Block120Data*
block120_data_ref (Block120Data* _data120_)
{
	g_atomic_int_inc (&_data120_->_ref_count_);
	return _data120_;
}

static void
block120_data_unref (void * _userdata_)
{
	Block120Data* _data120_;
	_data120_ = (Block120Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data120_->_ref_count_)) {
		TubaWidgetsCustomEmojiChooser* self;
		self = _data120_->self;
		_g_object_unref0 (_data120_->res);
		_g_object_unref0 (self);
		g_slice_free (Block120Data, _data120_);
	}
}

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

static gboolean
___lambda79_ (Block120Data* _data120_,
              TubaAPIEmoji* e)
{
	TubaWidgetsCustomEmojiChooser* self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	GeeHashMap* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gboolean result;
	self = _data120_->self;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = tuba_api_emoji_get_visible_in_picker (e);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		result = TRUE;
		_g_object_unref0 (e);
		return result;
	}
	_tmp2_ = _data120_->res;
	_tmp3_ = tuba_api_emoji_get_category (e);
	_tmp4_ = _tmp3_;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp2_, _tmp4_)) {
		GeeArrayList* array = NULL;
		GeeHashMap* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		gpointer _tmp8_;
		GeeArrayList* _tmp9_;
		_tmp5_ = _data120_->res;
		_tmp6_ = tuba_api_emoji_get_category (e);
		_tmp7_ = _tmp6_;
		_tmp8_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp5_, _tmp7_);
		array = (GeeArrayList*) _tmp8_;
		_tmp9_ = array;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, e);
		_g_object_unref0 (array);
	} else {
		GeeArrayList* array = NULL;
		GeeArrayList* _tmp10_;
		GeeArrayList* _tmp11_;
		GeeHashMap* _tmp12_;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		GeeArrayList* _tmp15_;
		_tmp10_ = gee_array_list_new (TUBA_API_TYPE_EMOJI, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
		array = _tmp10_;
		_tmp11_ = array;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp11_, e);
		_tmp12_ = _data120_->res;
		_tmp13_ = tuba_api_emoji_get_category (e);
		_tmp14_ = _tmp13_;
		_tmp15_ = array;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp12_, _tmp14_, _tmp15_);
		_g_object_unref0 (array);
	}
	result = TRUE;
	_g_object_unref0 (e);
	return result;
}

static gboolean
____lambda79__gee_forall_func (gpointer g,
                               gpointer self)
{
	gboolean result;
	result = ___lambda79_ (self, (TubaAPIEmoji*) g);
	return result;
}

static gint
_tuba_widgets_custom_emoji_chooser_sort_emojis_gcompare_data_func (gconstpointer a,
                                                                   gconstpointer b,
                                                                   gpointer self)
{
	gint result;
	result = tuba_widgets_custom_emoji_chooser_sort_emojis ((TubaWidgetsCustomEmojiChooser*) self, (TubaAPIEmoji*) a, (TubaAPIEmoji*) b);
	return result;
}

static gboolean
___lambda80_ (TubaWidgetsCustomEmojiChooser* self,
              GeeMapEntry* e)
{
	gconstpointer _tmp0_;
	gconstpointer _tmp1_;
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = gee_map_entry_get_value (e);
	_tmp1_ = _tmp0_;
	gee_list_sort ((GeeList*) ((GeeArrayList*) _tmp1_), _tuba_widgets_custom_emoji_chooser_sort_emojis_gcompare_data_func, g_object_ref (self), g_object_unref);
	result = TRUE;
	_g_object_unref0 (e);
	return result;
}

static gboolean
____lambda80__gee_forall_func (gpointer g,
                               gpointer self)
{
	gboolean result;
	result = ___lambda80_ ((TubaWidgetsCustomEmojiChooser*) self, (GeeMapEntry*) g);
	return result;
}

static GeeHashMap*
tuba_widgets_custom_emoji_chooser_gen_emojis_cat_map (TubaWidgetsCustomEmojiChooser* self)
{
	Block120Data* _data120_;
	GeeHashMap* _tmp0_;
	GeeArrayList* emojis = NULL;
	TubaAccountStore* _tmp1_;
	TubaInstanceAccount* _tmp2_;
	TubaInstanceAccount* _tmp3_;
	GeeArrayList* _tmp4_;
	GeeArrayList* _tmp5_;
	GeeArrayList* _tmp6_;
	gboolean _tmp7_ = FALSE;
	GeeArrayList* _tmp8_;
	GeeHashMap* _tmp14_;
	GeeHashMap* _tmp15_;
	GeeHashMap* result;
	g_return_val_if_fail (self != NULL, NULL);
	_data120_ = g_slice_new0 (Block120Data);
	_data120_->_ref_count_ = 1;
	_data120_->self = g_object_ref (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, GEE_TYPE_ARRAY_LIST, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_data120_->res = _tmp0_;
	_tmp1_ = tuba_accounts;
	_tmp2_ = tuba_account_store_get_active (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = tuba_instance_account_get_instance_emojis (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	emojis = _tmp6_;
	_tmp8_ = emojis;
	if (_tmp8_ != NULL) {
		GeeArrayList* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		_tmp9_ = emojis;
		_tmp10_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp9_);
		_tmp11_ = _tmp10_;
		_tmp7_ = _tmp11_ > 0;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		GeeArrayList* _tmp12_;
		GeeHashMap* _tmp13_;
		_tmp12_ = emojis;
		gee_abstract_collection_foreach ((GeeAbstractCollection*) _tmp12_, ____lambda79__gee_forall_func, _data120_);
		_tmp13_ = _data120_->res;
		gee_abstract_map_foreach ((GeeAbstractMap*) _tmp13_, ____lambda80__gee_forall_func, self);
	}
	_tmp14_ = _data120_->res;
	_tmp15_ = _g_object_ref0 (_tmp14_);
	result = _tmp15_;
	_g_object_unref0 (emojis);
	block120_data_unref (_data120_);
	_data120_ = NULL;
	return result;
}

static gint
tuba_widgets_custom_emoji_chooser_sort_emojis (TubaWidgetsCustomEmojiChooser* self,
                                               TubaAPIEmoji* a,
                                               TubaAPIEmoji* b)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (a != NULL, 0);
	g_return_val_if_fail (b != NULL, 0);
	_tmp0_ = tuba_api_emoji_get_shortcode (a);
	_tmp1_ = _tmp0_;
	_tmp2_ = tuba_api_emoji_get_shortcode (b);
	_tmp3_ = _tmp2_;
	result = g_utf8_collate (_tmp1_, _tmp3_);
	return result;
}

static Block121Data*
block121_data_ref (Block121Data* _data121_)
{
	g_atomic_int_inc (&_data121_->_ref_count_);
	return _data121_;
}

static void
block121_data_unref (void * _userdata_)
{
	Block121Data* _data121_;
	_data121_ = (Block121Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data121_->_ref_count_)) {
		TubaWidgetsCustomEmojiChooser* self;
		self = _data121_->self;
		_g_object_unref0 (_data121_->recents_to_api);
		_g_object_unref0 (self);
		g_slice_free (Block121Data, _data121_);
	}
}

static gboolean
_vala_string_array_contains (gchar* * stack,
                             gssize stack_length,
                             const gchar* needle)
{
	gssize i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}

static gboolean
__lambda81_ (Block121Data* _data121_,
             TubaAPIEmoji* e)
{
	TubaWidgetsCustomEmojiChooser* self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	TubaSettings* _tmp4_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gint _tmp6_ = 0;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gboolean result;
	self = _data121_->self;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = tuba_api_emoji_get_visible_in_picker (e);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		result = TRUE;
		_g_object_unref0 (e);
		return result;
	}
	_tmp2_ = tuba_api_emoji_get_shortcode (e);
	_tmp3_ = _tmp2_;
	_tmp4_ = tuba_settings;
	_tmp5_ = tuba_settings_get_recently_used_custom_emojis (_tmp4_, &_tmp6_);
	_tmp5__length1 = _tmp6_;
	_tmp7_ = _tmp5_;
	_tmp7__length1 = _tmp5__length1;
	if (_vala_string_array_contains (_tmp7_, _tmp7__length1, _tmp3_)) {
		GeeHashMap* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		_tmp8_ = _data121_->recents_to_api;
		_tmp9_ = tuba_api_emoji_get_shortcode (e);
		_tmp10_ = _tmp9_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp8_, _tmp10_, e);
		_data121_->total -= 1;
	}
	if (_data121_->total < 1) {
		result = FALSE;
		_g_object_unref0 (e);
		return result;
	}
	result = TRUE;
	_g_object_unref0 (e);
	return result;
}

static gboolean
___lambda81__gee_forall_func (gpointer g,
                              gpointer self)
{
	gboolean result;
	result = __lambda81_ (self, (TubaAPIEmoji*) g);
	return result;
}

static void
tuba_widgets_custom_emoji_chooser_populate_recents (TubaWidgetsCustomEmojiChooser* self)
{
	Block121Data* _data121_;
	TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp0_;
	TubaSettings* _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gint _tmp3_ = 0;
	gchar** _tmp4_;
	gint _tmp4__length1;
	GeeHashMap* _tmp6_;
	TubaSettings* _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	gint _tmp9_ = 0;
	gchar** _tmp10_;
	gint _tmp10__length1;
	TubaAccountStore* _tmp11_;
	TubaInstanceAccount* _tmp12_;
	TubaInstanceAccount* _tmp13_;
	GeeArrayList* _tmp14_;
	GeeArrayList* _tmp15_;
	GeeHashMap* _tmp30_;
	TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp31_;
	g_return_if_fail (self != NULL);
	_data121_ = g_slice_new0 (Block121Data);
	_data121_->_ref_count_ = 1;
	_data121_->self = g_object_ref (self);
	_tmp0_ = self->priv->recents;
	tuba_widgets_custom_emoji_chooser_emoji_category_remove_all (_tmp0_);
	_tmp1_ = tuba_settings;
	_tmp2_ = tuba_settings_get_recently_used_custom_emojis (_tmp1_, &_tmp3_);
	_tmp2__length1 = _tmp3_;
	_tmp4_ = _tmp2_;
	_tmp4__length1 = _tmp2__length1;
	if (_tmp4__length1 == 0) {
		TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp5_;
		_tmp5_ = self->priv->recents;
		gtk_widget_set_visible ((GtkWidget*) _tmp5_, FALSE);
		block121_data_unref (_data121_);
		_data121_ = NULL;
		return;
	}
	_tmp6_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, TUBA_API_TYPE_EMOJI, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_data121_->recents_to_api = _tmp6_;
	_tmp7_ = tuba_settings;
	_tmp8_ = tuba_settings_get_recently_used_custom_emojis (_tmp7_, &_tmp9_);
	_tmp8__length1 = _tmp9_;
	_tmp10_ = _tmp8_;
	_tmp10__length1 = _tmp8__length1;
	_data121_->total = _tmp10__length1;
	_tmp11_ = tuba_accounts;
	_tmp12_ = tuba_account_store_get_active (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = tuba_instance_account_get_instance_emojis (_tmp13_);
	_tmp15_ = _tmp14_;
	gee_abstract_collection_foreach ((GeeAbstractCollection*) _tmp15_, ___lambda81__gee_forall_func, _data121_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp16_ = FALSE;
			_tmp16_ = TRUE;
			while (TRUE) {
				TubaSettings* _tmp18_;
				gchar** _tmp19_;
				gint _tmp19__length1;
				gint _tmp20_ = 0;
				gchar** _tmp21_;
				gint _tmp21__length1;
				TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp22_;
				GeeHashMap* _tmp23_;
				TubaSettings* _tmp24_;
				gchar** _tmp25_;
				gint _tmp25__length1;
				gint _tmp26_ = 0;
				gchar** _tmp27_;
				gint _tmp27__length1;
				const gchar* _tmp28_;
				gpointer _tmp29_;
				if (!_tmp16_) {
					gint _tmp17_;
					_tmp17_ = i;
					i = _tmp17_ + 1;
				}
				_tmp16_ = FALSE;
				_tmp18_ = tuba_settings;
				_tmp19_ = tuba_settings_get_recently_used_custom_emojis (_tmp18_, &_tmp20_);
				_tmp19__length1 = _tmp20_;
				_tmp21_ = _tmp19_;
				_tmp21__length1 = _tmp19__length1;
				if (!(i < _tmp21__length1)) {
					break;
				}
				_tmp22_ = self->priv->recents;
				_tmp23_ = _data121_->recents_to_api;
				_tmp24_ = tuba_settings;
				_tmp25_ = tuba_settings_get_recently_used_custom_emojis (_tmp24_, &_tmp26_);
				_tmp25__length1 = _tmp26_;
				_tmp27_ = _tmp25_;
				_tmp27__length1 = _tmp25__length1;
				_tmp28_ = _tmp27_[i];
				_tmp29_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp23_, _tmp28_);
				tuba_widgets_custom_emoji_chooser_emoji_category_add_emoji (_tmp22_, (TubaAPIEmoji*) _tmp29_);
			}
		}
	}
	_tmp30_ = _data121_->recents_to_api;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp30_);
	_tmp31_ = self->priv->recents;
	gtk_widget_set_visible ((GtkWidget*) _tmp31_, TRUE);
	block121_data_unref (_data121_);
	_data121_ = NULL;
}

static void
_vala_array_add105 (gchar** * array,
                    gint* length,
                    gint* size,
                    gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add106 (gchar** * array,
                    gint* length,
                    gint* size,
                    gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add107 (gchar** * array,
                    gint* length,
                    gint* size,
                    gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
tuba_widgets_custom_emoji_chooser_update_recents (TubaWidgetsCustomEmojiChooser* self,
                                                  const gchar* shortcode)
{
	gchar** res = NULL;
	gchar** _tmp0_;
	gint res_length1;
	gint _res_size_;
	gchar* _tmp1_;
	TubaSettings* _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gint _tmp4_ = 0;
	gchar** _tmp5_;
	gint _tmp5__length1;
	TubaSettings* _tmp31_;
	gchar** _tmp32_;
	gint _tmp32__length1;
	g_return_if_fail (self != NULL);
	g_return_if_fail (shortcode != NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	res = _tmp0_;
	res_length1 = 0;
	_res_size_ = res_length1;
	_tmp1_ = g_strdup (shortcode);
	_vala_array_add105 (&res, &res_length1, &_res_size_, _tmp1_);
	_tmp2_ = tuba_settings;
	_tmp3_ = tuba_settings_get_recently_used_custom_emojis (_tmp2_, &_tmp4_);
	_tmp3__length1 = _tmp4_;
	_tmp5_ = _tmp3_;
	_tmp5__length1 = _tmp3__length1;
	if (_vala_string_array_contains (_tmp5_, _tmp5__length1, shortcode)) {
		TubaSettings* _tmp6_;
		gchar** _tmp7_;
		gint _tmp7__length1;
		gint _tmp8_ = 0;
		gchar** _tmp9_;
		gint _tmp9__length1;
		_tmp6_ = tuba_settings;
		_tmp7_ = tuba_settings_get_recently_used_custom_emojis (_tmp6_, &_tmp8_);
		_tmp7__length1 = _tmp8_;
		_tmp9_ = _tmp7_;
		_tmp9__length1 = _tmp7__length1;
		{
			gchar** emoji_collection = NULL;
			gint emoji_collection_length1 = 0;
			gint _emoji_collection_size_ = 0;
			gint emoji_it = 0;
			emoji_collection = _tmp9_;
			emoji_collection_length1 = _tmp9__length1;
			for (emoji_it = 0; emoji_it < emoji_collection_length1; emoji_it = emoji_it + 1) {
				gchar* _tmp10_;
				gchar* emoji = NULL;
				_tmp10_ = g_strdup (emoji_collection[emoji_it]);
				emoji = _tmp10_;
				{
					const gchar* _tmp11_;
					_tmp11_ = emoji;
					if (g_strcmp0 (_tmp11_, shortcode) != 0) {
						const gchar* _tmp12_;
						gchar* _tmp13_;
						_tmp12_ = emoji;
						_tmp13_ = g_strdup (_tmp12_);
						_vala_array_add106 (&res, &res_length1, &_res_size_, _tmp13_);
					}
					_g_free0 (emoji);
				}
			}
		}
	} else {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp14_ = FALSE;
				_tmp14_ = TRUE;
				while (TRUE) {
					gint _tmp16_ = 0;
					TubaSettings* _tmp17_;
					gchar** _tmp18_;
					gint _tmp18__length1;
					gint _tmp19_ = 0;
					gchar** _tmp20_;
					gint _tmp20__length1;
					TubaSettings* _tmp25_;
					gchar** _tmp26_;
					gint _tmp26__length1;
					gint _tmp27_ = 0;
					gchar** _tmp28_;
					gint _tmp28__length1;
					const gchar* _tmp29_;
					gchar* _tmp30_;
					if (!_tmp14_) {
						gint _tmp15_;
						_tmp15_ = i;
						i = _tmp15_ + 1;
					}
					_tmp14_ = FALSE;
					_tmp17_ = tuba_settings;
					_tmp18_ = tuba_settings_get_recently_used_custom_emojis (_tmp17_, &_tmp19_);
					_tmp18__length1 = _tmp19_;
					_tmp20_ = _tmp18_;
					_tmp20__length1 = _tmp18__length1;
					if (_tmp20__length1 < tuba_widgets_custom_emoji_chooser_max_recents) {
						TubaSettings* _tmp21_;
						gchar** _tmp22_;
						gint _tmp22__length1;
						gint _tmp23_ = 0;
						gchar** _tmp24_;
						gint _tmp24__length1;
						_tmp21_ = tuba_settings;
						_tmp22_ = tuba_settings_get_recently_used_custom_emojis (_tmp21_, &_tmp23_);
						_tmp22__length1 = _tmp23_;
						_tmp24_ = _tmp22_;
						_tmp24__length1 = _tmp22__length1;
						_tmp16_ = _tmp24__length1;
					} else {
						_tmp16_ = tuba_widgets_custom_emoji_chooser_max_recents - 1;
					}
					if (!(i < _tmp16_)) {
						break;
					}
					_tmp25_ = tuba_settings;
					_tmp26_ = tuba_settings_get_recently_used_custom_emojis (_tmp25_, &_tmp27_);
					_tmp26__length1 = _tmp27_;
					_tmp28_ = _tmp26_;
					_tmp28__length1 = _tmp26__length1;
					_tmp29_ = _tmp28_[i];
					_tmp30_ = g_strdup (_tmp29_);
					_vala_array_add107 (&res, &res_length1, &_res_size_, _tmp30_);
				}
			}
		}
	}
	_tmp31_ = tuba_settings;
	_tmp32_ = res;
	_tmp32__length1 = res_length1;
	tuba_settings_set_recently_used_custom_emojis (_tmp31_, _tmp32_, _tmp32__length1);
	res = (_vala_array_free (res, res_length1, (GDestroyNotify) g_free), NULL);
}

static gchar*
string_chug (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strchug (_result_);
	result = _result_;
	return result;
}

static gchar*
string_chomp (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strchomp (_result_);
	result = _result_;
	return result;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected 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 NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected 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 NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	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 NULL;
}

static Block122Data*
block122_data_ref (Block122Data* _data122_)
{
	g_atomic_int_inc (&_data122_->_ref_count_);
	return _data122_;
}

static void
block122_data_unref (void * _userdata_)
{
	Block122Data* _data122_;
	_data122_ = (Block122Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data122_->_ref_count_)) {
		TubaWidgetsCustomEmojiChooser* self;
		self = _data122_->self;
		_g_object_unref0 (self);
		g_slice_free (Block122Data, _data122_);
	}
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static gboolean
___lambda82_ (Block122Data* _data122_,
              TubaAPIEmoji* e)
{
	TubaWidgetsCustomEmojiChooser* self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	gboolean _tmp7_;
	gboolean result;
	self = _data122_->self;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = tuba_api_emoji_get_visible_in_picker (e);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		result = TRUE;
		_g_object_unref0 (e);
		return result;
	}
	_tmp2_ = tuba_api_emoji_get_shortcode (e);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_utf8_strdown (_tmp3_, (gssize) -1);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->_query;
	_tmp7_ = string_contains (_tmp5_, _tmp6_);
	_g_free0 (_tmp5_);
	if (_tmp7_) {
		TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp8_;
		TubaAPIEmoji* _tmp9_;
		_data122_->at_least_one = TRUE;
		_tmp8_ = self->priv->results;
		_tmp9_ = _g_object_ref0 (e);
		tuba_widgets_custom_emoji_chooser_emoji_category_add_emoji (_tmp8_, _tmp9_);
	}
	result = TRUE;
	_g_object_unref0 (e);
	return result;
}

static gboolean
____lambda82__gee_forall_func (gpointer g,
                               gpointer self)
{
	gboolean result;
	result = ___lambda82_ (self, (TubaAPIEmoji*) g);
	return result;
}

void
tuba_widgets_custom_emoji_chooser_search (TubaWidgetsCustomEmojiChooser* self)
{
	GtkSearchEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp11_;
	const gchar* _tmp12_;
	GeeArrayList* emojis = NULL;
	TubaAccountStore* _tmp14_;
	TubaInstanceAccount* _tmp15_;
	TubaInstanceAccount* _tmp16_;
	GeeArrayList* _tmp17_;
	GeeArrayList* _tmp18_;
	GeeArrayList* _tmp19_;
	gboolean _tmp20_ = FALSE;
	GeeArrayList* _tmp21_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->entry;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_chug (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = string_chomp (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_utf8_strdown (_tmp6_, (gssize) -1);
	_tmp8_ = _tmp7_;
	_tmp9_ = string_replace (_tmp8_, ":", "");
	_tmp10_ = _tmp9_;
	tuba_widgets_custom_emoji_chooser_set_query (self, _tmp10_);
	_g_free0 (_tmp10_);
	_g_free0 (_tmp8_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	_tmp11_ = self->priv->results;
	tuba_widgets_custom_emoji_chooser_emoji_category_remove_all (_tmp11_);
	_tmp12_ = self->priv->_query;
	if (g_strcmp0 (_tmp12_, "") == 0) {
		TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp13_;
		_tmp13_ = self->priv->results;
		gtk_widget_set_visible ((GtkWidget*) _tmp13_, FALSE);
		return;
	}
	_tmp14_ = tuba_accounts;
	_tmp15_ = tuba_account_store_get_active (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = tuba_instance_account_get_instance_emojis (_tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = _g_object_ref0 (_tmp18_);
	emojis = _tmp19_;
	_tmp21_ = emojis;
	if (_tmp21_ != NULL) {
		GeeArrayList* _tmp22_;
		gint _tmp23_;
		gint _tmp24_;
		_tmp22_ = emojis;
		_tmp23_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp22_);
		_tmp24_ = _tmp23_;
		_tmp20_ = _tmp24_ > 0;
	} else {
		_tmp20_ = FALSE;
	}
	if (_tmp20_) {
		Block122Data* _data122_;
		GeeArrayList* _tmp25_;
		TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp30_;
		_data122_ = g_slice_new0 (Block122Data);
		_data122_->_ref_count_ = 1;
		_data122_->self = g_object_ref (self);
		_data122_->at_least_one = FALSE;
		_tmp25_ = emojis;
		gee_abstract_collection_foreach ((GeeAbstractCollection*) _tmp25_, ____lambda82__gee_forall_func, _data122_);
		if (_data122_->at_least_one) {
			TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp26_;
			GtkScrolledWindow* _tmp27_;
			gboolean _tmp28_ = FALSE;
			_tmp26_ = self->priv->results;
			tuba_widgets_custom_emoji_chooser_emoji_category_set_label (_tmp26_, _ ("Results"));
			_tmp27_ = self->priv->custom_emojis_scrolled;
			g_signal_emit_by_name (_tmp27_, "scroll-child", GTK_SCROLL_START, FALSE, &_tmp28_);
		} else {
			TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp29_;
			_tmp29_ = self->priv->results;
			tuba_widgets_custom_emoji_chooser_emoji_category_set_label (_tmp29_, _ ("No Results"));
		}
		_tmp30_ = self->priv->results;
		gtk_widget_set_visible ((GtkWidget*) _tmp30_, TRUE);
		block122_data_unref (_data122_);
		_data122_ = NULL;
	}
	_g_object_unref0 (emojis);
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

void
tuba_widgets_custom_emoji_chooser_on_custom_emoji_picked (TubaWidgetsCustomEmojiChooser* self,
                                                          const gchar* shortcode)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (shortcode != NULL);
	tuba_widgets_custom_emoji_chooser_on_close (self);
	tuba_widgets_custom_emoji_chooser_update_recents (self, shortcode);
	_tmp0_ = string_to_string (shortcode);
	_tmp1_ = g_strconcat (":", _tmp0_, ": ", NULL);
	_tmp2_ = _tmp1_;
	g_signal_emit (self, tuba_widgets_custom_emoji_chooser_signals[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_PICKED_SIGNAL], 0, _tmp2_);
	_g_free0 (_tmp2_);
}

void
tuba_widgets_custom_emoji_chooser_on_close (TubaWidgetsCustomEmojiChooser* self)
{
	g_return_if_fail (self != NULL);
	gtk_popover_popdown ((GtkPopover*) self);
}

static gboolean
_tuba_widgets_custom_emoji_chooser_show_idle_gsource_func (gpointer self)
{
	gboolean result;
	result = tuba_widgets_custom_emoji_chooser_show_idle ((TubaWidgetsCustomEmojiChooser*) self);
	return result;
}

static void
tuba_widgets_custom_emoji_chooser_real_show (GtkWidget* base)
{
	TubaWidgetsCustomEmojiChooser * self;
	self = (TubaWidgetsCustomEmojiChooser*) base;
	GTK_WIDGET_CLASS (tuba_widgets_custom_emoji_chooser_parent_class)->show ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_popover_get_type (), GtkPopover));
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tuba_widgets_custom_emoji_chooser_show_idle_gsource_func, g_object_ref (self), g_object_unref);
}

static gboolean
tuba_widgets_custom_emoji_chooser_show_idle (TubaWidgetsCustomEmojiChooser* self)
{
	gboolean _tmp0_;
	GtkSearchEntry* _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	tuba_widgets_custom_emoji_chooser_populate_recents (self);
	_tmp0_ = self->priv->_is_populated;
	if (!_tmp0_) {
		tuba_widgets_custom_emoji_chooser_populate_chooser (self);
	}
	_tmp1_ = self->priv->entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp1_);
	result = G_SOURCE_REMOVE;
	return result;
}

static gint
_tuba_widgets_custom_emoji_chooser_sort_strings_gcompare_data_func (gconstpointer a,
                                                                    gconstpointer b,
                                                                    gpointer self)
{
	gint result;
	result = tuba_widgets_custom_emoji_chooser_sort_strings ((TubaWidgetsCustomEmojiChooser*) self, (const gchar*) a, (const gchar*) b);
	return result;
}

static void
_tuba_widgets_custom_emoji_chooser_on_custom_emoji_picked_tuba_widgets_custom_emoji_chooser_emoji_category_emoji_selected (TubaWidgetsCustomEmojiChooserEmojiCategory* _sender,
                                                                                                                           const gchar* shortcode,
                                                                                                                           gpointer self)
{
	tuba_widgets_custom_emoji_chooser_on_custom_emoji_picked ((TubaWidgetsCustomEmojiChooser*) self, shortcode);
}

void
tuba_widgets_custom_emoji_chooser_populate_chooser (TubaWidgetsCustomEmojiChooser* self)
{
	GeeHashMap* categorized_custom_emojis = NULL;
	GeeHashMap* _tmp0_;
	GeeArrayList* categories_keys = NULL;
	GeeHashMap* _tmp1_;
	GeeSet* _tmp2_;
	GeeSet* _tmp3_;
	GeeSet* _tmp4_;
	gint _tmp5_ = 0;
	gpointer* _tmp6_;
	GeeArrayList* _tmp7_;
	GeeArrayList* _tmp8_;
	GeeArrayList* _tmp9_;
	GeeHashMap* _tmp10_;
	GeeHashMap* _tmp44_;
	GeeArrayList* _tmp45_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tuba_widgets_custom_emoji_chooser_gen_emojis_cat_map (self);
	categorized_custom_emojis = _tmp0_;
	_tmp1_ = categorized_custom_emojis;
	_tmp2_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp6_ = gee_collection_to_array ((GeeCollection*) _tmp4_, &_tmp5_);
	_tmp7_ = gee_array_list_new_wrap (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp6_, _tmp5_, NULL, NULL, NULL);
	_tmp8_ = _tmp7_;
	_g_object_unref0 (_tmp4_);
	categories_keys = _tmp8_;
	_tmp9_ = categories_keys;
	gee_list_sort ((GeeList*) _tmp9_, _tuba_widgets_custom_emoji_chooser_sort_strings_gcompare_data_func, g_object_ref (self), g_object_unref);
	_tmp10_ = categorized_custom_emojis;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp10_, _ ("Other"))) {
		const gchar* _tmp11_ = NULL;
		GeeHashMap* _tmp12_;
		gint _tmp13_;
		gint _tmp14_;
		gchar* cat_name = NULL;
		gchar* _tmp15_;
		TubaWidgetsCustomEmojiChooserEmojiCategory* category = NULL;
		const gchar* _tmp16_;
		TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp17_;
		TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp18_;
		GeeHashMap* _tmp19_;
		gpointer _tmp20_;
		GeeArrayList* _tmp21_;
		TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp22_;
		GtkBox* _tmp23_;
		TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp24_;
		GeeArrayList* _tmp25_;
		_tmp12_ = categorized_custom_emojis;
		_tmp13_ = gee_abstract_map_get_size ((GeeAbstractMap*) _tmp12_);
		_tmp14_ = _tmp13_;
		if (_tmp14_ > 1) {
			_tmp11_ = _ ("Other");
		} else {
			_tmp11_ = _ ("Custom Emojis");
		}
		_tmp15_ = g_strdup (_tmp11_);
		cat_name = _tmp15_;
		_tmp16_ = cat_name;
		_tmp17_ = tuba_widgets_custom_emoji_chooser_emoji_category_new (_tmp16_);
		g_object_ref_sink (_tmp17_);
		category = _tmp17_;
		_tmp18_ = category;
		_tmp19_ = categorized_custom_emojis;
		_tmp20_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp19_, _ ("Other"));
		_tmp21_ = (GeeArrayList*) _tmp20_;
		tuba_widgets_custom_emoji_chooser_emoji_category_add_emojis (_tmp18_, _tmp21_);
		_g_object_unref0 (_tmp21_);
		_tmp22_ = category;
		g_signal_connect_object (_tmp22_, "emoji-selected", (GCallback) _tuba_widgets_custom_emoji_chooser_on_custom_emoji_picked_tuba_widgets_custom_emoji_chooser_emoji_category_emoji_selected, self, 0);
		_tmp23_ = self->priv->custom_emojis_box;
		_tmp24_ = category;
		gtk_box_append (_tmp23_, (GtkWidget*) _tmp24_);
		_tmp25_ = categories_keys;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp25_, _ ("Other"));
		_g_object_unref0 (category);
		_g_free0 (cat_name);
	}
	{
		GeeArrayList* _t_shortcode_list = NULL;
		GeeArrayList* _tmp26_;
		gint _t_shortcode_size = 0;
		GeeArrayList* _tmp27_;
		gint _tmp28_;
		gint _tmp29_;
		gint _t_shortcode_index = 0;
		_tmp26_ = categories_keys;
		_t_shortcode_list = _tmp26_;
		_tmp27_ = _t_shortcode_list;
		_tmp28_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp27_);
		_tmp29_ = _tmp28_;
		_t_shortcode_size = _tmp29_;
		_t_shortcode_index = -1;
		while (TRUE) {
			gint _tmp30_;
			gint _tmp31_;
			gchar* t_shortcode = NULL;
			GeeArrayList* _tmp32_;
			gpointer _tmp33_;
			TubaWidgetsCustomEmojiChooserEmojiCategory* category = NULL;
			const gchar* _tmp34_;
			TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp35_;
			TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp36_;
			GeeHashMap* _tmp37_;
			const gchar* _tmp38_;
			gpointer _tmp39_;
			GeeArrayList* _tmp40_;
			TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp41_;
			GtkBox* _tmp42_;
			TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp43_;
			_t_shortcode_index = _t_shortcode_index + 1;
			_tmp30_ = _t_shortcode_index;
			_tmp31_ = _t_shortcode_size;
			if (!(_tmp30_ < _tmp31_)) {
				break;
			}
			_tmp32_ = _t_shortcode_list;
			_tmp33_ = gee_abstract_list_get ((GeeAbstractList*) _tmp32_, _t_shortcode_index);
			t_shortcode = (gchar*) _tmp33_;
			_tmp34_ = t_shortcode;
			_tmp35_ = tuba_widgets_custom_emoji_chooser_emoji_category_new (_tmp34_);
			g_object_ref_sink (_tmp35_);
			category = _tmp35_;
			_tmp36_ = category;
			_tmp37_ = categorized_custom_emojis;
			_tmp38_ = t_shortcode;
			_tmp39_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp37_, _tmp38_);
			_tmp40_ = (GeeArrayList*) _tmp39_;
			tuba_widgets_custom_emoji_chooser_emoji_category_add_emojis (_tmp36_, _tmp40_);
			_g_object_unref0 (_tmp40_);
			_tmp41_ = category;
			g_signal_connect_object (_tmp41_, "emoji-selected", (GCallback) _tuba_widgets_custom_emoji_chooser_on_custom_emoji_picked_tuba_widgets_custom_emoji_chooser_emoji_category_emoji_selected, self, 0);
			_tmp42_ = self->priv->custom_emojis_box;
			_tmp43_ = category;
			gtk_box_append (_tmp42_, (GtkWidget*) _tmp43_);
			_g_object_unref0 (category);
			_g_free0 (t_shortcode);
		}
	}
	tuba_widgets_custom_emoji_chooser_set_is_populated (self, TRUE);
	_tmp44_ = categorized_custom_emojis;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp44_);
	_tmp45_ = categories_keys;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp45_);
	_g_object_unref0 (categories_keys);
	_g_object_unref0 (categorized_custom_emojis);
}

static gint
tuba_widgets_custom_emoji_chooser_sort_strings (TubaWidgetsCustomEmojiChooser* self,
                                                const gchar* a,
                                                const gchar* b)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (a != NULL, 0);
	g_return_val_if_fail (b != NULL, 0);
	result = g_utf8_collate (a, b);
	return result;
}

TubaWidgetsCustomEmojiChooser*
tuba_widgets_custom_emoji_chooser_construct (GType object_type)
{
	TubaWidgetsCustomEmojiChooser * self = NULL;
	self = (TubaWidgetsCustomEmojiChooser*) g_object_new (object_type, NULL);
	return self;
}

TubaWidgetsCustomEmojiChooser*
tuba_widgets_custom_emoji_chooser_new (void)
{
	return tuba_widgets_custom_emoji_chooser_construct (TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER);
}

const gchar*
tuba_widgets_custom_emoji_chooser_get_query (TubaWidgetsCustomEmojiChooser* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_query;
	result = _tmp0_;
	return result;
}

void
tuba_widgets_custom_emoji_chooser_set_query (TubaWidgetsCustomEmojiChooser* self,
                                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_custom_emoji_chooser_get_query (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_query);
		self->priv->_query = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_custom_emoji_chooser_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_QUERY_PROPERTY]);
	}
}

gboolean
tuba_widgets_custom_emoji_chooser_get_is_populated (TubaWidgetsCustomEmojiChooser* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_populated;
	return result;
}

void
tuba_widgets_custom_emoji_chooser_set_is_populated (TubaWidgetsCustomEmojiChooser* self,
                                                    gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_custom_emoji_chooser_get_is_populated (self);
	if (old_value != value) {
		self->priv->_is_populated = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_custom_emoji_chooser_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_IS_POPULATED_PROPERTY]);
	}
}

static inline gpointer
tuba_widgets_custom_emoji_chooser_emoji_category_get_instance_private (TubaWidgetsCustomEmojiChooserEmojiCategory* self)
{
	return G_STRUCT_MEMBER_P (self, TubaWidgetsCustomEmojiChooserEmojiCategory_private_offset);
}

static TubaWidgetsCustomEmojiChooserEmojiCategory*
tuba_widgets_custom_emoji_chooser_emoji_category_construct (GType object_type,
                                                            const gchar* title)
{
	TubaWidgetsCustomEmojiChooserEmojiCategory * self = NULL;
	GtkLabel* _tmp0_;
	g_return_val_if_fail (title != NULL, NULL);
	self = (TubaWidgetsCustomEmojiChooserEmojiCategory*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->title_label;
	gtk_label_set_label (_tmp0_, title);
	return self;
}

static TubaWidgetsCustomEmojiChooserEmojiCategory*
tuba_widgets_custom_emoji_chooser_emoji_category_new (const gchar* title)
{
	return tuba_widgets_custom_emoji_chooser_emoji_category_construct (TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_TYPE_EMOJI_CATEGORY, title);
}

static gboolean
_tuba_widgets_custom_emoji_chooser_emoji_category_add_emoji_gee_forall_func (gpointer g,
                                                                             gpointer self)
{
	gboolean result;
	result = tuba_widgets_custom_emoji_chooser_emoji_category_add_emoji ((TubaWidgetsCustomEmojiChooserEmojiCategory*) self, (TubaAPIEmoji*) g);
	return result;
}

static void
tuba_widgets_custom_emoji_chooser_emoji_category_add_emojis (TubaWidgetsCustomEmojiChooserEmojiCategory* self,
                                                             GeeArrayList* emojis)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (emojis != NULL);
	gee_abstract_collection_foreach ((GeeAbstractCollection*) emojis, _tuba_widgets_custom_emoji_chooser_emoji_category_add_emoji_gee_forall_func, self);
}

static void
_tuba_widgets_custom_emoji_chooser_emoji_category_on_custom_emoji_picked_tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_emoji_selected (TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton* _sender,
                                                                                                                                                       const gchar* shortcode,
                                                                                                                                                       gpointer self)
{
	tuba_widgets_custom_emoji_chooser_emoji_category_on_custom_emoji_picked ((TubaWidgetsCustomEmojiChooserEmojiCategory*) self, shortcode);
}

static gboolean
tuba_widgets_custom_emoji_chooser_emoji_category_add_emoji (TubaWidgetsCustomEmojiChooserEmojiCategory* self,
                                                            TubaAPIEmoji* emoji)
{
	TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton* emoji_btn = NULL;
	TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton* _tmp0_;
	GtkFlowBox* _tmp1_;
	GtkWidget* _tmp2_;
	GtkFlowBoxChild* _tmp3_ = NULL;
	GtkFlowBoxChild* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (emoji != NULL, FALSE);
	_tmp0_ = tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_new (emoji);
	g_object_ref_sink (_tmp0_);
	emoji_btn = _tmp0_;
	g_signal_connect_object (emoji_btn, "emoji-selected", (GCallback) _tuba_widgets_custom_emoji_chooser_emoji_category_on_custom_emoji_picked_tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_emoji_selected, self, 0);
	_tmp1_ = self->priv->emoji_box;
	_tmp2_ = _g_object_ref0 ((GtkWidget*) emoji_btn);
	_tmp3_ = (GtkFlowBoxChild*) gtk_flow_box_child_new ();
	gtk_flow_box_child_set_child (_tmp3_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	gtk_widget_set_focusable ((GtkWidget*) _tmp3_, FALSE);
	g_object_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	gtk_flow_box_append (_tmp1_, (GtkWidget*) _tmp4_);
	_g_object_unref0 (_tmp4_);
	result = TRUE;
	_g_object_unref0 (emoji_btn);
	_g_object_unref0 (emoji);
	return result;
}

static void
tuba_widgets_custom_emoji_chooser_emoji_category_remove_all (TubaWidgetsCustomEmojiChooserEmojiCategory* self)
{
	GtkFlowBox* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->emoji_box;
	gtk_flow_box_remove_all (_tmp0_);
}

static void
tuba_widgets_custom_emoji_chooser_emoji_category_on_custom_emoji_picked (TubaWidgetsCustomEmojiChooserEmojiCategory* self,
                                                                         const gchar* shortcode)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (shortcode != NULL);
	g_signal_emit (self, tuba_widgets_custom_emoji_chooser_emoji_category_signals[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_SELECTED_SIGNAL], 0, shortcode);
}

static const gchar*
tuba_widgets_custom_emoji_chooser_emoji_category_get_label (TubaWidgetsCustomEmojiChooserEmojiCategory* self)
{
	const gchar* result;
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->title_label;
	_tmp1_ = gtk_label_get_label (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static void
tuba_widgets_custom_emoji_chooser_emoji_category_set_label (TubaWidgetsCustomEmojiChooserEmojiCategory* self,
                                                            const gchar* value)
{
	GtkLabel* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->title_label;
	gtk_label_set_label (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_custom_emoji_chooser_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_LABEL_PROPERTY]);
}

static inline gpointer
tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_get_instance_private (TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton* self)
{
	return G_STRUCT_MEMBER_P (self, TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton_private_offset);
}

static void
_tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_on_custom_emoji_picked_gtk_button_clicked (GtkButton* _sender,
                                                                                                          gpointer self)
{
	tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_on_custom_emoji_picked ((TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton*) self);
}

static TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton*
tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_construct (GType object_type,
                                                                         TubaAPIEmoji* emoji)
{
	TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton * self = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	TubaWidgetsEmoji* _tmp7_ = NULL;
	TubaWidgetsEmoji* _tmp8_;
	g_return_val_if_fail (emoji != NULL, NULL);
	self = (TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton*) g_object_new (object_type, NULL);
	_tmp0_ = tuba_api_emoji_get_shortcode (emoji);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (self->priv->shortcode);
	self->priv->shortcode = _tmp2_;
	_tmp3_ = tuba_api_emoji_get_url (emoji);
	_tmp4_ = _tmp3_;
	_tmp5_ = tuba_api_emoji_get_shortcode (emoji);
	_tmp6_ = _tmp5_;
	_tmp7_ = tuba_widgets_emoji_new (_tmp4_, _tmp6_);
	tuba_widgets_emoji_set_icon_size (_tmp7_, GTK_ICON_SIZE_LARGE);
	g_object_ref_sink (_tmp7_);
	_tmp8_ = _tmp7_;
	gtk_button_set_child ((GtkButton*) self, (GtkWidget*) _tmp8_);
	_g_object_unref0 (_tmp8_);
	g_signal_connect_object ((GtkButton*) self, "clicked", (GCallback) _tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_on_custom_emoji_picked_gtk_button_clicked, self, 0);
	return self;
}

static TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton*
tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_new (TubaAPIEmoji* emoji)
{
	return tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_construct (TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_TYPE_EMOJI_BUTTON, emoji);
}

static void
tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_on_custom_emoji_picked (TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton* self)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->shortcode;
	g_signal_emit (self, tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_signals[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_BUTTON_EMOJI_SELECTED_SIGNAL], 0, _tmp0_);
}

static GObject *
tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_constructor (GType type,
                                                                           guint n_construct_properties,
                                                                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	parent_class = G_OBJECT_CLASS (tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_TYPE_EMOJI_BUTTON, TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton);
	_tmp0_ = g_strdup ("flat");
	_tmp1_ = g_strdup ("picker-emoji-button");
	_tmp2_ = g_new0 (gchar*, 2 + 1);
	_tmp2_[0] = _tmp0_;
	_tmp2_[1] = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp3__length1 = 2;
	gtk_widget_set_css_classes ((GtkWidget*) self, _tmp3_);
	_tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL);
	return obj;
}

static void
tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_class_init (TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButtonClass * klass,
                                                                          gpointer klass_data)
{
	tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton_private_offset);
	G_OBJECT_CLASS (klass)->constructor = tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_constructor;
	G_OBJECT_CLASS (klass)->finalize = tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_finalize;
	tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_signals[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_BUTTON_EMOJI_SELECTED_SIGNAL] = g_signal_new ("emoji-selected", TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_TYPE_EMOJI_BUTTON, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_instance_init (TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton * self,
                                                                             gpointer klass)
{
	self->priv = tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_get_instance_private (self);
}

static void
tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_finalize (GObject * obj)
{
	TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_TYPE_EMOJI_BUTTON, TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton);
	_g_free0 (self->priv->shortcode);
	G_OBJECT_CLASS (tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton), 0, (GInstanceInitFunc) tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_instance_init, NULL };
	GType tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_type_id;
	tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_type_id = g_type_register_static (gtk_button_get_type (), "TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton", &g_define_type_info, 0);
	TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButton_private_offset = g_type_add_instance_private (tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_type_id, sizeof (TubaWidgetsCustomEmojiChooserEmojiCategoryEmojiButtonPrivate));
	return tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_type_id;
}

static GType
tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_get_type (void)
{
	static gsize tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_type_id__once = 0;
	if (g_once_init_enter (&tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_type_id__once)) {
		GType tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_type_id;
		tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_type_id = tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_get_type_once ();
		g_once_init_leave (&tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_type_id__once, tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_type_id);
	}
	return tuba_widgets_custom_emoji_chooser_emoji_category_emoji_button_type_id__once;
}

static GObject *
tuba_widgets_custom_emoji_chooser_emoji_category_constructor (GType type,
                                                              guint n_construct_properties,
                                                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaWidgetsCustomEmojiChooserEmojiCategory * self;
	GtkLabel* _tmp0_ = NULL;
	GtkFlowBox* _tmp1_ = NULL;
	GtkLabel* _tmp2_;
	GtkFlowBox* _tmp3_;
	parent_class = G_OBJECT_CLASS (tuba_widgets_custom_emoji_chooser_emoji_category_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserEmojiCategory);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	gtk_box_set_spacing ((GtkBox*) self, 6);
	_tmp0_ = (GtkLabel*) gtk_label_new ("");
	gtk_label_set_wrap (_tmp0_, TRUE);
	gtk_label_set_wrap_mode (_tmp0_, PANGO_WRAP_WORD_CHAR);
	gtk_widget_set_halign ((GtkWidget*) _tmp0_, GTK_ALIGN_START);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp0_, 3);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->title_label);
	self->priv->title_label = _tmp0_;
	_tmp1_ = (GtkFlowBox*) gtk_flow_box_new ();
	gtk_flow_box_set_homogeneous (_tmp1_, TRUE);
	gtk_flow_box_set_column_spacing (_tmp1_, (guint) 6);
	gtk_flow_box_set_row_spacing (_tmp1_, (guint) 6);
	gtk_flow_box_set_max_children_per_line (_tmp1_, (guint) 6);
	gtk_flow_box_set_min_children_per_line (_tmp1_, (guint) 6);
	gtk_flow_box_set_selection_mode (_tmp1_, GTK_SELECTION_NONE);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->emoji_box);
	self->priv->emoji_box = _tmp1_;
	_tmp2_ = self->priv->title_label;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp2_);
	_tmp3_ = self->priv->emoji_box;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp3_);
	return obj;
}

static void
tuba_widgets_custom_emoji_chooser_emoji_category_class_init (TubaWidgetsCustomEmojiChooserEmojiCategoryClass * klass,
                                                             gpointer klass_data)
{
	tuba_widgets_custom_emoji_chooser_emoji_category_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaWidgetsCustomEmojiChooserEmojiCategory_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_widgets_custom_emoji_chooser_emoji_category_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_widgets_custom_emoji_chooser_emoji_category_set_property;
	G_OBJECT_CLASS (klass)->constructor = tuba_widgets_custom_emoji_chooser_emoji_category_constructor;
	G_OBJECT_CLASS (klass)->finalize = tuba_widgets_custom_emoji_chooser_emoji_category_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_LABEL_PROPERTY, tuba_widgets_custom_emoji_chooser_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_LABEL_PROPERTY] = g_param_spec_string ("label", "label", "label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	tuba_widgets_custom_emoji_chooser_emoji_category_signals[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_EMOJI_SELECTED_SIGNAL] = g_signal_new ("emoji-selected", TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_TYPE_EMOJI_CATEGORY, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
tuba_widgets_custom_emoji_chooser_emoji_category_instance_init (TubaWidgetsCustomEmojiChooserEmojiCategory * self,
                                                                gpointer klass)
{
	self->priv = tuba_widgets_custom_emoji_chooser_emoji_category_get_instance_private (self);
}

static void
tuba_widgets_custom_emoji_chooser_emoji_category_finalize (GObject * obj)
{
	TubaWidgetsCustomEmojiChooserEmojiCategory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserEmojiCategory);
	_g_object_unref0 (self->priv->title_label);
	_g_object_unref0 (self->priv->emoji_box);
	G_OBJECT_CLASS (tuba_widgets_custom_emoji_chooser_emoji_category_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_widgets_custom_emoji_chooser_emoji_category_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaWidgetsCustomEmojiChooserEmojiCategoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_widgets_custom_emoji_chooser_emoji_category_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaWidgetsCustomEmojiChooserEmojiCategory), 0, (GInstanceInitFunc) tuba_widgets_custom_emoji_chooser_emoji_category_instance_init, NULL };
	GType tuba_widgets_custom_emoji_chooser_emoji_category_type_id;
	tuba_widgets_custom_emoji_chooser_emoji_category_type_id = g_type_register_static (gtk_box_get_type (), "TubaWidgetsCustomEmojiChooserEmojiCategory", &g_define_type_info, 0);
	TubaWidgetsCustomEmojiChooserEmojiCategory_private_offset = g_type_add_instance_private (tuba_widgets_custom_emoji_chooser_emoji_category_type_id, sizeof (TubaWidgetsCustomEmojiChooserEmojiCategoryPrivate));
	return tuba_widgets_custom_emoji_chooser_emoji_category_type_id;
}

static GType
tuba_widgets_custom_emoji_chooser_emoji_category_get_type (void)
{
	static gsize tuba_widgets_custom_emoji_chooser_emoji_category_type_id__once = 0;
	if (g_once_init_enter (&tuba_widgets_custom_emoji_chooser_emoji_category_type_id__once)) {
		GType tuba_widgets_custom_emoji_chooser_emoji_category_type_id;
		tuba_widgets_custom_emoji_chooser_emoji_category_type_id = tuba_widgets_custom_emoji_chooser_emoji_category_get_type_once ();
		g_once_init_leave (&tuba_widgets_custom_emoji_chooser_emoji_category_type_id__once, tuba_widgets_custom_emoji_chooser_emoji_category_type_id);
	}
	return tuba_widgets_custom_emoji_chooser_emoji_category_type_id__once;
}

static void
_vala_tuba_widgets_custom_emoji_chooser_emoji_category_get_property (GObject * object,
                                                                     guint property_id,
                                                                     GValue * value,
                                                                     GParamSpec * pspec)
{
	TubaWidgetsCustomEmojiChooserEmojiCategory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserEmojiCategory);
	switch (property_id) {
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_LABEL_PROPERTY:
		g_value_set_string (value, tuba_widgets_custom_emoji_chooser_emoji_category_get_label (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_widgets_custom_emoji_chooser_emoji_category_set_property (GObject * object,
                                                                     guint property_id,
                                                                     const GValue * value,
                                                                     GParamSpec * pspec)
{
	TubaWidgetsCustomEmojiChooserEmojiCategory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserEmojiCategory);
	switch (property_id) {
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_CATEGORY_LABEL_PROPERTY:
		tuba_widgets_custom_emoji_chooser_emoji_category_set_label (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_tuba_widgets_custom_emoji_chooser_search_gtk_search_entry_activate (GtkSearchEntry* _sender,
                                                                     gpointer self)
{
	tuba_widgets_custom_emoji_chooser_search ((TubaWidgetsCustomEmojiChooser*) self);
}

static void
_tuba_widgets_custom_emoji_chooser_search_gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                                           gpointer self)
{
	tuba_widgets_custom_emoji_chooser_search ((TubaWidgetsCustomEmojiChooser*) self);
}

static void
_tuba_widgets_custom_emoji_chooser_on_close_gtk_search_entry_stop_search (GtkSearchEntry* _sender,
                                                                          gpointer self)
{
	tuba_widgets_custom_emoji_chooser_on_close ((TubaWidgetsCustomEmojiChooser*) self);
}

static GObject *
tuba_widgets_custom_emoji_chooser_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaWidgetsCustomEmojiChooser * self;
	GtkBox* _tmp0_ = NULL;
	GtkScrolledWindow* _tmp1_ = NULL;
	GtkBox* content_box = NULL;
	GtkBox* _tmp2_;
	GtkBox* _tmp3_;
	GtkScrolledWindow* _tmp4_;
	GtkBox* _tmp5_;
	GtkScrolledWindow* _tmp6_;
	GtkBox* _tmp7_;
	TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp8_ = NULL;
	TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp9_;
	GtkBox* _tmp10_;
	TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp11_;
	TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp12_ = NULL;
	TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp13_;
	GtkBox* _tmp14_;
	TubaWidgetsCustomEmojiChooserEmojiCategory* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	GtkSearchEntry* _tmp18_ = NULL;
	AdwBin* entry_bin = NULL;
	gchar* _tmp19_;
	gchar** _tmp20_;
	GtkSearchEntry* _tmp21_;
	GtkWidget* _tmp22_;
	AdwBin* _tmp23_ = NULL;
	GtkBox* _tmp24_;
	AdwBin* _tmp25_;
	GtkSearchEntry* _tmp26_;
	GtkSearchEntry* _tmp27_;
	GtkSearchEntry* _tmp28_;
	parent_class = G_OBJECT_CLASS (tuba_widgets_custom_emoji_chooser_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER, TubaWidgetsCustomEmojiChooser);
	gtk_widget_add_css_class ((GtkWidget*) self, "emoji-picker");
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp0_, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp0_, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp0_, 6);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->custom_emojis_box);
	self->priv->custom_emojis_box = _tmp0_;
	_tmp1_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_set (_tmp1_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	g_object_set ((GtkWidget*) _tmp1_, "height-request", 360, NULL);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->custom_emojis_scrolled);
	self->priv->custom_emojis_scrolled = _tmp1_;
	_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp2_);
	content_box = _tmp2_;
	_tmp3_ = content_box;
	_tmp4_ = self->priv->custom_emojis_scrolled;
	gtk_box_append (_tmp3_, (GtkWidget*) _tmp4_);
	_tmp5_ = content_box;
	gtk_popover_set_child ((GtkPopover*) self, (GtkWidget*) _tmp5_);
	_tmp6_ = self->priv->custom_emojis_scrolled;
	_tmp7_ = self->priv->custom_emojis_box;
	gtk_scrolled_window_set_child (_tmp6_, (GtkWidget*) _tmp7_);
	_tmp8_ = tuba_widgets_custom_emoji_chooser_emoji_category_new (_ ("Results"));
	gtk_widget_set_visible ((GtkWidget*) _tmp8_, FALSE);
	g_object_ref_sink (_tmp8_);
	_g_object_unref0 (self->priv->results);
	self->priv->results = _tmp8_;
	_tmp9_ = self->priv->results;
	g_signal_connect_object (_tmp9_, "emoji-selected", (GCallback) _tuba_widgets_custom_emoji_chooser_on_custom_emoji_picked_tuba_widgets_custom_emoji_chooser_emoji_category_emoji_selected, self, 0);
	_tmp10_ = self->priv->custom_emojis_box;
	_tmp11_ = self->priv->results;
	gtk_box_append (_tmp10_, (GtkWidget*) _tmp11_);
	_tmp12_ = tuba_widgets_custom_emoji_chooser_emoji_category_new (_ ("Recently Used"));
	gtk_widget_set_visible ((GtkWidget*) _tmp12_, FALSE);
	g_object_ref_sink (_tmp12_);
	_g_object_unref0 (self->priv->recents);
	self->priv->recents = _tmp12_;
	_tmp13_ = self->priv->recents;
	g_signal_connect_object (_tmp13_, "emoji-selected", (GCallback) _tuba_widgets_custom_emoji_chooser_on_custom_emoji_picked_tuba_widgets_custom_emoji_chooser_emoji_category_emoji_selected, self, 0);
	_tmp14_ = self->priv->custom_emojis_box;
	_tmp15_ = self->priv->recents;
	gtk_box_append (_tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = self->priv->_query;
	_tmp17_ = g_strdup (_tmp16_);
	_tmp18_ = (GtkSearchEntry*) gtk_search_entry_new ();
	gtk_editable_set_text ((GtkEditable*) _tmp18_, _tmp17_);
	_g_free0 (_tmp17_);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp18_, TRUE);
	g_object_ref_sink (_tmp18_);
	_g_object_unref0 (self->priv->entry);
	self->priv->entry = _tmp18_;
	_tmp19_ = g_strdup ("emoji-searchbar");
	_tmp20_ = g_new0 (gchar*, 1 + 1);
	_tmp20_[0] = _tmp19_;
	_tmp21_ = self->priv->entry;
	_tmp22_ = _g_object_ref0 ((GtkWidget*) _tmp21_);
	_tmp23_ = (AdwBin*) adw_bin_new ();
	gtk_widget_set_css_classes ((GtkWidget*) _tmp23_, _tmp20_);
	_tmp20_ = (_vala_array_free (_tmp20_, 1, (GDestroyNotify) g_free), NULL);
	adw_bin_set_child (_tmp23_, _tmp22_);
	_g_object_unref0 (_tmp22_);
	g_object_ref_sink (_tmp23_);
	entry_bin = _tmp23_;
	_tmp24_ = content_box;
	_tmp25_ = entry_bin;
	gtk_box_prepend (_tmp24_, (GtkWidget*) _tmp25_);
	_tmp26_ = self->priv->entry;
	g_signal_connect_object (_tmp26_, "activate", (GCallback) _tuba_widgets_custom_emoji_chooser_search_gtk_search_entry_activate, self, 0);
	_tmp27_ = self->priv->entry;
	g_signal_connect_object (_tmp27_, "search-changed", (GCallback) _tuba_widgets_custom_emoji_chooser_search_gtk_search_entry_search_changed, self, 0);
	_tmp28_ = self->priv->entry;
	g_signal_connect_object (_tmp28_, "stop-search", (GCallback) _tuba_widgets_custom_emoji_chooser_on_close_gtk_search_entry_stop_search, self, 0);
	_g_object_unref0 (entry_bin);
	_g_object_unref0 (content_box);
	return obj;
}

static void
tuba_widgets_custom_emoji_chooser_class_init (TubaWidgetsCustomEmojiChooserClass * klass,
                                              gpointer klass_data)
{
	tuba_widgets_custom_emoji_chooser_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaWidgetsCustomEmojiChooser_private_offset);
	((GtkWidgetClass *) klass)->show = (void (*) (GtkWidget*)) tuba_widgets_custom_emoji_chooser_real_show;
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_widgets_custom_emoji_chooser_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_widgets_custom_emoji_chooser_set_property;
	G_OBJECT_CLASS (klass)->constructor = tuba_widgets_custom_emoji_chooser_constructor;
	G_OBJECT_CLASS (klass)->finalize = tuba_widgets_custom_emoji_chooser_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_QUERY_PROPERTY, tuba_widgets_custom_emoji_chooser_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_QUERY_PROPERTY] = g_param_spec_string ("query", "query", "query", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_IS_POPULATED_PROPERTY, tuba_widgets_custom_emoji_chooser_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_IS_POPULATED_PROPERTY] = g_param_spec_boolean ("is-populated", "is-populated", "is-populated", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	tuba_widgets_custom_emoji_chooser_signals[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_EMOJI_PICKED_SIGNAL] = g_signal_new ("emoji-picked", TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
tuba_widgets_custom_emoji_chooser_instance_init (TubaWidgetsCustomEmojiChooser * self,
                                                 gpointer klass)
{
	gchar* _tmp0_;
	self->priv = tuba_widgets_custom_emoji_chooser_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->_query = _tmp0_;
	self->priv->_is_populated = FALSE;
}

static void
tuba_widgets_custom_emoji_chooser_finalize (GObject * obj)
{
	TubaWidgetsCustomEmojiChooser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER, TubaWidgetsCustomEmojiChooser);
	g_debug ("CustomEmojiChooser.vala:41: Destroying CustomEmojiChooser");
	_g_free0 (self->priv->_query);
	_g_object_unref0 (self->priv->custom_emojis_box);
	_g_object_unref0 (self->priv->entry);
	_g_object_unref0 (self->priv->custom_emojis_scrolled);
	_g_object_unref0 (self->priv->recents);
	_g_object_unref0 (self->priv->results);
	G_OBJECT_CLASS (tuba_widgets_custom_emoji_chooser_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_widgets_custom_emoji_chooser_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaWidgetsCustomEmojiChooserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_widgets_custom_emoji_chooser_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaWidgetsCustomEmojiChooser), 0, (GInstanceInitFunc) tuba_widgets_custom_emoji_chooser_instance_init, NULL };
	GType tuba_widgets_custom_emoji_chooser_type_id;
	tuba_widgets_custom_emoji_chooser_type_id = g_type_register_static (gtk_popover_get_type (), "TubaWidgetsCustomEmojiChooser", &g_define_type_info, 0);
	TubaWidgetsCustomEmojiChooser_private_offset = g_type_add_instance_private (tuba_widgets_custom_emoji_chooser_type_id, sizeof (TubaWidgetsCustomEmojiChooserPrivate));
	return tuba_widgets_custom_emoji_chooser_type_id;
}

GType
tuba_widgets_custom_emoji_chooser_get_type (void)
{
	static gsize tuba_widgets_custom_emoji_chooser_type_id__once = 0;
	if (g_once_init_enter (&tuba_widgets_custom_emoji_chooser_type_id__once)) {
		GType tuba_widgets_custom_emoji_chooser_type_id;
		tuba_widgets_custom_emoji_chooser_type_id = tuba_widgets_custom_emoji_chooser_get_type_once ();
		g_once_init_leave (&tuba_widgets_custom_emoji_chooser_type_id__once, tuba_widgets_custom_emoji_chooser_type_id);
	}
	return tuba_widgets_custom_emoji_chooser_type_id__once;
}

static void
_vala_tuba_widgets_custom_emoji_chooser_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec)
{
	TubaWidgetsCustomEmojiChooser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER, TubaWidgetsCustomEmojiChooser);
	switch (property_id) {
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_QUERY_PROPERTY:
		g_value_set_string (value, tuba_widgets_custom_emoji_chooser_get_query (self));
		break;
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_IS_POPULATED_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_custom_emoji_chooser_get_is_populated (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_widgets_custom_emoji_chooser_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec)
{
	TubaWidgetsCustomEmojiChooser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER, TubaWidgetsCustomEmojiChooser);
	switch (property_id) {
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_QUERY_PROPERTY:
		tuba_widgets_custom_emoji_chooser_set_query (self, g_value_get_string (value));
		break;
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_IS_POPULATED_PROPERTY:
		tuba_widgets_custom_emoji_chooser_set_is_populated (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

