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

/*
Copyright (C) 2015 2019 Johan Mattsson

This library is free software; you can redistribute it and/or modify 
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation; either version 3 of the 
License, or (at your option) any later version.

This library 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 
Lesser General Public License for more details.
*/

#include "birdfont.h"
#include <gee.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <cairo-gobject.h>
#include <float.h>
#include <math.h>
#include <gio/gio.h>

#define BIRD_FONT_RECENT_FILES_NEW_FONT -5
#define BIRD_FONT_RECENT_FILES_CURRENT_FONT -4
#define BIRD_FONT_RECENT_FILES_RECENT_FONT -3
#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

enum  {
	BIRD_FONT_RECENT_FILES_0_PROPERTY,
	BIRD_FONT_RECENT_FILES_NUM_PROPERTIES
};
static GParamSpec* bird_font_recent_files_properties[BIRD_FONT_RECENT_FILES_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block55Data Block55Data;

struct _BirdFontRecentFilesPrivate {
	GeeArrayList* rows;
};

struct _Block55Data {
	int _ref_count_;
	BirdFontSaveDialogListener* dialog;
	gchar* fn;
};

static gint BirdFontRecentFiles_private_offset;
static gpointer bird_font_recent_files_parent_class = NULL;

static GeeArrayList* bird_font_recent_files_real_get_rows (BirdFontTable* base);
static void bird_font_recent_files_real_selected_row (BirdFontTable* base,
                                               BirdFontRow* row,
                                               gint column,
                                               gboolean delete_button);
static void bird_font_recent_files_real_update_rows (BirdFontTable* base);
static gchar* bird_font_recent_files_real_get_label (BirdFontFontDisplay* base);
static gchar* bird_font_recent_files_real_get_name (BirdFontFontDisplay* base);
static void bird_font_recent_files_real_draw (BirdFontFontDisplay* base,
                                       BirdFontWidgetAllocation* allocation,
                                       cairo_t* cr);
static Block55Data* block55_data_ref (Block55Data* _data55_);
static void block55_data_unref (void * _userdata_);
static void __lambda310_ (void);
static void ___lambda310__bird_font_load_callback_file_loaded (BirdFontLoadCallback* _sender,
                                                        gpointer self);
static void __lambda311_ (Block55Data* _data55_);
static void ___lambda311__bird_font_save_dialog_listener_signal_discard (BirdFontSaveDialogListener* _sender,
                                                                  gpointer self);
static void __lambda312_ (Block55Data* _data55_);
static void __lambda313_ (Block55Data* _data55_);
static void ___lambda313__bird_font_save_callback_file_saved (BirdFontSaveCallback* _sender,
                                                       gpointer self);
static void ___lambda312__bird_font_save_dialog_listener_signal_save (BirdFontSaveDialogListener* _sender,
                                                               gpointer self);
static void __lambda314_ (void);
static void ___lambda314__bird_font_save_dialog_listener_signal_cancel (BirdFontSaveDialogListener* _sender,
                                                                 gpointer self);
static void bird_font_recent_files_finalize (GObject * obj);
static GType bird_font_recent_files_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 inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
bird_font_recent_files_get_instance_private (BirdFontRecentFiles* self)
{
	return G_STRUCT_MEMBER_P (self, BirdFontRecentFiles_private_offset);
}

BirdFontRecentFiles*
bird_font_recent_files_construct (GType object_type)
{
	BirdFontRecentFiles * self = NULL;
	self = (BirdFontRecentFiles*) bird_font_table_construct (object_type);
	return self;
}

BirdFontRecentFiles*
bird_font_recent_files_new (void)
{
	return bird_font_recent_files_construct (BIRD_FONT_TYPE_RECENT_FILES);
}

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

static GeeArrayList*
bird_font_recent_files_real_get_rows (BirdFontTable* base)
{
	BirdFontRecentFiles * self;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* result;
	self = (BirdFontRecentFiles*) base;
	_tmp0_ = self->priv->rows;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
bird_font_recent_files_real_selected_row (BirdFontTable* base,
                                          BirdFontRow* row,
                                          gint column,
                                          gboolean delete_button)
{
	BirdFontRecentFiles * self;
	self = (BirdFontRecentFiles*) base;
	g_return_if_fail (row != NULL);
	if (bird_font_row_get_index (row) == BIRD_FONT_RECENT_FILES_NEW_FONT) {
		bird_font_menu_tab_new_file ();
		bird_font_menu_tab_select_overview ();
	} else {
		if (bird_font_row_get_index (row) == BIRD_FONT_RECENT_FILES_RECENT_FONT) {
			GObject* _tmp0_;
			GObject* _tmp1_;
			BirdFontFont* f = NULL;
			GObject* _tmp2_;
			BirdFontScrollbar* _tmp3_;
			BirdFontFont* _tmp4_;
			gchar* _tmp5_;
			gchar* _tmp6_;
			_tmp0_ = bird_font_row_get_row_data (row);
			_tmp1_ = _tmp0_;
			g_return_if_fail (BIRD_FONT_IS_FONT (_tmp1_));
			_g_object_unref0 (_tmp1_);
			_tmp2_ = bird_font_row_get_row_data (row);
			f = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, BIRD_FONT_TYPE_FONT, BirdFontFont);
			_tmp3_ = bird_font_main_window_scrollbar;
			bird_font_scrollbar_set_size (_tmp3_, (gdouble) 0);
			bird_font_glyph_canvas_redraw ();
			_tmp4_ = f;
			_tmp5_ = bird_font_font_get_path (_tmp4_);
			_tmp6_ = _tmp5_;
			bird_font_recent_files_load_font (_tmp6_);
			_g_free0 (_tmp6_);
			_g_object_unref0 (f);
		}
	}
	bird_font_glyph_canvas_redraw ();
}

static void
bird_font_recent_files_real_update_rows (BirdFontTable* base)
{
	BirdFontRecentFiles * self;
	BirdFontRow* row = NULL;
	GeeArrayList* recent_fonts = NULL;
	GeeArrayList* _tmp0_;
	BirdFontFont* current_font = NULL;
	BirdFontFont* _tmp1_;
	GeeArrayList* _tmp2_;
	GeeArrayList* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	BirdFontFont* _tmp16_;
	const gchar* _tmp17_;
	GeeArrayList* _tmp50_;
	gint _tmp51_;
	gint _tmp52_;
	self = (BirdFontRecentFiles*) base;
	_tmp0_ = bird_font_recent_files_get_recent_font_files (self);
	recent_fonts = _tmp0_;
	_tmp1_ = bird_font_bird_font_get_current_font ();
	current_font = _tmp1_;
	_tmp2_ = self->priv->rows;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp2_);
	_tmp3_ = recent_fonts;
	_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ == 0) {
		gchar* _tmp6_;
		gchar* _tmp7_;
		BirdFontRow* _tmp8_;
		GeeArrayList* _tmp9_;
		BirdFontRow* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		BirdFontRow* _tmp13_;
		GeeArrayList* _tmp14_;
		BirdFontRow* _tmp15_;
		_tmp6_ = bird_font_t_ ("No fonts created yet");
		_tmp7_ = _tmp6_;
		_tmp8_ = bird_font_row_new_headline (_tmp7_);
		_g_object_unref0 (row);
		row = _tmp8_;
		_g_free0 (_tmp7_);
		_tmp9_ = self->priv->rows;
		_tmp10_ = row;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, _tmp10_);
		_tmp11_ = bird_font_t_ ("Create a New Font");
		_tmp12_ = _tmp11_;
		_tmp13_ = bird_font_row_new_columns_1 (_tmp12_, BIRD_FONT_RECENT_FILES_NEW_FONT, FALSE);
		_g_object_unref0 (row);
		row = _tmp13_;
		_g_free0 (_tmp12_);
		_tmp14_ = self->priv->rows;
		_tmp15_ = row;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp15_);
	}
	_tmp16_ = current_font;
	_tmp17_ = _tmp16_->font_file;
	if (_tmp17_ != NULL) {
		BirdFontFont* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		BirdFontRow* _tmp21_;
		GeeArrayList* _tmp22_;
		BirdFontRow* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		gchar* _tmp26_;
		gchar* _tmp27_;
		BirdFontFont* _tmp28_;
		GFile* _tmp29_;
		GFile* _tmp30_;
		gchar* _tmp31_;
		gchar* _tmp32_;
		gchar* _tmp33_;
		gchar* _tmp34_;
		BirdFontRow* _tmp35_;
		GeeArrayList* _tmp36_;
		BirdFontRow* _tmp37_;
		gchar* _tmp38_;
		gchar* _tmp39_;
		BirdFontFont* _tmp40_;
		gchar* _tmp41_;
		gchar* _tmp42_;
		gchar* _tmp43_;
		gchar* _tmp44_;
		gchar* _tmp45_;
		gchar* _tmp46_;
		BirdFontRow* _tmp47_;
		GeeArrayList* _tmp48_;
		BirdFontRow* _tmp49_;
		_tmp18_ = current_font;
		_tmp19_ = bird_font_font_get_file_name (_tmp18_);
		_tmp20_ = _tmp19_;
		_tmp21_ = bird_font_row_new_headline (_tmp20_);
		_g_object_unref0 (row);
		row = _tmp21_;
		_g_free0 (_tmp20_);
		_tmp22_ = self->priv->rows;
		_tmp23_ = row;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp22_, _tmp23_);
		_tmp24_ = bird_font_t_ ("Folder");
		_tmp25_ = _tmp24_;
		_tmp26_ = g_strconcat (_tmp25_, ": ", NULL);
		_tmp27_ = _tmp26_;
		_tmp28_ = current_font;
		_tmp29_ = bird_font_font_get_folder (_tmp28_);
		_tmp30_ = _tmp29_;
		_tmp31_ = g_file_get_path (_tmp30_);
		_tmp32_ = (gchar*) _tmp31_;
		_tmp33_ = g_strconcat (_tmp27_, _tmp32_, NULL);
		_tmp34_ = _tmp33_;
		_tmp35_ = bird_font_row_new_columns_1 (_tmp34_, BIRD_FONT_RECENT_FILES_CURRENT_FONT, FALSE);
		_g_object_unref0 (row);
		row = _tmp35_;
		_g_free0 (_tmp34_);
		_g_free0 (_tmp32_);
		_g_object_unref0 (_tmp30_);
		_g_free0 (_tmp27_);
		_g_free0 (_tmp25_);
		_tmp36_ = self->priv->rows;
		_tmp37_ = row;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp36_, _tmp37_);
		_tmp38_ = bird_font_t_ ("Glyphs");
		_tmp39_ = _tmp38_;
		_tmp40_ = current_font;
		_tmp41_ = g_strdup_printf ("%u", bird_font_font_length (_tmp40_));
		_tmp42_ = _tmp41_;
		_tmp43_ = g_strconcat (": ", _tmp42_, NULL);
		_tmp44_ = _tmp43_;
		_tmp45_ = g_strconcat (_tmp39_, _tmp44_, NULL);
		_tmp46_ = _tmp45_;
		_tmp47_ = bird_font_row_new_columns_1 (_tmp46_, BIRD_FONT_RECENT_FILES_CURRENT_FONT, FALSE);
		_g_object_unref0 (row);
		row = _tmp47_;
		_g_free0 (_tmp46_);
		_g_free0 (_tmp44_);
		_g_free0 (_tmp42_);
		_g_free0 (_tmp39_);
		_tmp48_ = self->priv->rows;
		_tmp49_ = row;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp48_, _tmp49_);
	}
	_tmp50_ = recent_fonts;
	_tmp51_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp50_);
	_tmp52_ = _tmp51_;
	if (_tmp52_ > 0) {
		gchar* _tmp53_;
		gchar* _tmp54_;
		BirdFontRow* _tmp55_;
		GeeArrayList* _tmp56_;
		BirdFontRow* _tmp57_;
		_tmp53_ = bird_font_t_ ("Recent Files");
		_tmp54_ = _tmp53_;
		_tmp55_ = bird_font_row_new_headline (_tmp54_);
		_g_object_unref0 (row);
		row = _tmp55_;
		_g_free0 (_tmp54_);
		_tmp56_ = self->priv->rows;
		_tmp57_ = row;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp56_, _tmp57_);
	}
	{
		GeeArrayList* _font_list = NULL;
		GeeArrayList* _tmp58_;
		gint _font_size = 0;
		GeeArrayList* _tmp59_;
		gint _tmp60_;
		gint _tmp61_;
		gint _font_index = 0;
		_tmp58_ = recent_fonts;
		_font_list = _tmp58_;
		_tmp59_ = _font_list;
		_tmp60_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp59_);
		_tmp61_ = _tmp60_;
		_font_size = _tmp61_;
		_font_index = -1;
		while (TRUE) {
			gint _tmp62_;
			gint _tmp63_;
			BirdFontFont* font = NULL;
			GeeArrayList* _tmp64_;
			gpointer _tmp65_;
			BirdFontFont* _tmp66_;
			gchar* _tmp67_;
			gchar* _tmp68_;
			BirdFontRow* _tmp69_;
			BirdFontRow* _tmp70_;
			BirdFontFont* _tmp71_;
			GeeArrayList* _tmp72_;
			BirdFontRow* _tmp73_;
			_font_index = _font_index + 1;
			_tmp62_ = _font_index;
			_tmp63_ = _font_size;
			if (!(_tmp62_ < _tmp63_)) {
				break;
			}
			_tmp64_ = _font_list;
			_tmp65_ = gee_abstract_list_get ((GeeAbstractList*) _tmp64_, _font_index);
			font = (BirdFontFont*) _tmp65_;
			_tmp66_ = font;
			_tmp67_ = bird_font_font_get_file_name (_tmp66_);
			_tmp68_ = _tmp67_;
			_tmp69_ = bird_font_row_new_columns_1 (_tmp68_, BIRD_FONT_RECENT_FILES_RECENT_FONT, FALSE);
			_g_object_unref0 (row);
			row = _tmp69_;
			_g_free0 (_tmp68_);
			_tmp70_ = row;
			_tmp71_ = font;
			bird_font_row_set_row_data (_tmp70_, (GObject*) _tmp71_);
			_tmp72_ = self->priv->rows;
			_tmp73_ = row;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp72_, _tmp73_);
			_g_object_unref0 (font);
		}
	}
	bird_font_glyph_canvas_redraw ();
	_g_object_unref0 (current_font);
	_g_object_unref0 (recent_fonts);
	_g_object_unref0 (row);
}

