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

/*
* Copyright (c) 2017 Robert San <robertsanseries@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 <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib/gi18n-lib.h>

#define CIANO_CONFIGS_PROPERTIES_TEXT_CONVERT_FILE _ ("Convert File")
#define CIANO_CONFIGS_PROPERTIES_TEXT_CONVERT_FILE_TO _ ("Convert file to")
#define CIANO_CONFIGS_PROPERTIES_TEXT_ADD_ITEMS_TO_CONVERSION _ ("Add items to conversion:")
#define CIANO_CONFIGS_PROPERTIES_NAME _ ("Name")
#define CIANO_CONFIGS_PROPERTIES_DIRECTORY _ ("Directory")
#define CIANO_CONFIGS_PROPERTIES_TEXT_ADD_FILE _ ("Add file")
#define CIANO_CONFIGS_PROPERTIES_TEXT_DELETE _ ("Delete")
#define CIANO_CONFIGS_PROPERTIES_TEXT_CANCEL _ ("Cancel")
#define CIANO_CONFIGS_PROPERTIES_TEXT_START_CONVERSION _ ("Start conversion")
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define CIANO_WIDGETS_TYPE_DIALOG_CONVERT_FILE (ciano_widgets_dialog_convert_file_get_type ())
#define CIANO_WIDGETS_DIALOG_CONVERT_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CIANO_WIDGETS_TYPE_DIALOG_CONVERT_FILE, CianoWidgetsDialogConvertFile))
#define CIANO_WIDGETS_DIALOG_CONVERT_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CIANO_WIDGETS_TYPE_DIALOG_CONVERT_FILE, CianoWidgetsDialogConvertFileClass))
#define CIANO_WIDGETS_IS_DIALOG_CONVERT_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CIANO_WIDGETS_TYPE_DIALOG_CONVERT_FILE))
#define CIANO_WIDGETS_IS_DIALOG_CONVERT_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CIANO_WIDGETS_TYPE_DIALOG_CONVERT_FILE))
#define CIANO_WIDGETS_DIALOG_CONVERT_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CIANO_WIDGETS_TYPE_DIALOG_CONVERT_FILE, CianoWidgetsDialogConvertFileClass))

typedef struct _CianoWidgetsDialogConvertFile CianoWidgetsDialogConvertFile;
typedef struct _CianoWidgetsDialogConvertFileClass CianoWidgetsDialogConvertFileClass;
typedef struct _CianoWidgetsDialogConvertFilePrivate CianoWidgetsDialogConvertFilePrivate;

#define CIANO_CONTROLLERS_TYPE_CONVERTER_CONTROLLER (ciano_controllers_converter_controller_get_type ())
#define CIANO_CONTROLLERS_CONVERTER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CIANO_CONTROLLERS_TYPE_CONVERTER_CONTROLLER, CianoControllersConverterController))
#define CIANO_CONTROLLERS_CONVERTER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CIANO_CONTROLLERS_TYPE_CONVERTER_CONTROLLER, CianoControllersConverterControllerClass))
#define CIANO_CONTROLLERS_IS_CONVERTER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CIANO_CONTROLLERS_TYPE_CONVERTER_CONTROLLER))
#define CIANO_CONTROLLERS_IS_CONVERTER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CIANO_CONTROLLERS_TYPE_CONVERTER_CONTROLLER))
#define CIANO_CONTROLLERS_CONVERTER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CIANO_CONTROLLERS_TYPE_CONVERTER_CONTROLLER, CianoControllersConverterControllerClass))

typedef struct _CianoControllersConverterController CianoControllersConverterController;
typedef struct _CianoControllersConverterControllerClass CianoControllersConverterControllerClass;
enum  {
	CIANO_WIDGETS_DIALOG_CONVERT_FILE_0_PROPERTY,
	CIANO_WIDGETS_DIALOG_CONVERT_FILE_NUM_PROPERTIES
};
static GParamSpec* ciano_widgets_dialog_convert_file_properties[CIANO_WIDGETS_DIALOG_CONVERT_FILE_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _ciano_controllers_converter_controller_unref0(var) ((var == NULL) ? NULL : (var = (ciano_controllers_converter_controller_unref (var), NULL)))
typedef enum  {
	CIANO_ENUMS_COLUMN_ENUM_NAME,
	CIANO_ENUMS_COLUMN_ENUM_DIRECTORY,
	CIANO_ENUMS_COLUMN_ENUM_N_COLUMNS
} CianoEnumsColumnEnum;

#define CIANO_ENUMS_TYPE_COLUMN_ENUM (ciano_enums_column_enum_get_type ())
typedef struct _Block9Data Block9Data;

struct _CianoWidgetsDialogConvertFile {
	GtkDialog parent_instance;
	CianoWidgetsDialogConvertFilePrivate * priv;
};

struct _CianoWidgetsDialogConvertFileClass {
	GtkDialogClass parent_class;
};

struct _CianoWidgetsDialogConvertFilePrivate {
	gchar** formats;
	gint formats_length1;
	gint _formats_size_;
	gchar* name_format;
	GtkListStore* list_store;
	GtkTreeView* tree_view;
	GtkTreeIter iter;
	CianoControllersConverterController* converter_controller;
};

struct _Block9Data {
	int _ref_count_;
	CianoWidgetsDialogConvertFile* self;
	GtkToolButton* button_remove;
};

static gint CianoWidgetsDialogConvertFile_private_offset;
static gpointer ciano_widgets_dialog_convert_file_parent_class = NULL;

VALA_EXTERN GType ciano_widgets_dialog_convert_file_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CianoWidgetsDialogConvertFile, g_object_unref)
VALA_EXTERN gpointer ciano_controllers_converter_controller_ref (gpointer instance);
VALA_EXTERN void ciano_controllers_converter_controller_unref (gpointer instance);
VALA_EXTERN GParamSpec* ciano_controllers_param_spec_converter_controller (const gchar* name,
                                                               const gchar* nick,
                                                               const gchar* blurb,
                                                               GType object_type,
                                                               GParamFlags flags);
VALA_EXTERN void ciano_controllers_value_set_converter_controller (GValue* value,
                                                       gpointer v_object);
VALA_EXTERN void ciano_controllers_value_take_converter_controller (GValue* value,
                                                        gpointer v_object);
VALA_EXTERN gpointer ciano_controllers_value_get_converter_controller (const GValue* value);
VALA_EXTERN GType ciano_controllers_converter_controller_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CianoControllersConverterController, ciano_controllers_converter_controller_unref)
VALA_EXTERN CianoWidgetsDialogConvertFile* ciano_widgets_dialog_convert_file_new (CianoControllersConverterController* converter_controller,
                                                                      gchar** formats,
                                                                      gint formats_length1,
                                                                      const gchar* name_format,
                                                                      GtkWindow* parent);
VALA_EXTERN CianoWidgetsDialogConvertFile* ciano_widgets_dialog_convert_file_construct (GType object_type,
                                                                            CianoControllersConverterController* converter_controller,
                                                                            gchar** formats,
                                                                            gint formats_length1,
                                                                            const gchar* name_format,
                                                                            GtkWindow* parent);
static gchar** _vala_array_dup5 (gchar** self,
                          gssize length);
static GtkFrame* ciano_widgets_dialog_convert_file_mount_frame (CianoWidgetsDialogConvertFile* self);
static GtkGrid* ciano_widgets_dialog_convert_file_mount_buttons (CianoWidgetsDialogConvertFile* self);
static GtkScrolledWindow* ciano_widgets_dialog_convert_file_mount_treeview (CianoWidgetsDialogConvertFile* self);
static GtkToolbar* ciano_widgets_dialog_convert_file_mount_toolbar (CianoWidgetsDialogConvertFile* self);
VALA_EXTERN GType ciano_enums_column_enum_get_type (void) G_GNUC_CONST ;
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
static void __lambda11_ (CianoWidgetsDialogConvertFile* self);
VALA_EXTERN void ciano_controllers_converter_controller_on_activate_button_add_file (CianoControllersConverterController* self,
                                                                         GtkDialog* parent_dialog,
                                                                         GtkTreeView* tree_view,
                                                                         GtkTreeIter* iter,
                                                                         GtkListStore* list_store,
                                                                         gchar** formats,
                                                                         gint formats_length1);
static void ___lambda11__gtk_tool_button_clicked (GtkToolButton* _sender,
                                           gpointer self);
static void __lambda12_ (Block9Data* _data9_);
VALA_EXTERN void ciano_controllers_converter_controller_on_activate_button_remove (CianoControllersConverterController* self,
                                                                       GtkDialog* parent_dialog,
                                                                       GtkTreeView* tree_view,
                                                                       GtkListStore* list_store,
                                                                       GtkToolButton* button_remove);
static void ___lambda12__gtk_tool_button_clicked (GtkToolButton* _sender,
                                           gpointer self);
static void __lambda13_ (Block9Data* _data9_);
static void ___lambda13__gtk_tree_view_cursor_changed (GtkTreeView* _sender,
                                                gpointer self);
static void __lambda14_ (CianoWidgetsDialogConvertFile* self);
static void ___lambda14__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void __lambda15_ (CianoWidgetsDialogConvertFile* self);
VALA_EXTERN void ciano_controllers_converter_controller_on_activate_button_start_conversion (CianoControllersConverterController* self,
                                                                                 GtkListStore* list_store,
                                                                                 const gchar* name_format);
static void ___lambda15__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void ciano_widgets_dialog_convert_file_finalize (GObject * obj);
static GType ciano_widgets_dialog_convert_file_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
ciano_widgets_dialog_convert_file_get_instance_private (CianoWidgetsDialogConvertFile* self)
{
	return G_STRUCT_MEMBER_P (self, CianoWidgetsDialogConvertFile_private_offset);
}

/**
         * Constructs a new {@code DialogConvertFile} object responsible for assemble the structure of the dialog.
         * Defines the title and description to be performed. Then mount the grid using the "mount_frame" method
         * and add the buttons with the method "mount_buttons".
         *
         * @see Ciano.Configs.Properties
         * @see Ciano.Controllers.ConverterController
         * @see mount_frame
         * @see mount_buttons
         * @param {@code ConverterController}  converter_controller
         * @param {@code string[]}             formats
         * @param {@code string}               name_format
         * @param {@code Gtk.Window}           parent
         */
