/* DialogPreferences.c generated by valac 0.56.19, the Vala compiler
 * generated from DialogPreferences.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 <granite.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>

#define CIANO_CONFIGS_PROPERTIES_TEXT_PREFERENCES _ ("Preferences")
#define CIANO_UTILS_STRING_UTIL_EMPTY ""
#define CIANO_CONFIGS_PROPERTIES_TEXT_OUTPUT_FOLDER _ ("Output folder:")
#define CIANO_CONFIGS_PROPERTIES_TEXT_OUTPUT_SOURCE_FILE_FOLDER _ ("Files origin:")
#define CIANO_CONFIGS_PROPERTIES_TEXT_SELECT_OUTPUT_FOLDER _ ("Select the output folder:")
#define CIANO_CONFIGS_PROPERTIES_TEXT_NOTIFY _ ("Notifications:")
#define CIANO_CONFIGS_PROPERTIES_TEXT_COMPLETE_NOTIFY _ ("Notify about completed action:")
#define CIANO_CONFIGS_PROPERTIES_TEXT_ERRO_NOTIFY _ ("Notify about an error:")
#define CIANO_CONFIGS_PROPERTIES_TEXT_CLOSE _ ("Close")
#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_PREFERENCES (ciano_widgets_dialog_preferences_get_type ())
#define CIANO_WIDGETS_DIALOG_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CIANO_WIDGETS_TYPE_DIALOG_PREFERENCES, CianoWidgetsDialogPreferences))
#define CIANO_WIDGETS_DIALOG_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CIANO_WIDGETS_TYPE_DIALOG_PREFERENCES, CianoWidgetsDialogPreferencesClass))
#define CIANO_WIDGETS_IS_DIALOG_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CIANO_WIDGETS_TYPE_DIALOG_PREFERENCES))
#define CIANO_WIDGETS_IS_DIALOG_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CIANO_WIDGETS_TYPE_DIALOG_PREFERENCES))
#define CIANO_WIDGETS_DIALOG_PREFERENCES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CIANO_WIDGETS_TYPE_DIALOG_PREFERENCES, CianoWidgetsDialogPreferencesClass))

typedef struct _CianoWidgetsDialogPreferences CianoWidgetsDialogPreferences;
typedef struct _CianoWidgetsDialogPreferencesClass CianoWidgetsDialogPreferencesClass;
typedef struct _CianoWidgetsDialogPreferencesPrivate CianoWidgetsDialogPreferencesPrivate;

#define CIANO_SERVICES_TYPE_SETTINGS (ciano_services_settings_get_type ())
#define CIANO_SERVICES_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CIANO_SERVICES_TYPE_SETTINGS, CianoServicesSettings))
#define CIANO_SERVICES_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CIANO_SERVICES_TYPE_SETTINGS, CianoServicesSettingsClass))
#define CIANO_SERVICES_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CIANO_SERVICES_TYPE_SETTINGS))
#define CIANO_SERVICES_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CIANO_SERVICES_TYPE_SETTINGS))
#define CIANO_SERVICES_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CIANO_SERVICES_TYPE_SETTINGS, CianoServicesSettingsClass))

typedef struct _CianoServicesSettings CianoServicesSettings;
typedef struct _CianoServicesSettingsClass CianoServicesSettingsClass;
enum  {
	CIANO_WIDGETS_DIALOG_PREFERENCES_0_PROPERTY,
	CIANO_WIDGETS_DIALOG_PREFERENCES_NUM_PROPERTIES
};
static GParamSpec* ciano_widgets_dialog_preferences_properties[CIANO_WIDGETS_DIALOG_PREFERENCES_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _CianoWidgetsDialogPreferences {
	GtkDialog parent_instance;
	CianoWidgetsDialogPreferencesPrivate * priv;
};

struct _CianoWidgetsDialogPreferencesClass {
	GtkDialogClass parent_class;
};

struct _CianoWidgetsDialogPreferencesPrivate {
	CianoServicesSettings* settings;
	GtkFileChooserButton* output_folder;
	GtkSwitch* output_source_file_folder;
	GtkSwitch* complete_notify;
	GtkSwitch* error_notify;
};

static gint CianoWidgetsDialogPreferences_private_offset;
static gpointer ciano_widgets_dialog_preferences_parent_class = NULL;

VALA_EXTERN GType ciano_widgets_dialog_preferences_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CianoWidgetsDialogPreferences, g_object_unref)
VALA_EXTERN GType ciano_services_settings_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CianoServicesSettings, g_object_unref)
VALA_EXTERN CianoWidgetsDialogPreferences* ciano_widgets_dialog_preferences_new (GtkWindow* parent);
VALA_EXTERN CianoWidgetsDialogPreferences* ciano_widgets_dialog_preferences_construct (GType object_type,
                                                                           GtkWindow* parent);
VALA_EXTERN CianoServicesSettings* ciano_services_settings_get_instance (void);
static void ciano_widgets_dialog_preferences_init_options (CianoWidgetsDialogPreferences* self);
static void ciano_widgets_dialog_preferences_mount_options (CianoWidgetsDialogPreferences* self,
                                                     GtkGrid* grid);
VALA_EXTERN const gchar* ciano_services_settings_get_output_folder (CianoServicesSettings* self);
static void __lambda8_ (CianoWidgetsDialogPreferences* self);
VALA_EXTERN void ciano_services_settings_set_output_folder (CianoServicesSettings* self,
                                                const gchar* value);
static void ___lambda8__gtk_file_chooser_selection_changed (GtkFileChooser* _sender,
                                                     gpointer self);
static void __lambda9_ (CianoWidgetsDialogPreferences* self);
static void ___lambda9__g_object_notify (GObject* _sender,
                                  GParamSpec* pspec,
                                  gpointer self);
static void ciano_widgets_dialog_preferences_mount_section_output_folder (CianoWidgetsDialogPreferences* self,
                                                                   GtkGrid* grid,
                                                                   gint* row);
static void ciano_widgets_dialog_preferences_mount_section_notify (CianoWidgetsDialogPreferences* self,
                                                            GtkGrid* grid,
                                                            gint* row);
static void ciano_widgets_dialog_preferences_mount_buttons (CianoWidgetsDialogPreferences* self,
                                                     GtkGrid* grid,
                                                     gint* row);
static void ciano_widgets_dialog_preferences_add_section (CianoWidgetsDialogPreferences* self,
                                                   GtkGrid* grid,
                                                   GtkLabel* name,
                                                   gint* row);
static void ciano_widgets_dialog_preferences_add_option (CianoWidgetsDialogPreferences* self,
                                                  GtkGrid* grid,
                                                  GtkLabel* label,
                                                  GtkWidget* widget,
                                                  gint* row);
static void __lambda10_ (CianoWidgetsDialogPreferences* self);
static void ___lambda10__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void ciano_widgets_dialog_preferences_finalize (GObject * obj);
static GType ciano_widgets_dialog_preferences_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
ciano_widgets_dialog_preferences_get_instance_private (CianoWidgetsDialogPreferences* self)
{
	return G_STRUCT_MEMBER_P (self, CianoWidgetsDialogPreferences_private_offset);
}

/**
         * Constructs a new {@code DialogPreferences} object responsible for assembling the dialog box structure and
         * get the instance of the {@code Settings} class with the last values set to be set in its components.
         *
         * @see Ciano.Configs.Properties
         * @see Ciano.Services.Settings
         * @see init_options
         * @see mount_options
         * @param {@code Gtk.Window} parent
         */