static gchar*
bird_font_recent_files_real_get_label (BirdFontFontDisplay* base)
{
	BirdFontRecentFiles * self;
	gchar* _tmp0_;
	gchar* result;
	self = (BirdFontRecentFiles*) base;
	_tmp0_ = bird_font_t_ ("Files");
	result = _tmp0_;
	return result;
}

static gchar*
bird_font_recent_files_real_get_name (BirdFontFontDisplay* base)
{
	BirdFontRecentFiles * self;
	gchar* _tmp0_;
	gchar* result;
	self = (BirdFontRecentFiles*) base;
	_tmp0_ = g_strdup ("Files");
	result = _tmp0_;
	return result;
}

GeeArrayList*
bird_font_recent_files_get_recent_font_files (BirdFontRecentFiles* self)
{
	GFile* file = NULL;
	BirdFontFont* font = NULL;
	gboolean unique = FALSE;
	GeeArrayList* fonts = NULL;
	GeeArrayList* _tmp0_;
	gint _tmp1_ = 0;
	gchar** _tmp2_;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (BIRD_FONT_TYPE_FONT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	fonts = _tmp0_;
	_tmp2_ = bird_font_preferences_get_recent_files (&_tmp1_);
	{
		gchar** f_collection = NULL;
		gint f_collection_length1 = 0;
		gint _f_collection_size_ = 0;
		gint f_it = 0;
		f_collection = _tmp2_;
		f_collection_length1 = _tmp1_;
		for (f_it = 0; f_it < f_collection_length1; f_it = f_it + 1) {
			gchar* _tmp3_;
			gchar* f = NULL;
			_tmp3_ = g_strdup (f_collection[f_it]);
			f = _tmp3_;
			{
				const gchar* _tmp4_;
				const gchar* _tmp5_;
				GFile* _tmp6_;
				BirdFontFont* _tmp7_;
				BirdFontFont* _tmp8_;
				const gchar* _tmp9_;
				gboolean _tmp23_ = FALSE;
				_tmp4_ = f;
				if (g_strcmp0 (_tmp4_, "") == 0) {
					_g_free0 (f);
					continue;
				}
				_tmp5_ = f;
				_tmp6_ = g_file_new_for_path (_tmp5_);
				_g_object_unref0 (file);
				file = _tmp6_;
				_tmp7_ = bird_font_font_new ();
				_g_object_unref0 (font);
				font = _tmp7_;
				_tmp8_ = font;
				_tmp9_ = f;
				bird_font_font_set_font_file (_tmp8_, _tmp9_);
				unique = TRUE;
				{
					GeeArrayList* _recent_font_list = NULL;
					GeeArrayList* _tmp10_;
					gint _recent_font_size = 0;
					GeeArrayList* _tmp11_;
					gint _tmp12_;
					gint _tmp13_;
					gint _recent_font_index = 0;
					_tmp10_ = fonts;
					_recent_font_list = _tmp10_;
					_tmp11_ = _recent_font_list;
					_tmp12_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp11_);
					_tmp13_ = _tmp12_;
					_recent_font_size = _tmp13_;
					_recent_font_index = -1;
					while (TRUE) {
						gint _tmp14_;
						gint _tmp15_;
						BirdFontFont* recent_font = NULL;
						GeeArrayList* _tmp16_;
						gpointer _tmp17_;
						BirdFontFont* _tmp18_;
						gchar* _tmp19_;
						gchar* _tmp20_;
						const gchar* _tmp21_;
						gboolean _tmp22_;
						_recent_font_index = _recent_font_index + 1;
						_tmp14_ = _recent_font_index;
						_tmp15_ = _recent_font_size;
						if (!(_tmp14_ < _tmp15_)) {
							break;
						}
						_tmp16_ = _recent_font_list;
						_tmp17_ = gee_abstract_list_get ((GeeAbstractList*) _tmp16_, _recent_font_index);
						recent_font = (BirdFontFont*) _tmp17_;
						_tmp18_ = recent_font;
						_tmp19_ = bird_font_font_get_path (_tmp18_);
						_tmp20_ = _tmp19_;
						_tmp21_ = f;
						_tmp22_ = g_strcmp0 (_tmp20_, _tmp21_) == 0;
						_g_free0 (_tmp20_);
						if (_tmp22_) {
							unique = FALSE;
						}
						_g_object_unref0 (recent_font);
					}
				}
				if (unique) {
					GFile* _tmp24_;
					_tmp24_ = file;
					_tmp23_ = g_file_query_exists (_tmp24_, NULL);
				} else {
					_tmp23_ = FALSE;
				}
				if (_tmp23_) {
					GeeArrayList* _tmp25_;
					BirdFontFont* _tmp26_;
					_tmp25_ = fonts;
					_tmp26_ = font;
					gee_abstract_list_insert ((GeeAbstractList*) _tmp25_, 0, _tmp26_);
				}
				_g_free0 (f);
			}
		}
		f_collection = (_vala_array_free (f_collection, f_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	result = fonts;
	_g_object_unref0 (font);
	_g_object_unref0 (file);
	return result;
}

static void
bird_font_recent_files_real_draw (BirdFontFontDisplay* base,
                                  BirdFontWidgetAllocation* allocation,
                                  cairo_t* cr)
{
	BirdFontRecentFiles * self;
	BirdFontOverview* _tmp0_;
	BirdFontOverview* _tmp1_;
	BirdFontWidgetAllocation* _tmp2_;
	self = (BirdFontRecentFiles*) base;
	g_return_if_fail (allocation != NULL);
	g_return_if_fail (cr != NULL);
	_tmp0_ = bird_font_main_window_get_overview ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (allocation);
	_g_object_unref0 (_tmp1_->allocation);
	_tmp1_->allocation = _tmp2_;
	_g_object_unref0 (_tmp1_);
	BIRD_FONT_FONT_DISPLAY_CLASS (bird_font_recent_files_parent_class)->draw ((BirdFontFontDisplay*) G_TYPE_CHECK_INSTANCE_CAST (self, BIRD_FONT_TYPE_TABLE, BirdFontTable), allocation, cr);
}

static Block55Data*
block55_data_ref (Block55Data* _data55_)
{
	g_atomic_int_inc (&_data55_->_ref_count_);
	return _data55_;
}

static void
block55_data_unref (void * _userdata_)
{
	Block55Data* _data55_;
	_data55_ = (Block55Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data55_->_ref_count_)) {
		_g_object_unref0 (_data55_->dialog);
		_g_free0 (_data55_->fn);
		g_slice_free (Block55Data, _data55_);
	}
}

static void
__lambda310_ (void)
{
	BirdFontFont* f = NULL;
	BirdFontFont* _tmp0_;
	BirdFontDrawingTools* _tmp1_;
	BirdFontDrawingTools* _tmp2_;
	BirdFontSpinButton* _tmp15_;
	BirdFontFont* _tmp16_;
	const gchar* _tmp17_;
	BirdFontFont* _tmp18_;
	BirdFontOverview* _tmp19_;
	BirdFontOverview* _tmp20_;
	if (bird_font_menu_tab_has_suppress_event ()) {
		g_warning ("RecentFiles.vala:149: Load font event suppressed.");
		_g_object_unref0 (f);
		return;
	}
	_tmp0_ = bird_font_bird_font_get_current_font ();
	_g_object_unref0 (f);
	f = _tmp0_;
	_tmp1_ = bird_font_main_window_get_drawing_tools ();
	_tmp2_ = _tmp1_;
	bird_font_drawing_tools_remove_all_grid_buttons (_tmp2_);
	_g_object_unref0 (_tmp2_);
	{
		GeeArrayList* _v_list = NULL;
		BirdFontFont* _tmp3_;
		GeeArrayList* _tmp4_;
		gint _v_size = 0;
		GeeArrayList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _v_index = 0;
		_tmp3_ = f;
		_tmp4_ = _tmp3_->grid_width;
		_v_list = _tmp4_;
		_tmp5_ = _v_list;
		_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_v_size = _tmp7_;
		_v_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			gchar* v = NULL;
			GeeArrayList* _tmp10_;
			gpointer _tmp11_;
			BirdFontDrawingTools* _tmp12_;
			BirdFontDrawingTools* _tmp13_;
			const gchar* _tmp14_;
			_v_index = _v_index + 1;
			_tmp8_ = _v_index;
			_tmp9_ = _v_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _v_list;
			_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _v_index);
			v = (gchar*) _tmp11_;
			_tmp12_ = bird_font_main_window_get_drawing_tools ();
			_tmp13_ = _tmp12_;
			_tmp14_ = v;
			bird_font_drawing_tools_parse_grid (_tmp13_, _tmp14_);
			_g_object_unref0 (_tmp13_);
			_g_free0 (v);
		}
	}
	_tmp15_ = bird_font_drawing_tools_background_scale;
	_tmp16_ = f;
	_tmp17_ = _tmp16_->background_scale;
	bird_font_spin_button_set_value (_tmp15_, _tmp17_, TRUE, TRUE);
	bird_font_kerning_tools_update_kerning_classes ();
	_tmp18_ = f;
	bird_font_menu_tab_apply_font_setting (_tmp18_);
	bird_font_menu_tab_show_default_characters ();
	_tmp19_ = bird_font_main_window_get_overview ();
	_tmp20_ = _tmp19_;
	bird_font_font_display_selected_canvas ((BirdFontFontDisplay*) _tmp20_);
	_g_object_unref0 (_tmp20_);
	_g_object_unref0 (f);
}