static gpointer
_ciano_controllers_converter_controller_ref0 (gpointer self)
{
	return self ? ciano_controllers_converter_controller_ref (self) : NULL;
}

static gchar**
_vala_array_dup5 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

CianoWidgetsDialogConvertFile*
ciano_widgets_dialog_convert_file_construct (GType object_type,
                                             CianoControllersConverterController* converter_controller,
                                             gchar** formats,
                                             gint formats_length1,
                                             const gchar* name_format,
                                             GtkWindow* parent)
{
	CianoWidgetsDialogConvertFile * self = NULL;
	CianoControllersConverterController* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar* _tmp2_;
	GtkLabel* title = NULL;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GtkLabel* _tmp5_;
	GtkLabel* _tmp6_;
	GtkStyleContext* _tmp7_;
	GtkLabel* label = NULL;
	GtkLabel* _tmp8_;
	GtkFrame* frame = NULL;
	GtkFrame* _tmp9_;
	GtkGrid* grid_buttons = NULL;
	GtkGrid* _tmp10_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp11_;
	GtkBox* _tmp12_;
	g_return_val_if_fail (converter_controller != NULL, NULL);
	g_return_val_if_fail (name_format != NULL, NULL);
	g_return_val_if_fail (parent != NULL, NULL);
	self = (CianoWidgetsDialogConvertFile*) g_object_new (object_type, NULL);
	gtk_window_set_title ((GtkWindow*) self, CIANO_CONFIGS_PROPERTIES_TEXT_CONVERT_FILE);
	gtk_window_set_resizable ((GtkWindow*) self, FALSE);
	gtk_window_set_deletable ((GtkWindow*) self, FALSE);
	_tmp0_ = _ciano_controllers_converter_controller_ref0 (converter_controller);
	_ciano_controllers_converter_controller_unref0 (self->priv->converter_controller);
	self->priv->converter_controller = _tmp0_;
	_tmp1_ = (formats != NULL) ? _vala_array_dup5 (formats, formats_length1) : formats;
	_tmp1__length1 = formats_length1;
	self->priv->formats = (_vala_array_free (self->priv->formats, self->priv->formats_length1, (GDestroyNotify) g_free), NULL);
	self->priv->formats = _tmp1_;
	self->priv->formats_length1 = _tmp1__length1;
	self->priv->_formats_size_ = self->priv->formats_length1;
	_tmp2_ = g_strdup (name_format);
	_g_free0 (self->priv->name_format);
	self->priv->name_format = _tmp2_;
	gtk_window_set_transient_for ((GtkWindow*) self, parent);
	gtk_window_set_default_size ((GtkWindow*) self, 800, 600);
	gtk_widget_set_size_request ((GtkWidget*) self, 800, 600);
	gtk_window_set_modal ((GtkWindow*) self, TRUE);
	_tmp3_ = g_strdup_printf ("<b>%s %s</b>", CIANO_CONFIGS_PROPERTIES_TEXT_CONVERT_FILE_TO, name_format);
	_tmp4_ = _tmp3_;
	_tmp5_ = (GtkLabel*) gtk_label_new (_tmp4_);
	g_object_ref_sink (_tmp5_);
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp4_);
	title = _tmp6_;
	gtk_label_set_use_markup (title, TRUE);
	_tmp7_ = gtk_widget_get_style_context ((GtkWidget*) title);
	gtk_style_context_add_class (_tmp7_, "title-section-dialog");
	gtk_widget_set_halign ((GtkWidget*) title, GTK_ALIGN_CENTER);
	g_object_set ((GtkWidget*) title, "margin", 5, NULL);
	_tmp8_ = (GtkLabel*) gtk_label_new (CIANO_CONFIGS_PROPERTIES_TEXT_ADD_ITEMS_TO_CONVERSION);
	g_object_ref_sink (_tmp8_);
	label = _tmp8_;
	gtk_widget_set_halign ((GtkWidget*) label, GTK_ALIGN_START);
	g_object_set ((GtkWidget*) label, "margin", 5, NULL);
	_tmp9_ = ciano_widgets_dialog_convert_file_mount_frame (self);
	frame = _tmp9_;
	_tmp10_ = ciano_widgets_dialog_convert_file_mount_buttons (self);
	grid_buttons = _tmp10_;
	_tmp11_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp11_);
	grid = _tmp11_;
	gtk_orientable_set_orientation ((GtkOrientable*) grid, GTK_ORIENTATION_VERTICAL);
	gtk_widget_set_margin_start ((GtkWidget*) grid, 15);
	gtk_widget_set_margin_end ((GtkWidget*) grid, 15);
	gtk_widget_set_margin_top ((GtkWidget*) grid, 0);
	gtk_widget_set_margin_bottom ((GtkWidget*) grid, 0);
	gtk_container_add ((GtkContainer*) grid, (GtkWidget*) title);
	gtk_container_add ((GtkContainer*) grid, (GtkWidget*) label);
	gtk_container_add ((GtkContainer*) grid, (GtkWidget*) frame);
	gtk_container_add ((GtkContainer*) grid, (GtkWidget*) grid_buttons);
	_tmp12_ = gtk_dialog_get_content_area ((GtkDialog*) self);
	gtk_container_add ((GtkContainer*) _tmp12_, (GtkWidget*) grid);
	_g_object_unref0 (grid);
	_g_object_unref0 (grid_buttons);
	_g_object_unref0 (frame);
	_g_object_unref0 (label);
	_g_object_unref0 (title);
	return self;
}

