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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * 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 3 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: Alain M. <alainmh23@gmail.com>
 */

#include "planify.h"
#include <gtk/gtk.h>
#include <gee.h>
#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <adwaita.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.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

enum  {
	WIDGETS_PROJECT_PICKER_CORE_0_PROPERTY,
	WIDGETS_PROJECT_PICKER_CORE_SOURCE_PROPERTY,
	WIDGETS_PROJECT_PICKER_CORE_NUM_PROPERTIES
};
static GParamSpec* widgets_project_picker_core_properties[WIDGETS_PROJECT_PICKER_CORE_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 _Block38Data Block38Data;
typedef struct _Block39Data Block39Data;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
enum  {
	WIDGETS_PROJECT_PICKER_CORE_SELECTED_SIGNAL,
	WIDGETS_PROJECT_PICKER_CORE_CLOSE_SIGNAL,
	WIDGETS_PROJECT_PICKER_CORE_NUM_SIGNALS
};
static guint widgets_project_picker_core_signals[WIDGETS_PROJECT_PICKER_CORE_NUM_SIGNALS] = {0};

struct _WidgetsProjectPickerCorePrivate {
	ObjectsSource* _source;
	GtkListBox* listbox;
	GtkRevealer* search_entry_revealer;
	ObjectsProject* _selected_project;
	GeeHashMap* signal_map;
};

struct _Block38Data {
	int _ref_count_;
	WidgetsProjectPickerCore* self;
	WidgetsProjectPickerProjectPickerRow* row;
};

struct _Block39Data {
	int _ref_count_;
	WidgetsProjectPickerCore* self;
	GtkSearchEntry* search_entry;
	GtkScrolledWindow* scrolled_window;
};

static gint WidgetsProjectPickerCore_private_offset;
static gpointer widgets_project_picker_core_parent_class = NULL;

static void widgets_project_picker_core_add_projects (WidgetsProjectPickerCore* self);
static GtkWidget* widgets_project_picker_core_build_project_row (WidgetsProjectPickerCore* self,
                                                          ObjectsProject* project);
static Block38Data* block38_data_ref (Block38Data* _data38_);
static void block38_data_unref (void * _userdata_);
static void __lambda112_ (Block38Data* _data38_);
static void widgets_project_picker_core_update_selected_project (WidgetsProjectPickerCore* self,
                                                          ObjectsProject* project);
static void ___lambda112__widgets_project_picker_project_picker_row_selected (WidgetsProjectPickerProjectPickerRow* _sender,
                                                                       gpointer self);
static gint widgets_project_picker_core_sort_source_function (WidgetsProjectPickerCore* self,
                                                       GtkListBoxRow* row1,
                                                       GtkListBoxRow* row2);
static void widgets_project_picker_core_header_project_function (WidgetsProjectPickerCore* self,
                                                          GtkListBoxRow* lbrow,
                                                          GtkListBoxRow* lbbefore);
static GtkWidget* widgets_project_picker_core_get_header_box (WidgetsProjectPickerCore* self,
                                                       const gchar* title);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static GObject * widgets_project_picker_core_constructor (GType type,
                                                   guint n_construct_properties,
                                                   GObjectConstructParam * construct_properties);
static Block39Data* block39_data_ref (Block39Data* _data39_);
static void block39_data_unref (void * _userdata_);
static gint _widgets_project_picker_core_sort_source_function_gtk_list_box_sort_func (GtkListBoxRow* row1,
                                                                               GtkListBoxRow* row2,
                                                                               gpointer self);
static void _widgets_project_picker_core_header_project_function_gtk_list_box_update_header_func (GtkListBoxRow* row,
                                                                                           GtkListBoxRow* before,
                                                                                           gpointer self);
static gboolean _widgets_project_picker_core___lambda113_ (Block39Data* _data39_,
                                                    GtkListBoxRow* row);
static gboolean __widgets_project_picker_core___lambda113__gtk_list_box_filter_func (GtkListBoxRow* row,
                                                                              gpointer self);
static void _widgets_project_picker_core___lambda114_ (Block39Data* _data39_);
static void __widgets_project_picker_core___lambda114__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                                                 gpointer self);
static void _widgets_project_picker_core___lambda115_ (WidgetsProjectPickerCore* self,
                                                GtkListBoxRow* row);
static void __widgets_project_picker_core___lambda115__gtk_list_box_row_activated (GtkListBox* _sender,
                                                                            GtkListBoxRow* row,
                                                                            gpointer self);
static gboolean _widgets_project_picker_core___lambda116_ (Block39Data* _data39_,
                                                    guint keyval,
                                                    guint keycode,
                                                    GdkModifierType state);
static gboolean __widgets_project_picker_core___lambda116__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                                          guint keyval,
                                                                                          guint keycode,
                                                                                          GdkModifierType state,
                                                                                          gpointer self);
static gboolean _widgets_project_picker_core___lambda117_ (WidgetsProjectPickerCore* self,
                                                    guint keyval,
                                                    guint keycode,
                                                    GdkModifierType state);
static gboolean __widgets_project_picker_core___lambda117__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                                          guint keyval,
                                                                                          guint keycode,
                                                                                          GdkModifierType state,
                                                                                          gpointer self);
static void widgets_project_picker_core_finalize (GObject * obj);
static GType widgets_project_picker_core_get_type_once (void);
static void _vala_widgets_project_picker_core_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec);
static void _vala_widgets_project_picker_core_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
widgets_project_picker_core_get_instance_private (WidgetsProjectPickerCore* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsProjectPickerCore_private_offset);
}

WidgetsProjectPickerCore*
widgets_project_picker_core_construct (GType object_type,
                                       ObjectsSource* source)
{
	WidgetsProjectPickerCore * self = NULL;
	self = (WidgetsProjectPickerCore*) g_object_new (object_type, "source", source, NULL);
	return self;
}

WidgetsProjectPickerCore*
widgets_project_picker_core_new (ObjectsSource* source)
{
	return widgets_project_picker_core_construct (WIDGETS_TYPE_PROJECT_PICKER_CORE, source);
}