static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

CianoWidgetsDialogPreferences*
ciano_widgets_dialog_preferences_construct (GType object_type,
                                            GtkWindow* parent)
{
	CianoWidgetsDialogPreferences * self = NULL;
	CianoServicesSettings* _tmp0_;
	CianoServicesSettings* _tmp1_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp2_;
	GtkBox* _tmp3_;
	g_return_val_if_fail (parent != NULL, NULL);
	self = (CianoWidgetsDialogPreferences*) g_object_new (object_type, NULL);
	gtk_window_set_title ((GtkWindow*) self, CIANO_CONFIGS_PROPERTIES_TEXT_PREFERENCES);
	gtk_window_set_resizable ((GtkWindow*) self, FALSE);
	gtk_window_set_deletable ((GtkWindow*) self, FALSE);
	gtk_window_set_transient_for ((GtkWindow*) self, parent);
	gtk_window_set_default_size ((GtkWindow*) self, 500, 350);
	gtk_widget_set_size_request ((GtkWidget*) self, 500, 350);
	gtk_window_set_modal ((GtkWindow*) self, TRUE);
	_tmp0_ = ciano_services_settings_get_instance ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp1_;
	_tmp2_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp2_);
	grid = _tmp2_;
	gtk_grid_set_row_spacing (grid, 5);
	gtk_grid_set_column_spacing (grid, 5);
	g_object_set ((GtkWidget*) grid, "margin", 7, NULL);
	gtk_widget_set_margin_top ((GtkWidget*) grid, 5);
	ciano_widgets_dialog_preferences_init_options (self);
	ciano_widgets_dialog_preferences_mount_options (self, grid);
	_tmp3_ = gtk_dialog_get_content_area ((GtkDialog*) self);
	gtk_container_add ((GtkContainer*) _tmp3_, (GtkWidget*) grid);
	_g_object_unref0 (grid);
	return self;
}