CianoWidgetsDialogConvertFile*
ciano_widgets_dialog_convert_file_new (CianoControllersConverterController* converter_controller,
                                       gchar** formats,
                                       gint formats_length1,
                                       const gchar* name_format,
                                       GtkWindow* parent)
{
	return ciano_widgets_dialog_convert_file_construct (CIANO_WIDGETS_TYPE_DIALOG_CONVERT_FILE, converter_controller, formats, formats_length1, name_format, parent);
}

/**
         * Mounts to {@code Gtk.Frame} structure with your widgets.
         * 1 - create the {@code Gtk.Treeview} and add the {@code Gtk.Grid} that will be in the {@code Gtk.Frame}.
         * 2 - create the {@code Gtk.Toobar} and add the {@code Gtk.Grid} that will be in the {@code Gtk.Frame}.
         *
         * @see mount_treeview
         * @see mount_toolbar
         * @return {@code Gtk.Frame}
         */
static GtkFrame*
ciano_widgets_dialog_convert_file_mount_frame (CianoWidgetsDialogConvertFile* self)
{
	GtkScrolledWindow* treeview = NULL;
	GtkScrolledWindow* _tmp0_;
	GtkToolbar* toolbar = NULL;
	GtkToolbar* _tmp1_;
	GtkGrid* grid_itens = NULL;
	GtkGrid* _tmp2_;
	GtkFrame* frame = NULL;
	GtkFrame* _tmp3_;
	GtkFrame* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = ciano_widgets_dialog_convert_file_mount_treeview (self);
	treeview = _tmp0_;
	_tmp1_ = ciano_widgets_dialog_convert_file_mount_toolbar (self);
	toolbar = _tmp1_;
	_tmp2_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp2_);
	grid_itens = _tmp2_;
	gtk_orientable_set_orientation ((GtkOrientable*) grid_itens, GTK_ORIENTATION_VERTICAL);
	gtk_container_add ((GtkContainer*) grid_itens, (GtkWidget*) treeview);
	gtk_container_add ((GtkContainer*) grid_itens, (GtkWidget*) toolbar);
	_tmp3_ = (GtkFrame*) gtk_frame_new (NULL);
	g_object_ref_sink (_tmp3_);
	frame = _tmp3_;
	gtk_container_add ((GtkContainer*) frame, (GtkWidget*) grid_itens);
	result = frame;
	_g_object_unref0 (grid_itens);
	_g_object_unref0 (toolbar);
	_g_object_unref0 (treeview);
	return result;
}