static void
widgets_project_picker_core_add_projects (WidgetsProjectPickerCore* self)
{
	ObjectsProject* inbox_project = NULL;
	ServicesStore* _tmp0_;
	ServicesSettings* _tmp1_;
	ServicesSettings* _tmp2_;
	GSettings* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	ObjectsProject* _tmp6_;
	ObjectsProject* _tmp7_;
	ObjectsSource* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_store_instance ();
	_tmp1_ = services_settings_get_default ();
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_->settings;
	_tmp4_ = g_settings_get_string (_tmp3_, "local-inbox-project-id");
	_tmp5_ = _tmp4_;
	_tmp6_ = services_store_get_project (_tmp0_, _tmp5_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	_g_object_unref0 (_tmp2_);
	inbox_project = _tmp7_;
	_tmp8_ = self->priv->_source;
	if (_tmp8_ == NULL) {
		GtkListBox* _tmp9_;
		ObjectsProject* _tmp10_;
		GtkWidget* _tmp11_;
		GtkWidget* _tmp12_;
		_tmp9_ = self->priv->listbox;
		_tmp10_ = inbox_project;
		_tmp11_ = widgets_project_picker_core_build_project_row (self, _tmp10_);
		_tmp12_ = _tmp11_;
		gtk_list_box_append (_tmp9_, _tmp12_);
		_g_object_unref0 (_tmp12_);
	}
	{
		GeeArrayList* _project_list = NULL;
		ServicesStore* _tmp13_;
		GeeArrayList* _tmp14_;
		GeeArrayList* _tmp15_;
		gint _project_size = 0;
		GeeArrayList* _tmp16_;
		gint _tmp17_;
		gint _tmp18_;
		gint _project_index = 0;
		_tmp13_ = services_store_instance ();
		_tmp14_ = services_store_get_projects (_tmp13_);
		_tmp15_ = _tmp14_;
		_project_list = _tmp15_;
		_tmp16_ = _project_list;
		_tmp17_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp16_);
		_tmp18_ = _tmp17_;
		_project_size = _tmp18_;
		_project_index = -1;
		while (TRUE) {
			gint _tmp19_;
			gint _tmp20_;
			ObjectsProject* project = NULL;
			GeeArrayList* _tmp21_;
			gpointer _tmp22_;
			gboolean _tmp23_ = FALSE;
			ObjectsSource* _tmp24_;
			gboolean _tmp33_ = FALSE;
			gboolean _tmp34_ = FALSE;
			ObjectsProject* _tmp35_;
			ObjectsSource* _tmp36_;
			ObjectsSource* _tmp37_;
			gboolean _tmp38_;
			gboolean _tmp39_;
			GtkListBox* _tmp49_;
			ObjectsProject* _tmp50_;
			GtkWidget* _tmp51_;
			GtkWidget* _tmp52_;
			_project_index = _project_index + 1;
			_tmp19_ = _project_index;
			_tmp20_ = _project_size;
			if (!(_tmp19_ < _tmp20_)) {
				break;
			}
			_tmp21_ = _project_list;
			_tmp22_ = gee_abstract_list_get ((GeeAbstractList*) _tmp21_, _project_index);
			project = (ObjectsProject*) _tmp22_;
			_tmp24_ = self->priv->_source;
			if (_tmp24_ != NULL) {
				ObjectsSource* _tmp25_;
				const gchar* _tmp26_;
				const gchar* _tmp27_;
				ObjectsProject* _tmp28_;
				ObjectsSource* _tmp29_;
				ObjectsSource* _tmp30_;
				const gchar* _tmp31_;
				const gchar* _tmp32_;
				_tmp25_ = self->priv->_source;
				_tmp26_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp25_);
				_tmp27_ = _tmp26_;
				_tmp28_ = project;
				_tmp29_ = objects_project_get_source (_tmp28_);
				_tmp30_ = _tmp29_;
				_tmp31_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp30_);
				_tmp32_ = _tmp31_;
				_tmp23_ = g_strcmp0 (_tmp27_, _tmp32_) != 0;
			} else {
				_tmp23_ = FALSE;
			}
			if (_tmp23_) {
				_g_object_unref0 (project);
				continue;
			}
			_tmp35_ = project;
			_tmp36_ = objects_project_get_source (_tmp35_);
			_tmp37_ = _tmp36_;
			_tmp38_ = objects_source_get_is_visible (_tmp37_);
			_tmp39_ = _tmp38_;
			if (!_tmp39_) {
				_tmp34_ = TRUE;
			} else {
				ObjectsProject* _tmp40_;
				gboolean _tmp41_;
				gboolean _tmp42_;
				_tmp40_ = project;
				_tmp41_ = objects_project_get_is_archived (_tmp40_);
				_tmp42_ = _tmp41_;
				_tmp34_ = _tmp42_;
			}
			if (_tmp34_) {
				_tmp33_ = TRUE;
			} else {
				ObjectsProject* _tmp43_;
				const gchar* _tmp44_;
				const gchar* _tmp45_;
				ObjectsProject* _tmp46_;
				const gchar* _tmp47_;
				const gchar* _tmp48_;
				_tmp43_ = project;
				_tmp44_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp43_);
				_tmp45_ = _tmp44_;
				_tmp46_ = inbox_project;
				_tmp47_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp46_);
				_tmp48_ = _tmp47_;
				_tmp33_ = g_strcmp0 (_tmp45_, _tmp48_) == 0;
			}
			if (_tmp33_) {
				_g_object_unref0 (project);
				continue;
			}
			_tmp49_ = self->priv->listbox;
			_tmp50_ = project;
			_tmp51_ = widgets_project_picker_core_build_project_row (self, _tmp50_);
			_tmp52_ = _tmp51_;
			gtk_list_box_append (_tmp49_, _tmp52_);
			_g_object_unref0 (_tmp52_);
			_g_object_unref0 (project);
		}
	}
	_g_object_unref0 (inbox_project);
}

static Block38Data*
block38_data_ref (Block38Data* _data38_)
{
	g_atomic_int_inc (&_data38_->_ref_count_);
	return _data38_;
}

static void
block38_data_unref (void * _userdata_)
{
	Block38Data* _data38_;
	_data38_ = (Block38Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data38_->_ref_count_)) {
		WidgetsProjectPickerCore* self;
		self = _data38_->self;
		_g_object_unref0 (_data38_->row);
		_g_object_unref0 (self);
		g_slice_free (Block38Data, _data38_);
	}
}

static void
__lambda112_ (Block38Data* _data38_)
{
	WidgetsProjectPickerCore* self;
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	ObjectsProject* _tmp2_;
	self = _data38_->self;
	_tmp0_ = widgets_project_picker_project_picker_row_get_project (_data38_->row);
	_tmp1_ = _tmp0_;
	widgets_project_picker_core_update_selected_project (self, _tmp1_);
	_tmp2_ = self->priv->_selected_project;
	g_signal_emit (self, widgets_project_picker_core_signals[WIDGETS_PROJECT_PICKER_CORE_SELECTED_SIGNAL], 0, _tmp2_);
	g_signal_emit (self, widgets_project_picker_core_signals[WIDGETS_PROJECT_PICKER_CORE_CLOSE_SIGNAL], 0);
}

static void
___lambda112__widgets_project_picker_project_picker_row_selected (WidgetsProjectPickerProjectPickerRow* _sender,
                                                                  gpointer self)
{
	__lambda112_ (self);
}

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

static GtkWidget*
widgets_project_picker_core_build_project_row (WidgetsProjectPickerCore* self,
                                               ObjectsProject* project)
{
	Block38Data* _data38_;
	WidgetsProjectPickerProjectPickerRow* _tmp0_;
	GeeHashMap* _tmp1_;
	gulong _tmp2_;
	GtkWidget* _tmp3_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (project != NULL, NULL);
	_data38_ = g_slice_new0 (Block38Data);
	_data38_->_ref_count_ = 1;
	_data38_->self = g_object_ref (self);
	_tmp0_ = widgets_project_picker_project_picker_row_new (project);
	g_object_ref_sink (_tmp0_);
	_data38_->row = _tmp0_;
	_tmp1_ = self->priv->signal_map;
	_tmp2_ = g_signal_connect_data (_data38_->row, "selected", (GCallback) ___lambda112__widgets_project_picker_project_picker_row_selected, block38_data_ref (_data38_), (GClosureNotify) block38_data_unref, 0);
	gee_abstract_map_set ((GeeAbstractMap*) _tmp1_, (gpointer) ((guintptr) _tmp2_), (GObject*) _data38_->row);
	_tmp3_ = _g_object_ref0 ((GtkWidget*) _data38_->row);
	result = _tmp3_;
	block38_data_unref (_data38_);
	_data38_ = NULL;
	return result;
}