CianoWidgetsDialogPreferences*
ciano_widgets_dialog_preferences_new (GtkWindow* parent)
{
	return ciano_widgets_dialog_preferences_construct (CIANO_WIDGETS_TYPE_DIALOG_PREFERENCES, parent);
}

/**
         * Set the last values defined in the widgets.
         *
         * @see Ciano.Config.Settings
         * @see Ciano.Utils.StringUtil
         * @return {@code void}
         */
static void
__lambda8_ (CianoWidgetsDialogPreferences* self)
{
	CianoServicesSettings* _tmp0_;
	GtkFileChooserButton* _tmp1_;
	GFile* _tmp2_;
	GFile* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	_tmp0_ = self->priv->settings;
	_tmp1_ = self->priv->output_folder;
	_tmp2_ = gtk_file_chooser_get_file ((GtkFileChooser*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_file_get_path (_tmp3_);
	_tmp5_ = _tmp4_;
	ciano_services_settings_set_output_folder (_tmp0_, _tmp5_);
	_g_free0 (_tmp5_);
	_g_object_unref0 (_tmp3_);
}

static void
___lambda8__gtk_file_chooser_selection_changed (GtkFileChooser* _sender,
                                                gpointer self)
{
	__lambda8_ ((CianoWidgetsDialogPreferences*) self);
}

static void
__lambda9_ (CianoWidgetsDialogPreferences* self)
{
	GtkSwitch* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	_tmp0_ = self->priv->output_source_file_folder;
	_tmp1_ = gtk_switch_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkFileChooserButton* _tmp3_;
		_tmp3_ = self->priv->output_folder;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, FALSE);
	} else {
		GtkFileChooserButton* _tmp4_;
		_tmp4_ = self->priv->output_folder;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp4_, TRUE);
	}
}

static void
___lambda9__g_object_notify (GObject* _sender,
                             GParamSpec* pspec,
                             gpointer self)
{
	__lambda9_ ((CianoWidgetsDialogPreferences*) self);
}