/**
         * Mount the {@code Gtk.Treeview} structure. {@code Gtk.Treeview} will have only two columns "name"
         * and "Directory".
         *
         * @see Ciano.Configs.Properties
         * @see Ciano.Enums.ColumnEnum
         * @return Gtk.ScrolledWindow
         */
static GtkScrolledWindow*
ciano_widgets_dialog_convert_file_mount_treeview (CianoWidgetsDialogConvertFile* self)
{
	GtkListStore* _tmp0_;
	GtkListStore* _tmp1_;
	GtkTreeView* _tmp2_;
	GtkTreeView* _tmp3_;
	GtkTreeViewColumn* name_column = NULL;
	GtkTreeViewColumn* _tmp4_;
	GtkCellRendererText* cell1 = NULL;
	GtkCellRendererText* _tmp5_;
	GtkTreeViewColumn* directory_column = NULL;
	GtkTreeViewColumn* _tmp6_;
	GtkCellRendererText* cell2 = NULL;
	GtkCellRendererText* _tmp7_;
	GtkTreeView* _tmp8_;
	GtkTreeView* _tmp9_;
	GtkScrolledWindow* scrolled = NULL;
	GtkScrolledWindow* _tmp10_;
	GtkTreeView* _tmp11_;
	GtkScrolledWindow* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gtk_list_store_new ((gint) CIANO_ENUMS_COLUMN_ENUM_N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, -1);
	_g_object_unref0 (self->priv->list_store);
	self->priv->list_store = _tmp0_;
	_tmp1_ = self->priv->list_store;
	_tmp2_ = (GtkTreeView*) gtk_tree_view_new_with_model ((GtkTreeModel*) _tmp1_);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->tree_view);
	self->priv->tree_view = _tmp2_;
	_tmp3_ = self->priv->tree_view;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp3_, TRUE);
	_tmp4_ = gtk_tree_view_column_new ();
	g_object_ref_sink (_tmp4_);
	name_column = _tmp4_;
	_tmp5_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp5_);
	cell1 = _tmp5_;
	gtk_tree_view_column_set_title (name_column, CIANO_CONFIGS_PROPERTIES_NAME);
	gtk_tree_view_column_set_expand (name_column, TRUE);
	gtk_tree_view_column_set_min_width (name_column, 200);
	gtk_tree_view_column_set_max_width (name_column, 200);
	gtk_cell_layout_pack_start ((GtkCellLayout*) name_column, (GtkCellRenderer*) cell1, FALSE);
	gtk_cell_layout_add_attribute ((GtkCellLayout*) name_column, (GtkCellRenderer*) cell1, "text", (gint) CIANO_ENUMS_COLUMN_ENUM_NAME);
	_tmp6_ = gtk_tree_view_column_new ();
	g_object_ref_sink (_tmp6_);
	directory_column = _tmp6_;
	_tmp7_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp7_);
	cell2 = _tmp7_;
	gtk_tree_view_column_set_title (directory_column, CIANO_CONFIGS_PROPERTIES_DIRECTORY);
	gtk_tree_view_column_set_expand (directory_column, TRUE);
	gtk_tree_view_column_set_min_width (directory_column, 200);
	gtk_tree_view_column_set_max_width (directory_column, 200);
	gtk_cell_layout_pack_start ((GtkCellLayout*) directory_column, (GtkCellRenderer*) cell2, FALSE);
	gtk_cell_layout_add_attribute ((GtkCellLayout*) directory_column, (GtkCellRenderer*) cell2, "text", (gint) CIANO_ENUMS_COLUMN_ENUM_DIRECTORY);
	_tmp8_ = self->priv->tree_view;
	gtk_tree_view_insert_column (_tmp8_, name_column, -1);
	_tmp9_ = self->priv->tree_view;
	gtk_tree_view_insert_column (_tmp9_, directory_column, -1);
	_tmp10_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_ref_sink (_tmp10_);
	scrolled = _tmp10_;
	g_object_set ((GtkWidget*) scrolled, "expand", TRUE, NULL);
	_tmp11_ = self->priv->tree_view;
	gtk_container_add ((GtkContainer*) scrolled, (GtkWidget*) _tmp11_);
	result = scrolled;
	_g_object_unref0 (cell2);
	_g_object_unref0 (directory_column);
	_g_object_unref0 (cell1);
	_g_object_unref0 (name_column);
	return result;
}