static gint
widgets_project_picker_core_sort_source_function (WidgetsProjectPickerCore* self,
                                                  GtkListBoxRow* row1,
                                                  GtkListBoxRow* row2)
{
	ObjectsProject* project1 = NULL;
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	ObjectsProject* _tmp2_;
	ObjectsProject* project2 = NULL;
	ObjectsProject* _tmp3_;
	ObjectsProject* _tmp4_;
	ObjectsProject* _tmp5_;
	gboolean _tmp6_ = FALSE;
	ObjectsProject* _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp13_ = FALSE;
	ObjectsProject* _tmp14_;
	gboolean _tmp15_;
	gboolean _tmp16_;
	ObjectsProject* _tmp20_;
	ObjectsSource* _tmp21_;
	ObjectsSource* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	ObjectsProject* _tmp25_;
	ObjectsSource* _tmp26_;
	ObjectsSource* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (row1 != NULL, -1);
	_tmp0_ = widgets_project_picker_project_picker_row_get_project (G_TYPE_CHECK_INSTANCE_CAST (row1, WIDGETS_PROJECT_PICKER_TYPE_PROJECT_PICKER_ROW, WidgetsProjectPickerProjectPickerRow));
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	project1 = _tmp2_;
	_tmp3_ = widgets_project_picker_project_picker_row_get_project (G_TYPE_CHECK_INSTANCE_CAST (row2, WIDGETS_PROJECT_PICKER_TYPE_PROJECT_PICKER_ROW, WidgetsProjectPickerProjectPickerRow));
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	project2 = _tmp5_;
	_tmp7_ = project1;
	_tmp8_ = objects_project_get_is_inbox_project (_tmp7_);
	_tmp9_ = _tmp8_;
	if (_tmp9_) {
		ObjectsProject* _tmp10_;
		gboolean _tmp11_;
		gboolean _tmp12_;
		_tmp10_ = project2;
		_tmp11_ = objects_project_get_is_inbox_project (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp6_ = !_tmp12_;
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		result = -1;
		_g_object_unref0 (project2);
		_g_object_unref0 (project1);
		return result;
	}
	_tmp14_ = project1;
	_tmp15_ = objects_project_get_is_inbox_project (_tmp14_);
	_tmp16_ = _tmp15_;
	if (!_tmp16_) {
		ObjectsProject* _tmp17_;
		gboolean _tmp18_;
		gboolean _tmp19_;
		_tmp17_ = project2;
		_tmp18_ = objects_project_get_is_inbox_project (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp13_ = _tmp19_;
	} else {
		_tmp13_ = FALSE;
	}
	if (_tmp13_) {
		result = 1;
		_g_object_unref0 (project2);
		_g_object_unref0 (project1);
		return result;
	}
	_tmp20_ = project2;
	_tmp21_ = objects_project_get_source (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = project1;
	_tmp26_ = objects_project_get_source (_tmp25_);
	_tmp27_ = _tmp26_;
	_tmp28_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp27_);
	_tmp29_ = _tmp28_;
	result = g_utf8_collate (_tmp24_, _tmp29_);
	_g_object_unref0 (project2);
	_g_object_unref0 (project1);
	return result;
}

static void
widgets_project_picker_core_header_project_function (WidgetsProjectPickerCore* self,
                                                     GtkListBoxRow* lbrow,
                                                     GtkListBoxRow* lbbefore)
{
	WidgetsProjectPickerProjectPickerRow* row = NULL;
	WidgetsProjectPickerProjectPickerRow* _tmp0_;
	WidgetsProjectPickerProjectPickerRow* _tmp1_;
	ObjectsProject* _tmp2_;
	ObjectsProject* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp9_ = FALSE;
	WidgetsProjectPickerProjectPickerRow* _tmp26_;
	WidgetsProjectPickerProjectPickerRow* _tmp27_;
	ObjectsProject* _tmp28_;
	ObjectsProject* _tmp29_;
	ObjectsSource* _tmp30_;
	ObjectsSource* _tmp31_;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	GtkWidget* _tmp34_;
	GtkWidget* _tmp35_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (lbrow != NULL);
	if (!WIDGETS_PROJECT_PICKER_IS_PROJECT_PICKER_ROW (lbrow)) {
		return;
	}
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (lbrow, WIDGETS_PROJECT_PICKER_TYPE_PROJECT_PICKER_ROW, WidgetsProjectPickerProjectPickerRow));
	row = _tmp0_;
	_tmp1_ = row;
	_tmp2_ = widgets_project_picker_project_picker_row_get_project (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = objects_project_get_is_inbox_project (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_) {
		WidgetsProjectPickerProjectPickerRow* _tmp6_;
		WidgetsProjectPickerProjectPickerRow* _tmp7_;
		WidgetsProjectPickerProjectPickerRow* _tmp8_;
		_tmp6_ = row;
		gtk_widget_set_margin_top ((GtkWidget*) _tmp6_, 6);
		_tmp7_ = row;
		gtk_widget_set_margin_bottom ((GtkWidget*) _tmp7_, 6);
		_tmp8_ = row;
		gtk_list_box_row_set_header ((GtkListBoxRow*) _tmp8_, NULL);
		_g_object_unref0 (row);
		return;
	}
	if (lbbefore != NULL) {
		_tmp9_ = WIDGETS_PROJECT_PICKER_IS_PROJECT_PICKER_ROW (lbbefore);
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		WidgetsProjectPickerProjectPickerRow* before = NULL;
		WidgetsProjectPickerProjectPickerRow* _tmp10_;
		WidgetsProjectPickerProjectPickerRow* _tmp11_;
		ObjectsProject* _tmp12_;
		ObjectsProject* _tmp13_;
		ObjectsSource* _tmp14_;
		ObjectsSource* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		WidgetsProjectPickerProjectPickerRow* _tmp18_;
		ObjectsProject* _tmp19_;
		ObjectsProject* _tmp20_;
		ObjectsSource* _tmp21_;
		ObjectsSource* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		_tmp10_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (lbbefore, WIDGETS_PROJECT_PICKER_TYPE_PROJECT_PICKER_ROW, WidgetsProjectPickerProjectPickerRow));
		before = _tmp10_;
		_tmp11_ = row;
		_tmp12_ = widgets_project_picker_project_picker_row_get_project (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = objects_project_get_source (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = before;
		_tmp19_ = widgets_project_picker_project_picker_row_get_project (_tmp18_);
		_tmp20_ = _tmp19_;
		_tmp21_ = objects_project_get_source (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp22_);
		_tmp24_ = _tmp23_;
		if (g_strcmp0 (_tmp17_, _tmp24_) == 0) {
			WidgetsProjectPickerProjectPickerRow* _tmp25_;
			_tmp25_ = row;
			gtk_list_box_row_set_header ((GtkListBoxRow*) _tmp25_, NULL);
			_g_object_unref0 (before);
			_g_object_unref0 (row);
			return;
		}
		_g_object_unref0 (before);
	}
	_tmp26_ = row;
	_tmp27_ = row;
	_tmp28_ = widgets_project_picker_project_picker_row_get_project (_tmp27_);
	_tmp29_ = _tmp28_;
	_tmp30_ = objects_project_get_source (_tmp29_);
	_tmp31_ = _tmp30_;
	_tmp32_ = objects_source_get_header_text (_tmp31_);
	_tmp33_ = _tmp32_;
	_tmp34_ = widgets_project_picker_core_get_header_box (self, _tmp33_);
	_tmp35_ = _tmp34_;
	gtk_list_box_row_set_header ((GtkListBoxRow*) _tmp26_, _tmp35_);
	_g_object_unref0 (_tmp35_);
	_g_object_unref0 (row);
}

static GtkWidget*
widgets_project_picker_core_get_header_box (WidgetsProjectPickerCore* self,
                                            const gchar* title)
{
	GtkLabel* header_label = NULL;
	gchar* _tmp0_;
	gchar** _tmp1_;
	GtkLabel* _tmp2_ = NULL;
	GtkBox* header_box = NULL;
	GtkBox* _tmp3_ = NULL;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	_tmp0_ = g_strdup ("heading");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = (GtkLabel*) gtk_label_new (title);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp2_, _tmp1_);
	_tmp1_ = (_vala_array_free (_tmp1_, 1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_halign ((GtkWidget*) _tmp2_, GTK_ALIGN_START);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp2_, 3);
	g_object_ref_sink (_tmp2_);
	header_label = _tmp2_;
	_tmp3_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp3_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp3_, 6);
	g_object_ref_sink (_tmp3_);
	header_box = _tmp3_;
	gtk_box_append (header_box, (GtkWidget*) header_label);
	result = (GtkWidget*) header_box;
	_g_object_unref0 (header_label);
	return result;
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static void
widgets_project_picker_core_update_selected_project (WidgetsProjectPickerCore* self,
                                                     ObjectsProject* project)
{
	ObjectsProject* _tmp0_;
	Util* _tmp1_;
	Util* _tmp2_;
	GtkListBox* _tmp3_;
	GList* _tmp4_;
	GList* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	_tmp0_ = _g_object_ref0 (project);
	_g_object_unref0 (self->priv->_selected_project);
	self->priv->_selected_project = _tmp0_;
	_tmp1_ = util_get_default ();
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->listbox;
	_tmp4_ = util_get_children (_tmp2_, _tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp2_);
	{
		GList* child_collection = NULL;
		GList* child_it = NULL;
		child_collection = _tmp5_;
		for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
			GtkWidget* child = NULL;
			child = (GtkWidget*) ((GtkListBoxRow*) child_it->data);
			{
				WidgetsProjectPickerProjectPickerRow* row = NULL;
				GtkWidget* _tmp6_;
				WidgetsProjectPickerProjectPickerRow* _tmp7_;
				WidgetsProjectPickerProjectPickerRow* _tmp8_;
				WidgetsProjectPickerProjectPickerRow* _tmp9_;
				ObjectsProject* _tmp10_;
				ObjectsProject* _tmp11_;
				const gchar* _tmp12_;
				const gchar* _tmp13_;
				const gchar* _tmp14_;
				const gchar* _tmp15_;
				_tmp6_ = child;
				_tmp7_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, WIDGETS_PROJECT_PICKER_TYPE_PROJECT_PICKER_ROW, WidgetsProjectPickerProjectPickerRow));
				row = _tmp7_;
				_tmp8_ = row;
				_tmp9_ = row;
				_tmp10_ = widgets_project_picker_project_picker_row_get_project (_tmp9_);
				_tmp11_ = _tmp10_;
				_tmp12_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp11_);
				_tmp13_ = _tmp12_;
				_tmp14_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
				_tmp15_ = _tmp14_;
				widgets_project_picker_project_picker_row_set_is_selected (_tmp8_, g_strcmp0 (_tmp13_, _tmp15_) == 0);
				_g_object_unref0 (row);
			}
		}
		(child_collection == NULL) ? NULL : (child_collection = (_g_list_free__g_object_unref0_ (child_collection), NULL));
	}
}