static void
___lambda310__bird_font_load_callback_file_loaded (BirdFontLoadCallback* _sender,
                                                   gpointer self)
{
	__lambda310_ ();
}

static void
__lambda311_ (Block55Data* _data55_)
{
	BirdFontFont* f = NULL;
	BirdFontFont* _tmp0_;
	BirdFontFont* _tmp1_;
	BirdFontNativeWindow* _tmp2_;
	if (bird_font_menu_tab_has_suppress_event ()) {
		_g_object_unref0 (f);
		return;
	}
	_tmp0_ = bird_font_bird_font_new_font ();
	_g_object_unref0 (f);
	f = _tmp0_;
	bird_font_main_window_close_all_tabs ();
	bird_font_menu_tab_clear_font_settings ();
	_tmp1_ = f;
	bird_font_font_set_file (_tmp1_, _data55_->fn);
	if (!g_str_has_suffix (_data55_->fn, ".bf_backup")) {
		bird_font_preferences_add_recent_files (_data55_->fn);
	}
	_tmp2_ = bird_font_main_window_native_window;
	bird_font_native_window_load (_tmp2_);
	_g_object_unref0 (f);
}

static void
___lambda311__bird_font_save_dialog_listener_signal_discard (BirdFontSaveDialogListener* _sender,
                                                             gpointer self)
{
	__lambda311_ (self);
}

