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

/*
 * This file is part of LaTeXila.
 *
 * Copyright © 2011, 2012 Sébastien Wilmet
 *
 * LaTeXila 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.
 *
 * LaTeXila 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 LaTeXila.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <tepl/tepl.h>
#include <gio/gio.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <latexila.h>
#include <glib/gi18n-lib.h>


#define TYPE_CLEAN_BUILD_FILES (clean_build_files_get_type ())
#define CLEAN_BUILD_FILES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLEAN_BUILD_FILES, CleanBuildFiles))
#define CLEAN_BUILD_FILES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLEAN_BUILD_FILES, CleanBuildFilesClass))
#define IS_CLEAN_BUILD_FILES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CLEAN_BUILD_FILES))
#define IS_CLEAN_BUILD_FILES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CLEAN_BUILD_FILES))
#define CLEAN_BUILD_FILES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CLEAN_BUILD_FILES, CleanBuildFilesClass))

typedef struct _CleanBuildFiles CleanBuildFiles;
typedef struct _CleanBuildFilesClass CleanBuildFilesClass;
typedef struct _CleanBuildFilesPrivate CleanBuildFilesPrivate;

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

typedef struct _MainWindow MainWindow;
typedef struct _MainWindowClass MainWindowClass;

#define TYPE_DOCUMENT (document_get_type ())
#define DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DOCUMENT, Document))
#define DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DOCUMENT, DocumentClass))
#define IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DOCUMENT))
#define IS_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DOCUMENT))
#define DOCUMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DOCUMENT, DocumentClass))

typedef struct _Document Document;
typedef struct _DocumentClass DocumentClass;

#define CLEAN_BUILD_FILES_TYPE_CLEAN_FILE_COLUMN (clean_build_files_clean_file_column_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_PROJECT (project_get_type ())
typedef struct _Project Project;
#define _project_free0(var) ((var == NULL) ? NULL : (var = (project_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block11Data Block11Data;
#define _gtk_tree_path_free0(var) ((var == NULL) ? NULL : (var = (gtk_tree_path_free (var), NULL)))

struct _CleanBuildFiles {
	GObject parent_instance;
	CleanBuildFilesPrivate * priv;
};

struct _CleanBuildFilesClass {
	GObjectClass parent_class;
};

struct _CleanBuildFilesPrivate {
	MainWindow* _main_window;
	Document* _doc;
	GSettings* _settings;
};

typedef enum  {
	CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_DELETE,
	CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_NAME,
	CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_FILE,
	CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_N_COLUMNS
} CleanBuildFilesCleanFileColumn;

struct _Project {
	GFile* directory;
	GFile* main_file;
};

struct _Block11Data {
	int _ref_count_;
	CleanBuildFiles* self;
	GtkListStore* store;
};


static gpointer clean_build_files_parent_class = NULL;

GType clean_build_files_get_type (void) G_GNUC_CONST;
GType main_window_get_type (void) G_GNUC_CONST;
GType document_get_type (void) G_GNUC_CONST;
#define CLEAN_BUILD_FILES_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_CLEAN_BUILD_FILES, CleanBuildFilesPrivate))
enum  {
	CLEAN_BUILD_FILES_DUMMY_PROPERTY
};
static GType clean_build_files_clean_file_column_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
CleanBuildFiles* clean_build_files_new (MainWindow* main_window, Document* doc);
CleanBuildFiles* clean_build_files_construct (GType object_type, MainWindow* main_window, Document* doc);
void clean_build_files_clean (CleanBuildFiles* self);
gboolean document_is_main_file_a_tex_file (Document* self);
GType project_get_type (void) G_GNUC_CONST;
Project* project_dup (const Project* self);
void project_free (Project* self);
void project_copy (const Project* self, Project* dest);
void project_destroy (Project* self);
Project* document_get_project (Document* self);
static GeeArrayList* clean_build_files_get_build_files_in_directory (CleanBuildFiles* self, GFile* directory);
GFile* document_get_location (Document* self);
static GeeArrayList* clean_build_files_get_build_files_simple (CleanBuildFiles* self);
static void clean_build_files_show_info_no_file (CleanBuildFiles* self);
void utils_delete_file (GFile* file);
static void clean_build_files_confirm_cleanup (CleanBuildFiles* self, GeeArrayList* files_to_delete, GFile* directory);
static GtkTreeView* clean_build_files_get_list_files (CleanBuildFiles* self, GeeArrayList* files_to_delete, GFile* directory);
static GtkDialog* clean_build_files_get_dialog (CleanBuildFiles* self, GtkTreeView* list_files);
static void clean_build_files_run_dialog (CleanBuildFiles* self, GtkDialog* dialog, GtkTreeModel* list_store);
static Block11Data* block11_data_ref (Block11Data* _data11_);
static void block11_data_unref (void * _userdata_);
static gint clean_build_files_on_sort_list_files (CleanBuildFiles* self, GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b);
static gint _clean_build_files_on_sort_list_files_gtk_tree_iter_compare_func (GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b, gpointer self);
gchar* utils_get_relative_path (GFile* origin, GFile* target, GFile* common_dir);
static void __lambda17_ (Block11Data* _data11_, const gchar* path_str);
static void ___lambda17__gtk_cell_renderer_toggle_toggled (GtkCellRendererToggle* _sender, const gchar* path, gpointer self);
GtkScrolledWindow* utils_add_scrollbar (GtkWidget* child);
static void _vala_array_add1 (GFile** * array, int* length, int* size, GFile* value);
static void clean_build_files_finalize (GObject * obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


static GType clean_build_files_clean_file_column_get_type (void) {
	static volatile gsize clean_build_files_clean_file_column_type_id__volatile = 0;
	if (g_once_init_enter (&clean_build_files_clean_file_column_type_id__volatile)) {
		static const GEnumValue values[] = {{CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_DELETE, "CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_DELETE", "delete"}, {CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_NAME, "CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_NAME", "name"}, {CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_FILE, "CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_FILE", "file"}, {CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_N_COLUMNS, "CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_N_COLUMNS", "n-columns"}, {0, NULL, NULL}};
		GType clean_build_files_clean_file_column_type_id;
		clean_build_files_clean_file_column_type_id = g_enum_register_static ("CleanBuildFilesCleanFileColumn", values);
		g_once_init_leave (&clean_build_files_clean_file_column_type_id__volatile, clean_build_files_clean_file_column_type_id);
	}
	return clean_build_files_clean_file_column_type_id__volatile;
}


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


CleanBuildFiles* clean_build_files_construct (GType object_type, MainWindow* main_window, Document* doc) {
	CleanBuildFiles * self = NULL;
	MainWindow* _tmp0_;
	Document* _tmp1_;
	Document* _tmp2_;
	GSettings* _tmp3_;
	g_return_val_if_fail (main_window != NULL, NULL);
	g_return_val_if_fail (doc != NULL, NULL);
	self = (CleanBuildFiles*) g_object_new (object_type, NULL);
	_tmp0_ = main_window;
	self->priv->_main_window = _tmp0_;
	_tmp1_ = doc;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (self->priv->_doc);
	self->priv->_doc = _tmp2_;
	_tmp3_ = g_settings_new ("org.gnome.latexila.preferences.latex");
	_g_object_unref0 (self->priv->_settings);
	self->priv->_settings = _tmp3_;
	return self;
}


CleanBuildFiles* clean_build_files_new (MainWindow* main_window, Document* doc) {
	return clean_build_files_construct (TYPE_CLEAN_BUILD_FILES, main_window, doc);
}


void clean_build_files_clean (CleanBuildFiles* self) {
	Document* _tmp0_;
	gboolean _tmp1_;
	GeeArrayList* files_to_delete = NULL;
	GFile* directory = NULL;
	Project* project = NULL;
	Document* _tmp2_;
	Project* _tmp3_;
	Project* _tmp4_;
	gboolean no_confirm = FALSE;
	GSettings* _tmp15_;
	gboolean _tmp16_;
	GeeArrayList* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	gboolean _tmp21_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_doc;
	_tmp1_ = document_is_main_file_a_tex_file (_tmp0_);
	if (!_tmp1_) {
		return;
	}
	_tmp2_ = self->priv->_doc;
	_tmp3_ = document_get_project (_tmp2_);
	project = _tmp3_;
	_tmp4_ = project;
	if (_tmp4_ != NULL) {
		Project* _tmp5_;
		GFile* _tmp6_;
		GFile* _tmp7_;
		GFile* _tmp8_;
		GeeArrayList* _tmp9_;
		_tmp5_ = project;
		_tmp6_ = (*_tmp5_).directory;
		_tmp7_ = _g_object_ref0 (_tmp6_);
		_g_object_unref0 (directory);
		directory = _tmp7_;
		_tmp8_ = directory;
		_tmp9_ = clean_build_files_get_build_files_in_directory (self, _tmp8_);
		_g_object_unref0 (files_to_delete);
		files_to_delete = _tmp9_;
	} else {
		Document* _tmp10_;
		GFile* _tmp11_;
		GFile* _tmp12_;
		GFile* _tmp13_;
		GeeArrayList* _tmp14_;
		_tmp10_ = self->priv->_doc;
		_tmp11_ = document_get_location (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = g_file_get_parent (_tmp12_);
		_g_object_unref0 (directory);
		directory = _tmp13_;
		_tmp14_ = clean_build_files_get_build_files_simple (self);
		_g_object_unref0 (files_to_delete);
		files_to_delete = _tmp14_;
	}
	_tmp15_ = self->priv->_settings;
	_tmp16_ = g_settings_get_boolean (_tmp15_, "no-confirm-clean");
	no_confirm = _tmp16_;
	_tmp17_ = files_to_delete;
	_tmp18_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp17_);
	_tmp19_ = _tmp18_;
	if (_tmp19_ == 0) {
		gboolean _tmp20_;
		_tmp20_ = no_confirm;
		if (!_tmp20_) {
			clean_build_files_show_info_no_file (self);
		}
		_project_free0 (project);
		_g_object_unref0 (directory);
		_g_object_unref0 (files_to_delete);
		return;
	}
	_tmp21_ = no_confirm;
	if (_tmp21_) {
		{
			GeeArrayList* _file_to_delete_list = NULL;
			GeeArrayList* _tmp22_;
			GeeArrayList* _tmp23_;
			gint _file_to_delete_size = 0;
			GeeArrayList* _tmp24_;
			gint _tmp25_;
			gint _tmp26_;
			gint _file_to_delete_index = 0;
			_tmp22_ = files_to_delete;
			_tmp23_ = _g_object_ref0 (_tmp22_);
			_file_to_delete_list = _tmp23_;
			_tmp24_ = _file_to_delete_list;
			_tmp25_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp24_);
			_tmp26_ = _tmp25_;
			_file_to_delete_size = _tmp26_;
			_file_to_delete_index = -1;
			while (TRUE) {
				gint _tmp27_;
				gint _tmp28_;
				gint _tmp29_;
				GFile* file_to_delete = NULL;
				GeeArrayList* _tmp30_;
				gint _tmp31_;
				gpointer _tmp32_;
				GFile* _tmp33_;
				_tmp27_ = _file_to_delete_index;
				_file_to_delete_index = _tmp27_ + 1;
				_tmp28_ = _file_to_delete_index;
				_tmp29_ = _file_to_delete_size;
				if (!(_tmp28_ < _tmp29_)) {
					break;
				}
				_tmp30_ = _file_to_delete_list;
				_tmp31_ = _file_to_delete_index;
				_tmp32_ = gee_abstract_list_get ((GeeAbstractList*) _tmp30_, _tmp31_);
				file_to_delete = (GFile*) _tmp32_;
				_tmp33_ = file_to_delete;
				utils_delete_file (_tmp33_);
				_g_object_unref0 (file_to_delete);
			}
			_g_object_unref0 (_file_to_delete_list);
		}
	} else {
		GeeArrayList* _tmp34_;
		GFile* _tmp35_;
		_tmp34_ = files_to_delete;
		_tmp35_ = directory;
		clean_build_files_confirm_cleanup (self, _tmp34_, _tmp35_);
	}
	_project_free0 (project);
	_g_object_unref0 (directory);
	_g_object_unref0 (files_to_delete);
}


static GeeArrayList* clean_build_files_get_build_files_simple (CleanBuildFiles* self) {
	GeeArrayList* result = NULL;
	GFile* location = NULL;
	Document* _tmp0_;
	GFile* _tmp1_;
	GFile* _tmp2_;
	GFile* _tmp3_;
	GFile* directory = NULL;
	GFile* _tmp4_;
	GFile* _tmp5_;
	gchar* exts = NULL;
	GSettings* _tmp6_;
	gchar* _tmp7_;
	gchar** extensions = NULL;
	const gchar* _tmp8_;
	gchar** _tmp9_;
	gchar** _tmp10_;
	gint extensions_length1;
	gint _extensions_size_;
	gchar* shortname = NULL;
	GFile* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	GeeArrayList* files_to_delete = NULL;
	GeeArrayList* _tmp16_;
	gchar** _tmp17_;
	gint _tmp17__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_doc;
	_tmp1_ = document_get_location (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	location = _tmp3_;
	_tmp4_ = location;
	_tmp5_ = g_file_get_parent (_tmp4_);
	directory = _tmp5_;
	_tmp6_ = self->priv->_settings;
	_tmp7_ = g_settings_get_string (_tmp6_, "clean-extensions");
	exts = _tmp7_;
	_tmp8_ = exts;
	_tmp10_ = _tmp9_ = g_strsplit (_tmp8_, " ", 0);
	extensions = _tmp10_;
	extensions_length1 = _vala_array_length (_tmp9_);
	_extensions_size_ = extensions_length1;
	_tmp11_ = location;
	_tmp12_ = g_file_get_basename (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = latexila_utils_get_shortname (_tmp13_);
	_tmp15_ = _tmp14_;
	_g_free0 (_tmp13_);
	shortname = _tmp15_;
	_tmp16_ = gee_array_list_new (g_file_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	files_to_delete = _tmp16_;
	_tmp17_ = extensions;
	_tmp17__length1 = extensions_length1;
	{
		gchar** extension_collection = NULL;
		gint extension_collection_length1 = 0;
		gint _extension_collection_size_ = 0;
		gint extension_it = 0;
		extension_collection = _tmp17_;
		extension_collection_length1 = _tmp17__length1;
		for (extension_it = 0; extension_it < _tmp17__length1; extension_it = extension_it + 1) {
			gchar* _tmp18_;
			gchar* extension = NULL;
			_tmp18_ = g_strdup (extension_collection[extension_it]);
			extension = _tmp18_;
			{
				gchar* basename = NULL;
				const gchar* _tmp19_;
				const gchar* _tmp20_;
				gchar* _tmp21_;
				GFile* file = NULL;
				GFile* _tmp22_;
				const gchar* _tmp23_;
				GFile* _tmp24_;
				GFile* _tmp25_;
				gboolean _tmp26_;
				_tmp19_ = shortname;
				_tmp20_ = extension;
				_tmp21_ = g_strconcat (_tmp19_, _tmp20_, NULL);
				basename = _tmp21_;
				_tmp22_ = directory;
				_tmp23_ = basename;
				_tmp24_ = g_file_get_child (_tmp22_, _tmp23_);
				file = _tmp24_;
				_tmp25_ = file;
				_tmp26_ = g_file_query_exists (_tmp25_, NULL);
				if (_tmp26_) {
					GeeArrayList* _tmp27_;
					GFile* _tmp28_;
					_tmp27_ = files_to_delete;
					_tmp28_ = file;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp27_, _tmp28_);
				}
				_g_object_unref0 (file);
				_g_free0 (basename);
				_g_free0 (extension);
			}
		}
	}
	result = files_to_delete;
	_g_free0 (shortname);
	extensions = (_vala_array_free (extensions, extensions_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (exts);
	_g_object_unref0 (directory);
	_g_object_unref0 (location);
	return result;
}


static gchar string_get (const gchar* self, glong index) {
	gchar result = '\0';
	glong _tmp0_;
	gchar _tmp1_;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = index;
	_tmp1_ = ((gchar*) self)[_tmp0_];
	result = _tmp1_;
	return result;
}


static GeeArrayList* clean_build_files_get_build_files_in_directory (CleanBuildFiles* self, GFile* directory) {
	GeeArrayList* result = NULL;
	gchar* exts = NULL;
	GSettings* _tmp0_;
	gchar* _tmp1_;
	gchar** extensions = NULL;
	const gchar* _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
	gint extensions_length1;
	gint _extensions_size_;
	GeeArrayList* files_to_delete = NULL;
	GeeArrayList* _tmp5_;
	GFileEnumerator* enumerator = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (directory != NULL, NULL);
	_tmp0_ = self->priv->_settings;
	_tmp1_ = g_settings_get_string (_tmp0_, "clean-extensions");
	exts = _tmp1_;
	_tmp2_ = exts;
	_tmp4_ = _tmp3_ = g_strsplit (_tmp2_, " ", 0);
	extensions = _tmp4_;
	extensions_length1 = _vala_array_length (_tmp3_);
	_extensions_size_ = extensions_length1;
	_tmp5_ = gee_array_list_new (g_file_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	files_to_delete = _tmp5_;
	{
		GFileEnumerator* _tmp6_ = NULL;
		GFile* _tmp7_;
		GFileEnumerator* _tmp8_;
		GFileEnumerator* _tmp9_;
		_tmp7_ = directory;
		_tmp8_ = g_file_enumerate_children (_tmp7_, "standard::type,standard::name", G_FILE_QUERY_INFO_NONE, NULL, &_inner_error_);
		_tmp6_ = _tmp8_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp9_ = _tmp6_;
		_tmp6_ = NULL;
		_g_object_unref0 (enumerator);
		enumerator = _tmp9_;
		_g_object_unref0 (_tmp6_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp10_;
		const gchar* _tmp11_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp10_ = e;
		_tmp11_ = _tmp10_->message;
		g_warning ("clean_build_files.vala:123: Clean build files: %s", _tmp11_);
		result = files_to_delete;
		_g_error_free0 (e);
		_g_object_unref0 (enumerator);
		extensions = (_vala_array_free (extensions, extensions_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (exts);
		return result;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_object_unref0 (enumerator);
		_g_object_unref0 (files_to_delete);
		extensions = (_vala_array_free (extensions, extensions_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (exts);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	while (TRUE) {
		GFileInfo* info = NULL;
		GFileInfo* _tmp18_;
		gchar* name = NULL;
		GFileInfo* _tmp19_;
		const gchar* _tmp20_;
		gchar* _tmp21_;
		const gchar* _tmp22_;
		gchar _tmp23_;
		GFile* file = NULL;
		GFile* _tmp24_;
		const gchar* _tmp25_;
		GFile* _tmp26_;
		GFileType type = 0;
		GFileInfo* _tmp27_;
		GFileType _tmp28_;
		GFileType _tmp29_;
		gchar** _tmp34_;
		gint _tmp34__length1;
		info = NULL;
		{
			GFileInfo* _tmp12_ = NULL;
			GFileEnumerator* _tmp13_;
			GFileInfo* _tmp14_;
			GFileInfo* _tmp15_;
			_tmp13_ = enumerator;
			_tmp14_ = g_file_enumerator_next_file (_tmp13_, NULL, &_inner_error_);
			_tmp12_ = _tmp14_;
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				goto __catch1_g_error;
			}
			_tmp15_ = _tmp12_;
			_tmp12_ = NULL;
			_g_object_unref0 (info);
			info = _tmp15_;
			_g_object_unref0 (_tmp12_);
		}
		goto __finally1;
		__catch1_g_error:
		{
			GError* e = NULL;
			GError* _tmp16_;
			const gchar* _tmp17_;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp16_ = e;
			_tmp17_ = _tmp16_->message;
			g_warning ("clean_build_files.vala:137: Clean build files: %s", _tmp17_);
			_g_error_free0 (e);
			_g_object_unref0 (info);
			break;
		}
		__finally1:
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_object_unref0 (info);
			_g_object_unref0 (enumerator);
			_g_object_unref0 (files_to_delete);
			extensions = (_vala_array_free (extensions, extensions_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (exts);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
		_tmp18_ = info;
		if (_tmp18_ == NULL) {
			_g_object_unref0 (info);
			break;
		}
		_tmp19_ = info;
		_tmp20_ = g_file_info_get_name (_tmp19_);
		_tmp21_ = g_strdup (_tmp20_);
		name = _tmp21_;
		_tmp22_ = name;
		_tmp23_ = string_get (_tmp22_, (glong) 0);
		if (_tmp23_ == '.') {
			_g_free0 (name);
			_g_object_unref0 (info);
			continue;
		}
		_tmp24_ = directory;
		_tmp25_ = name;
		_tmp26_ = g_file_get_child (_tmp24_, _tmp25_);
		file = _tmp26_;
		_tmp27_ = info;
		_tmp28_ = g_file_info_get_file_type (_tmp27_);
		type = _tmp28_;
		_tmp29_ = type;
		if (_tmp29_ == G_FILE_TYPE_DIRECTORY) {
			GeeArrayList* files_to_delete_in_dir = NULL;
			GFile* _tmp30_;
			GeeArrayList* _tmp31_;
			GeeArrayList* _tmp32_;
			GeeArrayList* _tmp33_;
			_tmp30_ = file;
			_tmp31_ = clean_build_files_get_build_files_in_directory (self, _tmp30_);
			files_to_delete_in_dir = _tmp31_;
			_tmp32_ = files_to_delete;
			_tmp33_ = files_to_delete_in_dir;
			gee_array_list_add_all (_tmp32_, (GeeCollection*) _tmp33_);
			_g_object_unref0 (files_to_delete_in_dir);
			_g_object_unref0 (file);
			_g_free0 (name);
			_g_object_unref0 (info);
			continue;
		}
		_tmp34_ = extensions;
		_tmp34__length1 = extensions_length1;
		{
			gchar** ext_collection = NULL;
			gint ext_collection_length1 = 0;
			gint _ext_collection_size_ = 0;
			gint ext_it = 0;
			ext_collection = _tmp34_;
			ext_collection_length1 = _tmp34__length1;
			for (ext_it = 0; ext_it < _tmp34__length1; ext_it = ext_it + 1) {
				gchar* _tmp35_;
				gchar* ext = NULL;
				_tmp35_ = g_strdup (ext_collection[ext_it]);
				ext = _tmp35_;
				{
					const gchar* _tmp36_;
					const gchar* _tmp37_;
					gboolean _tmp38_;
					_tmp36_ = name;
					_tmp37_ = ext;
					_tmp38_ = g_str_has_suffix (_tmp36_, _tmp37_);
					if (_tmp38_) {
						GeeArrayList* _tmp39_;
						GFile* _tmp40_;
						_tmp39_ = files_to_delete;
						_tmp40_ = file;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp39_, _tmp40_);
						_g_free0 (ext);
						break;
					}
					_g_free0 (ext);
				}
			}
		}
		_g_object_unref0 (file);
		_g_free0 (name);
		_g_object_unref0 (info);
	}
	result = files_to_delete;
	_g_object_unref0 (enumerator);
	extensions = (_vala_array_free (extensions, extensions_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (exts);
	return result;
}


static void clean_build_files_confirm_cleanup (CleanBuildFiles* self, GeeArrayList* files_to_delete, GFile* directory) {
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	GtkTreeView* list_files = NULL;
	GeeArrayList* _tmp3_;
	GFile* _tmp4_;
	GtkTreeView* _tmp5_;
	GtkDialog* dialog = NULL;
	GtkDialog* _tmp6_;
	GtkTreeModel* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (files_to_delete != NULL);
	g_return_if_fail (directory != NULL);
	_tmp0_ = files_to_delete;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	g_return_if_fail (0 < _tmp2_);
	_tmp3_ = files_to_delete;
	_tmp4_ = directory;
	_tmp5_ = clean_build_files_get_list_files (self, _tmp3_, _tmp4_);
	list_files = _tmp5_;
	_tmp6_ = clean_build_files_get_dialog (self, list_files);
	dialog = _tmp6_;
	_tmp7_ = gtk_tree_view_get_model (list_files);
	clean_build_files_run_dialog (self, dialog, _tmp7_);
	_g_object_unref0 (dialog);
	_g_object_unref0 (list_files);
}


static Block11Data* block11_data_ref (Block11Data* _data11_) {
	g_atomic_int_inc (&_data11_->_ref_count_);
	return _data11_;
}


static void block11_data_unref (void * _userdata_) {
	Block11Data* _data11_;
	_data11_ = (Block11Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data11_->_ref_count_)) {
		CleanBuildFiles* self;
		self = _data11_->self;
		_g_object_unref0 (_data11_->store);
		_g_object_unref0 (self);
		g_slice_free (Block11Data, _data11_);
	}
}


static gint _clean_build_files_on_sort_list_files_gtk_tree_iter_compare_func (GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b, gpointer self) {
	gint result;
	result = clean_build_files_on_sort_list_files ((CleanBuildFiles*) self, model, a, b);
	return result;
}


static void __lambda17_ (Block11Data* _data11_, const gchar* path_str) {
	CleanBuildFiles* self;
	GtkTreePath* path = NULL;
	const gchar* _tmp0_;
	GtkTreePath* _tmp1_;
	GtkTreeIter iter = {0};
	gboolean active = FALSE;
	GtkListStore* _tmp2_;
	GtkTreeIter _tmp3_ = {0};
	GtkListStore* _tmp4_;
	GtkTreeIter _tmp5_;
	GtkListStore* _tmp6_;
	GtkTreeIter _tmp7_;
	self = _data11_->self;
	g_return_if_fail (path_str != NULL);
	_tmp0_ = path_str;
	_tmp1_ = gtk_tree_path_new_from_string (_tmp0_);
	path = _tmp1_;
	_tmp2_ = _data11_->store;
	gtk_tree_model_get_iter ((GtkTreeModel*) _tmp2_, &_tmp3_, path);
	iter = _tmp3_;
	_tmp4_ = _data11_->store;
	_tmp5_ = iter;
	gtk_tree_model_get ((GtkTreeModel*) _tmp4_, &_tmp5_, CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_DELETE, &active, -1);
	_tmp6_ = _data11_->store;
	_tmp7_ = iter;
	gtk_list_store_set (_tmp6_, &_tmp7_, CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_DELETE, !active, -1);
	_gtk_tree_path_free0 (path);
}


static void ___lambda17__gtk_cell_renderer_toggle_toggled (GtkCellRendererToggle* _sender, const gchar* path, gpointer self) {
	__lambda17_ (self, path);
}


static GtkTreeView* clean_build_files_get_list_files (CleanBuildFiles* self, GeeArrayList* files_to_delete, GFile* directory) {
	GtkTreeView* result = NULL;
	Block11Data* _data11_;
	GtkTreeView* treeview = NULL;
	GtkTreeView* _tmp0_;
	GtkTreeView* _tmp1_;
	GtkTreeView* _tmp2_;
	GtkTreeView* _tmp3_;
	GtkListStore* _tmp4_;
	GtkListStore* _tmp5_;
	GtkListStore* _tmp6_;
	GtkTreeView* _tmp28_;
	GtkListStore* _tmp29_;
	GtkCellRendererToggle* toggle_renderer = NULL;
	GtkCellRendererToggle* _tmp30_;
	GtkTreeViewColumn* column = NULL;
	GtkTreeViewColumn* _tmp31_;
	GtkTreeView* _tmp32_;
	GtkTreeViewColumn* _tmp33_;
	GtkCellRendererText* text_renderer = NULL;
	GtkCellRendererText* _tmp34_;
	GtkTreeViewColumn* _tmp35_;
	GtkTreeView* _tmp36_;
	GtkTreeViewColumn* _tmp37_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (files_to_delete != NULL, NULL);
	g_return_val_if_fail (directory != NULL, NULL);
	_data11_ = g_slice_new0 (Block11Data);
	_data11_->_ref_count_ = 1;
	_data11_->self = g_object_ref (self);
	_tmp0_ = (GtkTreeView*) gtk_tree_view_new ();
	g_object_ref_sink (_tmp0_);
	treeview = _tmp0_;
	_tmp1_ = treeview;
	gtk_widget_set_size_request ((GtkWidget*) _tmp1_, 260, 120);
	_tmp2_ = treeview;
	gtk_tree_view_set_headers_visible (_tmp2_, FALSE);
	_tmp3_ = treeview;
	gtk_tree_view_set_enable_search (_tmp3_, FALSE);
	_tmp4_ = gtk_list_store_new ((gint) CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_N_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_STRING, g_file_get_type (), -1);
	_data11_->store = _tmp4_;
	_tmp5_ = _data11_->store;
	gtk_tree_sortable_set_sort_func ((GtkTreeSortable*) _tmp5_, 0, _clean_build_files_on_sort_list_files_gtk_tree_iter_compare_func, g_object_ref (self), g_object_unref);
	_tmp6_ = _data11_->store;
	gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable*) _tmp6_, 0, GTK_SORT_ASCENDING);
	{
		GeeArrayList* _file_to_delete_list = NULL;
		GeeArrayList* _tmp7_;
		GeeArrayList* _tmp8_;
		gint _file_to_delete_size = 0;
		GeeArrayList* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		gint _file_to_delete_index = 0;
		_tmp7_ = files_to_delete;
		_tmp8_ = _g_object_ref0 (_tmp7_);
		_file_to_delete_list = _tmp8_;
		_tmp9_ = _file_to_delete_list;
		_tmp10_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp9_);
		_tmp11_ = _tmp10_;
		_file_to_delete_size = _tmp11_;
		_file_to_delete_index = -1;
		while (TRUE) {
			gint _tmp12_;
			gint _tmp13_;
			gint _tmp14_;
			GFile* file_to_delete = NULL;
			GeeArrayList* _tmp15_;
			gint _tmp16_;
			gpointer _tmp17_;
			gchar* relative_path = NULL;
			GFile* _tmp18_;
			GFile* _tmp19_;
			GFile* _tmp20_;
			gchar* _tmp21_;
			GtkTreeIter iter = {0};
			GtkListStore* _tmp22_;
			GtkTreeIter _tmp23_ = {0};
			GtkListStore* _tmp24_;
			GtkTreeIter _tmp25_;
			const gchar* _tmp26_;
			GFile* _tmp27_;
			_tmp12_ = _file_to_delete_index;
			_file_to_delete_index = _tmp12_ + 1;
			_tmp13_ = _file_to_delete_index;
			_tmp14_ = _file_to_delete_size;
			if (!(_tmp13_ < _tmp14_)) {
				break;
			}
			_tmp15_ = _file_to_delete_list;
			_tmp16_ = _file_to_delete_index;
			_tmp17_ = gee_abstract_list_get ((GeeAbstractList*) _tmp15_, _tmp16_);
			file_to_delete = (GFile*) _tmp17_;
			_tmp18_ = directory;
			_tmp19_ = file_to_delete;
			_tmp20_ = directory;
			_tmp21_ = utils_get_relative_path (_tmp18_, _tmp19_, _tmp20_);
			relative_path = _tmp21_;
			_tmp22_ = _data11_->store;
			gtk_list_store_append (_tmp22_, &_tmp23_);
			iter = _tmp23_;
			_tmp24_ = _data11_->store;
			_tmp25_ = iter;
			_tmp26_ = relative_path;
			_tmp27_ = file_to_delete;
			gtk_list_store_set (_tmp24_, &_tmp25_, CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_DELETE, TRUE, CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_NAME, _tmp26_, CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_FILE, _tmp27_, -1);
			_g_free0 (relative_path);
			_g_object_unref0 (file_to_delete);
		}
		_g_object_unref0 (_file_to_delete_list);
	}
	_tmp28_ = treeview;
	_tmp29_ = _data11_->store;
	gtk_tree_view_set_model (_tmp28_, (GtkTreeModel*) _tmp29_);
	_tmp30_ = (GtkCellRendererToggle*) gtk_cell_renderer_toggle_new ();
	g_object_ref_sink (_tmp30_);
	toggle_renderer = _tmp30_;
	g_signal_connect_data (toggle_renderer, "toggled", (GCallback) ___lambda17__gtk_cell_renderer_toggle_toggled, block11_data_ref (_data11_), (GClosureNotify) block11_data_unref, 0);
	_tmp31_ = gtk_tree_view_column_new_with_attributes ("Delete?", (GtkCellRenderer*) toggle_renderer, "active", CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_DELETE, NULL, NULL);
	g_object_ref_sink (_tmp31_);
	column = _tmp31_;
	_tmp32_ = treeview;
	_tmp33_ = column;
	gtk_tree_view_append_column (_tmp32_, _tmp33_);
	_tmp34_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp34_);
	text_renderer = _tmp34_;
	_tmp35_ = gtk_tree_view_column_new_with_attributes ("Name", (GtkCellRenderer*) text_renderer, "text", CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_NAME, NULL);
	g_object_ref_sink (_tmp35_);
	_g_object_unref0 (column);
	column = _tmp35_;
	_tmp36_ = treeview;
	_tmp37_ = column;
	gtk_tree_view_append_column (_tmp36_, _tmp37_);
	result = treeview;
	_g_object_unref0 (text_renderer);
	_g_object_unref0 (column);
	_g_object_unref0 (toggle_renderer);
	block11_data_unref (_data11_);
	_data11_ = NULL;
	return result;
}


static GtkDialog* clean_build_files_get_dialog (CleanBuildFiles* self, GtkTreeView* list_files) {
	GtkDialog* result = NULL;
	GtkDialog* dialog = NULL;
	MainWindow* _tmp0_;
	GtkDialog* _tmp1_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp2_;
	GtkBox* content_area = NULL;
	GtkBox* _tmp3_;
	GtkBox* _tmp4_;
	GtkImage* image = NULL;
	GtkImage* _tmp5_;
	GtkLabel* primary_label = NULL;
	GtkLabel* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GtkLabel* select_label = NULL;
	GtkLabel* _tmp11_;
	GtkScrolledWindow* sw = NULL;
	GtkTreeView* _tmp12_;
	GtkScrolledWindow* _tmp13_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (list_files != NULL, NULL);
	_tmp0_ = self->priv->_main_window;
	_tmp1_ = (GtkDialog*) gtk_dialog_new_with_buttons (NULL, (GtkWindow*) _tmp0_, GTK_DIALOG_DESTROY_WITH_PARENT, _ ("_Cancel"), GTK_RESPONSE_CANCEL, _ ("_Delete"), GTK_RESPONSE_ACCEPT, NULL);
	g_object_ref_sink (_tmp1_);
	dialog = _tmp1_;
	_tmp2_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp2_);
	grid = _tmp2_;
	gtk_grid_set_column_spacing (grid, (guint) 12);
	gtk_grid_set_row_spacing (grid, (guint) 8);
	gtk_container_set_border_width ((GtkContainer*) grid, (guint) 5);
	_tmp3_ = (GtkBox*) gtk_dialog_get_content_area (dialog);
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, gtk_box_get_type ()) ? ((GtkBox*) _tmp3_) : NULL);
	content_area = _tmp4_;
	gtk_box_pack_start (content_area, (GtkWidget*) grid, TRUE, TRUE, (guint) 0);
	_tmp5_ = (GtkImage*) gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_DIALOG);
	g_object_ref_sink (_tmp5_);
	image = _tmp5_;
	gtk_widget_set_valign ((GtkWidget*) image, GTK_ALIGN_START);
	gtk_grid_attach (grid, (GtkWidget*) image, 0, 0, 1, 3);
	_tmp6_ = (GtkLabel*) gtk_label_new (NULL);
	g_object_ref_sink (_tmp6_);
	primary_label = _tmp6_;
	gtk_label_set_line_wrap (primary_label, TRUE);
	gtk_label_set_use_markup (primary_label, TRUE);
	gtk_widget_set_halign ((GtkWidget*) primary_label, GTK_ALIGN_START);
	gtk_label_set_selectable (primary_label, TRUE);
	gtk_widget_set_margin_bottom ((GtkWidget*) primary_label, 4);
	_tmp7_ = g_strconcat ("<span weight=\"bold\" size=\"larger\">", _ ("Do you really want to delete these files?"), NULL);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_strconcat (_tmp8_, "</span>", NULL);
	_tmp10_ = _tmp9_;
	gtk_label_set_markup (primary_label, _tmp10_);
	_g_free0 (_tmp10_);
	_g_free0 (_tmp8_);
	gtk_grid_attach (grid, (GtkWidget*) primary_label, 1, 0, 1, 1);
	_tmp11_ = (GtkLabel*) gtk_label_new (_ ("Select the files you want to delete:"));
	g_object_ref_sink (_tmp11_);
	select_label = _tmp11_;
	gtk_label_set_line_wrap (select_label, TRUE);
	gtk_widget_set_halign ((GtkWidget*) select_label, GTK_ALIGN_START);
	gtk_grid_attach (grid, (GtkWidget*) select_label, 1, 1, 1, 1);
	_tmp12_ = list_files;
	_tmp13_ = utils_add_scrollbar ((GtkWidget*) _tmp12_);
	sw = _tmp13_;
	gtk_scrolled_window_set_shadow_type (sw, GTK_SHADOW_IN);
	g_object_set ((GtkWidget*) sw, "expand", TRUE, NULL);
	gtk_grid_attach (grid, (GtkWidget*) sw, 1, 2, 1, 1);
	gtk_widget_show_all ((GtkWidget*) grid);
	result = dialog;
	_g_object_unref0 (sw);
	_g_object_unref0 (select_label);
	_g_object_unref0 (primary_label);
	_g_object_unref0 (image);
	_g_object_unref0 (content_area);
	_g_object_unref0 (grid);
	return result;
}


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


static void clean_build_files_run_dialog (CleanBuildFiles* self, GtkDialog* dialog, GtkTreeModel* list_store) {
	GtkDialog* _tmp0_;
	gint _tmp1_;
	GtkDialog* _tmp18_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (dialog != NULL);
	g_return_if_fail (list_store != NULL);
	_tmp0_ = dialog;
	_tmp1_ = gtk_dialog_run (_tmp0_);
	if (_tmp1_ == ((gint) GTK_RESPONSE_ACCEPT)) {
		GFile** selected_files = NULL;
		GFile** _tmp2_;
		gint selected_files_length1;
		gint _selected_files_size_;
		GtkTreeIter iter = {0};
		gboolean valid = FALSE;
		GtkTreeModel* _tmp3_;
		GtkTreeIter _tmp4_ = {0};
		gboolean _tmp5_;
		GFile** _tmp15_;
		gint _tmp15__length1;
		_tmp2_ = g_new0 (GFile*, 0 + 1);
		selected_files = _tmp2_;
		selected_files_length1 = 0;
		_selected_files_size_ = selected_files_length1;
		_tmp3_ = list_store;
		_tmp5_ = gtk_tree_model_get_iter_first (_tmp3_, &_tmp4_);
		iter = _tmp4_;
		valid = _tmp5_;
		while (TRUE) {
			gboolean _tmp6_;
			gboolean selected = FALSE;
			GFile* file_to_delete = NULL;
			GtkTreeModel* _tmp7_;
			GtkTreeIter _tmp8_;
			gboolean _tmp9_;
			GtkTreeModel* _tmp13_;
			gboolean _tmp14_;
			_tmp6_ = valid;
			if (!_tmp6_) {
				break;
			}
			_tmp7_ = list_store;
			_tmp8_ = iter;
			gtk_tree_model_get (_tmp7_, &_tmp8_, CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_DELETE, &selected, CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_FILE, &file_to_delete, -1);
			_tmp9_ = selected;
			if (_tmp9_) {
				GFile** _tmp10_;
				gint _tmp10__length1;
				GFile* _tmp11_;
				GFile* _tmp12_;
				_tmp10_ = selected_files;
				_tmp10__length1 = selected_files_length1;
				_tmp11_ = file_to_delete;
				_tmp12_ = _g_object_ref0 (_tmp11_);
				_vala_array_add1 (&selected_files, &selected_files_length1, &_selected_files_size_, _tmp12_);
			}
			_tmp13_ = list_store;
			_tmp14_ = gtk_tree_model_iter_next (_tmp13_, &iter);
			valid = _tmp14_;
			_g_object_unref0 (file_to_delete);
		}
		_tmp15_ = selected_files;
		_tmp15__length1 = selected_files_length1;
		{
			GFile** file_to_delete_collection = NULL;
			gint file_to_delete_collection_length1 = 0;
			gint _file_to_delete_collection_size_ = 0;
			gint file_to_delete_it = 0;
			file_to_delete_collection = _tmp15_;
			file_to_delete_collection_length1 = _tmp15__length1;
			for (file_to_delete_it = 0; file_to_delete_it < _tmp15__length1; file_to_delete_it = file_to_delete_it + 1) {
				GFile* _tmp16_;
				GFile* file_to_delete = NULL;
				_tmp16_ = _g_object_ref0 (file_to_delete_collection[file_to_delete_it]);
				file_to_delete = _tmp16_;
				{
					GFile* _tmp17_;
					_tmp17_ = file_to_delete;
					utils_delete_file (_tmp17_);
					_g_object_unref0 (file_to_delete);
				}
			}
		}
		selected_files = (_vala_array_free (selected_files, selected_files_length1, (GDestroyNotify) g_object_unref), NULL);
	}
	_tmp18_ = dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp18_);
}


static gint clean_build_files_on_sort_list_files (CleanBuildFiles* self, GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b) {
	gint result = 0;
	gchar* name_a = NULL;
	gchar* name_b = NULL;
	GtkTreeModel* _tmp0_;
	GtkTreeIter _tmp1_;
	GtkTreeModel* _tmp2_;
	GtkTreeIter _tmp3_;
	gint _tmp4_;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (model != NULL, 0);
	g_return_val_if_fail (a != NULL, 0);
	g_return_val_if_fail (b != NULL, 0);
	_tmp0_ = model;
	_tmp1_ = *a;
	gtk_tree_model_get (_tmp0_, &_tmp1_, CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_NAME, &name_a, -1);
	_tmp2_ = model;
	_tmp3_ = *b;
	gtk_tree_model_get (_tmp2_, &_tmp3_, CLEAN_BUILD_FILES_CLEAN_FILE_COLUMN_NAME, &name_b, -1);
	_tmp4_ = g_utf8_collate (name_a, name_b);
	result = _tmp4_;
	_g_free0 (name_b);
	_g_free0 (name_a);
	return result;
}


static void clean_build_files_show_info_no_file (CleanBuildFiles* self) {
	GtkDialog* dialog = NULL;
	MainWindow* _tmp0_;
	GtkMessageDialog* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_main_window;
	_tmp1_ = (GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) _tmp0_, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", _ ("No build file to clean up."));
	g_object_ref_sink (_tmp1_);
	dialog = (GtkDialog*) _tmp1_;
	gtk_dialog_run (dialog);
	gtk_widget_destroy ((GtkWidget*) dialog);
	_g_object_unref0 (dialog);
}


static void clean_build_files_class_init (CleanBuildFilesClass * klass) {
	clean_build_files_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (CleanBuildFilesPrivate));
	G_OBJECT_CLASS (klass)->finalize = clean_build_files_finalize;
}


static void clean_build_files_instance_init (CleanBuildFiles * self) {
	self->priv = CLEAN_BUILD_FILES_GET_PRIVATE (self);
}


static void clean_build_files_finalize (GObject * obj) {
	CleanBuildFiles * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_CLEAN_BUILD_FILES, CleanBuildFiles);
	_g_object_unref0 (self->priv->_doc);
	_g_object_unref0 (self->priv->_settings);
	G_OBJECT_CLASS (clean_build_files_parent_class)->finalize (obj);
}


GType clean_build_files_get_type (void) {
	static volatile gsize clean_build_files_type_id__volatile = 0;
	if (g_once_init_enter (&clean_build_files_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (CleanBuildFilesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clean_build_files_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CleanBuildFiles), 0, (GInstanceInitFunc) clean_build_files_instance_init, NULL };
		GType clean_build_files_type_id;
		clean_build_files_type_id = g_type_register_static (G_TYPE_OBJECT, "CleanBuildFiles", &g_define_type_info, 0);
		g_once_init_leave (&clean_build_files_type_id__volatile, clean_build_files_type_id);
	}
	return clean_build_files_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int 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, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


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