void
widgets_project_picker_core_set_selected_project (WidgetsProjectPickerCore* self,
                                                  ObjectsProject* project)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	widgets_project_picker_core_update_selected_project (self, project);
}

void
widgets_project_picker_core_clean_up (WidgetsProjectPickerCore* self)
{
	GtkListBox* _tmp0_;
	GtkListBox* _tmp1_;
	GtkListBox* _tmp2_;
	GeeHashMap* _tmp18_;
	Util* _tmp19_;
	Util* _tmp20_;
	GtkListBox* _tmp21_;
	GList* _tmp22_;
	GList* _tmp23_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->listbox;
	gtk_list_box_set_sort_func (_tmp0_, NULL, NULL, NULL);
	_tmp1_ = self->priv->listbox;
	gtk_list_box_set_header_func (_tmp1_, NULL, NULL, NULL);
	_tmp2_ = self->priv->listbox;
	gtk_list_box_set_filter_func (_tmp2_, NULL, NULL, NULL);
	{
		GeeIterator* _entry_it = NULL;
		GeeHashMap* _tmp3_;
		GeeSet* _tmp4_;
		GeeSet* _tmp5_;
		GeeSet* _tmp6_;
		GeeIterator* _tmp7_;
		GeeIterator* _tmp8_;
		_tmp3_ = self->priv->signal_map;
		_tmp4_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = _tmp5_;
		_tmp7_ = gee_iterable_iterator ((GeeIterable*) _tmp6_);
		_tmp8_ = _tmp7_;
		_g_object_unref0 (_tmp6_);
		_entry_it = _tmp8_;
		while (TRUE) {
			GeeIterator* _tmp9_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp10_;
			gpointer _tmp11_;
			GeeMapEntry* _tmp12_;
			gconstpointer _tmp13_;
			gconstpointer _tmp14_;
			GeeMapEntry* _tmp15_;
			gconstpointer _tmp16_;
			gconstpointer _tmp17_;
			_tmp9_ = _entry_it;
			if (!gee_iterator_next (_tmp9_)) {
				break;
			}
			_tmp10_ = _entry_it;
			_tmp11_ = gee_iterator_get (_tmp10_);
			entry = (GeeMapEntry*) _tmp11_;
			_tmp12_ = entry;
			_tmp13_ = gee_map_entry_get_value (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = entry;
			_tmp16_ = gee_map_entry_get_key (_tmp15_);
			_tmp17_ = _tmp16_;
			g_signal_handler_disconnect ((GObject*) _tmp14_, (gulong) ((guintptr) _tmp17_));
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	_tmp18_ = self->priv->signal_map;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp18_);
	_tmp19_ = util_get_default ();
	_tmp20_ = _tmp19_;
	_tmp21_ = self->priv->listbox;
	_tmp22_ = util_get_children (_tmp20_, _tmp21_);
	_tmp23_ = _tmp22_;
	_g_object_unref0 (_tmp20_);
	{
		GList* child_collection = NULL;
		GList* child_it = NULL;
		child_collection = _tmp23_;
		for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
			GtkWidget* child = NULL;
			child = (GtkWidget*) ((GtkListBoxRow*) child_it->data);
			{
				GtkWidget* _tmp24_;
				_tmp24_ = child;
				widgets_project_picker_project_picker_row_clean_up (G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, WIDGETS_PROJECT_PICKER_TYPE_PROJECT_PICKER_ROW, WidgetsProjectPickerProjectPickerRow));
			}
		}
		(child_collection == NULL) ? NULL : (child_collection = (_g_list_free__g_object_unref0_ (child_collection), NULL));
	}
}

