/* baobab-preferences-dialog.c generated by valac 0.56.0, the Vala compiler
 * generated from baobab-preferences-dialog.vala, do not modify */

/* Baobab - disk usage analyzer
 *
 * Copyright (C) 2020  Stefano Facchini <stefano.facchini@gmail.com>
 *
 * 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.
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "baobab.h"
#include <glib/gi18n-lib.h>

#define BAOBAB_TYPE_EXCLUDED_ROW (baobab_excluded_row_get_type ())
#define BAOBAB_EXCLUDED_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAOBAB_TYPE_EXCLUDED_ROW, BaobabExcludedRow))
#define BAOBAB_EXCLUDED_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BAOBAB_TYPE_EXCLUDED_ROW, BaobabExcludedRowClass))
#define BAOBAB_IS_EXCLUDED_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAOBAB_TYPE_EXCLUDED_ROW))
#define BAOBAB_IS_EXCLUDED_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAOBAB_TYPE_EXCLUDED_ROW))
#define BAOBAB_EXCLUDED_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BAOBAB_TYPE_EXCLUDED_ROW, BaobabExcludedRowClass))

typedef struct _BaobabExcludedRow BaobabExcludedRow;
typedef struct _BaobabExcludedRowClass BaobabExcludedRowClass;
typedef struct _BaobabExcludedRowPrivate BaobabExcludedRowPrivate;
enum  {
	BAOBAB_EXCLUDED_ROW_0_PROPERTY,
	BAOBAB_EXCLUDED_ROW_NUM_PROPERTIES
};
static GParamSpec* baobab_excluded_row_properties[BAOBAB_EXCLUDED_ROW_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	BAOBAB_EXCLUDED_ROW_REMOVED_SIGNAL,
	BAOBAB_EXCLUDED_ROW_NUM_SIGNALS
};
static guint baobab_excluded_row_signals[BAOBAB_EXCLUDED_ROW_NUM_SIGNALS] = {0};
enum  {
	BAOBAB_PREFERENCES_DIALOG_0_PROPERTY,
	BAOBAB_PREFERENCES_DIALOG_NUM_PROPERTIES
};
static GParamSpec* baobab_preferences_dialog_properties[BAOBAB_PREFERENCES_DIALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block4Data Block4Data;
typedef struct _Block5Data Block5Data;

struct _BaobabExcludedRow {
	GtkListBoxRow parent_instance;
	BaobabExcludedRowPrivate * priv;
};

struct _BaobabExcludedRowClass {
	GtkListBoxRowClass parent_class;
};

struct _BaobabExcludedRowPrivate {
	GtkLabel* name_label;
	GtkButton* remove_button;
};

struct _BaobabPreferencesDialogPrivate {
	GtkListBox* excluded_list_box;
	GSettings* prefs_settings;
};

struct _Block4Data {
	int _ref_count_;
	BaobabPreferencesDialog* self;
	gchar* uri;
};

struct _Block5Data {
	int _ref_count_;
	BaobabPreferencesDialog* self;
	GtkFileChooserNative* file_chooser;
};

static gint BaobabExcludedRow_private_offset;
static gpointer baobab_excluded_row_parent_class = NULL;
static gint BaobabPreferencesDialog_private_offset;
static gpointer baobab_preferences_dialog_parent_class = NULL;

VALA_EXTERN GType baobab_excluded_row_get_type (void) G_GNUC_CONST ;
VALA_EXTERN BaobabExcludedRow* baobab_excluded_row_new (GFile* file);
VALA_EXTERN BaobabExcludedRow* baobab_excluded_row_construct (GType object_type,
                                                  GFile* file);
static void __lambda18_ (BaobabExcludedRow* self);
static void ___lambda18__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void baobab_excluded_row_finalize (GObject * obj);
static GType baobab_excluded_row_get_type_once (void);
static void baobab_preferences_dialog_populate (BaobabPreferencesDialog* self);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static void ____lambda19_ (Block4Data* _data4_);
static void baobab_preferences_dialog_remove_uri (BaobabPreferencesDialog* self,
                                           const gchar* uri);
static void _____lambda19__baobab_excluded_row_removed (BaobabExcludedRow* _sender,
                                                 gpointer self);
static void baobab_preferences_dialog_add_uri (BaobabPreferencesDialog* self,
                                        const gchar* uri);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
static void _vala_array_add1 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add2 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static GObject * baobab_preferences_dialog_constructor (GType type,
                                                 guint n_construct_properties,
                                                 GObjectConstructParam * construct_properties);
static void _baobab_preferences_dialog___lambda20_ (BaobabPreferencesDialog* self);
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
static void __lambda21_ (Block5Data* _data5_,
                  gint response);
static void ___lambda21__gtk_native_dialog_response (GtkNativeDialog* _sender,
                                              gint response_id,
                                              gpointer self);
static void __baobab_preferences_dialog___lambda20__gtk_list_box_row_activated (GtkListBox* _sender,
                                                                         GtkListBoxRow* row,
                                                                         gpointer self);
static void baobab_preferences_dialog_finalize (GObject * obj);
static GType baobab_preferences_dialog_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
baobab_excluded_row_get_instance_private (BaobabExcludedRow* self)
{
	return G_STRUCT_MEMBER_P (self, BaobabExcludedRow_private_offset);
}

static void
__lambda18_ (BaobabExcludedRow* self)
{
	g_signal_emit (self, baobab_excluded_row_signals[BAOBAB_EXCLUDED_ROW_REMOVED_SIGNAL], 0);
}

static void
___lambda18__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda18_ ((BaobabExcludedRow*) self);
}

BaobabExcludedRow*
baobab_excluded_row_construct (GType object_type,
                               GFile* file)
{
	BaobabExcludedRow * self = NULL;
	GtkButton* _tmp6_;
	g_return_val_if_fail (file != NULL, NULL);
	self = (BaobabExcludedRow*) g_object_new (object_type, NULL);
	if (g_file_has_uri_scheme (file, "file")) {
		GtkLabel* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp0_ = self->priv->name_label;
		_tmp1_ = g_file_get_path (file);
		_tmp2_ = _tmp1_;
		gtk_label_set_label (_tmp0_, _tmp2_);
		_g_free0 (_tmp2_);
	} else {
		GtkLabel* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp3_ = self->priv->name_label;
		_tmp4_ = g_file_get_uri (file);
		_tmp5_ = _tmp4_;
		gtk_label_set_label (_tmp3_, _tmp5_);
		_g_free0 (_tmp5_);
	}
	_tmp6_ = self->priv->remove_button;
	g_signal_connect_object (_tmp6_, "clicked", (GCallback) ___lambda18__gtk_button_clicked, self, 0);
	return self;
}

BaobabExcludedRow*
baobab_excluded_row_new (GFile* file)
{
	return baobab_excluded_row_construct (BAOBAB_TYPE_EXCLUDED_ROW, file);
}

static void
baobab_excluded_row_class_init (BaobabExcludedRowClass * klass,
                                gpointer klass_data)
{
	baobab_excluded_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BaobabExcludedRow_private_offset);
	G_OBJECT_CLASS (klass)->finalize = baobab_excluded_row_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/baobab/ui/baobab-excluded-row.ui");
	baobab_excluded_row_signals[BAOBAB_EXCLUDED_ROW_REMOVED_SIGNAL] = g_signal_new ("removed", BAOBAB_TYPE_EXCLUDED_ROW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "name_label", FALSE, BaobabExcludedRow_private_offset + G_STRUCT_OFFSET (BaobabExcludedRowPrivate, name_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "remove_button", FALSE, BaobabExcludedRow_private_offset + G_STRUCT_OFFSET (BaobabExcludedRowPrivate, remove_button));
}

static void
baobab_excluded_row_instance_init (BaobabExcludedRow * self,
                                   gpointer klass)
{
	self->priv = baobab_excluded_row_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
baobab_excluded_row_finalize (GObject * obj)
{
	BaobabExcludedRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BAOBAB_TYPE_EXCLUDED_ROW, BaobabExcludedRow);
	G_OBJECT_CLASS (baobab_excluded_row_parent_class)->finalize (obj);
}

static GType
baobab_excluded_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BaobabExcludedRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) baobab_excluded_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BaobabExcludedRow), 0, (GInstanceInitFunc) baobab_excluded_row_instance_init, NULL };
	GType baobab_excluded_row_type_id;
	baobab_excluded_row_type_id = g_type_register_static (gtk_list_box_row_get_type (), "BaobabExcludedRow", &g_define_type_info, 0);
	BaobabExcludedRow_private_offset = g_type_add_instance_private (baobab_excluded_row_type_id, sizeof (BaobabExcludedRowPrivate));
	return baobab_excluded_row_type_id;
}

GType
baobab_excluded_row_get_type (void)
{
	static volatile gsize baobab_excluded_row_type_id__once = 0;
	if (g_once_init_enter (&baobab_excluded_row_type_id__once)) {
		GType baobab_excluded_row_type_id;
		baobab_excluded_row_type_id = baobab_excluded_row_get_type_once ();
		g_once_init_leave (&baobab_excluded_row_type_id__once, baobab_excluded_row_type_id);
	}
	return baobab_excluded_row_type_id__once;
}

static inline gpointer
baobab_preferences_dialog_get_instance_private (BaobabPreferencesDialog* self)
{
	return G_STRUCT_MEMBER_P (self, BaobabPreferencesDialog_private_offset);
}

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

static Block4Data*
block4_data_ref (Block4Data* _data4_)
{
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}

static void
block4_data_unref (void * _userdata_)
{
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		BaobabPreferencesDialog* self;
		self = _data4_->self;
		_g_free0 (_data4_->uri);
		_g_object_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}

static void
____lambda19_ (Block4Data* _data4_)
{
	BaobabPreferencesDialog* self;
	const gchar* _tmp0_;
	self = _data4_->self;
	_tmp0_ = _data4_->uri;
	baobab_preferences_dialog_remove_uri (self, _tmp0_);
	baobab_preferences_dialog_populate (self);
}

static void
_____lambda19__baobab_excluded_row_removed (BaobabExcludedRow* _sender,
                                            gpointer self)
{
	____lambda19_ (self);
}

static void
baobab_preferences_dialog_populate (BaobabPreferencesDialog* self)
{
	GSettings* _tmp10_;
	gchar** _tmp11_;
	gchar** _tmp12_;
	GtkLabel* label = NULL;
	GtkLabel* _tmp21_;
	GtkListBox* _tmp22_;
	g_return_if_fail (self != NULL);
	{
		GtkWidget* child = NULL;
		GtkListBox* _tmp0_;
		GtkWidget* _tmp1_;
		GtkWidget* _tmp2_;
		_tmp0_ = self->priv->excluded_list_box;
		_tmp1_ = gtk_widget_get_first_child ((GtkWidget*) _tmp0_);
		_tmp2_ = _g_object_ref0 (_tmp1_);
		child = _tmp2_;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				GtkWidget* _tmp7_;
				GtkListBox* _tmp8_;
				GtkWidget* _tmp9_;
				if (!_tmp3_) {
					GtkListBox* _tmp4_;
					GtkWidget* _tmp5_;
					GtkWidget* _tmp6_;
					_tmp4_ = self->priv->excluded_list_box;
					_tmp5_ = gtk_widget_get_first_child ((GtkWidget*) _tmp4_);
					_tmp6_ = _g_object_ref0 (_tmp5_);
					_g_object_unref0 (child);
					child = _tmp6_;
				}
				_tmp3_ = FALSE;
				_tmp7_ = child;
				if (!(_tmp7_ != NULL)) {
					break;
				}
				_tmp8_ = self->priv->excluded_list_box;
				_tmp9_ = child;
				gtk_list_box_remove (_tmp8_, _tmp9_);
			}
		}
		_g_object_unref0 (child);
	}
	_tmp10_ = self->priv->prefs_settings;
	_tmp12_ = _tmp11_ = g_settings_get_strv (_tmp10_, "excluded-uris");
	{
		gchar** uri_collection = NULL;
		gint uri_collection_length1 = 0;
		gint _uri_collection_size_ = 0;
		gint uri_it = 0;
		uri_collection = _tmp12_;
		uri_collection_length1 = _vala_array_length (_tmp11_);
		for (uri_it = 0; uri_it < uri_collection_length1; uri_it = uri_it + 1) {
			gchar* _tmp13_;
			gchar* uri = NULL;
			_tmp13_ = g_strdup (uri_collection[uri_it]);
			uri = _tmp13_;
			{
				Block4Data* _data4_;
				GFile* file = NULL;
				const gchar* _tmp14_;
				GFile* _tmp15_;
				BaobabExcludedRow* row = NULL;
				GFile* _tmp16_;
				BaobabExcludedRow* _tmp17_;
				GtkListBox* _tmp18_;
				BaobabExcludedRow* _tmp19_;
				BaobabExcludedRow* _tmp20_;
				_data4_ = g_slice_new0 (Block4Data);
				_data4_->_ref_count_ = 1;
				_data4_->self = g_object_ref (self);
				_data4_->uri = uri;
				_tmp14_ = _data4_->uri;
				_tmp15_ = g_file_new_for_uri (_tmp14_);
				file = _tmp15_;
				_tmp16_ = file;
				_tmp17_ = baobab_excluded_row_new (_tmp16_);
				g_object_ref_sink (_tmp17_);
				row = _tmp17_;
				_tmp18_ = self->priv->excluded_list_box;
				_tmp19_ = row;
				gtk_list_box_append (_tmp18_, (GtkWidget*) _tmp19_);
				_tmp20_ = row;
				g_signal_connect_data (_tmp20_, "removed", (GCallback) _____lambda19__baobab_excluded_row_removed, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0);
				_g_object_unref0 (row);
				_g_object_unref0 (file);
				block4_data_unref (_data4_);
				_data4_ = NULL;
			}
		}
		uri_collection = (_vala_array_free (uri_collection, uri_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp21_ = (GtkLabel*) gtk_label_new (_ ("Add Location…"));
	g_object_ref_sink (_tmp21_);
	label = _tmp21_;
	gtk_widget_set_margin_start ((GtkWidget*) label, 12);
	gtk_widget_set_margin_end ((GtkWidget*) label, 12);
	gtk_widget_set_margin_top ((GtkWidget*) label, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) label, 12);
	_tmp22_ = self->priv->excluded_list_box;
	gtk_list_box_append (_tmp22_, (GtkWidget*) label);
	_g_object_unref0 (label);
}

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

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

static void
baobab_preferences_dialog_add_uri (BaobabPreferencesDialog* self,
                                   const gchar* uri)
{
	gchar** uris = NULL;
	GSettings* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint uris_length1;
	gint _uris_size_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	g_return_if_fail (self != NULL);
	g_return_if_fail (uri != NULL);
	_tmp0_ = self->priv->prefs_settings;
	_tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "excluded-uris");
	uris = _tmp2_;
	uris_length1 = _vala_array_length (_tmp1_);
	_uris_size_ = uris_length1;
	_tmp3_ = uris;
	_tmp3__length1 = uris_length1;
	if (!_vala_string_array_contains (_tmp3_, _tmp3__length1, uri)) {
		gchar* _tmp4_;
		GSettings* _tmp5_;
		gchar** _tmp6_;
		gint _tmp6__length1;
		_tmp4_ = g_strdup (uri);
		_vala_array_add1 (&uris, &uris_length1, &_uris_size_, _tmp4_);
		_tmp5_ = self->priv->prefs_settings;
		_tmp6_ = uris;
		_tmp6__length1 = uris_length1;
		g_settings_set_strv (_tmp5_, "excluded-uris", _tmp6_);
	}
	uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL);
}

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

static void
baobab_preferences_dialog_remove_uri (BaobabPreferencesDialog* self,
                                      const gchar* uri)
{
	gchar** uris = NULL;
	gchar** _tmp0_;
	gint uris_length1;
	gint _uris_size_;
	GSettings* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	GSettings* _tmp8_;
	gchar** _tmp9_;
	gint _tmp9__length1;
	g_return_if_fail (self != NULL);
	g_return_if_fail (uri != NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	uris = _tmp0_;
	uris_length1 = 0;
	_uris_size_ = uris_length1;
	_tmp1_ = self->priv->prefs_settings;
	_tmp3_ = _tmp2_ = g_settings_get_strv (_tmp1_, "excluded-uris");
	{
		gchar** uri_iter_collection = NULL;
		gint uri_iter_collection_length1 = 0;
		gint _uri_iter_collection_size_ = 0;
		gint uri_iter_it = 0;
		uri_iter_collection = _tmp3_;
		uri_iter_collection_length1 = _vala_array_length (_tmp2_);
		for (uri_iter_it = 0; uri_iter_it < uri_iter_collection_length1; uri_iter_it = uri_iter_it + 1) {
			gchar* _tmp4_;
			gchar* uri_iter = NULL;
			_tmp4_ = g_strdup (uri_iter_collection[uri_iter_it]);
			uri_iter = _tmp4_;
			{
				const gchar* _tmp5_;
				_tmp5_ = uri_iter;
				if (g_strcmp0 (_tmp5_, uri) != 0) {
					const gchar* _tmp6_;
					gchar* _tmp7_;
					_tmp6_ = uri_iter;
					_tmp7_ = g_strdup (_tmp6_);
					_vala_array_add2 (&uris, &uris_length1, &_uris_size_, _tmp7_);
				}
				_g_free0 (uri_iter);
			}
		}
		uri_iter_collection = (_vala_array_free (uri_iter_collection, uri_iter_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp8_ = self->priv->prefs_settings;
	_tmp9_ = uris;
	_tmp9__length1 = uris_length1;
	g_settings_set_strv (_tmp8_, "excluded-uris", _tmp9_);
	uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL);
}

BaobabPreferencesDialog*
baobab_preferences_dialog_construct (GType object_type)
{
	BaobabPreferencesDialog * self = NULL;
	self = (BaobabPreferencesDialog*) g_object_new (object_type, NULL);
	return self;
}

BaobabPreferencesDialog*
baobab_preferences_dialog_new (void)
{
	return baobab_preferences_dialog_construct (BAOBAB_TYPE_PREFERENCES_DIALOG);
}

static Block5Data*
block5_data_ref (Block5Data* _data5_)
{
	g_atomic_int_inc (&_data5_->_ref_count_);
	return _data5_;
}

static void
block5_data_unref (void * _userdata_)
{
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		BaobabPreferencesDialog* self;
		self = _data5_->self;
		_g_object_unref0 (_data5_->file_chooser);
		_g_object_unref0 (self);
		g_slice_free (Block5Data, _data5_);
	}
}

static void
__lambda21_ (Block5Data* _data5_,
             gint response)
{
	BaobabPreferencesDialog* self;
	GtkFileChooserNative* _tmp6_;
	self = _data5_->self;
	if (response == ((gint) GTK_RESPONSE_ACCEPT)) {
		gchar* uri = NULL;
		GtkFileChooserNative* _tmp0_;
		GFile* _tmp1_;
		GFile* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp0_ = _data5_->file_chooser;
		_tmp1_ = gtk_file_chooser_get_file ((GtkFileChooser*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = g_file_get_uri (_tmp2_);
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp2_);
		uri = _tmp4_;
		_tmp5_ = uri;
		baobab_preferences_dialog_add_uri (self, _tmp5_);
		baobab_preferences_dialog_populate (self);
		_g_free0 (uri);
	}
	_tmp6_ = _data5_->file_chooser;
	gtk_native_dialog_destroy ((GtkNativeDialog*) _tmp6_);
}

static void
___lambda21__gtk_native_dialog_response (GtkNativeDialog* _sender,
                                         gint response_id,
                                         gpointer self)
{
	__lambda21_ (self, response_id);
}

static void
_baobab_preferences_dialog___lambda20_ (BaobabPreferencesDialog* self)
{
	Block5Data* _data5_;
	GtkFileChooserNative* _tmp0_;
	GtkFileChooserNative* _tmp1_;
	GtkFileChooserNative* _tmp2_;
	GtkFileChooserNative* _tmp3_;
	_data5_ = g_slice_new0 (Block5Data);
	_data5_->_ref_count_ = 1;
	_data5_->self = g_object_ref (self);
	_tmp0_ = gtk_file_chooser_native_new (_ ("Select Location to Ignore"), (GtkWindow*) self, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, NULL, NULL);
	_data5_->file_chooser = _tmp0_;
	_tmp1_ = _data5_->file_chooser;
	gtk_native_dialog_set_modal ((GtkNativeDialog*) _tmp1_, TRUE);
	_tmp2_ = _data5_->file_chooser;
	g_signal_connect_data ((GtkNativeDialog*) _tmp2_, "response", (GCallback) ___lambda21__gtk_native_dialog_response, block5_data_ref (_data5_), (GClosureNotify) block5_data_unref, 0);
	_tmp3_ = _data5_->file_chooser;
	gtk_native_dialog_show ((GtkNativeDialog*) _tmp3_);
	block5_data_unref (_data5_);
	_data5_ = NULL;
}

static void
__baobab_preferences_dialog___lambda20__gtk_list_box_row_activated (GtkListBox* _sender,
                                                                    GtkListBoxRow* row,
                                                                    gpointer self)
{
	_baobab_preferences_dialog___lambda20_ ((BaobabPreferencesDialog*) self);
}

static GObject *
baobab_preferences_dialog_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	BaobabPreferencesDialog * self;
	GSettings* _tmp0_;
	GtkListBox* _tmp1_;
	parent_class = G_OBJECT_CLASS (baobab_preferences_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BAOBAB_TYPE_PREFERENCES_DIALOG, BaobabPreferencesDialog);
	_tmp0_ = g_settings_new ("org.gnome.baobab.preferences");
	_g_object_unref0 (self->priv->prefs_settings);
	self->priv->prefs_settings = _tmp0_;
	_tmp1_ = self->priv->excluded_list_box;
	g_signal_connect_object (_tmp1_, "row-activated", (GCallback) __baobab_preferences_dialog___lambda20__gtk_list_box_row_activated, self, 0);
	baobab_preferences_dialog_populate (self);
	return obj;
}

static void
baobab_preferences_dialog_class_init (BaobabPreferencesDialogClass * klass,
                                      gpointer klass_data)
{
	baobab_preferences_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BaobabPreferencesDialog_private_offset);
	G_OBJECT_CLASS (klass)->constructor = baobab_preferences_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = baobab_preferences_dialog_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/baobab/ui/baobab-preferences-dialog.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "excluded_list_box", FALSE, BaobabPreferencesDialog_private_offset + G_STRUCT_OFFSET (BaobabPreferencesDialogPrivate, excluded_list_box));
}

static void
baobab_preferences_dialog_instance_init (BaobabPreferencesDialog * self,
                                         gpointer klass)
{
	self->priv = baobab_preferences_dialog_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
baobab_preferences_dialog_finalize (GObject * obj)
{
	BaobabPreferencesDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BAOBAB_TYPE_PREFERENCES_DIALOG, BaobabPreferencesDialog);
	_g_object_unref0 (self->priv->prefs_settings);
	G_OBJECT_CLASS (baobab_preferences_dialog_parent_class)->finalize (obj);
}

static GType
baobab_preferences_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BaobabPreferencesDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) baobab_preferences_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BaobabPreferencesDialog), 0, (GInstanceInitFunc) baobab_preferences_dialog_instance_init, NULL };
	GType baobab_preferences_dialog_type_id;
	baobab_preferences_dialog_type_id = g_type_register_static (adw_preferences_window_get_type (), "BaobabPreferencesDialog", &g_define_type_info, 0);
	BaobabPreferencesDialog_private_offset = g_type_add_instance_private (baobab_preferences_dialog_type_id, sizeof (BaobabPreferencesDialogPrivate));
	return baobab_preferences_dialog_type_id;
}

GType
baobab_preferences_dialog_get_type (void)
{
	static volatile gsize baobab_preferences_dialog_type_id__once = 0;
	if (g_once_init_enter (&baobab_preferences_dialog_type_id__once)) {
		GType baobab_preferences_dialog_type_id;
		baobab_preferences_dialog_type_id = baobab_preferences_dialog_get_type_once ();
		g_once_init_leave (&baobab_preferences_dialog_type_id__once, baobab_preferences_dialog_type_id);
	}
	return baobab_preferences_dialog_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;
}