/**
         * Mount the {@code Gtk.Toolbar} structure. The {@code Gtk.Toolbar} will have the option to add items
         * and remove them from the {@code Gtk.Treeview}. The methods responsible for performing the actions of
         * adding ({@code on_activate_button_add_file}) and removing ({@code on_activate_button_remove})
         * the items are implemented in the controller ({@code ConverterController}).
         *
         * @see Ciano.Configs.Properties
         * @see Ciano.Controllers.ConverterController
         * @return Gtk.Toolbar
         */
static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		CianoWidgetsDialogConvertFile* self;
		self = _data9_->self;
		_g_object_unref0 (_data9_->button_remove);
		_g_object_unref0 (self);
		g_slice_free (Block9Data, _data9_);
	}
}

static void
__lambda11_ (CianoWidgetsDialogConvertFile* self)
{
	CianoControllersConverterController* _tmp0_;
	GtkTreeView* _tmp1_;
	GtkTreeIter _tmp2_;
	GtkListStore* _tmp3_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	_tmp0_ = self->priv->converter_controller;
	_tmp1_ = self->priv->tree_view;
	_tmp2_ = self->priv->iter;
	_tmp3_ = self->priv->list_store;
	_tmp4_ = self->priv->formats;
	_tmp4__length1 = self->priv->formats_length1;
	ciano_controllers_converter_controller_on_activate_button_add_file (_tmp0_, (GtkDialog*) self, _tmp1_, &_tmp2_, _tmp3_, _tmp4_, (gint) _tmp4__length1);
}