ObjectsSource*
widgets_project_picker_core_get_source (WidgetsProjectPickerCore* self)
{
	ObjectsSource* result;
	ObjectsSource* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_source;
	result = _tmp0_;
	return result;
}

static void
widgets_project_picker_core_set_source (WidgetsProjectPickerCore* self,
                                        ObjectsSource* value)
{
	ObjectsSource* old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_project_picker_core_get_source (self);
	if (old_value != value) {
		ObjectsSource* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_source);
		self->priv->_source = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, widgets_project_picker_core_properties[WIDGETS_PROJECT_PICKER_CORE_SOURCE_PROPERTY]);
	}
}

static Block39Data*
block39_data_ref (Block39Data* _data39_)
{
	g_atomic_int_inc (&_data39_->_ref_count_);
	return _data39_;
}

static void
block39_data_unref (void * _userdata_)
{
	Block39Data* _data39_;
	_data39_ = (Block39Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data39_->_ref_count_)) {
		WidgetsProjectPickerCore* self;
		self = _data39_->self;
		_g_object_unref0 (_data39_->scrolled_window);
		_g_object_unref0 (_data39_->search_entry);
		_g_object_unref0 (self);
		g_slice_free (Block39Data, _data39_);
	}
}

static gint
_widgets_project_picker_core_sort_source_function_gtk_list_box_sort_func (GtkListBoxRow* row1,
                                                                          GtkListBoxRow* row2,
                                                                          gpointer self)
{
	gint result;
	result = widgets_project_picker_core_sort_source_function ((WidgetsProjectPickerCore*) self, row1, row2);
	return result;
}

static void
_widgets_project_picker_core_header_project_function_gtk_list_box_update_header_func (GtkListBoxRow* row,
                                                                                      GtkListBoxRow* before,
                                                                                      gpointer self)
{
	widgets_project_picker_core_header_project_function ((WidgetsProjectPickerCore*) self, row, before);
}

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
_widgets_project_picker_core___lambda113_ (Block39Data* _data39_,
                                           GtkListBoxRow* row)
{
	WidgetsProjectPickerCore* self;
	ObjectsProject* project = NULL;
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	ObjectsProject* _tmp2_;
	ObjectsProject* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GtkSearchEntry* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gboolean _tmp13_;
	gboolean result;
	self = _data39_->self;
	g_return_val_if_fail (row != NULL, FALSE);
	_tmp0_ = widgets_project_picker_project_picker_row_get_project (G_TYPE_CHECK_INSTANCE_CAST (row, WIDGETS_PROJECT_PICKER_TYPE_PROJECT_PICKER_ROW, WidgetsProjectPickerProjectPickerRow));
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	project = _tmp2_;
	_tmp3_ = project;
	_tmp4_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_utf8_strdown (_tmp5_, (gssize) -1);
	_tmp7_ = _tmp6_;
	_tmp8_ = _data39_->search_entry;
	_tmp9_ = gtk_editable_get_text ((GtkEditable*) _tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = g_utf8_strdown (_tmp10_, (gssize) -1);
	_tmp12_ = _tmp11_;
	_tmp13_ = string_contains (_tmp7_, _tmp12_);
	_g_free0 (_tmp12_);
	_g_free0 (_tmp7_);
	result = _tmp13_;
	_g_object_unref0 (project);
	return result;
}

static gboolean
__widgets_project_picker_core___lambda113__gtk_list_box_filter_func (GtkListBoxRow* row,
                                                                     gpointer self)
{
	gboolean result;
	result = _widgets_project_picker_core___lambda113_ (self, row);
	return result;
}

static void
_widgets_project_picker_core___lambda114_ (Block39Data* _data39_)
{
	WidgetsProjectPickerCore* self;
	GtkScrolledWindow* _tmp0_;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	GtkListBox* _tmp3_;
	self = _data39_->self;
	_tmp0_ = _data39_->scrolled_window;
	_tmp1_ = gtk_scrolled_window_get_vadjustment (_tmp0_);
	_tmp2_ = _tmp1_;
	gtk_adjustment_set_value (_tmp2_, (gdouble) 0);
	_tmp3_ = self->priv->listbox;
	gtk_list_box_invalidate_filter (_tmp3_);
}

static void
__widgets_project_picker_core___lambda114__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                                            gpointer self)
{
	_widgets_project_picker_core___lambda114_ (self);
}

static void
_widgets_project_picker_core___lambda115_ (WidgetsProjectPickerCore* self,
                                           GtkListBoxRow* row)
{
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	ObjectsProject* _tmp2_;
	g_return_if_fail (row != NULL);
	_tmp0_ = widgets_project_picker_project_picker_row_get_project (G_TYPE_CHECK_INSTANCE_CAST (row, WIDGETS_PROJECT_PICKER_TYPE_PROJECT_PICKER_ROW, WidgetsProjectPickerProjectPickerRow));
	_tmp1_ = _tmp0_;
	widgets_project_picker_core_update_selected_project (self, _tmp1_);
	_tmp2_ = self->priv->_selected_project;
	g_signal_emit (self, widgets_project_picker_core_signals[WIDGETS_PROJECT_PICKER_CORE_SELECTED_SIGNAL], 0, _tmp2_);
	g_signal_emit (self, widgets_project_picker_core_signals[WIDGETS_PROJECT_PICKER_CORE_CLOSE_SIGNAL], 0);
}

static void
__widgets_project_picker_core___lambda115__gtk_list_box_row_activated (GtkListBox* _sender,
                                                                       GtkListBoxRow* row,
                                                                       gpointer self)
{
	_widgets_project_picker_core___lambda115_ ((WidgetsProjectPickerCore*) self, row);
}

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

static gchar*
g_unichar_to_string (gunichar self)
{
	gchar* str = NULL;
	gchar* _tmp0_;
	gchar* result;
	_tmp0_ = g_new0 (gchar, 7);
	str = (gchar*) _tmp0_;
	g_unichar_to_utf8 (self, str);
	result = str;
	return result;
}