static void
__lambda313_ (Block55Data* _data55_)
{
	BirdFontSaveDialogListener* _tmp0_;
	_tmp0_ = _data55_->dialog;
	g_signal_emit_by_name (_tmp0_, "signal-discard");
}

static void
___lambda313__bird_font_save_callback_file_saved (BirdFontSaveCallback* _sender,
                                                  gpointer self)
{
	__lambda313_ (self);
}

static void
__lambda312_ (Block55Data* _data55_)
{
	BirdFontSaveCallback* _tmp0_;
	BirdFontSaveCallback* _tmp1_;
	BirdFontSaveCallback* _tmp2_;
	BirdFontSaveCallback* _tmp3_;
	if (bird_font_menu_tab_has_suppress_event ()) {
		bird_font_warn_if_test ("Event suppressed.");
		return;
	}
	_tmp0_ = bird_font_save_callback_new ();
	_tmp1_ = _tmp0_;
	bird_font_menu_tab_set_save_callback (_tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = bird_font_menu_tab_save_callback;
	g_signal_connect_data (_tmp2_, "file-saved", (GCallback) ___lambda313__bird_font_save_callback_file_saved, block55_data_ref (_data55_), (GClosureNotify) block55_data_unref, 0);
	_tmp3_ = bird_font_menu_tab_save_callback;
	bird_font_save_callback_save (_tmp3_);
}

static void
___lambda312__bird_font_save_dialog_listener_signal_save (BirdFontSaveDialogListener* _sender,
                                                          gpointer self)
{
	__lambda312_ (self);
}

static void
__lambda314_ (void)
{
	bird_font_main_window_hide_dialog ();
}

static void
___lambda314__bird_font_save_dialog_listener_signal_cancel (BirdFontSaveDialogListener* _sender,
                                                            gpointer self)
{
	__lambda314_ ();
}

void
bird_font_recent_files_load_font (const gchar* fn)
{
	Block55Data* _data55_;
	gchar* _tmp0_;
	BirdFontFont* font = NULL;
	BirdFontSaveDialogListener* _tmp1_;
	BirdFontFont* _tmp2_;
	BirdFontLoadCallback* _tmp3_;
	BirdFontLoadCallback* _tmp4_;
	BirdFontSaveDialogListener* _tmp5_;
	BirdFontSaveDialogListener* _tmp6_;
	BirdFontSaveDialogListener* _tmp7_;
	BirdFontFont* _tmp8_;
	g_return_if_fail (fn != NULL);
	_data55_ = g_slice_new0 (Block55Data);
	_data55_->_ref_count_ = 1;
	_tmp0_ = g_strdup (fn);
	_g_free0 (_data55_->fn);
	_data55_->fn = _tmp0_;
	_tmp1_ = bird_font_save_dialog_listener_new ();
	_data55_->dialog = _tmp1_;
	if (bird_font_menu_tab_has_suppress_event ()) {
		_g_object_unref0 (font);
		block55_data_unref (_data55_);
		_data55_ = NULL;
		return;
	}
	_tmp2_ = bird_font_bird_font_get_current_font ();
	_g_object_unref0 (font);
	font = _tmp2_;
	_tmp3_ = bird_font_load_callback_new ();
	_g_object_unref0 (bird_font_menu_tab_load_callback);
	bird_font_menu_tab_load_callback = _tmp3_;
	_tmp4_ = bird_font_menu_tab_load_callback;
	g_signal_connect (_tmp4_, "file-loaded", (GCallback) ___lambda310__bird_font_load_callback_file_loaded, NULL);
	_tmp5_ = _data55_->dialog;
	g_signal_connect_data (_tmp5_, "signal-discard", (GCallback) ___lambda311__bird_font_save_dialog_listener_signal_discard, block55_data_ref (_data55_), (GClosureNotify) block55_data_unref, 0);
	_tmp6_ = _data55_->dialog;
	g_signal_connect_data (_tmp6_, "signal-save", (GCallback) ___lambda312__bird_font_save_dialog_listener_signal_save, block55_data_ref (_data55_), (GClosureNotify) block55_data_unref, 0);
	_tmp7_ = _data55_->dialog;
	g_signal_connect (_tmp7_, "signal-cancel", (GCallback) ___lambda314__bird_font_save_dialog_listener_signal_cancel, NULL);
	_tmp8_ = font;
	if (!bird_font_font_is_modified (_tmp8_)) {
		BirdFontSaveDialogListener* _tmp9_;
		_tmp9_ = _data55_->dialog;
		g_signal_emit_by_name (_tmp9_, "signal-discard");
	} else {
		BirdFontSaveDialogListener* _tmp10_;
		BirdFontSaveDialog* _tmp11_;
		BirdFontSaveDialog* _tmp12_;
		_tmp10_ = _data55_->dialog;
		_tmp11_ = bird_font_save_dialog_new (_tmp10_);
		_tmp12_ = _tmp11_;
		bird_font_main_window_show_dialog ((BirdFontDialog*) _tmp12_);
		_g_object_unref0 (_tmp12_);
	}
	_g_object_unref0 (font);
	block55_data_unref (_data55_);
	_data55_ = NULL;
}

static void
bird_font_recent_files_class_init (BirdFontRecentFilesClass * klass,
                                   gpointer klass_data)
{
	bird_font_recent_files_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BirdFontRecentFiles_private_offset);
	((BirdFontTableClass *) klass)->get_rows = (GeeArrayList* (*) (BirdFontTable*)) bird_font_recent_files_real_get_rows;
	((BirdFontTableClass *) klass)->selected_row = (void (*) (BirdFontTable*, BirdFontRow*, gint, gboolean)) bird_font_recent_files_real_selected_row;
	((BirdFontTableClass *) klass)->update_rows = (void (*) (BirdFontTable*)) bird_font_recent_files_real_update_rows;
	((BirdFontFontDisplayClass *) klass)->get_label = (gchar* (*) (BirdFontFontDisplay*)) bird_font_recent_files_real_get_label;
	((BirdFontFontDisplayClass *) klass)->get_name = (gchar* (*) (BirdFontFontDisplay*)) bird_font_recent_files_real_get_name;
	((BirdFontFontDisplayClass *) klass)->draw = (void (*) (BirdFontFontDisplay*, BirdFontWidgetAllocation*, cairo_t*)) bird_font_recent_files_real_draw;
	G_OBJECT_CLASS (klass)->finalize = bird_font_recent_files_finalize;
}

