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

/*
* Copyright (c) 2018-2026 (https://github.com/phase1geo/Minder)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authored by: Trevor Williams <phase1geo@gmail.com>
*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <pango/pango.h>
#include <gdk/gdk.h>
#include <granite-7.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <float.h>
#include <math.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <glib/gstdio.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 TYPE_STICKER_INSPECTOR (sticker_inspector_get_type ())
#define STICKER_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_STICKER_INSPECTOR, StickerInspector))
#define STICKER_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_STICKER_INSPECTOR, StickerInspectorClass))
#define IS_STICKER_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_STICKER_INSPECTOR))
#define IS_STICKER_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_STICKER_INSPECTOR))
#define STICKER_INSPECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_STICKER_INSPECTOR, StickerInspectorClass))

typedef struct _StickerInspector StickerInspector;
typedef struct _StickerInspectorClass StickerInspectorClass;
typedef struct _StickerInspectorPrivate StickerInspectorPrivate;

#define TYPE_MAIN_WINDOW (main_window_get_type ())
#define MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW, MainWindow))
#define MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW, MainWindowClass))
#define IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW))
#define IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW))
#define MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW, MainWindowClass))

typedef struct _MainWindow MainWindow;
typedef struct _MainWindowClass MainWindowClass;

#define TYPE_STICKER_SET (sticker_set_get_type ())
#define STICKER_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_STICKER_SET, StickerSet))
#define STICKER_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_STICKER_SET, StickerSetClass))
#define IS_STICKER_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_STICKER_SET))
#define IS_STICKER_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_STICKER_SET))
#define STICKER_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_STICKER_SET, StickerSetClass))

typedef struct _StickerSet StickerSet;
typedef struct _StickerSetClass StickerSetClass;
enum  {
	STICKER_INSPECTOR_0_PROPERTY,
	STICKER_INSPECTOR_NUM_PROPERTIES
};
static GParamSpec* sticker_inspector_properties[STICKER_INSPECTOR_NUM_PROPERTIES];
typedef void (*GSimpleActionActivateCallback) (GSimpleAction* action, GVariant* parameter, gpointer user_data);
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _sticker_set_unref0(var) ((var == NULL) ? NULL : (var = (sticker_set_unref (var), NULL)))

#define TYPE_MIND_MAP (mind_map_get_type ())
#define MIND_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MIND_MAP, MindMap))
#define MIND_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MIND_MAP, MindMapClass))
#define IS_MIND_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MIND_MAP))
#define IS_MIND_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MIND_MAP))
#define MIND_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MIND_MAP, MindMapClass))

typedef struct _MindMap MindMap;
typedef struct _MindMapClass MindMapClass;
#define _mind_map_unref0(var) ((var == NULL) ? NULL : (var = (mind_map_unref (var), NULL)))

#define STICKER_SET_TYPE_STICKER_INFO (sticker_set_sticker_info_get_type ())
#define STICKER_SET_STICKER_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STICKER_SET_TYPE_STICKER_INFO, StickerSetStickerInfo))
#define STICKER_SET_STICKER_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STICKER_SET_TYPE_STICKER_INFO, StickerSetStickerInfoClass))
#define STICKER_SET_IS_STICKER_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STICKER_SET_TYPE_STICKER_INFO))
#define STICKER_SET_IS_STICKER_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STICKER_SET_TYPE_STICKER_INFO))
#define STICKER_SET_STICKER_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STICKER_SET_TYPE_STICKER_INFO, StickerSetStickerInfoClass))

typedef struct _StickerSetStickerInfo StickerSetStickerInfo;
typedef struct _StickerSetStickerInfoClass StickerSetStickerInfoClass;
#define _g_array_unref0(var) ((var == NULL) ? NULL : (var = (g_array_unref (var), NULL)))
typedef struct _Block61Data Block61Data;
typedef struct _Block62Data Block62Data;
#define _xmlFreeDoc0(var) ((var == NULL) ? NULL : (var = (xmlFreeDoc (var), NULL)))
typedef struct _Block63Data Block63Data;
typedef struct _Block64Data Block64Data;

struct _StickerInspector {
	GtkBox parent_instance;
	StickerInspectorPrivate * priv;
};

struct _StickerInspectorClass {
	GtkBoxClass parent_class;
};

struct _StickerInspectorPrivate {
	gchar* favorites;
	MainWindow* _win;
	GSettings* _settings;
	GtkSearchEntry* _search;
	GtkStack* _stack;
	GtkFlowBox* _favorites;
	GtkFlowBox* _matched_box;
	GtkPicture* _dragged_sticker;
	GMenu* _favorite_menu;
	GMenu* _builtin_menu;
	GMenu* _custom_menu;
	GtkFlowBox* _clicked_category;
	StickerSet* _sticker_set;
	gchar* _clicked_sticker;
	GSimpleActionGroup* _actions;
};

struct _Block61Data {
	int _ref_count_;
	StickerInspector* self;
	GtkFlowBox* fbox;
	GtkDragSource* drag;
	gchar* category;
};

struct _Block62Data {
	int _ref_count_;
	StickerInspector* self;
	GtkPopoverMenu* popover;
};

struct _Block63Data {
	int _ref_count_;
	StickerInspector* self;
	gchar* search_text;
};

struct _Block64Data {
	int _ref_count_;
	StickerInspector* self;
	GtkFileDialog* dialog;
	GtkFlowBox* fbox;
	gchar* category;
};

static gint StickerInspector_private_offset;
static gpointer sticker_inspector_parent_class = NULL;

VALA_EXTERN GType sticker_inspector_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (StickerInspector, g_object_unref)
VALA_EXTERN GType main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindow, g_object_unref)
VALA_EXTERN gpointer sticker_set_ref (gpointer instance);
VALA_EXTERN void sticker_set_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_sticker_set (const gchar* name,
                                    const gchar* nick,
                                    const gchar* blurb,
                                    GType object_type,
                                    GParamFlags flags);
VALA_EXTERN void value_set_sticker_set (GValue* value,
                            gpointer v_object);
VALA_EXTERN void value_take_sticker_set (GValue* value,
                             gpointer v_object);
VALA_EXTERN gpointer value_get_sticker_set (const GValue* value);
VALA_EXTERN GType sticker_set_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (StickerSet, sticker_set_unref)
static void sticker_inspector_action_make_builtin_favorite (StickerInspector* self);
static void _sticker_inspector_action_make_builtin_favorite_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                       GVariant* parameter,
                                                                                       gpointer self);
static void sticker_inspector_action_make_custom_favorite (StickerInspector* self);
static void _sticker_inspector_action_make_custom_favorite_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                      GVariant* parameter,
                                                                                      gpointer self);
static void sticker_inspector_action_make_unfavorite (StickerInspector* self);
static void _sticker_inspector_action_make_unfavorite_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                 GVariant* parameter,
                                                                                 gpointer self);
static void sticker_inspector_action_remove (StickerInspector* self);
static void _sticker_inspector_action_remove_gsimple_action_activate_callback (GSimpleAction* action,
                                                                        GVariant* parameter,
                                                                        gpointer self);
VALA_EXTERN StickerInspector* sticker_inspector_new (MainWindow* win,
                                         GSettings* settings);
VALA_EXTERN StickerInspector* sticker_inspector_construct (GType object_type,
                                               MainWindow* win,
                                               GSettings* settings);
static void sticker_inspector_do_search (StickerInspector* self);
static void _sticker_inspector_do_search_gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                                   gpointer self);
static gboolean __lambda148_ (StickerInspector* self,
                       guint keyval,
                       guint keycode,
                       GdkModifierType state);
VALA_EXTERN gpointer mind_map_ref (gpointer instance);
VALA_EXTERN void mind_map_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_mind_map (const gchar* name,
                                 const gchar* nick,
                                 const gchar* blurb,
                                 GType object_type,
                                 GParamFlags flags);
VALA_EXTERN void value_set_mind_map (GValue* value,
                         gpointer v_object);
VALA_EXTERN void value_take_mind_map (GValue* value,
                          gpointer v_object);
VALA_EXTERN gpointer value_get_mind_map (const GValue* value);
VALA_EXTERN GType mind_map_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MindMap, mind_map_unref)
VALA_EXTERN MindMap* main_window_get_current_map (MainWindow* self,
                                      const gchar* caller);
static gboolean ___lambda148__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                             guint keyval,
                                                             guint keycode,
                                                             GdkModifierType state,
                                                             gpointer self);
static GtkFlowBox* sticker_inspector_create_icon_box (StickerInspector* self,
                                               const gchar* category);
VALA_EXTERN StickerSet* sticker_set_new (void);
VALA_EXTERN StickerSet* sticker_set_construct (GType object_type);
static GtkFlowBox* sticker_inspector_create_category (StickerInspector* self,
                                               GtkBox* box,
                                               const gchar* name);
static void sticker_inspector_load_favorites (StickerInspector* self);
static void sticker_inspector_create_from_sticker_set (StickerInspector* self,
                                                GtkBox* box);
static void __lambda154_ (StickerInspector* self);
VALA_EXTERN void utils_open_url (const gchar* url);
VALA_EXTERN gchar* sticker_set_sticker_dir (StickerSet* self);
static void ___lambda154__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
VALA_EXTERN GArray* sticker_set_get_categories (StickerSet* self);
VALA_EXTERN gpointer sticker_set_sticker_info_ref (gpointer instance);
VALA_EXTERN void sticker_set_sticker_info_unref (gpointer instance);
VALA_EXTERN GParamSpec* sticker_set_param_spec_sticker_info (const gchar* name,
                                                 const gchar* nick,
                                                 const gchar* blurb,
                                                 GType object_type,
                                                 GParamFlags flags);
VALA_EXTERN void sticker_set_value_set_sticker_info (GValue* value,
                                         gpointer v_object);
VALA_EXTERN void sticker_set_value_take_sticker_info (GValue* value,
                                          gpointer v_object);
VALA_EXTERN gpointer sticker_set_value_get_sticker_info (const GValue* value);
VALA_EXTERN GType sticker_set_sticker_info_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (StickerSetStickerInfo, sticker_set_sticker_info_unref)
VALA_EXTERN GArray* sticker_set_get_category_icons (StickerSet* self,
                                        const gchar* category);
static void sticker_inspector_create_image (StickerInspector* self,
                                     GtkFlowBox* fbox,
                                     const gchar* name,
                                     const gchar* tooltip);
VALA_EXTERN const gchar* sticker_set_sticker_info_get_resource (StickerSetStickerInfo* self);
VALA_EXTERN const gchar* sticker_set_sticker_info_get_tooltip (StickerSetStickerInfo* self);
static void sticker_inspector_create_import (StickerInspector* self,
                                      GtkFlowBox* box);
VALA_EXTERN GdkPixbuf* sticker_set_make_pixbuf (const gchar* resource,
                                    gint width);
static Block61Data* block61_data_ref (Block61Data* _data61_);
static void block61_data_unref (void * _userdata_);
static GdkContentProvider* __lambda149_ (Block61Data* _data61_,
                                  gdouble x,
                                  gdouble y);
static GdkContentProvider* ___lambda149__gtk_drag_source_prepare (GtkDragSource* _sender,
                                                           gdouble x,
                                                           gdouble y,
                                                           gpointer self);
static void __lambda150_ (Block61Data* _data61_,
                   gint n_press,
                   gdouble x,
                   gdouble y);
static void sticker_inspector_import_stickers (StickerInspector* self,
                                        GtkFlowBox* fbox,
                                        const gchar* category);
static void ___lambda150__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                              gint n_press,
                                              gdouble x,
                                              gdouble y,
                                              gpointer self);
static void __lambda152_ (Block61Data* _data61_,
                   gint n_press,
                   gdouble x,
                   gdouble y);
static void sticker_inspector_show_contextual_menu (StickerInspector* self,
                                             GtkWidget* sticker);
static void ___lambda152__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                              gint n_press,
                                              gdouble x,
                                              gdouble y,
                                              gpointer self);
static void sticker_inspector_set_action_enable (StickerInspector* self,
                                          const gchar* action_name,
                                          gboolean enabled);
static Block62Data* block62_data_ref (Block62Data* _data62_);
static void block62_data_unref (void * _userdata_);
static gboolean sticker_inspector_is_custom (StickerInspector* self,
                                      const gchar* name);
static gboolean sticker_inspector_is_favorite (StickerInspector* self,
                                        const gchar* name);
static void __lambda153_ (Block62Data* _data62_);
static void ___lambda153__gtk_widget_destroy (GtkWidget* _sender,
                                       gpointer self);
static void sticker_inspector_make_favorite (StickerInspector* self);
static void sticker_inspector_make_unfavorite (StickerInspector* self);
VALA_EXTERN gboolean sticker_set_remove_sticker (StickerSet* self,
                                     const gchar* name);
VALA_EXTERN GtkWidget* utils_get_child_at_index (GtkWidget* parent,
                                     gint index);
VALA_EXTERN gboolean sticker_set_get_icon_info (StickerSet* self,
                                    const gchar* resource,
                                    gchar** tooltip);
static void sticker_inspector_save_favorites (StickerInspector* self);
static Block63Data* block63_data_ref (Block63Data* _data63_);
static void block63_data_unref (void * _userdata_);
static gboolean ___lambda147_ (Block63Data* _data63_,
                        GtkFlowBoxChild* item);
static gboolean ____lambda147__gtk_flow_box_filter_func (GtkFlowBoxChild* child,
                                                  gpointer self);
VALA_EXTERN void sticker_inspector_grab_first (StickerInspector* self);
static Block64Data* block64_data_ref (Block64Data* _data64_);
static void block64_data_unref (void * _userdata_);
VALA_EXTERN GtkFileDialog* utils_make_file_chooser (const gchar* user_title,
                                        const gchar* user_accept_label);
static void __lambda151_ (Block64Data* _data64_,
                   GObject* obj,
                   GAsyncResult* res);
VALA_EXTERN gboolean sticker_set_load_sticker (StickerSet* self,
                                   const gchar* category,
                                   const gchar* name,
                                   const gchar* sticker_file,
                                   gboolean import);
static void ___lambda151__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void sticker_inspector_finalize (GObject * obj);
static GType sticker_inspector_get_type_once (void);
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 gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const GActionEntry STICKER_INSPECTOR_action_entries[4] = {{"action_make_builtin_favorite", _sticker_inspector_action_make_builtin_favorite_gsimple_action_activate_callback}, {"action_make_custom_favorite", _sticker_inspector_action_make_custom_favorite_gsimple_action_activate_callback}, {"action_make_unfavorite", _sticker_inspector_action_make_unfavorite_gsimple_action_activate_callback}, {"action_remove", _sticker_inspector_action_remove_gsimple_action_activate_callback}};

static inline gpointer
sticker_inspector_get_instance_private (StickerInspector* self)
{
	return G_STRUCT_MEMBER_P (self, StickerInspector_private_offset);
}

static void
_sticker_inspector_action_make_builtin_favorite_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                  GVariant* parameter,
                                                                                  gpointer self)
{
	sticker_inspector_action_make_builtin_favorite ((StickerInspector*) self);
}

static void
_sticker_inspector_action_make_custom_favorite_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                 GVariant* parameter,
                                                                                 gpointer self)
{
	sticker_inspector_action_make_custom_favorite ((StickerInspector*) self);
}

static void
_sticker_inspector_action_make_unfavorite_gsimple_action_activate_callback (GSimpleAction* action,
                                                                            GVariant* parameter,
                                                                            gpointer self)
{
	sticker_inspector_action_make_unfavorite ((StickerInspector*) self);
}

static void
_sticker_inspector_action_remove_gsimple_action_activate_callback (GSimpleAction* action,
                                                                   GVariant* parameter,
                                                                   gpointer self)
{
	sticker_inspector_action_remove ((StickerInspector*) self);
}

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

static void
_sticker_inspector_do_search_gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                              gpointer self)
{
	sticker_inspector_do_search ((StickerInspector*) self);
}

static gboolean
__lambda148_ (StickerInspector* self,
              guint keyval,
              guint keycode,
              GdkModifierType state)
{
	gboolean result;
	if (keyval == GDK_KEY_Escape) {
		GtkSearchEntry* _tmp0_;
		const gchar* _tmp1_;
		const gchar* _tmp2_;
		_tmp0_ = self->priv->_search;
		_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
		_tmp2_ = _tmp1_;
		if (g_strcmp0 (_tmp2_, "") == 0) {
			MainWindow* _tmp3_;
			MindMap* _tmp4_;
			MindMap* _tmp5_;
			_tmp3_ = self->priv->_win;
			_tmp4_ = main_window_get_current_map (_tmp3_, NULL);
			_tmp5_ = _tmp4_;
			g_signal_emit_by_name (_tmp5_, "hide-properties");
			_mind_map_unref0 (_tmp5_);
		} else {
			GtkSearchEntry* _tmp6_;
			_tmp6_ = self->priv->_search;
			gtk_editable_set_text ((GtkEditable*) _tmp6_, "");
		}
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
___lambda148__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                    guint keyval,
                                                    guint keycode,
                                                    GdkModifierType state,
                                                    gpointer self)
{
	gboolean result;
	result = __lambda148_ ((StickerInspector*) self, keyval, keycode, state);
	return result;
}

static void
__lambda154_ (StickerInspector* self)
{
	StickerSet* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	_tmp0_ = self->priv->_sticker_set;
	_tmp1_ = sticker_set_sticker_dir (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strconcat ("file://", _tmp2_, NULL);
	_tmp4_ = _tmp3_;
	utils_open_url (_tmp4_);
	_g_free0 (_tmp4_);
	_g_free0 (_tmp2_);
}

static void
___lambda154__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda154_ ((StickerInspector*) self);
}

StickerInspector*
sticker_inspector_construct (GType object_type,
                             MainWindow* win,
                             GSettings* settings)
{
	StickerInspector * self = NULL;
	MainWindow* _tmp0_;
	GSettings* _tmp1_;
	GMenu* _tmp2_;
	GMenu* _tmp3_;
	GMenu* _tmp4_;
	GMenu* _tmp5_;
	GMenu* custom_fav_menu = NULL;
	GMenu* _tmp6_;
	GMenu* custom_del_menu = NULL;
	GMenu* _tmp7_;
	GMenu* _tmp8_;
	GMenu* _tmp9_;
	GMenu* _tmp10_;
	GtkLabel* lbl = NULL;
	GtkLabel* _tmp11_ = NULL;
	gchar* _tmp12_;
	GtkSearchEntry* _tmp13_ = NULL;
	GtkSearchEntry* _tmp14_;
	GtkEventControllerKey* search_key = NULL;
	GtkEventControllerKey* _tmp15_;
	GtkSearchEntry* _tmp16_;
	GtkEventController* _tmp17_;
	GtkBox* box = NULL;
	GtkBox* _tmp18_;
	GtkScrolledWindow* sw = NULL;
	GtkWidget* _tmp19_;
	GtkScrolledWindow* _tmp20_ = NULL;
	GtkViewport* vp = NULL;
	GtkWidget* _tmp21_;
	GtkWidget* _tmp22_;
	GtkViewport* _tmp23_;
	GtkFlowBox* _tmp24_;
	GtkBox* mbox = NULL;
	GtkBox* _tmp25_;
	GtkFlowBox* _tmp26_;
	GtkScrolledWindow* msw = NULL;
	GtkWidget* _tmp27_;
	GtkScrolledWindow* _tmp28_ = NULL;
	GtkStack* _tmp29_ = NULL;
	GtkStack* _tmp30_;
	GtkStack* _tmp31_;
	StickerSet* _tmp32_;
	GtkFlowBox* _tmp33_;
	GtkButton* show = NULL;
	GtkButton* _tmp34_;
	GtkSearchEntry* _tmp35_;
	GtkStack* _tmp36_;
	GSimpleActionGroup* _tmp37_;
	GSimpleActionGroup* _tmp38_;
	GSimpleActionGroup* _tmp39_;
	g_return_val_if_fail (win != NULL, NULL);
	g_return_val_if_fail (settings != NULL, NULL);
	self = (StickerInspector*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "spacing", 10, NULL);
	_tmp0_ = _g_object_ref0 (win);
	_g_object_unref0 (self->priv->_win);
	self->priv->_win = _tmp0_;
	_tmp1_ = _g_object_ref0 (settings);
	_g_object_unref0 (self->priv->_settings);
	self->priv->_settings = _tmp1_;
	_tmp2_ = g_menu_new ();
	_g_object_unref0 (self->priv->_favorite_menu);
	self->priv->_favorite_menu = _tmp2_;
	_tmp3_ = self->priv->_favorite_menu;
	g_menu_append (_tmp3_, _ ("Remove From Favorites"), "sticker.action_make_unfavorite");
	_tmp4_ = g_menu_new ();
	_g_object_unref0 (self->priv->_builtin_menu);
	self->priv->_builtin_menu = _tmp4_;
	_tmp5_ = self->priv->_builtin_menu;
	g_menu_append (_tmp5_, _ ("Add To Favorites"), "sticker.action_make_builtin_favorite");
	_tmp6_ = g_menu_new ();
	custom_fav_menu = _tmp6_;
	g_menu_append (custom_fav_menu, _ ("Add To Favorites"), "sticker.action_make_custom_favorite");
	_tmp7_ = g_menu_new ();
	custom_del_menu = _tmp7_;
	g_menu_append (custom_del_menu, _ ("Remove Custom Sticker"), "sticker.action_remove");
	_tmp8_ = g_menu_new ();
	_g_object_unref0 (self->priv->_custom_menu);
	self->priv->_custom_menu = _tmp8_;
	_tmp9_ = self->priv->_custom_menu;
	g_menu_append_section (_tmp9_, NULL, (GMenuModel*) custom_fav_menu);
	_tmp10_ = self->priv->_custom_menu;
	g_menu_append_section (_tmp10_, NULL, (GMenuModel*) custom_del_menu);
	_tmp11_ = (GtkLabel*) gtk_label_new (_ ("Drag and drop sticker onto a node or anywhere else in the map to add a" \
" sticker."));
	gtk_label_set_wrap (_tmp11_, TRUE);
	gtk_label_set_wrap_mode (_tmp11_, PANGO_WRAP_WORD);
	g_object_ref_sink (_tmp11_);
	lbl = _tmp11_;
	_tmp12_ = g_strdup (_ ("Search Stickers"));
	_tmp13_ = (GtkSearchEntry*) gtk_search_entry_new ();
	g_object_set (_tmp13_, "placeholder-text", _tmp12_, NULL);
	_g_free0 (_tmp12_);
	g_object_ref_sink (_tmp13_);
	_g_object_unref0 (self->priv->_search);
	self->priv->_search = _tmp13_;
	_tmp14_ = self->priv->_search;
	g_signal_connect_object (_tmp14_, "search-changed", (GCallback) _sticker_inspector_do_search_gtk_search_entry_search_changed, self, 0);
	_tmp15_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	search_key = _tmp15_;
	_tmp16_ = self->priv->_search;
	_tmp17_ = _g_object_ref0 ((GtkEventController*) search_key);
	gtk_widget_add_controller ((GtkWidget*) _tmp16_, _tmp17_);
	g_signal_connect_object (search_key, "key-pressed", (GCallback) ___lambda148__gtk_event_controller_key_key_pressed, self, 0);
	_tmp18_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 20);
	g_object_ref_sink (_tmp18_);
	box = _tmp18_;
	_tmp19_ = _g_object_ref0 ((GtkWidget*) box);
	_tmp20_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	gtk_scrolled_window_set_child (_tmp20_, _tmp19_);
	_g_object_unref0 (_tmp19_);
	g_object_ref_sink (_tmp20_);
	sw = _tmp20_;
	_tmp21_ = gtk_scrolled_window_get_child (sw);
	_tmp22_ = _tmp21_;
	_tmp23_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, gtk_viewport_get_type (), GtkViewport));
	vp = _tmp23_;
	_tmp24_ = sticker_inspector_create_icon_box (self, "");
	_g_object_unref0 (self->priv->_matched_box);
	self->priv->_matched_box = _tmp24_;
	_tmp25_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp25_);
	mbox = _tmp25_;
	_tmp26_ = self->priv->_matched_box;
	gtk_box_append (mbox, (GtkWidget*) _tmp26_);
	_tmp27_ = _g_object_ref0 ((GtkWidget*) mbox);
	_tmp28_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	gtk_scrolled_window_set_child (_tmp28_, _tmp27_);
	_g_object_unref0 (_tmp27_);
	g_object_ref_sink (_tmp28_);
	msw = _tmp28_;
	gtk_widget_add_css_class ((GtkWidget*) msw, GRANITE_STYLE_CLASS_VIEW);
	_tmp29_ = (GtkStack*) gtk_stack_new ();
	gtk_widget_set_vexpand ((GtkWidget*) _tmp29_, TRUE);
	g_object_ref_sink (_tmp29_);
	_g_object_unref0 (self->priv->_stack);
	self->priv->_stack = _tmp29_;
	_tmp30_ = self->priv->_stack;
	gtk_stack_add_named (_tmp30_, (GtkWidget*) sw, "all");
	_tmp31_ = self->priv->_stack;
	gtk_stack_add_named (_tmp31_, (GtkWidget*) msw, "matched");
	_tmp32_ = sticker_set_new ();
	_sticker_set_unref0 (self->priv->_sticker_set);
	self->priv->_sticker_set = _tmp32_;
	_tmp33_ = sticker_inspector_create_category (self, box, _ ("Favorites"));
	_g_object_unref0 (self->priv->_favorites);
	self->priv->_favorites = _tmp33_;
	sticker_inspector_load_favorites (self);
	sticker_inspector_create_from_sticker_set (self, box);
	_tmp34_ = (GtkButton*) gtk_button_new_with_label (_ ("Show Custom Sticker Directory"));
	g_object_ref_sink (_tmp34_);
	show = _tmp34_;
	g_signal_connect_object (show, "clicked", (GCallback) ___lambda154__gtk_button_clicked, self, 0);
	gtk_box_append (box, (GtkWidget*) show);
	gtk_box_append ((GtkBox*) self, (GtkWidget*) lbl);
	_tmp35_ = self->priv->_search;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp35_);
	_tmp36_ = self->priv->_stack;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp36_);
	_tmp37_ = g_simple_action_group_new ();
	_g_object_unref0 (self->priv->_actions);
	self->priv->_actions = _tmp37_;
	_tmp38_ = self->priv->_actions;
	g_action_map_add_action_entries ((GActionMap*) _tmp38_, STICKER_INSPECTOR_action_entries, (gint) G_N_ELEMENTS (STICKER_INSPECTOR_action_entries), self);
	_tmp39_ = self->priv->_actions;
	gtk_widget_insert_action_group ((GtkWidget*) self, "sticker", (GActionGroup*) _tmp39_);
	_g_object_unref0 (show);
	_g_object_unref0 (msw);
	_g_object_unref0 (mbox);
	_g_object_unref0 (vp);
	_g_object_unref0 (sw);
	_g_object_unref0 (box);
	_g_object_unref0 (search_key);
	_g_object_unref0 (lbl);
	_g_object_unref0 (custom_del_menu);
	_g_object_unref0 (custom_fav_menu);
	return self;
}

StickerInspector*
sticker_inspector_new (MainWindow* win,
                       GSettings* settings)
{
	return sticker_inspector_construct (TYPE_STICKER_INSPECTOR, win, settings);
}

static void
sticker_inspector_create_from_sticker_set (StickerInspector* self,
                                           GtkBox* box)
{
	GArray* categories = NULL;
	StickerSet* _tmp0_;
	GArray* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (box != NULL);
	_tmp0_ = self->priv->_sticker_set;
	_tmp1_ = sticker_set_get_categories (_tmp0_);
	categories = _tmp1_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				GArray* _tmp4_;
				GtkFlowBox* category = NULL;
				GArray* _tmp5_;
				const gchar* _tmp6_;
				GtkFlowBox* _tmp7_;
				GArray* icons = NULL;
				StickerSet* _tmp8_;
				GArray* _tmp9_;
				const gchar* _tmp10_;
				GArray* _tmp11_;
				GtkFlowBox* _tmp33_;
				if (!_tmp2_) {
					gint _tmp3_;
					_tmp3_ = i;
					i = _tmp3_ + 1;
				}
				_tmp2_ = FALSE;
				_tmp4_ = categories;
				if (!(((guint) i) < _tmp4_->len)) {
					break;
				}
				_tmp5_ = categories;
				_tmp6_ = g_array_index (_tmp5_, gchar*, (guint) i);
				_tmp7_ = sticker_inspector_create_category (self, box, _tmp6_);
				category = _tmp7_;
				_tmp8_ = self->priv->_sticker_set;
				_tmp9_ = categories;
				_tmp10_ = g_array_index (_tmp9_, gchar*, (guint) i);
				_tmp11_ = sticker_set_get_category_icons (_tmp8_, _tmp10_);
				icons = _tmp11_;
				{
					gint j = 0;
					j = 0;
					{
						gboolean _tmp12_ = FALSE;
						_tmp12_ = TRUE;
						while (TRUE) {
							GArray* _tmp14_;
							GtkFlowBox* _tmp15_;
							GArray* _tmp16_;
							StickerSetStickerInfo* _tmp17_;
							const gchar* _tmp18_;
							const gchar* _tmp19_;
							GArray* _tmp20_;
							StickerSetStickerInfo* _tmp21_;
							const gchar* _tmp22_;
							const gchar* _tmp23_;
							GtkFlowBox* _tmp24_;
							GArray* _tmp25_;
							StickerSetStickerInfo* _tmp26_;
							const gchar* _tmp27_;
							const gchar* _tmp28_;
							GArray* _tmp29_;
							StickerSetStickerInfo* _tmp30_;
							const gchar* _tmp31_;
							const gchar* _tmp32_;
							if (!_tmp12_) {
								gint _tmp13_;
								_tmp13_ = j;
								j = _tmp13_ + 1;
							}
							_tmp12_ = FALSE;
							_tmp14_ = icons;
							if (!(((guint) j) < _tmp14_->len)) {
								break;
							}
							_tmp15_ = category;
							_tmp16_ = icons;
							_tmp17_ = g_array_index (_tmp16_, StickerSetStickerInfo*, (guint) j);
							_tmp18_ = sticker_set_sticker_info_get_resource (_tmp17_);
							_tmp19_ = _tmp18_;
							_tmp20_ = icons;
							_tmp21_ = g_array_index (_tmp20_, StickerSetStickerInfo*, (guint) j);
							_tmp22_ = sticker_set_sticker_info_get_tooltip (_tmp21_);
							_tmp23_ = _tmp22_;
							sticker_inspector_create_image (self, _tmp15_, _tmp19_, _tmp23_);
							_tmp24_ = self->priv->_matched_box;
							_tmp25_ = icons;
							_tmp26_ = g_array_index (_tmp25_, StickerSetStickerInfo*, (guint) j);
							_tmp27_ = sticker_set_sticker_info_get_resource (_tmp26_);
							_tmp28_ = _tmp27_;
							_tmp29_ = icons;
							_tmp30_ = g_array_index (_tmp29_, StickerSetStickerInfo*, (guint) j);
							_tmp31_ = sticker_set_sticker_info_get_tooltip (_tmp30_);
							_tmp32_ = _tmp31_;
							sticker_inspector_create_image (self, _tmp24_, _tmp28_, _tmp32_);
						}
					}
				}
				_tmp33_ = category;
				sticker_inspector_create_import (self, _tmp33_);
				_g_array_unref0 (icons);
				_g_object_unref0 (category);
			}
		}
	}
	_g_array_unref0 (categories);
}

static GtkFlowBox*
sticker_inspector_create_category (StickerInspector* self,
                                   GtkBox* box,
                                   const gchar* name)
{
	GtkFlowBox* fbox = NULL;
	GtkFlowBox* _tmp0_;
	GtkExpander* exp = NULL;
	GtkWidget* _tmp1_;
	GtkExpander* _tmp2_ = NULL;
	GtkFlowBox* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (box != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = sticker_inspector_create_icon_box (self, name);
	fbox = _tmp0_;
	_tmp1_ = _g_object_ref0 ((GtkWidget*) fbox);
	_tmp2_ = (GtkExpander*) gtk_expander_new (name);
	gtk_expander_set_expanded (_tmp2_, TRUE);
	gtk_expander_set_child (_tmp2_, _tmp1_);
	_g_object_unref0 (_tmp1_);
	g_object_ref_sink (_tmp2_);
	exp = _tmp2_;
	gtk_widget_add_css_class ((GtkWidget*) exp, "titled");
	gtk_box_append (box, (GtkWidget*) exp);
	result = fbox;
	_g_object_unref0 (exp);
	return result;
}

static void
sticker_inspector_create_image (StickerInspector* self,
                                GtkFlowBox* fbox,
                                const gchar* name,
                                const gchar* tooltip)
{
	GdkPixbuf* pixbuf = NULL;
	GdkPixbuf* _tmp0_;
	GdkPixbuf* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (fbox != NULL);
	g_return_if_fail (name != NULL);
	g_return_if_fail (tooltip != NULL);
	_tmp0_ = sticker_set_make_pixbuf (name, -1);
	pixbuf = _tmp0_;
	_tmp1_ = pixbuf;
	if (_tmp1_ != NULL) {
		GdkTexture* texture = NULL;
		GdkPixbuf* _tmp2_;
		GdkTexture* _tmp3_;
		GtkPicture* img = NULL;
		GdkTexture* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		GtkPicture* _tmp7_ = NULL;
		GtkPicture* _tmp8_;
		_tmp2_ = pixbuf;
		_tmp3_ = gdk_texture_new_for_pixbuf (_tmp2_);
		texture = _tmp3_;
		_tmp4_ = texture;
		_tmp5_ = g_strdup (name);
		_tmp6_ = g_strdup (tooltip);
		_tmp7_ = (GtkPicture*) gtk_picture_new_for_paintable ((GdkPaintable*) _tmp4_);
		gtk_picture_set_can_shrink (_tmp7_, FALSE);
		gtk_widget_set_name ((GtkWidget*) _tmp7_, _tmp5_);
		_g_free0 (_tmp5_);
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp7_, _tmp6_);
		_g_free0 (_tmp6_);
		g_object_ref_sink (_tmp7_);
		img = _tmp7_;
		_tmp8_ = img;
		gtk_flow_box_append (fbox, (GtkWidget*) _tmp8_);
		_g_object_unref0 (img);
		_g_object_unref0 (texture);
	}
	_g_object_unref0 (pixbuf);
}

static void
sticker_inspector_create_import (StickerInspector* self,
                                 GtkFlowBox* box)
{
	GtkImage* img = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	GtkImage* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (box != NULL);
	_tmp0_ = g_strdup ("");
	_tmp1_ = g_strdup (_ ("Add custom stickers"));
	_tmp2_ = (GtkImage*) gtk_image_new_from_icon_name ("list-add-symbolic");
	gtk_widget_set_name ((GtkWidget*) _tmp2_, _tmp0_);
	_g_free0 (_tmp0_);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp2_, _tmp1_);
	_g_free0 (_tmp1_);
	g_object_ref_sink (_tmp2_);
	img = _tmp2_;
	gtk_flow_box_append (box, (GtkWidget*) img);
	_g_object_unref0 (img);
}

static Block61Data*
block61_data_ref (Block61Data* _data61_)
{
	g_atomic_int_inc (&_data61_->_ref_count_);
	return _data61_;
}

static void
block61_data_unref (void * _userdata_)
{
	Block61Data* _data61_;
	_data61_ = (Block61Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data61_->_ref_count_)) {
		StickerInspector* self;
		self = _data61_->self;
		_g_object_unref0 (_data61_->drag);
		_g_object_unref0 (_data61_->fbox);
		_g_free0 (_data61_->category);
		_g_object_unref0 (self);
		g_slice_free (Block61Data, _data61_);
	}
}

static GdkContentProvider*
__lambda149_ (Block61Data* _data61_,
              gdouble x,
              gdouble y)
{
	StickerInspector* self;
	GtkFlowBoxChild* sticker = NULL;
	GtkFlowBoxChild* _tmp0_;
	GtkFlowBoxChild* _tmp1_;
	GtkFlowBoxChild* _tmp2_;
	GdkContentProvider* result;
	self = _data61_->self;
	_tmp0_ = gtk_flow_box_get_child_at_pos (_data61_->fbox, (gint) x, (gint) y);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	sticker = _tmp1_;
	_tmp2_ = sticker;
	if (_tmp2_ != NULL) {
		GtkFlowBoxChild* _tmp3_;
		GtkWidget* _tmp4_;
		GtkPicture* _tmp5_;
		GtkPicture* _tmp6_;
		GdkPaintable* _tmp7_;
		GdkPaintable* _tmp8_;
		GValue val = {0};
		GValue _tmp9_ = {0};
		GtkPicture* _tmp10_;
		GValue _tmp11_ = {0};
		GdkContentProvider* content = NULL;
		GValue _tmp12_;
		GdkContentProvider* _tmp13_;
		_tmp3_ = sticker;
		_tmp4_ = gtk_flow_box_child_get_child (_tmp3_);
		_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, gtk_picture_get_type (), GtkPicture));
		_g_object_unref0 (self->priv->_dragged_sticker);
		self->priv->_dragged_sticker = _tmp5_;
		_tmp6_ = self->priv->_dragged_sticker;
		_tmp7_ = gtk_picture_get_paintable (_tmp6_);
		_tmp8_ = _tmp7_;
		gtk_drag_source_set_icon (_data61_->drag, _tmp8_, 0, 0);
		g_value_init (&_tmp9_, gtk_picture_get_type ());
		val = _tmp9_;
		_tmp10_ = self->priv->_dragged_sticker;
		g_value_init (&_tmp11_, gtk_picture_get_type ());
		g_value_set_object (&_tmp11_, _tmp10_);
		G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
		val = _tmp11_;
		_tmp12_ = val;
		_tmp13_ = gdk_content_provider_new_for_value (&_tmp12_);
		content = _tmp13_;
		result = content;
		G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
		_g_object_unref0 (sticker);
		return result;
	}
	result = NULL;
	_g_object_unref0 (sticker);
	return result;
}

static GdkContentProvider*
___lambda149__gtk_drag_source_prepare (GtkDragSource* _sender,
                                       gdouble x,
                                       gdouble y,
                                       gpointer self)
{
	GdkContentProvider* result;
	result = __lambda149_ (self, x, y);
	return result;
}

static void
__lambda150_ (Block61Data* _data61_,
              gint n_press,
              gdouble x,
              gdouble y)
{
	StickerInspector* self;
	GtkFlowBoxChild* sticker = NULL;
	GtkFlowBoxChild* _tmp0_;
	GtkFlowBoxChild* _tmp1_;
	gboolean _tmp2_ = FALSE;
	GtkFlowBoxChild* _tmp3_;
	self = _data61_->self;
	_tmp0_ = gtk_flow_box_get_child_at_pos (_data61_->fbox, (gint) x, (gint) y);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	sticker = _tmp1_;
	_tmp3_ = sticker;
	if (_tmp3_ != NULL) {
		GtkFlowBoxChild* _tmp4_;
		GtkWidget* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp4_ = sticker;
		_tmp5_ = gtk_flow_box_child_get_child (_tmp4_);
		_tmp6_ = gtk_widget_get_name (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp2_ = g_strcmp0 (_tmp7_, "") == 0;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		sticker_inspector_import_stickers (self, _data61_->fbox, _data61_->category);
	}
	_g_object_unref0 (sticker);
}

static void
___lambda150__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                         gint n_press,
                                         gdouble x,
                                         gdouble y,
                                         gpointer self)
{
	__lambda150_ (self, n_press, x, y);
}

static void
__lambda152_ (Block61Data* _data61_,
              gint n_press,
              gdouble x,
              gdouble y)
{
	StickerInspector* self;
	GtkFlowBoxChild* sticker = NULL;
	GtkFlowBoxChild* _tmp0_;
	GtkFlowBoxChild* _tmp1_;
	GtkFlowBoxChild* _tmp2_;
	self = _data61_->self;
	_tmp0_ = gtk_flow_box_get_child_at_pos (_data61_->fbox, (gint) x, (gint) y);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	sticker = _tmp1_;
	_tmp2_ = sticker;
	if (_tmp2_ != NULL) {
		GtkFlowBox* _tmp3_;
		GtkFlowBoxChild* _tmp4_;
		GtkWidget* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		const gchar* _tmp9_;
		_tmp3_ = _g_object_ref0 (_data61_->fbox);
		_g_object_unref0 (self->priv->_clicked_category);
		self->priv->_clicked_category = _tmp3_;
		_tmp4_ = sticker;
		_tmp5_ = gtk_flow_box_child_get_child (_tmp4_);
		_tmp6_ = gtk_widget_get_name (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = g_strdup (_tmp7_);
		_g_free0 (self->priv->_clicked_sticker);
		self->priv->_clicked_sticker = _tmp8_;
		_tmp9_ = self->priv->_clicked_sticker;
		if (g_strcmp0 (_tmp9_, "") != 0) {
			GtkFlowBoxChild* _tmp10_;
			_tmp10_ = sticker;
			sticker_inspector_show_contextual_menu (self, (GtkWidget*) _tmp10_);
		}
	}
	_g_object_unref0 (sticker);
}

static void
___lambda152__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                         gint n_press,
                                         gdouble x,
                                         gdouble y,
                                         gpointer self)
{
	__lambda152_ (self, n_press, x, y);
}

static GtkFlowBox*
sticker_inspector_create_icon_box (StickerInspector* self,
                                   const gchar* category)
{
	Block61Data* _data61_;
	gchar* _tmp0_;
	GtkFlowBox* _tmp1_ = NULL;
	GtkDragSource* _tmp2_ = NULL;
	GtkEventController* _tmp3_;
	GtkGestureClick* primary_click = NULL;
	GtkGestureClick* _tmp4_ = NULL;
	GtkEventController* _tmp5_;
	GtkGestureClick* secondary_click = NULL;
	GtkGestureClick* _tmp6_ = NULL;
	GtkEventController* _tmp7_;
	GtkFlowBox* _tmp8_;
	GtkFlowBox* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (category != NULL, NULL);
	_data61_ = g_slice_new0 (Block61Data);
	_data61_->_ref_count_ = 1;
	_data61_->self = g_object_ref (self);
	_tmp0_ = g_strdup (category);
	_g_free0 (_data61_->category);
	_data61_->category = _tmp0_;
	_tmp1_ = (GtkFlowBox*) gtk_flow_box_new ();
	gtk_flow_box_set_homogeneous (_tmp1_, TRUE);
	gtk_flow_box_set_selection_mode (_tmp1_, GTK_SELECTION_NONE);
	g_object_ref_sink (_tmp1_);
	_data61_->fbox = _tmp1_;
	_tmp2_ = gtk_drag_source_new ();
	gtk_drag_source_set_actions (_tmp2_, GDK_ACTION_COPY);
	_data61_->drag = _tmp2_;
	_tmp3_ = _g_object_ref0 ((GtkEventController*) _data61_->drag);
	gtk_widget_add_controller ((GtkWidget*) _data61_->fbox, _tmp3_);
	g_signal_connect_data (_data61_->drag, "prepare", (GCallback) ___lambda149__gtk_drag_source_prepare, block61_data_ref (_data61_), (GClosureNotify) block61_data_unref, 0);
	_tmp4_ = (GtkGestureClick*) gtk_gesture_click_new ();
	gtk_gesture_single_set_button ((GtkGestureSingle*) _tmp4_, (guint) GDK_BUTTON_PRIMARY);
	primary_click = _tmp4_;
	_tmp5_ = _g_object_ref0 ((GtkEventController*) primary_click);
	gtk_widget_add_controller ((GtkWidget*) _data61_->fbox, _tmp5_);
	g_signal_connect_data (primary_click, "pressed", (GCallback) ___lambda150__gtk_gesture_click_pressed, block61_data_ref (_data61_), (GClosureNotify) block61_data_unref, 0);
	_tmp6_ = (GtkGestureClick*) gtk_gesture_click_new ();
	gtk_gesture_single_set_button ((GtkGestureSingle*) _tmp6_, (guint) GDK_BUTTON_SECONDARY);
	secondary_click = _tmp6_;
	_tmp7_ = _g_object_ref0 ((GtkEventController*) secondary_click);
	gtk_widget_add_controller ((GtkWidget*) _data61_->fbox, _tmp7_);
	g_signal_connect_data (secondary_click, "pressed", (GCallback) ___lambda152__gtk_gesture_click_pressed, block61_data_ref (_data61_), (GClosureNotify) block61_data_unref, 0);
	_tmp8_ = _g_object_ref0 (_data61_->fbox);
	result = _tmp8_;
	_g_object_unref0 (secondary_click);
	_g_object_unref0 (primary_click);
	block61_data_unref (_data61_);
	_data61_ = NULL;
	return result;
}

static void
sticker_inspector_set_action_enable (StickerInspector* self,
                                     const gchar* action_name,
                                     gboolean enabled)
{
	GSimpleAction* action = NULL;
	GSimpleActionGroup* _tmp0_;
	GAction* _tmp1_;
	GSimpleAction* _tmp2_;
	GSimpleAction* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action_name != NULL);
	_tmp0_ = self->priv->_actions;
	_tmp1_ = g_action_map_lookup_action ((GActionMap*) _tmp0_, action_name);
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, g_simple_action_get_type (), GSimpleAction));
	action = _tmp2_;
	_tmp3_ = action;
	if (_tmp3_ != NULL) {
		GSimpleAction* _tmp4_;
		_tmp4_ = action;
		g_simple_action_set_enabled (_tmp4_, enabled);
	}
	_g_object_unref0 (action);
}

static Block62Data*
block62_data_ref (Block62Data* _data62_)
{
	g_atomic_int_inc (&_data62_->_ref_count_);
	return _data62_;
}

static void
block62_data_unref (void * _userdata_)
{
	Block62Data* _data62_;
	_data62_ = (Block62Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data62_->_ref_count_)) {
		StickerInspector* self;
		self = _data62_->self;
		_g_object_unref0 (_data62_->popover);
		_g_object_unref0 (self);
		g_slice_free (Block62Data, _data62_);
	}
}

static void
__lambda153_ (Block62Data* _data62_)
{
	StickerInspector* self;
	GtkPopoverMenu* _tmp0_;
	self = _data62_->self;
	_tmp0_ = _data62_->popover;
	gtk_widget_unparent ((GtkWidget*) _tmp0_);
}

static void
___lambda153__gtk_widget_destroy (GtkWidget* _sender,
                                  gpointer self)
{
	__lambda153_ (self);
}

static void
sticker_inspector_show_contextual_menu (StickerInspector* self,
                                        GtkWidget* sticker)
{
	Block62Data* _data62_;
	GtkFlowBox* _tmp0_;
	GtkFlowBox* _tmp1_;
	GtkPopoverMenu* _tmp11_;
	GtkPopoverMenu* _tmp12_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sticker != NULL);
	_data62_ = g_slice_new0 (Block62Data);
	_data62_->_ref_count_ = 1;
	_data62_->self = g_object_ref (self);
	_tmp0_ = self->priv->_clicked_category;
	_tmp1_ = self->priv->_favorites;
	if (_tmp0_ == _tmp1_) {
		GMenu* _tmp2_;
		GtkPopoverMenu* _tmp3_;
		_tmp2_ = self->priv->_favorite_menu;
		_tmp3_ = (GtkPopoverMenu*) gtk_popover_menu_new_from_model ((GMenuModel*) _tmp2_);
		g_object_ref_sink (_tmp3_);
		_g_object_unref0 (_data62_->popover);
		_data62_->popover = _tmp3_;
	} else {
		const gchar* _tmp4_;
		_tmp4_ = self->priv->_clicked_sticker;
		if (sticker_inspector_is_custom (self, _tmp4_)) {
			const gchar* _tmp5_;
			GMenu* _tmp6_;
			GtkPopoverMenu* _tmp7_;
			_tmp5_ = self->priv->_clicked_sticker;
			sticker_inspector_set_action_enable (self, "action_make_custom_favorite", !sticker_inspector_is_favorite (self, _tmp5_));
			_tmp6_ = self->priv->_custom_menu;
			_tmp7_ = (GtkPopoverMenu*) gtk_popover_menu_new_from_model ((GMenuModel*) _tmp6_);
			g_object_ref_sink (_tmp7_);
			_g_object_unref0 (_data62_->popover);
			_data62_->popover = _tmp7_;
		} else {
			const gchar* _tmp8_;
			GMenu* _tmp9_;
			GtkPopoverMenu* _tmp10_;
			_tmp8_ = self->priv->_clicked_sticker;
			sticker_inspector_set_action_enable (self, "action_make_builtin_favorite", !sticker_inspector_is_favorite (self, _tmp8_));
			_tmp9_ = self->priv->_builtin_menu;
			_tmp10_ = (GtkPopoverMenu*) gtk_popover_menu_new_from_model ((GMenuModel*) _tmp9_);
			g_object_ref_sink (_tmp10_);
			_g_object_unref0 (_data62_->popover);
			_data62_->popover = _tmp10_;
		}
	}
	_tmp11_ = _data62_->popover;
	gtk_widget_set_parent ((GtkWidget*) _tmp11_, sticker);
	_tmp12_ = _data62_->popover;
	gtk_popover_popup ((GtkPopover*) _tmp12_);
	g_signal_connect_data (sticker, "destroy", (GCallback) ___lambda153__gtk_widget_destroy, block62_data_ref (_data62_), (GClosureNotify) block62_data_unref, 0);
	block62_data_unref (_data62_);
	_data62_ = NULL;
}

static void
sticker_inspector_action_make_builtin_favorite (StickerInspector* self)
{
	g_return_if_fail (self != NULL);
	sticker_inspector_make_favorite (self);
}

static void
sticker_inspector_action_make_custom_favorite (StickerInspector* self)
{
	g_return_if_fail (self != NULL);
	sticker_inspector_make_favorite (self);
}

static void
sticker_inspector_action_make_unfavorite (StickerInspector* self)
{
	g_return_if_fail (self != NULL);
	sticker_inspector_make_unfavorite (self);
}

static void
sticker_inspector_action_remove (StickerInspector* self)
{
	StickerSet* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_sticker_set;
	_tmp1_ = self->priv->_clicked_sticker;
	if (sticker_set_remove_sticker (_tmp0_, _tmp1_)) {
		gint index = 0;
		GtkWidget* w = NULL;
		GtkFlowBox* _tmp2_;
		gint _tmp3_;
		GtkWidget* _tmp4_;
		sticker_inspector_make_unfavorite (self);
		index = 0;
		_tmp2_ = self->priv->_clicked_category;
		_tmp3_ = index;
		index = _tmp3_ + 1;
		_tmp4_ = utils_get_child_at_index ((GtkWidget*) _tmp2_, _tmp3_);
		w = _tmp4_;
		while (TRUE) {
			GtkWidget* _tmp5_;
			GtkWidget* _tmp6_;
			GtkWidget* _tmp7_;
			const gchar* _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			GtkFlowBox* _tmp13_;
			gint _tmp14_;
			GtkWidget* _tmp15_;
			_tmp5_ = w;
			if (!(_tmp5_ != NULL)) {
				break;
			}
			_tmp6_ = w;
			_tmp7_ = gtk_flow_box_child_get_child (G_TYPE_CHECK_INSTANCE_TYPE (_tmp6_, gtk_flow_box_child_get_type ()) ? ((GtkFlowBoxChild*) _tmp6_) : NULL);
			_tmp8_ = gtk_widget_get_name (_tmp7_);
			_tmp9_ = _tmp8_;
			_tmp10_ = self->priv->_clicked_sticker;
			if (g_strcmp0 (_tmp9_, _tmp10_) == 0) {
				GtkFlowBox* _tmp11_;
				GtkWidget* _tmp12_;
				_tmp11_ = self->priv->_clicked_category;
				_tmp12_ = w;
				gtk_flow_box_remove (_tmp11_, _tmp12_);
				_g_object_unref0 (w);
				return;
			}
			_tmp13_ = self->priv->_clicked_category;
			_tmp14_ = index;
			index = _tmp14_ + 1;
			_tmp15_ = utils_get_child_at_index ((GtkWidget*) _tmp13_, _tmp14_);
			_g_object_unref0 (w);
			w = _tmp15_;
		}
		_g_object_unref0 (w);
	}
}

static gboolean
sticker_inspector_is_favorite (StickerInspector* self,
                               const gchar* name)
{
	gint index = 0;
	GtkWidget* w = NULL;
	GtkFlowBox* _tmp0_;
	gint _tmp1_;
	GtkWidget* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (name != NULL, FALSE);
	index = 0;
	_tmp0_ = self->priv->_favorites;
	_tmp1_ = index;
	index = _tmp1_ + 1;
	_tmp2_ = utils_get_child_at_index ((GtkWidget*) _tmp0_, _tmp1_);
	w = _tmp2_;
	while (TRUE) {
		GtkWidget* _tmp3_;
		GtkWidget* _tmp4_;
		GtkWidget* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		GtkFlowBox* _tmp8_;
		gint _tmp9_;
		GtkWidget* _tmp10_;
		_tmp3_ = w;
		if (!(_tmp3_ != NULL)) {
			break;
		}
		_tmp4_ = w;
		_tmp5_ = gtk_flow_box_child_get_child (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, gtk_flow_box_child_get_type ()) ? ((GtkFlowBoxChild*) _tmp4_) : NULL);
		_tmp6_ = gtk_widget_get_name (_tmp5_);
		_tmp7_ = _tmp6_;
		if (g_strcmp0 (_tmp7_, name) == 0) {
			result = TRUE;
			_g_object_unref0 (w);
			return result;
		}
		_tmp8_ = self->priv->_favorites;
		_tmp9_ = index;
		index = _tmp9_ + 1;
		_tmp10_ = utils_get_child_at_index ((GtkWidget*) _tmp8_, _tmp9_);
		_g_object_unref0 (w);
		w = _tmp10_;
	}
	result = FALSE;
	_g_object_unref0 (w);
	return result;
}

static gunichar
string_get_char (const gchar* self,
                 glong index)
{
	gunichar result;
	g_return_val_if_fail (self != NULL, 0U);
	result = g_utf8_get_char (((gchar*) self) + index);
	return result;
}

static gboolean
sticker_inspector_is_custom (StickerInspector* self,
                             const gchar* name)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (name != NULL, FALSE);
	result = string_get_char (name, (glong) 0) == ((gunichar) '/');
	return result;
}

static void
sticker_inspector_make_favorite (StickerInspector* self)
{
	gchar* tooltip = NULL;
	StickerSet* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_ = NULL;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_sticker_set;
	_tmp1_ = self->priv->_clicked_sticker;
	_tmp3_ = sticker_set_get_icon_info (_tmp0_, _tmp1_, &_tmp2_);
	_g_free0 (tooltip);
	tooltip = _tmp2_;
	if (_tmp3_) {
		GtkFlowBox* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		_tmp4_ = self->priv->_favorites;
		_tmp5_ = self->priv->_clicked_sticker;
		_tmp6_ = tooltip;
		sticker_inspector_create_image (self, _tmp4_, _tmp5_, _tmp6_);
		sticker_inspector_save_favorites (self);
	}
	_g_free0 (tooltip);
}

static void
sticker_inspector_make_unfavorite (StickerInspector* self)
{
	gint index = 0;
	GtkWidget* w = NULL;
	GtkFlowBox* _tmp0_;
	gint _tmp1_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	index = 0;
	_tmp0_ = self->priv->_favorites;
	_tmp1_ = index;
	index = _tmp1_ + 1;
	_tmp2_ = utils_get_child_at_index ((GtkWidget*) _tmp0_, _tmp1_);
	w = _tmp2_;
	while (TRUE) {
		GtkWidget* _tmp3_;
		GtkWidget* _tmp4_;
		GtkWidget* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		GtkFlowBox* _tmp11_;
		gint _tmp12_;
		GtkWidget* _tmp13_;
		_tmp3_ = w;
		if (!(_tmp3_ != NULL)) {
			break;
		}
		_tmp4_ = w;
		_tmp5_ = gtk_flow_box_child_get_child (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, gtk_flow_box_child_get_type ()) ? ((GtkFlowBoxChild*) _tmp4_) : NULL);
		_tmp6_ = gtk_widget_get_name (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = self->priv->_clicked_sticker;
		if (g_strcmp0 (_tmp7_, _tmp8_) == 0) {
			GtkFlowBox* _tmp9_;
			GtkWidget* _tmp10_;
			_tmp9_ = self->priv->_favorites;
			_tmp10_ = w;
			gtk_flow_box_remove (_tmp9_, _tmp10_);
			sticker_inspector_save_favorites (self);
			_g_object_unref0 (w);
			return;
		}
		_tmp11_ = self->priv->_favorites;
		_tmp12_ = index;
		index = _tmp12_ + 1;
		_tmp13_ = utils_get_child_at_index ((GtkWidget*) _tmp11_, _tmp12_);
		_g_object_unref0 (w);
		w = _tmp13_;
	}
	_g_object_unref0 (w);
}

static void
sticker_inspector_save_favorites (StickerInspector* self)
{
	xmlDoc* doc = NULL;
	xmlDoc* _tmp0_;
	xmlNode* root = NULL;
	xmlNode* _tmp1_;
	xmlDoc* _tmp2_;
	xmlNode* _tmp3_;
	gint index = 0;
	GtkWidget* w = NULL;
	GtkFlowBox* _tmp4_;
	gint _tmp5_;
	GtkWidget* _tmp6_;
	xmlDoc* _tmp21_;
	const gchar* _tmp22_;
	xmlDoc* _tmp23_;
	g_return_if_fail (self != NULL);
	_tmp0_ = xmlNewDoc ((xmlChar*) NULL);
	doc = _tmp0_;
	_tmp1_ = xmlNewNode (NULL, (xmlChar*) "favorites");
	root = _tmp1_;
	_tmp2_ = doc;
	_tmp3_ = root;
	xmlDocSetRootElement (_tmp2_, _tmp3_);
	index = 0;
	_tmp4_ = self->priv->_favorites;
	_tmp5_ = index;
	index = _tmp5_ + 1;
	_tmp6_ = utils_get_child_at_index ((GtkWidget*) _tmp4_, _tmp5_);
	w = _tmp6_;
	while (TRUE) {
		GtkWidget* _tmp7_;
		gchar* name = NULL;
		GtkWidget* _tmp8_;
		GtkWidget* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		gchar* _tmp12_;
		xmlNode* n = NULL;
		xmlNode* _tmp13_;
		xmlNode* _tmp14_;
		const gchar* _tmp15_;
		xmlNode* _tmp16_;
		xmlNode* _tmp17_;
		GtkFlowBox* _tmp18_;
		gint _tmp19_;
		GtkWidget* _tmp20_;
		_tmp7_ = w;
		if (!(_tmp7_ != NULL)) {
			break;
		}
		_tmp8_ = w;
		_tmp9_ = gtk_flow_box_child_get_child (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, gtk_flow_box_child_get_type ()) ? ((GtkFlowBoxChild*) _tmp8_) : NULL);
		_tmp10_ = gtk_widget_get_name (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = g_strdup (_tmp11_);
		name = _tmp12_;
		_tmp13_ = xmlNewNode (NULL, (xmlChar*) "sticker");
		n = _tmp13_;
		_tmp14_ = n;
		_tmp15_ = name;
		xmlSetProp (_tmp14_, (xmlChar*) "name", (xmlChar*) _tmp15_);
		_tmp16_ = root;
		_tmp17_ = n;
		xmlAddChild (_tmp16_, _tmp17_);
		_tmp18_ = self->priv->_favorites;
		_tmp19_ = index;
		index = _tmp19_ + 1;
		_tmp20_ = utils_get_child_at_index ((GtkWidget*) _tmp18_, _tmp19_);
		_g_object_unref0 (w);
		w = _tmp20_;
		_g_free0 (name);
	}
	_tmp21_ = doc;
	_tmp22_ = self->priv->favorites;
	xmlSaveFormatFile (_tmp22_, _tmp21_, 1);
	_tmp23_ = doc;
	_xmlFreeDoc0 (_tmp23_);
	_g_object_unref0 (w);
}

static void
sticker_inspector_load_favorites (StickerInspector* self)
{
	const gchar* _tmp0_;
	xmlDoc* doc = NULL;
	const gchar* _tmp1_;
	xmlDoc* _tmp2_;
	xmlDoc* _tmp3_;
	xmlDoc* _tmp24_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->favorites;
	if (!g_file_test (_tmp0_, G_FILE_TEST_EXISTS)) {
		return;
	}
	_tmp1_ = self->priv->favorites;
	_tmp2_ = xmlParseFile (_tmp1_);
	doc = _tmp2_;
	_tmp3_ = doc;
	if (_tmp3_ == NULL) {
		return;
	}
	{
		xmlNode* it = NULL;
		xmlDoc* _tmp4_;
		xmlNode* _tmp5_;
		xmlNode* _tmp6_;
		_tmp4_ = doc;
		_tmp5_ = xmlDocGetRootElement (_tmp4_);
		_tmp6_ = _tmp5_->children;
		it = _tmp6_;
		{
			gboolean _tmp7_ = FALSE;
			_tmp7_ = TRUE;
			while (TRUE) {
				xmlNode* _tmp10_;
				gboolean _tmp11_ = FALSE;
				xmlNode* _tmp12_;
				if (!_tmp7_) {
					xmlNode* _tmp8_;
					xmlNode* _tmp9_;
					_tmp8_ = it;
					_tmp9_ = _tmp8_->next;
					it = _tmp9_;
				}
				_tmp7_ = FALSE;
				_tmp10_ = it;
				if (!(_tmp10_ != NULL)) {
					break;
				}
				_tmp12_ = it;
				if (_tmp12_->type == XML_ELEMENT_NODE) {
					xmlNode* _tmp13_;
					const gchar* _tmp14_;
					_tmp13_ = it;
					_tmp14_ = _tmp13_->name;
					_tmp11_ = g_strcmp0 (_tmp14_, "sticker") == 0;
				} else {
					_tmp11_ = FALSE;
				}
				if (_tmp11_) {
					gchar* name = NULL;
					xmlNode* _tmp15_;
					gchar* _tmp16_;
					gchar* tooltip = NULL;
					StickerSet* _tmp17_;
					const gchar* _tmp18_;
					gchar* _tmp19_ = NULL;
					gboolean _tmp20_;
					_tmp15_ = it;
					_tmp16_ = (gchar*) xmlGetProp (_tmp15_, (xmlChar*) "name");
					name = _tmp16_;
					_tmp17_ = self->priv->_sticker_set;
					_tmp18_ = name;
					_tmp20_ = sticker_set_get_icon_info (_tmp17_, _tmp18_, &_tmp19_);
					_g_free0 (tooltip);
					tooltip = _tmp19_;
					if (_tmp20_) {
						GtkFlowBox* _tmp21_;
						const gchar* _tmp22_;
						const gchar* _tmp23_;
						_tmp21_ = self->priv->_favorites;
						_tmp22_ = name;
						_tmp23_ = tooltip;
						sticker_inspector_create_image (self, _tmp21_, _tmp22_, _tmp23_);
					}
					_g_free0 (tooltip);
					_g_free0 (name);
				}
			}
		}
	}
	_tmp24_ = doc;
	_xmlFreeDoc0 (_tmp24_);
}

static Block63Data*
block63_data_ref (Block63Data* _data63_)
{
	g_atomic_int_inc (&_data63_->_ref_count_);
	return _data63_;
}

static void
block63_data_unref (void * _userdata_)
{
	Block63Data* _data63_;
	_data63_ = (Block63Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data63_->_ref_count_)) {
		StickerInspector* self;
		self = _data63_->self;
		_g_free0 (_data63_->search_text);
		_g_object_unref0 (self);
		g_slice_free (Block63Data, _data63_);
	}
}

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
___lambda147_ (Block63Data* _data63_,
               GtkFlowBoxChild* item)
{
	StickerInspector* self;
	gchar** search_keys = NULL;
	const gchar* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint search_keys_length1;
	gint _search_keys_size_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gboolean result;
	self = _data63_->self;
	g_return_val_if_fail (item != NULL, FALSE);
	_tmp0_ = _data63_->search_text;
	_tmp2_ = _tmp1_ = g_strsplit (_tmp0_, " ", 0);
	search_keys = _tmp2_;
	search_keys_length1 = _vala_array_length (_tmp1_);
	_search_keys_size_ = search_keys_length1;
	_tmp3_ = search_keys;
	_tmp3__length1 = search_keys_length1;
	{
		gchar** sk_collection = NULL;
		gint sk_collection_length1 = 0;
		gint _sk_collection_size_ = 0;
		gint sk_it = 0;
		sk_collection = _tmp3_;
		sk_collection_length1 = _tmp3__length1;
		for (sk_it = 0; sk_it < sk_collection_length1; sk_it = sk_it + 1) {
			gchar* _tmp4_;
			gchar* sk = NULL;
			_tmp4_ = g_strdup (sk_collection[sk_it]);
			sk = _tmp4_;
			{
				GtkWidget* _tmp5_;
				const gchar* _tmp6_;
				gchar* _tmp7_;
				gchar* _tmp8_;
				const gchar* _tmp9_;
				gboolean _tmp10_;
				_tmp5_ = gtk_flow_box_child_get_child (item);
				_tmp6_ = gtk_widget_get_tooltip_text (_tmp5_);
				_tmp7_ = g_utf8_casefold (_tmp6_, (gssize) -1);
				_tmp8_ = _tmp7_;
				_tmp9_ = sk;
				_tmp10_ = !string_contains (_tmp8_, _tmp9_);
				_g_free0 (_tmp8_);
				if (_tmp10_) {
					result = FALSE;
					_g_free0 (sk);
					search_keys = (_vala_array_free (search_keys, search_keys_length1, (GDestroyNotify) g_free), NULL);
					return result;
				}
				_g_free0 (sk);
			}
		}
	}
	result = TRUE;
	search_keys = (_vala_array_free (search_keys, search_keys_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

static gboolean
____lambda147__gtk_flow_box_filter_func (GtkFlowBoxChild* child,
                                         gpointer self)
{
	gboolean result;
	result = ___lambda147_ (self, child);
	return result;
}

static void
sticker_inspector_do_search (StickerInspector* self)
{
	Block63Data* _data63_;
	GtkSearchEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	_data63_ = g_slice_new0 (Block63Data);
	_data63_->_ref_count_ = 1;
	_data63_->self = g_object_ref (self);
	_tmp0_ = self->priv->_search;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	_data63_->search_text = _tmp3_;
	_tmp4_ = _data63_->search_text;
	if (g_strcmp0 (_tmp4_, "") == 0) {
		GtkFlowBox* _tmp5_;
		GtkStack* _tmp6_;
		_tmp5_ = self->priv->_matched_box;
		gtk_flow_box_invalidate_filter (_tmp5_);
		_tmp6_ = self->priv->_stack;
		gtk_stack_set_visible_child_name (_tmp6_, "all");
	} else {
		GtkFlowBox* _tmp7_;
		GtkStack* _tmp8_;
		_tmp7_ = self->priv->_matched_box;
		gtk_flow_box_set_filter_func (_tmp7_, ____lambda147__gtk_flow_box_filter_func, block63_data_ref (_data63_), block63_data_unref);
		_tmp8_ = self->priv->_stack;
		gtk_stack_set_visible_child_name (_tmp8_, "matched");
	}
	block63_data_unref (_data63_);
	_data63_ = NULL;
}

void
sticker_inspector_grab_first (StickerInspector* self)
{
	GtkSearchEntry* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_search;
	gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
}

static Block64Data*
block64_data_ref (Block64Data* _data64_)
{
	g_atomic_int_inc (&_data64_->_ref_count_);
	return _data64_;
}

static void
block64_data_unref (void * _userdata_)
{
	Block64Data* _data64_;
	_data64_ = (Block64Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data64_->_ref_count_)) {
		StickerInspector* self;
		self = _data64_->self;
		_g_object_unref0 (_data64_->dialog);
		_g_object_unref0 (_data64_->fbox);
		_g_free0 (_data64_->category);
		_g_object_unref0 (self);
		g_slice_free (Block64Data, _data64_);
	}
}

static void
__lambda151_ (Block64Data* _data64_,
              GObject* obj,
              GAsyncResult* res)
{
	StickerInspector* self;
	GError* _inner_error0_ = NULL;
	self = _data64_->self;
	g_return_if_fail (res != NULL);
	{
		GListModel* files = NULL;
		GListModel* _tmp0_;
		_tmp0_ = gtk_file_dialog_open_multiple_finish (_data64_->dialog, res, &_inner_error0_);
		files = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (files != NULL) {
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp1_ = FALSE;
					_tmp1_ = TRUE;
					while (TRUE) {
						GFile* file = NULL;
						GObject* _tmp3_;
						gchar* sticker = NULL;
						GFile* _tmp4_;
						gchar* _tmp5_;
						gchar** parts = NULL;
						const gchar* _tmp6_;
						gchar* _tmp7_;
						gchar* _tmp8_;
						gchar** _tmp9_;
						gchar** _tmp10_;
						gchar** _tmp11_;
						gint _tmp11__length1;
						gint parts_length1;
						gint _parts_size_;
						StickerSet* _tmp12_;
						gchar** _tmp13_;
						gint _tmp13__length1;
						const gchar* _tmp14_;
						const gchar* _tmp15_;
						if (!_tmp1_) {
							gint _tmp2_;
							_tmp2_ = i;
							i = _tmp2_ + 1;
						}
						_tmp1_ = FALSE;
						if (!(((guint) i) < g_list_model_get_n_items (files))) {
							break;
						}
						_tmp3_ = g_list_model_get_item (files, (guint) i);
						file = G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, g_file_get_type (), GFile);
						_tmp4_ = file;
						_tmp5_ = g_file_get_path (_tmp4_);
						sticker = _tmp5_;
						_tmp6_ = sticker;
						_tmp7_ = g_path_get_basename (_tmp6_);
						_tmp8_ = _tmp7_;
						_tmp10_ = _tmp9_ = g_strsplit (_tmp8_, ".", 0);
						_tmp11_ = _tmp10_;
						_tmp11__length1 = _vala_array_length (_tmp9_);
						_g_free0 (_tmp8_);
						parts = _tmp11_;
						parts_length1 = _tmp11__length1;
						_parts_size_ = parts_length1;
						_tmp12_ = self->priv->_sticker_set;
						_tmp13_ = parts;
						_tmp13__length1 = parts_length1;
						_tmp14_ = _tmp13_[0];
						_tmp15_ = sticker;
						if (sticker_set_load_sticker (_tmp12_, _data64_->category, _tmp14_, _tmp15_, TRUE)) {
							gchar* tooltip = NULL;
							StickerSet* _tmp16_;
							const gchar* _tmp17_;
							gchar* _tmp18_ = NULL;
							const gchar* _tmp19_;
							const gchar* _tmp20_;
							_tmp16_ = self->priv->_sticker_set;
							_tmp17_ = sticker;
							sticker_set_get_icon_info (_tmp16_, _tmp17_, &_tmp18_);
							_g_free0 (tooltip);
							tooltip = _tmp18_;
							_tmp19_ = sticker;
							_tmp20_ = tooltip;
							sticker_inspector_create_image (self, _data64_->fbox, _tmp19_, _tmp20_);
							_g_free0 (tooltip);
						}
						parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
						_g_free0 (sticker);
						_g_object_unref0 (file);
					}
				}
			}
		}
		_g_object_unref0 (files);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
___lambda151__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	__lambda151_ (self, source_object, res);
	block64_data_unref (self);
}

static void
sticker_inspector_import_stickers (StickerInspector* self,
                                   GtkFlowBox* fbox,
                                   const gchar* category)
{
	Block64Data* _data64_;
	GtkFlowBox* _tmp0_;
	gchar* _tmp1_;
	GtkFileDialog* _tmp2_;
	MainWindow* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (fbox != NULL);
	g_return_if_fail (category != NULL);
	_data64_ = g_slice_new0 (Block64Data);
	_data64_->_ref_count_ = 1;
	_data64_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (fbox);
	_g_object_unref0 (_data64_->fbox);
	_data64_->fbox = _tmp0_;
	_tmp1_ = g_strdup (category);
	_g_free0 (_data64_->category);
	_data64_->category = _tmp1_;
	_tmp2_ = utils_make_file_chooser (_ ("Import Sticker(s)"), _ ("Import"));
	_data64_->dialog = _tmp2_;
	_tmp3_ = self->priv->_win;
	gtk_file_dialog_open_multiple (_data64_->dialog, (GtkWindow*) _tmp3_, NULL, ___lambda151__gasync_ready_callback, block64_data_ref (_data64_));
	block64_data_unref (_data64_);
	_data64_ = NULL;
}

static void
sticker_inspector_class_init (StickerInspectorClass * klass,
                              gpointer klass_data)
{
	sticker_inspector_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &StickerInspector_private_offset);
	G_OBJECT_CLASS (klass)->finalize = sticker_inspector_finalize;
}

static void
sticker_inspector_instance_init (StickerInspector * self,
                                 gpointer klass)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	self->priv = sticker_inspector_get_instance_private (self);
	_tmp0_ = g_get_user_data_dir ();
	_tmp1_ = g_build_filename (_tmp0_, "minder", "favorites.xml", NULL);
	self->priv->favorites = _tmp1_;
}

static void
sticker_inspector_finalize (GObject * obj)
{
	StickerInspector * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_STICKER_INSPECTOR, StickerInspector);
	_g_free0 (self->priv->favorites);
	_g_object_unref0 (self->priv->_win);
	_g_object_unref0 (self->priv->_settings);
	_g_object_unref0 (self->priv->_search);
	_g_object_unref0 (self->priv->_stack);
	_g_object_unref0 (self->priv->_favorites);
	_g_object_unref0 (self->priv->_matched_box);
	_g_object_unref0 (self->priv->_dragged_sticker);
	_g_object_unref0 (self->priv->_favorite_menu);
	_g_object_unref0 (self->priv->_builtin_menu);
	_g_object_unref0 (self->priv->_custom_menu);
	_g_object_unref0 (self->priv->_clicked_category);
	_sticker_set_unref0 (self->priv->_sticker_set);
	_g_free0 (self->priv->_clicked_sticker);
	_g_object_unref0 (self->priv->_actions);
	G_OBJECT_CLASS (sticker_inspector_parent_class)->finalize (obj);
}

static GType
sticker_inspector_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (StickerInspectorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sticker_inspector_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (StickerInspector), 0, (GInstanceInitFunc) sticker_inspector_instance_init, NULL };
	GType sticker_inspector_type_id;
	sticker_inspector_type_id = g_type_register_static (gtk_box_get_type (), "StickerInspector", &g_define_type_info, 0);
	StickerInspector_private_offset = g_type_add_instance_private (sticker_inspector_type_id, sizeof (StickerInspectorPrivate));
	return sticker_inspector_type_id;
}

GType
sticker_inspector_get_type (void)
{
	static volatile gsize sticker_inspector_type_id__once = 0;
	if (g_once_init_enter (&sticker_inspector_type_id__once)) {
		GType sticker_inspector_type_id;
		sticker_inspector_type_id = sticker_inspector_get_type_once ();
		g_once_init_leave (&sticker_inspector_type_id__once, sticker_inspector_type_id);
	}
	return sticker_inspector_type_id__once;
}

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

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

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