static gboolean
_widgets_project_picker_core___lambda116_ (Block39Data* _data39_,
                                           guint keyval,
                                           guint keycode,
                                           GdkModifierType state)
{
	WidgetsProjectPickerCore* self;
	gchar* key = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean result;
	self = _data39_->self;
	_tmp0_ = gdk_keyval_name (keyval);
	_tmp1_ = string_replace (_tmp0_, "KP_", "");
	key = _tmp1_;
	_tmp2_ = key;
	if (g_strcmp0 (_tmp2_, "Up") == 0) {
		GtkListBoxRow* selected_row = NULL;
		GtkListBox* _tmp3_;
		GtkListBoxRow* _tmp4_;
		GtkListBoxRow* _tmp5_;
		GtkListBoxRow* _tmp6_;
		_tmp3_ = self->priv->listbox;
		_tmp4_ = gtk_list_box_get_selected_row (_tmp3_);
		_tmp5_ = _g_object_ref0 (_tmp4_);
		selected_row = _tmp5_;
		_tmp6_ = selected_row;
		if (_tmp6_ != NULL) {
			GtkListBoxRow* first_visible_row = NULL;
			gint index = 0;
			gboolean _tmp15_ = FALSE;
			GtkListBoxRow* _tmp16_;
			first_visible_row = NULL;
			index = 0;
			while (TRUE) {
				GtkListBoxRow* row = NULL;
				GtkListBox* _tmp7_;
				GtkListBoxRow* _tmp8_;
				GtkListBoxRow* _tmp9_;
				GtkListBoxRow* _tmp10_;
				GtkListBoxRow* _tmp11_;
				gint _tmp14_;
				_tmp7_ = self->priv->listbox;
				_tmp8_ = gtk_list_box_get_row_at_index (_tmp7_, index);
				_tmp9_ = _g_object_ref0 (_tmp8_);
				row = _tmp9_;
				_tmp10_ = row;
				if (_tmp10_ == NULL) {
					_g_object_unref0 (row);
					break;
				}
				_tmp11_ = row;
				if (gtk_widget_get_child_visible ((GtkWidget*) _tmp11_)) {
					GtkListBoxRow* _tmp12_;
					GtkListBoxRow* _tmp13_;
					_tmp12_ = row;
					_tmp13_ = _g_object_ref0 (_tmp12_);
					_g_object_unref0 (first_visible_row);
					first_visible_row = _tmp13_;
					_g_object_unref0 (row);
					break;
				}
				_tmp14_ = index;
				index = _tmp14_ + 1;
				_g_object_unref0 (row);
			}
			_tmp16_ = first_visible_row;
			if (_tmp16_ != NULL) {
				GtkListBoxRow* _tmp17_;
				GtkListBoxRow* _tmp18_;
				_tmp17_ = selected_row;
				_tmp18_ = first_visible_row;
				_tmp15_ = _tmp17_ == _tmp18_;
			} else {
				_tmp15_ = FALSE;
			}
			if (_tmp15_) {
				GtkSearchEntry* _tmp19_;
				GtkSearchEntry* _tmp20_;
				GtkSearchEntry* _tmp21_;
				const gchar* _tmp22_;
				const gchar* _tmp23_;
				gint _tmp24_;
				gint _tmp25_;
				_tmp19_ = _data39_->search_entry;
				gtk_widget_grab_focus ((GtkWidget*) _tmp19_);
				_tmp20_ = _data39_->search_entry;
				_tmp21_ = _data39_->search_entry;
				_tmp22_ = gtk_editable_get_text ((GtkEditable*) _tmp21_);
				_tmp23_ = _tmp22_;
				_tmp24_ = strlen (_tmp23_);
				_tmp25_ = _tmp24_;
				gtk_editable_set_position ((GtkEditable*) _tmp20_, _tmp25_);
				result = TRUE;
				_g_object_unref0 (first_visible_row);
				_g_object_unref0 (selected_row);
				_g_free0 (key);
				return result;
			}
			_g_object_unref0 (first_visible_row);
		}
		_g_object_unref0 (selected_row);
	} else {
		const gchar* _tmp26_;
		_tmp26_ = key;
		if (g_strcmp0 (_tmp26_, "Down") == 0) {
		} else {
			gboolean _tmp27_ = FALSE;
			gboolean _tmp28_ = FALSE;
			const gchar* _tmp29_;
			_tmp29_ = key;
			if (g_strcmp0 (_tmp29_, "Enter") == 0) {
				_tmp28_ = TRUE;
			} else {
				const gchar* _tmp30_;
				_tmp30_ = key;
				_tmp28_ = g_strcmp0 (_tmp30_, "Return") == 0;
			}
			if (_tmp28_) {
				_tmp27_ = TRUE;
			} else {
				const gchar* _tmp31_;
				_tmp31_ = key;
				_tmp27_ = g_strcmp0 (_tmp31_, "KP_Enter") == 0;
			}
			if (_tmp27_) {
			} else {
				const gchar* _tmp32_;
				_tmp32_ = key;
				if (g_strcmp0 (_tmp32_, "BackSpace") == 0) {
					gboolean _tmp33_ = FALSE;
					GtkSearchEntry* _tmp34_;
					gboolean _tmp35_;
					gboolean _tmp36_;
					_tmp34_ = _data39_->search_entry;
					g_object_get ((GtkWidget*) _tmp34_, "has-focus", &_tmp35_, NULL);
					_tmp36_ = _tmp35_;
					if (!_tmp36_) {
						GtkSearchEntry* _tmp37_;
						const gchar* _tmp38_;
						const gchar* _tmp39_;
						gint _tmp40_;
						gint _tmp41_;
						_tmp37_ = _data39_->search_entry;
						_tmp38_ = gtk_editable_get_text ((GtkEditable*) _tmp37_);
						_tmp39_ = _tmp38_;
						_tmp40_ = strlen (_tmp39_);
						_tmp41_ = _tmp40_;
						_tmp33_ = _tmp41_ > 0;
					} else {
						_tmp33_ = FALSE;
					}
					if (_tmp33_) {
						GtkSearchEntry* _tmp42_;
						gint pos = 0;
						GtkSearchEntry* _tmp43_;
						const gchar* _tmp44_;
						const gchar* _tmp45_;
						gint _tmp46_;
						gint _tmp47_;
						GtkSearchEntry* _tmp48_;
						GtkSearchEntry* _tmp49_;
						_tmp42_ = _data39_->search_entry;
						gtk_widget_grab_focus ((GtkWidget*) _tmp42_);
						_tmp43_ = _data39_->search_entry;
						_tmp44_ = gtk_editable_get_text ((GtkEditable*) _tmp43_);
						_tmp45_ = _tmp44_;
						_tmp46_ = strlen (_tmp45_);
						_tmp47_ = _tmp46_;
						pos = _tmp47_;
						_tmp48_ = _data39_->search_entry;
						g_signal_emit_by_name ((GtkEditable*) _tmp48_, "delete-text", pos - 1, pos);
						_tmp49_ = _data39_->search_entry;
						gtk_editable_set_position ((GtkEditable*) _tmp49_, pos - 1);
						result = TRUE;
						_g_free0 (key);
						return result;
					}
				} else {
					GtkSearchEntry* _tmp50_;
					gboolean _tmp51_;
					gboolean _tmp52_;
					_tmp50_ = _data39_->search_entry;
					g_object_get ((GtkWidget*) _tmp50_, "has-focus", &_tmp51_, NULL);
					_tmp52_ = _tmp51_;
					if (!_tmp52_) {
						gunichar c = 0U;
						c = (gunichar) gdk_keyval_to_unicode (keyval);
						if (g_unichar_isprint (c)) {
							GtkSearchEntry* _tmp53_;
							gint pos = 0;
							GtkSearchEntry* _tmp54_;
							const gchar* _tmp55_;
							const gchar* _tmp56_;
							gint _tmp57_;
							gint _tmp58_;
							GtkSearchEntry* _tmp59_;
							gchar* _tmp60_;
							gchar* _tmp61_;
							GtkSearchEntry* _tmp62_;
							_tmp53_ = _data39_->search_entry;
							gtk_widget_grab_focus ((GtkWidget*) _tmp53_);
							_tmp54_ = _data39_->search_entry;
							_tmp55_ = gtk_editable_get_text ((GtkEditable*) _tmp54_);
							_tmp56_ = _tmp55_;
							_tmp57_ = strlen (_tmp56_);
							_tmp58_ = _tmp57_;
							pos = _tmp58_;
							_tmp59_ = _data39_->search_entry;
							_tmp60_ = g_unichar_to_string (c);
							_tmp61_ = _tmp60_;
							g_signal_emit_by_name ((GtkEditable*) _tmp59_, "insert-text", _tmp61_, -1, &pos);
							_g_free0 (_tmp61_);
							_tmp62_ = _data39_->search_entry;
							gtk_editable_set_position ((GtkEditable*) _tmp62_, pos);
							result = TRUE;
							_g_free0 (key);
							return result;
						}
					}
				}
			}
		}
	}
	result = FALSE;
	_g_free0 (key);
	return result;
}

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