static void
___lambda11__gtk_tool_button_clicked (GtkToolButton* _sender,
                                      gpointer self)
{
	__lambda11_ ((CianoWidgetsDialogConvertFile*) self);
}

static void
__lambda12_ (Block9Data* _data9_)
{
	CianoWidgetsDialogConvertFile* self;
	CianoControllersConverterController* _tmp0_;
	GtkTreeView* _tmp1_;
	GtkListStore* _tmp2_;
	self = _data9_->self;
	_tmp0_ = self->priv->converter_controller;
	_tmp1_ = self->priv->tree_view;
	_tmp2_ = self->priv->list_store;
	ciano_controllers_converter_controller_on_activate_button_remove (_tmp0_, (GtkDialog*) self, _tmp1_, _tmp2_, _data9_->button_remove);
}

static void
___lambda12__gtk_tool_button_clicked (GtkToolButton* _sender,
                                      gpointer self)
{
	__lambda12_ (self);
}

static void
__lambda13_ (Block9Data* _data9_)
{
	CianoWidgetsDialogConvertFile* self;
	self = _data9_->self;
	gtk_widget_set_sensitive ((GtkWidget*) _data9_->button_remove, TRUE);
}

static void
___lambda13__gtk_tree_view_cursor_changed (GtkTreeView* _sender,
                                           gpointer self)
{
	__lambda13_ (self);
}