static void
ciano_widgets_dialog_preferences_init_options (CianoWidgetsDialogPreferences* self)
{
	GtkFileChooserButton* _tmp0_;
	GtkFileChooserButton* _tmp1_;
	GtkFileChooserButton* _tmp2_;
	CianoServicesSettings* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	GtkFileChooserButton* _tmp6_;
	GtkSwitch* _tmp7_;
	CianoServicesSettings* _tmp8_;
	GSettings* _tmp9_;
	GSettings* _tmp10_;
	GtkSwitch* _tmp11_;
	GtkSwitch* _tmp12_;
	GtkSwitch* _tmp13_;
	CianoServicesSettings* _tmp14_;
	GSettings* _tmp15_;
	GSettings* _tmp16_;
	GtkSwitch* _tmp17_;
	GtkSwitch* _tmp18_;
	CianoServicesSettings* _tmp19_;
	GSettings* _tmp20_;
	GSettings* _tmp21_;
	GtkSwitch* _tmp22_;
	GtkSwitch* _tmp23_;
	gboolean _tmp24_;
	gboolean _tmp25_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkFileChooserButton*) gtk_file_chooser_button_new (CIANO_UTILS_STRING_UTIL_EMPTY, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->output_folder);
	self->priv->output_folder = _tmp0_;
	_tmp1_ = self->priv->output_folder;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp1_, TRUE);
	_tmp2_ = self->priv->output_folder;
	_tmp3_ = self->priv->settings;
	_tmp4_ = ciano_services_settings_get_output_folder (_tmp3_);
	_tmp5_ = _tmp4_;
	gtk_file_chooser_set_current_folder ((GtkFileChooser*) _tmp2_, _tmp5_);
	_tmp6_ = self->priv->output_folder;
	g_signal_connect_object ((GtkFileChooser*) _tmp6_, "selection-changed", (GCallback) ___lambda8__gtk_file_chooser_selection_changed, self, 0);
	_tmp7_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (self->priv->output_source_file_folder);
	self->priv->output_source_file_folder = _tmp7_;
	_tmp8_ = self->priv->settings;
	_tmp9_ = granite_services_settings_get_schema ((GraniteServicesSettings*) _tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = self->priv->output_source_file_folder;
	g_settings_bind (_tmp10_, "output-source-file-folder", (GObject*) _tmp11_, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp12_ = self->priv->output_source_file_folder;
	g_signal_connect_object ((GObject*) _tmp12_, "notify::active", (GCallback) ___lambda9__g_object_notify, self, 0);
	_tmp13_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp13_);
	_g_object_unref0 (self->priv->complete_notify);
	self->priv->complete_notify = _tmp13_;
	_tmp14_ = self->priv->settings;
	_tmp15_ = granite_services_settings_get_schema ((GraniteServicesSettings*) _tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = self->priv->complete_notify;
	g_settings_bind (_tmp16_, "complete-notify", (GObject*) _tmp17_, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp18_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp18_);
	_g_object_unref0 (self->priv->error_notify);
	self->priv->error_notify = _tmp18_;
	_tmp19_ = self->priv->settings;
	_tmp20_ = granite_services_settings_get_schema ((GraniteServicesSettings*) _tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = self->priv->error_notify;
	g_settings_bind (_tmp21_, "error-notify", (GObject*) _tmp22_, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp23_ = self->priv->output_source_file_folder;
	_tmp24_ = gtk_switch_get_active (_tmp23_);
	_tmp25_ = _tmp24_;
	if (_tmp25_) {
		GtkFileChooserButton* _tmp26_;
		_tmp26_ = self->priv->output_folder;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp26_, FALSE);
	}
}

/**
         * Assemble the entire grid. "line by line".
         *
         * @param  {@code Gtk.Grid}
         * @return {@code void}
         */
static void
ciano_widgets_dialog_preferences_mount_options (CianoWidgetsDialogPreferences* self,
                                                GtkGrid* grid)
{
	gint row = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (grid != NULL);
	row = 0;
	ciano_widgets_dialog_preferences_mount_section_output_folder (self, grid, &row);
	ciano_widgets_dialog_preferences_mount_section_notify (self, grid, &row);
	ciano_widgets_dialog_preferences_mount_buttons (self, grid, &row);
}

/**
         * Mounts the section on output folder.
         *
         * @see Ciano.Configs.Properties
         * @see add_section
         * @see add_option
         * @param  {@code Gtk.Grid} grid
         * @param  {@code int} row
         * @return {@code void}
         */
static void
ciano_widgets_dialog_preferences_mount_section_output_folder (CianoWidgetsDialogPreferences* self,
                                                              GtkGrid* grid,
                                                              gint* row)
{
	GtkLabel* label_output_folder = NULL;
	GtkLabel* _tmp0_;
	GtkLabel* label_output_source_file_folder = NULL;
	GtkLabel* _tmp1_;
	GtkSwitch* _tmp2_;
	GtkLabel* label_select_output_folder = NULL;
	GtkLabel* _tmp3_;
	GtkFileChooserButton* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (grid != NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (CIANO_CONFIGS_PROPERTIES_TEXT_OUTPUT_FOLDER);
	g_object_ref_sink (_tmp0_);
	label_output_folder = _tmp0_;
	ciano_widgets_dialog_preferences_add_section (self, grid, label_output_folder, row);
	_tmp1_ = (GtkLabel*) gtk_label_new (CIANO_CONFIGS_PROPERTIES_TEXT_OUTPUT_SOURCE_FILE_FOLDER);
	g_object_ref_sink (_tmp1_);
	label_output_source_file_folder = _tmp1_;
	_tmp2_ = self->priv->output_source_file_folder;
	ciano_widgets_dialog_preferences_add_option (self, grid, label_output_source_file_folder, (GtkWidget*) _tmp2_, row);
	_tmp3_ = (GtkLabel*) gtk_label_new (CIANO_CONFIGS_PROPERTIES_TEXT_SELECT_OUTPUT_FOLDER);
	g_object_ref_sink (_tmp3_);
	label_select_output_folder = _tmp3_;
	_tmp4_ = self->priv->output_folder;
	ciano_widgets_dialog_preferences_add_option (self, grid, label_select_output_folder, (GtkWidget*) _tmp4_, row);
	_g_object_unref0 (label_select_output_folder);
	_g_object_unref0 (label_output_source_file_folder);
	_g_object_unref0 (label_output_folder);
}

/**
         * Mount notification section.
         *
         * @see Ciano.Configs.Properties
         * @see add_section
         * @see add_option
         * @param  {@code Gtk.Grid} grid
         * @param  {@code int} row
         * @return {@code void}
         */
static void
ciano_widgets_dialog_preferences_mount_section_notify (CianoWidgetsDialogPreferences* self,
                                                       GtkGrid* grid,
                                                       gint* row)
{
	GtkLabel* label_notify = NULL;
	GtkLabel* _tmp0_;
	GtkLabel* label_complete_notify = NULL;
	GtkLabel* _tmp1_;
	GtkSwitch* _tmp2_;
	GtkLabel* label_error_notify = NULL;
	GtkLabel* _tmp3_;
	GtkSwitch* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (grid != NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (CIANO_CONFIGS_PROPERTIES_TEXT_NOTIFY);
	g_object_ref_sink (_tmp0_);
	label_notify = _tmp0_;
	ciano_widgets_dialog_preferences_add_section (self, grid, label_notify, row);
	_tmp1_ = (GtkLabel*) gtk_label_new (CIANO_CONFIGS_PROPERTIES_TEXT_COMPLETE_NOTIFY);
	g_object_ref_sink (_tmp1_);
	label_complete_notify = _tmp1_;
	_tmp2_ = self->priv->complete_notify;
	ciano_widgets_dialog_preferences_add_option (self, grid, label_complete_notify, (GtkWidget*) _tmp2_, row);
	_tmp3_ = (GtkLabel*) gtk_label_new (CIANO_CONFIGS_PROPERTIES_TEXT_ERRO_NOTIFY);
	g_object_ref_sink (_tmp3_);
	label_error_notify = _tmp3_;
	_tmp4_ = self->priv->error_notify;
	ciano_widgets_dialog_preferences_add_option (self, grid, label_error_notify, (GtkWidget*) _tmp4_, row);
	_g_object_unref0 (label_error_notify);
	_g_object_unref0 (label_complete_notify);
	_g_object_unref0 (label_notify);
}

/**
         * Mount buttons section.
         *
         * @see Ciano.Configs.Properties
         * @param  {@code Gtk.Grid} grid
         * @param  {@code int} row
         * @return {@code void}
         */
static void
__lambda10_ (CianoWidgetsDialogPreferences* self)
{
	gtk_widget_destroy ((GtkWidget*) self);
}

static void
___lambda10__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda10_ ((CianoWidgetsDialogPreferences*) self);
}

static void
ciano_widgets_dialog_preferences_mount_buttons (CianoWidgetsDialogPreferences* self,
                                                GtkGrid* grid,
                                                gint* row)
{
	GtkButton* close_button = NULL;
	GtkButton* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (grid != NULL);
	_tmp0_ = (GtkButton*) gtk_button_new_with_label (CIANO_CONFIGS_PROPERTIES_TEXT_CLOSE);
	g_object_ref_sink (_tmp0_);
	close_button = _tmp0_;
	g_signal_connect_object (close_button, "clicked", (GCallback) ___lambda10__gtk_button_clicked, self, 0);
	gtk_widget_set_margin_top ((GtkWidget*) close_button, 15);
	gtk_widget_set_halign ((GtkWidget*) close_button, GTK_ALIGN_END);
	gtk_grid_attach (grid, (GtkWidget*) close_button, 3, *row, 1, 1);
	_g_object_unref0 (close_button);
}

/**
         * Responsible for setting the label at the beginning of each section.
         *
         * @param  {@code Gtk.Grid}  grid
         * @param  {@code Gtk.Label} name
         * @param  {@code int}       row
         * @return {@code void}
         */
static void
ciano_widgets_dialog_preferences_add_section (CianoWidgetsDialogPreferences* self,
                                              GtkGrid* grid,
                                              GtkLabel* name,
                                              gint* row)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GtkStyleContext* _tmp3_;
	gint _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (grid != NULL);
	g_return_if_fail (name != NULL);
	gtk_widget_set_halign ((GtkWidget*) name, GTK_ALIGN_START);
	gtk_label_set_use_markup (name, TRUE);
	_tmp0_ = gtk_label_get_text (name);
	_tmp1_ = g_strdup_printf ("<b>%s</b>", _tmp0_);
	_tmp2_ = _tmp1_;
	gtk_label_set_markup (name, _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = gtk_widget_get_style_context ((GtkWidget*) name);
	gtk_style_context_add_class (_tmp3_, "title-section-dialog");
	if ((*row) > 0) {
		gtk_widget_set_margin_top ((GtkWidget*) name, 10);
	}
	gtk_grid_attach (grid, (GtkWidget*) name, 0, *row, 1, 1);
	_tmp4_ = *row;
	*row = _tmp4_ + 1;
}

/**
         * Responsible for adding an option widget.
         *
         * @param  {@code Gtk.Grid}   grid
         * @param  {@code Gtk.Label}  label
         * @param  {@code Gtk.Switch} widget
         * @param  {@code int}          row
         * @return {@code void}
         */
static void
ciano_widgets_dialog_preferences_add_option (CianoWidgetsDialogPreferences* self,
                                             GtkGrid* grid,
                                             GtkLabel* label,
                                             GtkWidget* widget,
                                             gint* row)
{
	gint _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (grid != NULL);
	g_return_if_fail (label != NULL);
	g_return_if_fail (widget != NULL);
	gtk_widget_set_halign ((GtkWidget*) label, GTK_ALIGN_END);
	gtk_widget_set_hexpand ((GtkWidget*) label, TRUE);
	gtk_widget_set_margin_start ((GtkWidget*) label, 35);
	gtk_widget_set_margin_top ((GtkWidget*) label, 0);
	gtk_widget_set_halign (widget, GTK_ALIGN_START);
	gtk_widget_set_hexpand (widget, TRUE);
	gtk_widget_set_margin_top (widget, 0);
	gtk_grid_attach (grid, (GtkWidget*) label, 0, *row, 1, 1);
	gtk_grid_attach_next_to (grid, widget, (GtkWidget*) label, GTK_POS_RIGHT, 3, 1);
	_tmp0_ = *row;
	*row = _tmp0_ + 1;
}

static void
ciano_widgets_dialog_preferences_class_init (CianoWidgetsDialogPreferencesClass * klass,
                                             gpointer klass_data)
{
	ciano_widgets_dialog_preferences_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &CianoWidgetsDialogPreferences_private_offset);
	G_OBJECT_CLASS (klass)->finalize = ciano_widgets_dialog_preferences_finalize;
}

static void
ciano_widgets_dialog_preferences_instance_init (CianoWidgetsDialogPreferences * self,
                                                gpointer klass)
{
	self->priv = ciano_widgets_dialog_preferences_get_instance_private (self);
}

static void
ciano_widgets_dialog_preferences_finalize (GObject * obj)
{
	CianoWidgetsDialogPreferences * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CIANO_WIDGETS_TYPE_DIALOG_PREFERENCES, CianoWidgetsDialogPreferences);
	_g_object_unref0 (self->priv->settings);
	_g_object_unref0 (self->priv->output_folder);
	_g_object_unref0 (self->priv->output_source_file_folder);
	_g_object_unref0 (self->priv->complete_notify);
	_g_object_unref0 (self->priv->error_notify);
	G_OBJECT_CLASS (ciano_widgets_dialog_preferences_parent_class)->finalize (obj);
}

/**
     * The {@code DialogPreferences} class is responsible for displaying the dialog
     * box where the user can configure the action of some application elements.
     *
     * @see Gtk.Dialog
     * @since 0.1.0
     */
static GType
ciano_widgets_dialog_preferences_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (CianoWidgetsDialogPreferencesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ciano_widgets_dialog_preferences_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CianoWidgetsDialogPreferences), 0, (GInstanceInitFunc) ciano_widgets_dialog_preferences_instance_init, NULL };
	GType ciano_widgets_dialog_preferences_type_id;
	ciano_widgets_dialog_preferences_type_id = g_type_register_static (gtk_dialog_get_type (), "CianoWidgetsDialogPreferences", &g_define_type_info, 0);
	CianoWidgetsDialogPreferences_private_offset = g_type_add_instance_private (ciano_widgets_dialog_preferences_type_id, sizeof (CianoWidgetsDialogPreferencesPrivate));
	return ciano_widgets_dialog_preferences_type_id;
}

GType
ciano_widgets_dialog_preferences_get_type (void)
{
	static volatile gsize ciano_widgets_dialog_preferences_type_id__once = 0;
	if (g_once_init_enter (&ciano_widgets_dialog_preferences_type_id__once)) {
		GType ciano_widgets_dialog_preferences_type_id;
		ciano_widgets_dialog_preferences_type_id = ciano_widgets_dialog_preferences_get_type_once ();
		g_once_init_leave (&ciano_widgets_dialog_preferences_type_id__once, ciano_widgets_dialog_preferences_type_id);
	}
	return ciano_widgets_dialog_preferences_type_id__once;
}

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