static gboolean
_widgets_project_picker_core___lambda117_ (WidgetsProjectPickerCore* self,
                                           guint keyval,
                                           guint keycode,
                                           GdkModifierType state)
{
	gchar* key = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean result;
	_tmp0_ = gdk_keyval_name (keyval);
	_tmp1_ = string_replace (_tmp0_, "KP_", "");
	key = _tmp1_;
	if (keyval == GDK_KEY_Escape) {
		g_signal_emit (self, widgets_project_picker_core_signals[WIDGETS_PROJECT_PICKER_CORE_CLOSE_SIGNAL], 0);
	} else {
		const gchar* _tmp2_;
		_tmp2_ = key;
		if (g_strcmp0 (_tmp2_, "Down") == 0) {
			GtkListBox* _tmp3_;
			GtkListBoxRow* _tmp4_;
			_tmp3_ = self->priv->listbox;
			_tmp4_ = gtk_list_box_get_row_at_index (_tmp3_, 0);
			gtk_widget_grab_focus ((GtkWidget*) _tmp4_);
			result = TRUE;
			_g_free0 (key);
			return result;
		}
	}
	result = FALSE;
	_g_free0 (key);
	return result;
}

static gboolean
__widgets_project_picker_core___lambda117__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                                 guint keyval,
                                                                                 guint keycode,
                                                                                 GdkModifierType state,
                                                                                 gpointer self)
{
	gboolean result;
	result = _widgets_project_picker_core___lambda117_ ((WidgetsProjectPickerCore*) self, keyval, keycode, state);
	return result;
}

static GObject *
widgets_project_picker_core_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsProjectPickerCore * self;
	Block39Data* _data39_;
	gchar* _tmp0_;
	GtkSearchEntry* _tmp1_ = NULL;
	GtkSearchEntry* _tmp2_;
	GtkWidget* _tmp3_;
	GtkRevealer* _tmp4_ = NULL;
	gchar* _tmp5_;
	gchar** _tmp6_;
	GtkListBox* _tmp7_ = NULL;
	GtkListBox* _tmp8_;
	ObjectsSource* _tmp9_;
	GtkListBox* _tmp11_;
	GtkListBox* _tmp12_;
	GtkWidget* _tmp13_;
	GtkScrolledWindow* _tmp14_ = NULL;
	AdwToolbarView* toolbar_view = NULL;
	AdwToolbarView* _tmp15_;
	AdwToolbarView* _tmp16_;
	GtkRevealer* _tmp17_;
	AdwToolbarView* _tmp18_;
	GtkScrolledWindow* _tmp19_;
	AdwToolbarView* _tmp20_;
	GeeHashMap* _tmp21_;
	GtkSearchEntry* _tmp22_;
	gulong _tmp23_;
	GtkSearchEntry* _tmp24_;
	GeeHashMap* _tmp25_;
	GtkListBox* _tmp26_;
	gulong _tmp27_;
	GtkListBox* _tmp28_;
	GtkEventControllerKey* listbox_controller_key = NULL;
	GtkEventControllerKey* _tmp29_;
	GtkListBox* _tmp30_;
	GtkEventControllerKey* _tmp31_;
	GtkEventController* _tmp32_;
	GeeHashMap* _tmp33_;
	GtkEventControllerKey* _tmp34_;
	gulong _tmp35_;
	GtkEventControllerKey* _tmp36_;
	GtkEventControllerKey* search_entry_ctrl_key = NULL;
	GtkEventControllerKey* _tmp37_;
	GtkSearchEntry* _tmp38_;
	GtkEventControllerKey* _tmp39_;
	GtkEventController* _tmp40_;
	GeeHashMap* _tmp41_;
	GtkEventControllerKey* _tmp42_;
	gulong _tmp43_;
	GtkEventControllerKey* _tmp44_;
	parent_class = G_OBJECT_CLASS (widgets_project_picker_core_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_PROJECT_PICKER_CORE, WidgetsProjectPickerCore);
	_data39_ = g_slice_new0 (Block39Data);
	_data39_->_ref_count_ = 1;
	_data39_->self = g_object_ref (self);
	_tmp0_ = g_strdup (_ ("Type a search"));
	_tmp1_ = (GtkSearchEntry*) gtk_search_entry_new ();
	g_object_set (_tmp1_, "placeholder-text", _tmp0_, NULL);
	_g_free0 (_tmp0_);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp1_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp1_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp1_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp1_, 12);
	g_object_ref_sink (_tmp1_);
	_data39_->search_entry = _tmp1_;
	_tmp2_ = _data39_->search_entry;
	_tmp3_ = _g_object_ref0 ((GtkWidget*) _tmp2_);
	_tmp4_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_child (_tmp4_, _tmp3_);
	_g_object_unref0 (_tmp3_);
	gtk_revealer_set_reveal_child (_tmp4_, TRUE);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->search_entry_revealer);
	self->priv->search_entry_revealer = _tmp4_;
	_tmp5_ = g_strdup ("listbox-background");
	_tmp6_ = g_new0 (gchar*, 1 + 1);
	_tmp6_[0] = _tmp5_;
	_tmp7_ = (GtkListBox*) gtk_list_box_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp7_, TRUE);
	gtk_widget_set_valign ((GtkWidget*) _tmp7_, GTK_ALIGN_START);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp7_, _tmp6_);
	_tmp6_ = (_vala_array_free (_tmp6_, 1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp7_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp7_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp7_, 12);
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (self->priv->listbox);
	self->priv->listbox = _tmp7_;
	_tmp8_ = self->priv->listbox;
	gtk_list_box_set_sort_func (_tmp8_, _widgets_project_picker_core_sort_source_function_gtk_list_box_sort_func, g_object_ref (self), g_object_unref);
	_tmp9_ = self->priv->_source;
	if (_tmp9_ == NULL) {
		GtkListBox* _tmp10_;
		_tmp10_ = self->priv->listbox;
		gtk_list_box_set_header_func (_tmp10_, _widgets_project_picker_core_header_project_function_gtk_list_box_update_header_func, g_object_ref (self), g_object_unref);
	}
	_tmp11_ = self->priv->listbox;
	gtk_list_box_set_filter_func (_tmp11_, __widgets_project_picker_core___lambda113__gtk_list_box_filter_func, block39_data_ref (_data39_), block39_data_unref);
	_tmp12_ = self->priv->listbox;
	_tmp13_ = _g_object_ref0 ((GtkWidget*) _tmp12_);
	_tmp14_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_set (_tmp14_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp14_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp14_, TRUE);
	gtk_scrolled_window_set_child (_tmp14_, _tmp13_);
	_g_object_unref0 (_tmp13_);
	g_object_ref_sink (_tmp14_);
	_data39_->scrolled_window = _tmp14_;
	_tmp15_ = (AdwToolbarView*) adw_toolbar_view_new ();
	g_object_ref_sink (_tmp15_);
	toolbar_view = _tmp15_;
	_tmp16_ = toolbar_view;
	_tmp17_ = self->priv->search_entry_revealer;
	adw_toolbar_view_add_top_bar (_tmp16_, (GtkWidget*) _tmp17_);
	_tmp18_ = toolbar_view;
	_tmp19_ = _data39_->scrolled_window;
	adw_toolbar_view_set_content (_tmp18_, (GtkWidget*) _tmp19_);
	_tmp20_ = toolbar_view;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp20_);
	widgets_project_picker_core_add_projects (self);
	_tmp21_ = self->priv->signal_map;
	_tmp22_ = _data39_->search_entry;
	_tmp23_ = g_signal_connect_data (_tmp22_, "search-changed", (GCallback) __widgets_project_picker_core___lambda114__gtk_search_entry_search_changed, block39_data_ref (_data39_), (GClosureNotify) block39_data_unref, 0);
	_tmp24_ = _data39_->search_entry;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp21_, (gpointer) ((guintptr) _tmp23_), (GObject*) _tmp24_);
	_tmp25_ = self->priv->signal_map;
	_tmp26_ = self->priv->listbox;
	_tmp27_ = g_signal_connect_object (_tmp26_, "row-activated", (GCallback) __widgets_project_picker_core___lambda115__gtk_list_box_row_activated, self, 0);
	_tmp28_ = self->priv->listbox;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp25_, (gpointer) ((guintptr) _tmp27_), (GObject*) _tmp28_);
	_tmp29_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	listbox_controller_key = _tmp29_;
	_tmp30_ = self->priv->listbox;
	_tmp31_ = listbox_controller_key;
	_tmp32_ = _g_object_ref0 ((GtkEventController*) _tmp31_);
	gtk_widget_add_controller ((GtkWidget*) _tmp30_, _tmp32_);
	_tmp33_ = self->priv->signal_map;
	_tmp34_ = listbox_controller_key;
	_tmp35_ = g_signal_connect_data (_tmp34_, "key-pressed", (GCallback) __widgets_project_picker_core___lambda116__gtk_event_controller_key_key_pressed, block39_data_ref (_data39_), (GClosureNotify) block39_data_unref, 0);
	_tmp36_ = listbox_controller_key;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp33_, (gpointer) ((guintptr) _tmp35_), (GObject*) _tmp36_);
	_tmp37_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	search_entry_ctrl_key = _tmp37_;
	_tmp38_ = _data39_->search_entry;
	_tmp39_ = search_entry_ctrl_key;
	_tmp40_ = _g_object_ref0 ((GtkEventController*) _tmp39_);
	gtk_widget_add_controller ((GtkWidget*) _tmp38_, _tmp40_);
	_tmp41_ = self->priv->signal_map;
	_tmp42_ = search_entry_ctrl_key;
	_tmp43_ = g_signal_connect_object (_tmp42_, "key-pressed", (GCallback) __widgets_project_picker_core___lambda117__gtk_event_controller_key_key_pressed, self, 0);
	_tmp44_ = search_entry_ctrl_key;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp41_, (gpointer) ((guintptr) _tmp43_), (GObject*) _tmp44_);
	_g_object_unref0 (search_entry_ctrl_key);
	_g_object_unref0 (listbox_controller_key);
	_g_object_unref0 (toolbar_view);
	block39_data_unref (_data39_);
	_data39_ = NULL;
	return obj;
}