static GtkToolbar*
ciano_widgets_dialog_convert_file_mount_toolbar (CianoWidgetsDialogConvertFile* self)
{
	Block9Data* _data9_;
	GtkToolbar* toolbar = NULL;
	GtkToolbar* _tmp0_;
	GtkStyleContext* _tmp1_;
	GtkToolButton* button_add_file = NULL;
	GtkImage* _tmp2_;
	GtkImage* _tmp3_;
	GtkToolButton* _tmp4_;
	GtkToolButton* _tmp5_;
	GtkImage* _tmp6_;
	GtkImage* _tmp7_;
	GtkToolButton* _tmp8_;
	GtkToolButton* _tmp9_;
	GtkTreeView* _tmp10_;
	GtkToolbar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_data9_ = g_slice_new0 (Block9Data);
	_data9_->_ref_count_ = 1;
	_data9_->self = g_object_ref (self);
	_tmp0_ = (GtkToolbar*) gtk_toolbar_new ();
	g_object_ref_sink (_tmp0_);
	toolbar = _tmp0_;
	_tmp1_ = gtk_widget_get_style_context ((GtkWidget*) toolbar);
	gtk_style_context_add_class (_tmp1_, GTK_STYLE_CLASS_INLINE_TOOLBAR);
	gtk_toolbar_set_icon_size (toolbar, GTK_ICON_SIZE_SMALL_TOOLBAR);
	_tmp2_ = (GtkImage*) gtk_image_new_from_icon_name ("list-add-symbolic", (GtkIconSize) GTK_ICON_SIZE_SMALL_TOOLBAR);
	g_object_ref_sink (_tmp2_);
	_tmp3_ = _tmp2_;
	_tmp4_ = (GtkToolButton*) gtk_tool_button_new ((GtkWidget*) _tmp3_, NULL);
	g_object_ref_sink (_tmp4_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp3_);
	button_add_file = _tmp5_;
	gtk_widget_set_tooltip_text ((GtkWidget*) button_add_file, CIANO_CONFIGS_PROPERTIES_TEXT_ADD_FILE);
	g_signal_connect_object (button_add_file, "clicked", (GCallback) ___lambda11__gtk_tool_button_clicked, self, 0);
	_tmp6_ = (GtkImage*) gtk_image_new_from_icon_name ("list-remove-symbolic", (GtkIconSize) GTK_ICON_SIZE_SMALL_TOOLBAR);
	g_object_ref_sink (_tmp6_);
	_tmp7_ = _tmp6_;
	_tmp8_ = (GtkToolButton*) gtk_tool_button_new ((GtkWidget*) _tmp7_, NULL);
	g_object_ref_sink (_tmp8_);
	_tmp9_ = _tmp8_;
	_g_object_unref0 (_tmp7_);
	_data9_->button_remove = _tmp9_;
	gtk_widget_set_tooltip_text ((GtkWidget*) _data9_->button_remove, CIANO_CONFIGS_PROPERTIES_TEXT_DELETE);
	gtk_widget_set_sensitive ((GtkWidget*) _data9_->button_remove, FALSE);
	g_signal_connect_data (_data9_->button_remove, "clicked", (GCallback) ___lambda12__gtk_tool_button_clicked, block9_data_ref (_data9_), (GClosureNotify) block9_data_unref, 0);
	_tmp10_ = self->priv->tree_view;
	g_signal_connect_data (_tmp10_, "cursor-changed", (GCallback) ___lambda13__gtk_tree_view_cursor_changed, block9_data_ref (_data9_), (GClosureNotify) block9_data_unref, 0);
	gtk_toolbar_insert (toolbar, (GtkToolItem*) button_add_file, -1);
	gtk_toolbar_insert (toolbar, (GtkToolItem*) _data9_->button_remove, -1);
	result = toolbar;
	_g_object_unref0 (button_add_file);
	block9_data_unref (_data9_);
	_data9_ = NULL;
	return result;
}

/**
         * Mount the {@code Gtk.Grid} where the cancel and start conversion buttons are displayed.
         * When you click the convert_button button, the "{@code on_activate_button_start_conversion}" method of
         * the "{@code ConverterController}" is responsible for performing all operations after the click.
         *
         * @see Ciano.Configs.Properties
         * @see Ciano.Controllers.ConverterController
         * @return Gtk.Grid
         */
static void
__lambda14_ (CianoWidgetsDialogConvertFile* self)
{
	gtk_widget_destroy ((GtkWidget*) self);
}

static void
___lambda14__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda14_ ((CianoWidgetsDialogConvertFile*) self);
}

static void
__lambda15_ (CianoWidgetsDialogConvertFile* self)
{
	CianoControllersConverterController* _tmp0_;
	GtkListStore* _tmp1_;
	const gchar* _tmp2_;
	gtk_widget_destroy ((GtkWidget*) self);
	_tmp0_ = self->priv->converter_controller;
	_tmp1_ = self->priv->list_store;
	_tmp2_ = self->priv->name_format;
	ciano_controllers_converter_controller_on_activate_button_start_conversion (_tmp0_, _tmp1_, _tmp2_);
}

static void
___lambda15__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda15_ ((CianoWidgetsDialogConvertFile*) self);
}