static void
bird_font_recent_files_instance_init (BirdFontRecentFiles * self,
                                      gpointer klass)
{
	GeeArrayList* _tmp0_;
	self->priv = bird_font_recent_files_get_instance_private (self);
	_tmp0_ = gee_array_list_new (BIRD_FONT_TYPE_ROW, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->rows = _tmp0_;
}

static void
bird_font_recent_files_finalize (GObject * obj)
{
	BirdFontRecentFiles * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BIRD_FONT_TYPE_RECENT_FILES, BirdFontRecentFiles);
	_g_object_unref0 (self->priv->rows);
	G_OBJECT_CLASS (bird_font_recent_files_parent_class)->finalize (obj);
}

/** A list of recently edited fonts. */
static GType
bird_font_recent_files_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontRecentFilesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_recent_files_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdFontRecentFiles), 0, (GInstanceInitFunc) bird_font_recent_files_instance_init, NULL };
	GType bird_font_recent_files_type_id;
	bird_font_recent_files_type_id = g_type_register_static (BIRD_FONT_TYPE_TABLE, "BirdFontRecentFiles", &g_define_type_info, 0);
	BirdFontRecentFiles_private_offset = g_type_add_instance_private (bird_font_recent_files_type_id, sizeof (BirdFontRecentFilesPrivate));
	return bird_font_recent_files_type_id;
}

GType
bird_font_recent_files_get_type (void)
{
	static volatile gsize bird_font_recent_files_type_id__once = 0;
	if (g_once_init_enter (&bird_font_recent_files_type_id__once)) {
		GType bird_font_recent_files_type_id;
		bird_font_recent_files_type_id = bird_font_recent_files_get_type_once ();
		g_once_init_leave (&bird_font_recent_files_type_id__once, bird_font_recent_files_type_id);
	}
	return bird_font_recent_files_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 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;
}