static void
widgets_project_picker_core_class_init (WidgetsProjectPickerCoreClass * klass,
                                        gpointer klass_data)
{
	widgets_project_picker_core_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsProjectPickerCore_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_project_picker_core_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_project_picker_core_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_project_picker_core_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_project_picker_core_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_PROJECT_PICKER_CORE_SOURCE_PROPERTY, widgets_project_picker_core_properties[WIDGETS_PROJECT_PICKER_CORE_SOURCE_PROPERTY] = g_param_spec_object ("source", "source", "source", OBJECTS_TYPE_SOURCE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	widgets_project_picker_core_signals[WIDGETS_PROJECT_PICKER_CORE_SELECTED_SIGNAL] = g_signal_new ("selected", WIDGETS_TYPE_PROJECT_PICKER_CORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_PROJECT);
	widgets_project_picker_core_signals[WIDGETS_PROJECT_PICKER_CORE_CLOSE_SIGNAL] = g_signal_new ("close", WIDGETS_TYPE_PROJECT_PICKER_CORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
widgets_project_picker_core_instance_init (WidgetsProjectPickerCore * self,
                                           gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = widgets_project_picker_core_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_ULONG, NULL, NULL, G_TYPE_OBJECT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->signal_map = _tmp0_;
}

static void
widgets_project_picker_core_finalize (GObject * obj)
{
	WidgetsProjectPickerCore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_PROJECT_PICKER_CORE, WidgetsProjectPickerCore);
	g_debug ("ProjectPickerCore.vala:41: Destroying - Widgets.ProjectPicker.ProjectP" \
"ickerPopover\n");
	_g_object_unref0 (self->priv->_source);
	_g_object_unref0 (self->priv->listbox);
	_g_object_unref0 (self->priv->search_entry_revealer);
	_g_object_unref0 (self->priv->_selected_project);
	_g_object_unref0 (self->priv->signal_map);
	G_OBJECT_CLASS (widgets_project_picker_core_parent_class)->finalize (obj);
}

static GType
widgets_project_picker_core_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsProjectPickerCoreClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_project_picker_core_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsProjectPickerCore), 0, (GInstanceInitFunc) widgets_project_picker_core_instance_init, NULL };
	GType widgets_project_picker_core_type_id;
	widgets_project_picker_core_type_id = g_type_register_static (adw_bin_get_type (), "WidgetsProjectPickerCore", &g_define_type_info, 0);
	WidgetsProjectPickerCore_private_offset = g_type_add_instance_private (widgets_project_picker_core_type_id, sizeof (WidgetsProjectPickerCorePrivate));
	return widgets_project_picker_core_type_id;
}

GType
widgets_project_picker_core_get_type (void)
{
	static volatile gsize widgets_project_picker_core_type_id__once = 0;
	if (g_once_init_enter (&widgets_project_picker_core_type_id__once)) {
		GType widgets_project_picker_core_type_id;
		widgets_project_picker_core_type_id = widgets_project_picker_core_get_type_once ();
		g_once_init_leave (&widgets_project_picker_core_type_id__once, widgets_project_picker_core_type_id);
	}
	return widgets_project_picker_core_type_id__once;
}

static void
_vala_widgets_project_picker_core_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec)
{
	WidgetsProjectPickerCore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_PROJECT_PICKER_CORE, WidgetsProjectPickerCore);
	switch (property_id) {
		case WIDGETS_PROJECT_PICKER_CORE_SOURCE_PROPERTY:
		g_value_set_object (value, widgets_project_picker_core_get_source (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_project_picker_core_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec)
{
	WidgetsProjectPickerCore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_PROJECT_PICKER_CORE, WidgetsProjectPickerCore);
	switch (property_id) {
		case WIDGETS_PROJECT_PICKER_CORE_SOURCE_PROPERTY:
		widgets_project_picker_core_set_source (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

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

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