static GtkGrid*
ciano_widgets_dialog_convert_file_mount_buttons (CianoWidgetsDialogConvertFile* self)
{
	GtkButton* calcel_button = NULL;
	GtkButton* _tmp0_;
	GtkButton* convert_button = NULL;
	GtkButton* _tmp1_;
	GtkStyleContext* _tmp2_;
	GtkGrid* grid_buttons = NULL;
	GtkGrid* _tmp3_;
	GtkGrid* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkButton*) gtk_button_new_with_label (CIANO_CONFIGS_PROPERTIES_TEXT_CANCEL);
	g_object_ref_sink (_tmp0_);
	calcel_button = _tmp0_;
	g_signal_connect_object (calcel_button, "clicked", (GCallback) ___lambda14__gtk_button_clicked, self, 0);
	gtk_widget_set_margin_end ((GtkWidget*) calcel_button, 10);
	_tmp1_ = (GtkButton*) gtk_button_new_with_label (CIANO_CONFIGS_PROPERTIES_TEXT_START_CONVERSION);
	g_object_ref_sink (_tmp1_);
	convert_button = _tmp1_;
	_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) convert_button);
	gtk_style_context_add_class (_tmp2_, "suggested-action");
	g_signal_connect_object (convert_button, "clicked", (GCallback) ___lambda15__gtk_button_clicked, self, 0);
	_tmp3_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp3_);
	grid_buttons = _tmp3_;
	gtk_widget_set_margin_top ((GtkWidget*) grid_buttons, 10);
	gtk_widget_set_halign ((GtkWidget*) grid_buttons, GTK_ALIGN_END);
	gtk_grid_attach (grid_buttons, (GtkWidget*) calcel_button, 0, 0, 1, 1);
	gtk_grid_attach_next_to (grid_buttons, (GtkWidget*) convert_button, (GtkWidget*) calcel_button, GTK_POS_RIGHT, 3, 1);
	result = grid_buttons;
	_g_object_unref0 (convert_button);
	_g_object_unref0 (calcel_button);
	return result;
}

static void
ciano_widgets_dialog_convert_file_class_init (CianoWidgetsDialogConvertFileClass * klass,
                                              gpointer klass_data)
{
	ciano_widgets_dialog_convert_file_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &CianoWidgetsDialogConvertFile_private_offset);
	G_OBJECT_CLASS (klass)->finalize = ciano_widgets_dialog_convert_file_finalize;
}

static void
ciano_widgets_dialog_convert_file_instance_init (CianoWidgetsDialogConvertFile * self,
                                                 gpointer klass)
{
	self->priv = ciano_widgets_dialog_convert_file_get_instance_private (self);
}

static void
ciano_widgets_dialog_convert_file_finalize (GObject * obj)
{
	CianoWidgetsDialogConvertFile * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CIANO_WIDGETS_TYPE_DIALOG_CONVERT_FILE, CianoWidgetsDialogConvertFile);
	self->priv->formats = (_vala_array_free (self->priv->formats, self->priv->formats_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (self->priv->name_format);
	_g_object_unref0 (self->priv->list_store);
	_g_object_unref0 (self->priv->tree_view);
	_ciano_controllers_converter_controller_unref0 (self->priv->converter_controller);
	G_OBJECT_CLASS (ciano_widgets_dialog_convert_file_parent_class)->finalize (obj);
}

/**
     * The {@code DialogConvertFile} class is responsible for displaying
     * the dialog where the user can add and remove items for conversion.
     *
     * @see Gtk.Dialog
     * @since 0.1.0
     */
static GType
ciano_widgets_dialog_convert_file_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (CianoWidgetsDialogConvertFileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ciano_widgets_dialog_convert_file_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CianoWidgetsDialogConvertFile), 0, (GInstanceInitFunc) ciano_widgets_dialog_convert_file_instance_init, NULL };
	GType ciano_widgets_dialog_convert_file_type_id;
	ciano_widgets_dialog_convert_file_type_id = g_type_register_static (gtk_dialog_get_type (), "CianoWidgetsDialogConvertFile", &g_define_type_info, 0);
	CianoWidgetsDialogConvertFile_private_offset = g_type_add_instance_private (ciano_widgets_dialog_convert_file_type_id, sizeof (CianoWidgetsDialogConvertFilePrivate));
	return ciano_widgets_dialog_convert_file_type_id;
}

GType
ciano_widgets_dialog_convert_file_get_type (void)
{
	static volatile gsize ciano_widgets_dialog_convert_file_type_id__once = 0;
	if (g_once_init_enter (&ciano_widgets_dialog_convert_file_type_id__once)) {
		GType ciano_widgets_dialog_convert_file_type_id;
		ciano_widgets_dialog_convert_file_type_id = ciano_widgets_dialog_convert_file_get_type_once ();
		g_once_init_leave (&ciano_widgets_dialog_convert_file_type_id__once, ciano_widgets_dialog_convert_file_type_id);
	}
	return ciano_widgets_dialog_convert_file_type_id__once;
}

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

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

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

