#include <gtk/gtk.h>
#include <gtk/gtkx.h>
#include <locale.h>
#include <stdio.h>
#include <unistd.h>
#include <vte/vte.h>
#include <stdlib.h>
#include <libintl.h>
#include <getopt.h>
#include <libintl.h>
#include <json-c/json.h>
#include <sys/statvfs.h>
#include <libublsettings.h>
#include <libublsettings-gtk3.h>
#include <libublsettingsui-gtk3.h>
// #define VTE_INCLUDE
#ifdef WEBKIT_INCLUDE
#include <webkit2/webkit2.h>
#endif
#include "ubl-strings.h"

#define _(String) gettext(String)

#define glade_path "/com/ublinux/ui/ubinstall-gtk.glade"
#define glade_path_ubinstall_language "/com/ublinux/ui/ubinstall-gtk-language.glade"
#define glade_path_network_info "/com/ublinux/ui/ubinstall-gtk-network-box.glade"
#define glade_path_log_view "/com/ublinux/ui/ubinstall-gtk-log-view.glade"
#define glade_path_user "/com/ublinux/ui/ubinstall-gtk-user.glade"
#define glade_path_menu_window "/com/ublinux/ui/ubinstall-gtk-menu.glade"
#define glade_path_menu_item "/com/ublinux/ui/ubinstall-gtk-menu-item.glade"
#define glade_path_kernel_row "/com/ublinux/ui/ubinstall-gtk-kernel-row.glade"
#define glade_path_kernel_addon_row "/com/ublinux/ui/ubinstall-gtk-kernel-addon-row.glade"
#define glade_path_os_row "/com/ublinux/ui/ubinstall-gtk-os-row.glade"
#define glade_path_service "/com/ublinux/ui/ubinstall-gtk-service-window.glade"
#define glade_path_bootloader_user "/com/ublinux/ui/ubinstall-gtk-bootloader-user.glade"
#define glade_path_advanced_part "/com/ublinux/ui/ubinstall-gtk-advanced-box.glade"
#define glade_path_configuration_mode "/com/ublinux/ui/ubinstall-gtk-configuration-mode.glade"
#define glade_path_source "/com/ublinux/ui/ubinstall-gtk-source.glade"
#define glade_path_source_element "/com/ublinux/ui/ubinstall-gtk-source-element.glade"
#define glade_locales_path "/com/ublinux/ui/ubinstall-gtk-layouts.glade"
#define glade_layouts_path "/com/ublinux/ui/ubinstall-gtk-keyboard-layouts.glade"
#define glade_path_slider "/com/ublinux/ui/ubinstall-gtk-slider.glade"
#define glade_path_package_info "/com/ublinux/ui/ubinstall-gtk-package-info.glade"

#define CssPath "/com/ublinux/css/ubinstall-gtk.css"
#define config_path yon_char_unite(yon_ubl_user_get_home_directory(), "/.config/", LocaleName, "/", LocaleName, ".conf", NULL)
#define icon_path "com.ublinux.ubinstall-gtk"
#define kernel_icon_path "com.ublinux.ubinstall-kernel"
#define untoggled_icon_path "com.ublinux.libublsettingsui-gtk3.untoggled-symbolic"
#define toggled_icon_path "com.ublinux.libublsettingsui-gtk3.toggled-symbolic"
#define add_icon_path "com.ublinux.libublsettingsui-gtk3.increase-symbolic"
#define active_icon_path "com.ublinux.libublsettingsui-gtk3.active-symbolic"
#define inactive_icon_path "com.ublinux.libublsettingsui-gtk3.inactive-symbolic"
#define info_icon_path "com.ublinux.libublsettingsui-gtk3.important-symbolic"
#define warning_icon_path "com.ublinux.libublsettingsui-gtk3.warning-symbolic"

#define LocalePath "/usr/share/locale"
#define LocaleName "ubinstall-gtk"

#define clear_config_both_command "ubconfig remove TEMP_SECTION TEMP_PATAMETER"
#define clear_config_global_command "ubconfig --target global remove TEMP_SECTION TEMP_PATAMETER"
#define clear_config_local_command "ubconfig --target system remove TEMP_SECTION TEMP_PATAMETER"

#define regions_path "/com/ublinux/images/map-time-zone.png"
#define keyboard_path "/com/ublinux/images/keyboard.png"
#define users_path "/com/ublinux/images/keyboard.png"
#define startup_path "/com/ublinux/images/keyboard.png"
#define bootloader_path "/com/ublinux/images/keyboard.png"
#define network_icon_path "/com/ublinux/images/keyboard.png"

#define licence_path "/usr/share/ublinux/agreement/EULA.txt"

#define languages_path "/usr/share/ubinstall-gtk/csv/locales.csv"
// #define installer_languages_path "resource:///com/ublinux/csv/languages.csv"

#define zone_path "/usr/share/zoneinfo/"

#define system_base_modules_path "/memory/data/from/0/ublinux/base"
#define system_modules_path "/memory/data/from/0/ublinux/modules"
#define additional_software_path "resource:///com/ublinux/csv/modules.csv"
#define kernel_list_path "resource:///com/ublinux/csv/kernel-list.csv"
#define kernel_list_addon_path "resource:///com/ublinux/csv/kernel-list-addon.csv"
#define services_list_path "resource:///com/ublinux/csv/services-list.csv"
#define apps_list_path "resource:///com/ublinux/csv/applications-list.csv"
#define network_path "resource:///com/ublinux/csv/network-list.csv"
#define fs_types_path "resource:///com/ublinux/csv/filesystems-format-list.csv"
#define vfs_list_path "resource:///com/ublinux/csv/vfs-list.csv"
#define groups_list_path "resource:///com/ublinux/csv/groups-list.csv"

#define encryptions_list "luks1", "luks2"

#define locales_list_command "/usr/share/i18n/locales/"

#define slide_0_path "/com/ublinux/images/slide-0.png"

#define arrow_left_icon_path "com.ublinux.ubinstall-gtk.arrow-left-symbolic"
#define arrow_right_icon_path "com.ublinux.ubinstall-gtk.arrow-right-symbolic"

#define pacman_lock_path "/var/lib/pacman/db.lck"
#define pacman_lock_dir_path "/var/lib/pacman/"

#define slide_repeat_path "/com/ublinux/images/slide-1.png",  \
						  "/com/ublinux/images/slide-2.png",  \
						  "/com/ublinux/images/slide-3.png",  \
						  "/com/ublinux/images/slide-4.png",  \
						  "/com/ublinux/images/slide-5.png",  \
						  "/com/ublinux/images/slide-6.png",  \
						  "/com/ublinux/images/slide-7.png",  \
						  "/com/ublinux/images/slide-8.png",  \
						  "/com/ublinux/images/slide-9.png",  \
						  "/com/ublinux/images/slide-10.png", \
						  "/com/ublinux/images/slide-11.png", \
						  "/com/ublinux/images/slide-12.png", \
						  NULL

// #define get_modules_command "pacman --color never -Qs ^ubm- | sed -Enr -e 'N;s/\\n/ ;/' -e \"s/^([^\\/]+)\\/([^[:blank:]]+)[[:blank:]]+([^[:blank:]]+)[[:blank:]]+(\\(([^\\)]+)\\)[^\\;]+|[^\\;]*);[[:blank:]]*(.*)/\\2;\\3;\\5;\\6/p\""
#define get_available_modules_command "pacman --color never -Ss ^ubm- | sed -Enr -e 'N;s/\\n/ ;/' -e \"s/^([^\\/]+)\\/([^[:blank:]]+)[[:blank:]]+([^[:blank:]]+)[[:blank:]]+(\\(([^\\)]+)\\)[^\\;]+|[^\\;]*);[[:blank:]]*(.*)/\\2;\\3;\\5;\\6/p\""

#define get_local_module_info_command(target) yon_char_unite("pacman --color never -Sp $(pacman -Ssq '", target, "') --print-format '%n;%v;%d' | grep -v \"^::\"", NULL);

#define get_menus_entry_command "/usr/lib/ublinux/scripts/grub-functions exec_get_all_menuentry2"

#define encrypt_domain_password_command(target) yon_char_unite("echo '", target, "' | base64", NULL)

#define get_ntp_default_command "ubconfig --default get [network] NTPSERVERS_DEFAULT"
#define get_ntp_ru_command "ubconfig --default get [network] NTPSERVERS_RU"

#define get_models_command "sed '/<\\/modelList>/q' /usr/share/X11/xkb/rules/base.xml | grep -E '^ {8,8}<name>|^ {8,8}<description>'|sed -e 's/  *<name>//g' -e 's,</name>,,g' -e 's/  *<description>//g' -e 's,</description>,,g'"
#define get_keyboard_models_command "sed -En '/^! model$/,/^ *$/!d;s/[[:blank:]]+([^ ]+)[[:blank:]]+(.*)/\\1|\\2/p' /usr/share/X11/xkb/rules/evdev.lst"

#define check_is_password_hash(password) system(yon_char_unite("/lib/ublinux/functions is_hash_password '", password, "'", NULL))

#define network_value(ip, mask, gateway, dns) g_strdup_printf("ipv4.method manual ipv4.addr %s/%s ipv4.gateway %s ipv4.dns %s", ip, mask, gateway, dns)
#define network_value_auto "ipv4.method auto"

#define check_open_command "command -v wmctrl &>/dev/null && command -v xdotool &>/dev/null && UBLPID=$(pidof ubinstall-gtk) && wmctrl -i -a $(xdotool search --pid ${UBLPID} | tail -1)"

#define get_layouts_command "xkbcli list --load-exotic | awk \"\
layout && /description:/ {\
    match(\\$0, /: *(.*)/, matches);\
    description = matches[1];\
    printf \\\"%s|%s|%s\\\\n\\\", layout, variant, description;\
    layout = \\\"\\\"; variant = \\\"\\\";\
}\
/layout:/ {\
    match(\\$0, /: *'([^']+)'/, matches);\
    l = matches[1];\
    layout = layouts[l] = l;\
}\
/variant:/ {\
    match(\\$0, /: *'([^']+)'/, matches);\
    variant = matches[1];\
}\
\" | sort -u\
"

#define yon_check_database_command "pacman -Syy >/dev/null"

#define internet_tomezone_check_command "curl -s ipinfo.io/timezone"
#define ubinstall_dry_run_command "/usr/bin/bash -c \"ubinstall --dry-run\""
#define os_name_get_command "sed -En 's/^PRETTY_NAME=[\"]*([^\"]+)[\"]*/\\1/p' /etc/os-release"

#define get_keyboard_layout_change_command "grep \"grp:\" /usr/share/X11/xkb/rules/base.lst | awk '{$1=$1; sub(/^!.*$/, \"\"); if ($1 ~ /^grp:/) {opt=$1; $1=\"\"; print opt \"|\" substr($0,2)}}'"

#define enable_vnc_command "ubconfig --target system set [desktop] X11VNC[password]=ublinux"
#define disable_vnc_command "ubconfig --target system remove [desktop] X11VNC[password]"

#define enable_rdp_command "ubconfig --target system set [desktop] AUTOEXEC++=freerdp-server.service"
#define disable_rdp_command "ubconfig --target system set [desktop] AUTOEXEC--=freerdp-server.service"

#define get_layouts_local_command(layout) yon_char_unite("xkbcli list --load-exotic | awk -v layout=\"", layout, "\" \"BEGIN {layout_pattern = sprintf(\\\"^ *- *layout: *'%s'\\\",layout);matched=0} matched && /variant:/ {match(\\$0, /: *'([^']+)'/, matches);variant = matches[1]} matched && /description:/ {match(\\$0, /: *(.+)/, matches);description = matches[1]} matched && /^ *-/{matched=0; if (variant) printf \\\"%s|%s\\n\\\",variant,description} \\$0 ~ layout_pattern {matched=1;variant=\\\"\\\";description=\\\"\\\";next}\" | sort -u", NULL)
// #define get_devices_command "lsblk --noheadings --nodeps -Jo PATH,SIZE,MODEL,VENDOR,SERIAL --exclude 7"
#define get_parts_and_devices_command "lsblk --noheadings --bytes -o TYPE,PATH,SIZE,FSTYPE,LABEL,PARTLABEL,MOUNTPOINT,FSUSED,FSUSE% --exclude 7 |awk '{print ($1\";\"$2\";\"$3\";\"$4\";\"$5\";\"$6\";\"$7\";\"$8\";\"$9)}'"

#define AUTOINSTALL(target) yon_char_unite("AUTOINSTALL[", target, "]", NULL)
#define AUTOINSTALL_TYPE_INSTALL "AUTOINSTALL[install_type]"
#define AUTOINSTALL_TYPE_INSTALL_command "ubconfig --source global get [autoinstall] AUTOINSTALL[install_type]"

#define device_parameter "AUTOINSTALL[device]"
#define device_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[device]"

#define part_parameter "AUTOINSTALL[part]"
#define part_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part]"

#define modules_parameter "AUTOINSTALL[modules]"
#define modules_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[modules]"

/*------------------------------------------------------------*/
#define root_password_parameter "AUTOINSTALL[ubconfig set [users] DEFAULTROOTPASSWD]"
#define root_password_parameter_command "ubconfig --source global --conarg get [autoinstall] AUTOINSTALL['ubconfig set [users] DEFAULTROOTPASSWD']"
#define autologin_parameter "AUTOINSTALL[ubconfig set [desktop] AUTOLOGINUSER]"
#define autologin_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [desktop] AUTOLOGINUSER']"
#define xkbmodel_parameter "AUTOINSTALL[ubconfig set [keyboard] XKBMODEL]"
#define xkbmodel_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [keyboard] XKBMODEL']"
#define xkblayout_parameter "AUTOINSTALL[ubconfig set [keyboard] XKBLAYOUT]"
#define xkblayout_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [keyboard] XKBLAYOUT']"
#define xkbvariant_parameter "AUTOINSTALL[ubconfig set [keyboard] XKBVARIANT]"
#define xkbvariant_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [keyboard] XKBVARIANT']"
#define xkboptions_parameter "AUTOINSTALL[ubconfig set [keyboard] XKBOPTIONS]"
#define xkboptions_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [keyboard] XKBOPTIONS']"
#define hostname_parameter "AUTOINSTALL[ubconfig set [system] HOSTNAME]"
#define hostname_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [system] HOSTNAME']"
#define zone_parameter "AUTOINSTALL[ubconfig set [clock] ZONE]"
#define zone_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [clock] ZONE']"
#define lang_parameter "AUTOINSTALL[ubconfig set [locale] LANG]"
#define lang_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [locale] LANG']"
#define locale_parameter "AUTOINSTALL[ubconfig set [locale] LOCALE]"
#define locale_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [locale] LOCALE']"
#define num_lock_boot_parameter "AUTOINSTALL[ubconfig set [keyboard] NUMLOCK]"
#define num_lock_boot_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [keyboard] NUMLOCK']"
/*------------------------------------------------------------*/

#define part_size_parameter "AUTOINSTALL[part_size]"
#define part_size_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_size]"
#define part_fs_type_parameter "AUTOINSTALL[part_fs_type]"
#define part_fs_type_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_fs_type]"
#define part_format_parameter "AUTOINSTALL[part_format]"
#define part_format_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_format]"
#define part_label_parameter "AUTOINSTALL[part_label]"
#define part_label_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_label]"
#define part_fs_label_parameter "AUTOINSTALL[part_fs_label]"
#define part_fs_label_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_fs_label]"
#define part_crypt_parameter "AUTOINSTALL[part_crypt]"
#define part_crypt_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_crypt]"
#define swap_parameter "AUTOINSTALL[swap]"
#define swap_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[swap]"
#define swap_size_parameter "AUTOINSTALL[swap_size]"
#define swap_size_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[swap_size]"
#define boot_parameter "AUTOINSTALL[boot]"
#define boot_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[boot]"
#define packages_parameter "AUTOINSTALL[packages]"
#define packages_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[packages]"
#define device_typevfs_parameter "AUTOINSTALL[device_typevfs]"
#define device_typevfs_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[device_typevfs]"
#define NTPSERVERS_parameter "AUTOINSTALL[ubconfig set [network] NTPSERVERS]"
#define NTPSERVERS_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [network] NTPSERVERS']"
#define DOMAIN_parameter "AUTOINSTALL[ubconfig set [network] DOMAIN]"
#define DOMAIN_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [network] DOMAIN']"
#define DOMAIN_admanger_parameter "AUTOINSTALL[ubconfig set [network] DOMAIN[admanger]]"
#define DOMAIN_admanger_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [network] DOMAIN[admanger]']"
#define USERADD_parameter_all "AUTOINSTALL[ubconfig set [users] USERADD[*]]"
#define USERADD_parameter_search "AUTOINSTALL[ubconfig set [users] USERADD["
#define USERADD_parameter(target) yon_char_unite("AUTOINSTALL[ubconfig set [users] USERADD[", target, "]]", NULL)
#define USERADD_parameter_command(target) yon_char_unite("ubconfig --source global get autoinstall AUTOINSTALL['ubconfig set [users] USERADD[", target, "]']", NULL)
#define KERNEL_BOOT_parameter "AUTOINSTALL[ubconfig set [boot] KERNEL_BOOT]"
#define KERNEL_BOOT_parameter_command "ubconfig --source global get autoinstall AUTOINSTALL['ubconfig set [boot] KERNEL_BOOT']"
#define SERVICES_ENABLE_parameter "AUTOINSTALL[ubconfig set [system] SERVICES_ENABLE]"
#define SERVICES_ENABLE_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [system] SERVICES_ENABLE']"
#define AUTOEXEC_parameter "AUTOINSTALL[ubconfig set [desktop] AUTOEXEC[@users]]"
#define AUTOEXEC_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [desktop] AUTOEXEC[@users]']"
#define GRUB_SUPERUSERS_parameter "AUTOINSTALL[ubconfig set [boot] GRUB_SUPERUSERS]"
#define GRUB_SUPERUSERS_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] GRUB_SUPERUSERS']"
#define GRUB_TIMEOUT_parameter "AUTOINSTALL[ubconfig set [boot] GRUB_TIMEOUT]"
#define GRUB_TIMEOUT_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] GRUB_TIMEOUT']"
#define GRUB_DEFAULT_parameter "AUTOINSTALL[ubconfig set [boot] GRUB_DEFAULT]"
#define GRUB_DEFAULT_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] GRUB_DEFAULT']"
#define GRUB_PASSWORD_parameter_search "AUTOINSTALL[ubconfig set [boot] GRUB_PASSWORD["
#define GRUB_PASSWORD_parameter_all "AUTOINSTALL[\"ubconfig set [boot] GRUB_PASSWORD[*]\"]"
#define GRUB_PASSWORD_parameter(target) yon_char_unite("AUTOINSTALL[ubconfig set [boot] GRUB_PASSWORD[", target, "]]", NULL)
#define GRUB_PASSWORD_parameter_command_all "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] GRUB_PASSWORD[*]']"
#define GRUB_PASSWORD_parameter_command(target) yon_char_unite("ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] GRUB_PASSWORD[", target, "]']", NULL)
#define AUTOLOGINUSER_parameter "AUTOINSTALL[ubconfig set [desktop] AUTOLOGINUSER]"
#define AUTOLOGINUSER_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] AUTOLOGINUSER']"
#define NETWORK_parameter_all "AUTOINSTALL[\"ubconfig set [network] NETWORK[*]\"]"
#define NETWORK_parameter_search "AUTOINSTALL[ubconfig set [network] NETWORK["
#define NETWORK_parameter(target) yon_char_unite("AUTOINSTALL[ubconfig set [network] NETWORK[", target, "@connmod]]", NULL)
#define NETWORK_devdown_parameter(target) yon_char_unite("AUTOINSTALL[ubconfig set [network] NETWORK[", target, "@devdown]]", NULL)
#define NETWORK_devdown_parameter_command(target) yon_char_unite("ubconfig get autoinstall AUTOINSTALL['ubconfig set [network] NETWORK[", target, "@devdown]']", NULL)
#define NETWORK_parameter_command(target) yon_char_unite("ubconfig get autoinstall AUTOINSTALL['ubconfig set [network] NETWORK[", target, "@connmod]']", NULL)
#define NETWORK(target) yon_char_unite("NETWORK[", target, "@connmod]", NULL)
#define installer_locale_parameter "AUTOINSTALL[installer_locale]"
#define installer_locale_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[installer_locale]"
#define source_parameter "AUTOINSTALL[source]"
#define source_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[source]"
#define finish_parameter "AUTOINSTALL[finish]"
#define finish_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[finish]"
#define admuid_parameter "ADMUID"
#define admuid_parameter_command "ubconfig --source global get [users] ADMUID"
#define DEFAULTUSER_parameter "AUTOINSTALL[ubconfig set [users] DEFAULTUSER]"
#define DEFAULTUSER_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [users] DEFAULTUSER']"
#define DEFAULTUSER_system_parameter "DEFAULTUSER"
#define DEFAULTUSER_system_parameter_command "ubconfig --source global get [users] DEFAULTUSER"
#define DEFAULTPASSWD_parameter "AUTOINSTALL[ubconfig set [users] DEFAULTPASSWD]"
#define DEFAULTPASSWD_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [users] DEFAULTPASSWD']"
#define DEFAULTPASSWD_system_parameter "DEFAULTPASSWD"
#define DEFAULTPASSWD_system_parameter_command "ubconfig --source global get [users] DEFAULTPASSWD"
#define DEFAULTROOTPASSWD_system_parameter "DEFAULTROOTPASSWD"
#define DEFAULTROOTPASSWD_system_parameter_command "ubconfig --source global get [users] DEFAULTROOTPASSWD"
#define ADDADM_parameter "AUTOINSTALL[ubconfig set [users] ADDADM]"
#define ADDADM_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [users] ADDADM']"
#define ADDADM_system_parameter "ADDADM"
#define ADDADM_system_parameter_command "ubconfig --source default get [autoinstall] ADDADM"

#define SYSTEM_LANG_parameter "AUTOINSTALL['ubconfig set [locale] LANG']"
#define SYSTEM_LANG_parameter_command "ubconfig --source global get autoinstall AUTOINSTALL['ubconfig set [locale] LANG']"

#define get_localisation_command "ubconfig -ea --source global get [autoinstall] AUTOINSTALL[installer_locale] -- get [autoinstall] AUTOINSTALL['ubconfig set [locale] LANG'] -- get [locale] LANG"

#define install_start_command(path) yon_char_unite("/usr/bin/bash -c \"nice ubinstall autoinstall",main_config.debug_mode?" --debug":""," --noautoconfig --noinstall_extra",strcmp(path,"system")?" --config=":"",strcmp(path,"system")?path:"","\"", NULL)
#define configuration_start_command(path) yon_char_unite("nice ubinstall autoconfig install_extra",main_config.debug_mode?" --debug":"",strcmp(path,"system")?" --config=":"",strcmp(path,"system")?path:"", NULL)

#define auto_install_command(path) yon_char_unite("nice ubinstall autoinstall",main_config.debug_mode?" --debug":"",strcmp(path,"system")?" --config=":"",strcmp(path,"system")?path:"", NULL)

#define get_default_password_command "ubconfig --raw --conarg --source default get [users] NOSECUREROOTPASSWD"

#define open_gparted_command "gparted"

#define PASSWORD_DEFAULT "ublinux"

#define progress_path "/var/log/ubinstall_progress.log"

#define password_limits_path "/etc/security/pwquiality.conf"

#define short_log_path "/var/log/ubinstall_progress.log"

#define full_log_path "/var/log/ubinstall.log"

#define get_devices_command "/usr/bin/bash -c \"ubinstall show --lsdevices\""
#define get_parts_for_device_command "/usr/bin/bash -c \"ubinstall show --lsparts\""
#define get_modules_command "/usr/bin/bash -c \"ubinstall show --lsmodules\""
#define ubconfig_file_create_pkexec(target) yon_char_unite("pkexec ubconfig --target \"",target,"\" create",NULL)

#define config_get_command(target) yon_char_unite("ubconfig -ea --conarg --source ", target, " get [autoinstall] AUTOINSTALL[*] ADDADM -- get [locale] LANG", NULL)

#define config_get_default_command "ubconfig -ea --noconarg --source default get [autoinstall] AUTOINSTALL[*] ADDADM -- get [locale] LANG -- get [users] ADMUID DEFAULTUSER DEFAULTPASSWD DEFAULTROOTPASSWD"

#define config_get_global_only_parameters ""
#define config_get_local_only_parameters ""

// #define ubconfig_file_create(target) yon_char_unite("ubconfig --target \"", target, "\" create", NULL)

#define default_langs(size) yon_char_parsed_new(size, "en_US.UTF-8", "ru_RU.UTF-8", NULL);

#define languages_command "while IFS= read -ru3 SELECT_LOCALE; do SELECT_LOCALE=\"${SELECT_LOCALE% *}\"; [[ $(< /usr/share/i18n/locales/${SELECT_LOCALE%.*}) =~ (\"language\"[[:blank:]]*\\\"([^\\\"]*)\\\".*\"territory\"[[:blank:]]*\\\"([^\\\"]*)\\\".*\"country_name\"[[:blank:]]*\\\"([^\\\"]*)\\\".*\"lang_name\"[[:blank:]]*\\\"([^\\\"]*)\\\")|(\"language\"[[:blank:]]*\\\"([^\\\"]*)\\\".*\"territory\"[[:blank:]]*\\\"([^\\\"]*)\\\".*\"lang_name\"[[:blank:]]*\\\"([^\\\"]*)\\\")|(\"language\"[[:blank:]]*\\\"([^\\\"]*)\\\".*\"territory\"[[:blank:]]*\\\"([^\\\"]*)\\\") ]] && echo \"${SELECT_LOCALE}|${BASH_REMATCH[2]}${BASH_REMATCH[7]}${BASH_REMATCH[11]}${BASH_REMATCH[5]:+ (${BASH_REMATCH[5]})}${BASH_REMATCH[9]:+ (${BASH_REMATCH[9]})}|${BASH_REMATCH[3]}${BASH_REMATCH[8]}${BASH_REMATCH[12]}${BASH_REMATCH[4]:+ (${BASH_REMATCH[4]})}\" || echo \"${SELECT_LOCALE}\"; done 3< \"/usr/share/i18n/SUPPORTED\""

#define get_package_info_command(target) yon_char_unite("pacman -Si ", target, "| sed 's/  */ /g'", NULL)

#define layouts_command "sed -En '/^! layout$/,/^ *$/!d;s/[[:blank:]]+([^ ]+)[[:blank:]]+(.*)/\\1|\\2/p' /usr/share/X11/xkb/rules/evdev.lst"
#define layouts_variant_command "sed -En '/^! variant$/,/^ *$/!d;s/[[:blank:]]+([^ ]+)[[:blank:]]+([^ :]+):[[:blank:]]+(.*)/\\2|\\1|\\3/p' /usr/share/X11/xkb/rules/evdev.lst"
#define grp_options_command "sed -En '/^! option$/,/^ *$/!d;s/[[:blank:]]+(grp:[^ ]+)[[:blank:]]+(.*)/\\1|\\2/p' /usr/share/X11/xkb/rules/evdev.lst"

#define install_common_parameters \
	AUTOINSTALL_TYPE_INSTALL,     \
		device_parameter,         \
		part_format_parameter,    \
		part_label_parameter,     \
		part_fs_type_parameter

#define install_part_parameters  \
	AUTOINSTALL_TYPE_INSTALL,    \
		device_parameter,        \
		part_format_parameter,   \
		part_fs_label_parameter, \
		part_parameter,          \
		part_fs_type_parameter,  \
		part_fs_label_parameter

#define install_next_parameters  \
	AUTOINSTALL_TYPE_INSTALL,    \
		device_parameter,        \
		part_format_parameter,   \
		part_fs_label_parameter, \
		part_parameter,          \
		part_fs_type_parameter,  \
		part_size_parameter

#define install_advanced_parameters \
	AUTOINSTALL_TYPE_INSTALL,       \
		device_parameter,           \
		part_format_parameter,      \
		part_label_parameter,       \
		part_parameter,             \
		part_fs_type_parameter,     \
		part_size_parameter

#define install_grub_install_update_parameters \
	AUTOINSTALL_TYPE_INSTALL,                  \
		device_parameter,                      \
		part_parameter

#define install_system_only_parameters \
	AUTOINSTALL_TYPE_INSTALL,          \
		device_parameter,              \
		part_format_parameter,         \
		part_label_parameter,          \
		part_parameter,                \
		part_fs_type_parameter,        \
		part_size_parameter,           \
		part_crypt_parameter

#define install_userdata_only_parameters \
	AUTOINSTALL_TYPE_INSTALL,            \
		device_parameter,                \
		part_format_parameter,           \
		part_label_parameter,            \
		part_parameter,                  \
		part_fs_type_parameter,          \
		part_size_parameter,             \
		part_crypt_parameter

typedef char *string;
__attribute__((unused)) static 
string version_application;

enum YON_PAGES
{
	YON_PAGE_WELCOME = 0,
	YON_PAGE_LICENCE,
	YON_PAGE_SECTIONS,
	YON_PAGE_OS_COMPONENTS,
	YON_PAGE_INSTALLATION_BEGIN,
	YON_PAGE_RECOVERY_BEGIN,
	YON_PAGE_CONFIG_HUB,
	YON_PAGE_KERNEL,
	YON_PAGE_KERNEL_ADDON,
	YON_PAGE_SOFTWARE,
	YON_PAGE_PACMAN_SOFTWARE,
	YON_PAGE_REGION,
	YON_PAGE_LANGUAGE,
	YON_PAGE_KEYBOARD,
	YON_PAGE_USERS,
	YON_PAGE_STARTUP,
	YON_PAGE_APP_STARTUP,
	YON_PAGE_BOOTLOADER,
	YON_PAGE_NETWORK,
	YON_PAGE_PACKAGES,
	YON_PAGE_INSTALLATION,
	YON_PAGE_RECOVERY_PROCESS,
	YON_PAGE_COMPLETION,
	YON_PAGE_RECOVERY_COMPLETION,
	YON_PAGE_COMPLETED,
	YON_PAGE_INSTALL_ERROR,
	YON_PAGE_CONFIGURE_END,
	YON_PAGE_CONFIGURE_SAVE,

	YON_PAGE_INSTALL_COMMON,
	YON_PAGE_INSTALL_SEPARATE,
	YON_PAGE_INSTALL_SAME_PARTITION,
	YON_PAGE_INSTALL_ADVANCED,
	YON_PAGE_INSTALL_RECOVERY,

	YON_PAGE_RECOVERY_GRUB_INSTALL,
	YON_PAGE_RECOVERY_GRUB_UPDATE,
	YON_PAGE_RECOVERY_OS_ONLY,
	YON_PAGE_RECOVERY_USRDATA_ONLY
};

typedef struct
{
	template_config_fields
		config_str launch_arguments;
	int launch_size;
	int save_done;
	int save_configured;

	int install_complete;
	guint slider_thread;
	unsigned long install_thread;
	guint progress_thread;
	int configure_mode;
	int log_progress_buzy;
	int autologin_default;
	int format_default;
	int log_end;
	int exit_accepted;
	GMutex progress_mutex;
	GMutex install_mutex;

	GHashTable *languages;

	int arg_size;
	config_str arg_target;
	GtkWidget *status_box;
	GHashTable *network_types;
	GtkWidget *kernel_unchosen_radio;

	// unsigned int cur_slide;
	gboolean dry_run;

	GtkTreeStore *layouts_store;

	GtkListStore *models_list;
	config_str variants_list;
	int variants_size;
	config_str layouts_list;
	int layouts_size;

	GList *slides;
	GList *chosen_slide;

	char *os_name;

	config_str partitions;
	int part_size;

	config_str devices;
	int devices_size;

	char *part_size_default;

	config_str modules;
	int modules_size;

	int block_restore;

	config_str argv;
	int argc;

	yon_config_custom *startup_config;

	int autoinstall; // if active, installation starts immidiately after app start
} config;

extern config main_config;

typedef struct
{
	GtkBuilder *builder;
	GtkListStore *DevicesList;
	GtkListStore *LanguagesList;
	GtkListStore *LayoutsList;
	GtkListStore *PartitionsList;

	GtkWidget *LoadLocalConfigurationMenuItem;
	GtkWidget *LoadExternalConfigurationMenuItem;

	GtkWidget *MainWindow;

	GtkWidget *LicenseAgreeRadio;
	GtkWidget *LicenseDisgreeRadio;

	GtkWidget *StartScenarioButton;
	GtkWidget *SourceButton;
	// GtkWidget *SkipInstallationButton;
	GtkWidget *MainSpinner;

	GtkWidget *StatusBox;
	GtkWidget *StatusBox2;
	GtkWidget *WelcomeToggle;
	GtkWidget *LicenceToggle;
	GtkWidget *PreparationToggle;
	GtkWidget *ConfigurationToggle;
	GtkWidget *InstallationToggle;
	GtkWidget *CompletionToggle;
	GtkWidget *LanguagesTree;
	GtkWidget *CountryLanguagesTree;
	GtkListStore *InstallerCountryList;
	GtkListStore *InstallerLanguageList;
	GtkTreeModel *InstallerCountryFilter;
	// GtkWidget *LanguageCombo;

	GtkWidget *RegionMapBox;
	GtkWidget *RegionMapOverlay;
	GtkWidget *RegionMapTarget;
	GtkWidget *TimeZoneMapOverlayBox;
	GtkWidget *TimeZoneMapOverlayImage;
	GtkWidget *TimeZoneMapOverlayTitleLabel;
	GtkWidget *TimeZoneMapOverlayInfoLabel;
	GtkWidget *RegionSensitiveSwitch;
	GtkWidget *RegionCombo;
	GtkWidget *ZoneCombo;
	GtkWidget *RegionEntry;
	GtkListStore *RegionTimezoneCompletionList;
	GtkTreeModelFilter *RegionTimezoneCompletionFilter;

	GtkWidget *InstallationRadio;
	GtkWidget *InstallationNearRadio;
	GtkWidget *InstallationLinuxRadio;
	GtkWidget *InstallationWindowsRadio;
	GtkWidget *InstallationOptionsRadio;

	// GtkWidget *UserImage;
	GtkWidget *UserRootNameEntry;
	GtkWidget *UserRootLoginEntry;
	GtkWidget *UserRootPasswordCombo;
	GtkWidget *UserRootPasswordEntry;
	GtkWidget *UserRootPasswordButton;
	GtkWidget *UserAutologinSwitch;
	GtkWidget *UserAddBox;
	GtkWidget *UserAddButton;

	GtkWidget *HotnameEntry;
	GtkWidget *AutoHostnameCheck;
	GtkWidget *CancelInstallButton;
	GtkWidget *BackButton;
	GtkWidget *NextButton;
	GtkWidget *mainSettingsButton;
	GtkWidget *menu1;
	GtkWidget *menu2;

	GtkWidget *LocaleDefaultSwitch;
	GtkWidget *LocaleTree;
	GtkWidget *LocaleAddButton;
	GtkWidget *LocaleRemoveButton;
	GtkCellRenderer *LocaleCell;
	GtkListStore *LanguageList;

	GtkWidget *KeyboardModelCombo;
	GtkWidget *KeyboardDefaultLayoutsSwitch;
	GtkWidget *KeyboardLayoutTree;
	GtkWidget *KeyboardLayoutMoveUpButton;
	GtkWidget *KeyboardLayoutMoveDownButton;
	GtkWidget *KeyboardLayoutAddButton;
	GtkWidget *KeyboardLayoutRemoveButton;
	GtkWidget *KeyboardLayoutChangingCombo;
	GtkWidget *KeyboardComposeSwitch;
	GtkWidget *KeyboardScrollLockSwitch;
	GtkWidget *KeyboardNumLockCombo;

	GtkWidget *Notebook;
	GtkWidget *LicenceLabel;
	GtkWidget *SlidesImage;

	GtkWidget *CommonInstallationDevicesTree;
	GtkWidget *CommonInstallationFilesystemTypeCombo;
	GtkWidget *CommonInstallationSectionNameEntry;
	GtkWidget *CommonFormatSwitch;
	GtkWidget *CommonGpartedButton;
	GtkWidget *CommonUpdateGpartedButton;

	GtkWidget *NextInstallationSysDevicesTree;
	GtkWidget *NextInstallationSysSectionTree;
	GtkWidget *NextInstallationFormatSwitch;
	GtkWidget *NextInstallationFormatRevealer;
	GtkWidget *NextInstallationSizeSpin;
	GtkWidget *NextInstallationSizeTypeSpin;
	GtkWidget *NextInstallationFilesystemTypeCombo;
	GtkWidget *NextInstallationSectionNameEntry;
	GtkWidget *NextInstallationGPartedButton;
	GtkWidget *NextInstallationUpdateGPartedButton;

	GtkWidget *SamePlaceDeviceTree;
	GtkWidget *SamePlacePartTree;
	GtkWidget *SameInstallationFormatSwitch;
	GtkWidget *SameInstallationFormatRevealer;
	GtkWidget *SameInstallationFilesystemTypeCombo;
	GtkWidget *SameInstallationSectionNameEntry;
	GtkWidget *SameGpartedButton;
	GtkWidget *SameUpdateGpartedButton;

	GtkWidget *InstallationProgress;
	GtkWidget *InstallationLabel;
	GtkWidget *ReadShortLogButton;
	GtkWidget *PackageInstallationProgress;
	GtkWidget *PackageInstallationLabel;
	GtkWidget *ReadFullLogButton;

	GtkWidget *ConfigurationModeMenuItem;
	GtkWidget *ConfigurationModeCheck;
	GtkWidget *EnableVNCMenuItem;
	GtkWidget *EnableRDPMenuItem;
	GtkWidget *AboutMenuItem;
	GtkWidget *DocumentationMenuItem;

	GtkWidget *AdditionalComponentsStatusImage;
	GtkWidget *AdditionalComponentsStatusLabel;
	GtkWidget *AdditionalComponentsStatusButton;
	GtkWidget *AdditionalComponentsList;
	GtkWidget *AdditionalComponentsOverallSizeLabel;
	GtkWidget *AdditionalComponentsUncheckAllCheck;

	GtkWidget *GrubInstallRadio;
	GtkWidget *GrubUpdateRadio;
	GtkWidget *SeparateRadio;
	GtkWidget *OSRadio;
	GtkWidget *UserDataOnlyRadio;

	GtkWidget *GrubInstallGpartedButton;
	GtkWidget *GrubInstallUpdateGpartedButton;
	GtkWidget *GrubInstallDevicesTree;
	GtkWidget *GrubInstallPartitionTree;

	GtkWidget *GrubUpdateGpartedButton;
	GtkWidget *GrubUpdateUpdateGpartedButton;
	GtkWidget *GrubUpdateDevicesTree;
	GtkWidget *GrubUpdatePartitionTree;

	GtkWidget *OSGpartedButton;
	GtkWidget *OSUpdateGpartedButton;
	GtkWidget *OSDevicesTree;
	GtkWidget *OSSysSectionTree;
	GtkWidget *OSFormatSwitch;
	GtkWidget *OSRevealer;
	GtkWidget *OSFormatSizeSpin;
	GtkWidget *OSFormatSizeCombo;
	GtkWidget *OSFormatPartitionEntry;
	GtkWidget *OSFilesystemTypeCombo;
	GtkWidget *OSFormatFSMarkEntry;
	GtkWidget *OSFormatEncryptionCombo;
	GtkWidget *OSFormatEncryptionEntry;
	GtkWidget *OSFormatEncryptionButton;
	GtkWidget *OSSpinner;
	GtkWidget *OSOverlay;
	GtkWidget *OSComponentsOverallSizeLabel;
	GtkWidget *OSSoftwareUncheckAllCheck;

	GtkWidget *UserdataGpartedButton;
	GtkWidget *UserdataUpdateGpartedButton;
	GtkWidget *UserdataDevicesTree;
	GtkWidget *UserdataSysSectionTree;
	GtkWidget *UserdataFormatSwitch;
	GtkWidget *UserdataRevealer;
	GtkWidget *UserdataFormatSizeSpin;
	GtkWidget *UserdataFormatSizeCombo;
	GtkWidget *UserdataFormatPartitionEntry;
	GtkWidget *UserdataFilesystemTypeCombo;
	GtkWidget *UserdataFormatFSMarkEntry;
	GtkWidget *UserdataFormatEncryptionCombo;
	GtkWidget *UserdataFormatEncryptionEntry;
	GtkWidget *UserdataFormatEncryptionButton;

	GtkTreeModel *LanguagesFilter;
	GtkTreeModel *LayoutsFilter;

	GtkWidget *HostnameSensitiveSwitch;

	GtkWidget *KernelPacmanStatusImage;
	GtkWidget *KernelPacmanStatusLabel;
	GtkWidget *KernelPacmanStatusButton;
	GtkWidget *KernelListBox;
	GtkWidget *KernelInstallLabel;
	GtkWidget *KernelEnableLabel;
	GtkWidget *KernelNameLabel;
	GtkWidget *KernelTagsLabel;
	GtkWidget *KernelModulesLabel;
	GtkWidget *KernelDescriptionLabel;
	GtkSizeGroup *KernelSizeGroup;

	GtkWidget *KernelAddonPacmanStatusImage;
	GtkWidget *KernelAddonPacmanStatusLabel;
	GtkWidget *KernelAddonPacmanStatusButton;
	GtkWidget *KernelAddonListBox;
	GtkWidget *KernelAddonInstallLabel;
	GtkWidget *KernelAddonNameLabel;
	GtkWidget *KernelAddonModulesLabel;
	GtkWidget *KernelAddonDescriptionLabel;

	GtkWidget *OSSoftwareListBox;
	GtkWidget *OSSoftwareInstallLabel;
	GtkWidget *OSSoftwareNameLabel;
	GtkWidget *OSSoftwareTagsLabel;
	GtkWidget *OSSoftwareDescriptionLabel;
	GtkWidget *OSSoftwareEmptyLabel;

	GtkWidget *PacmanSoftwareSearchEntry;
	GtkWidget *PacmanSoftwareStatusImage;
	GtkWidget *PacmanSoftwareStatusLabel;
	GtkWidget *PacmanSoftwareStatusButton;

	GtkWidget *PacmanLoadingOverlay;
	GtkWidget *PacmanSoftwareAllPackagesTree;
	GtkListStore *PacmanSoftwareAllList;
	GtkCellRenderer *PacmanSoftwareAllCell;
	GtkCellRenderer *PacmanAllInfoImageCell;
	GHashTable *pacmanchosen;

	GtkWidget *PacmanSoftwareChosenPackagesTree;
	GtkListStore *PacmanSoftwareChosenList;
	GtkCellRenderer *PacmanSoftwareChosenCell;
	GtkCellRenderer *PacmanChosenInfoImageCell;
	GtkWidget *PacmanOverallSizeLabel;
	GtkWidget *PacmanChosenLabel;


	// GtkWidget *StartupImage;
	GtkWidget *StartupServicesTree;
	GtkWidget *StartupServicesAddButton;
	GtkWidget *StartupServicesEditButton;
	GtkWidget *StartupServicesRemoveButton;
	GtkCellRenderer *StartupChosenCell;
	GtkListStore *StartupList;
	GtkWidget *StartupAppsTree;
	GtkWidget *StartupAppsAddButton;
	GtkWidget *StartupAppsEditButton;
	GtkWidget *StartupAppsRemoveButton;
	GtkCellRenderer *StartupAppsChosenCell;
	GtkListStore *StartupAppsList;

	// GtkWidget *BootloaderImage;
	GtkWidget *BootloadTimerSwitch;
	GtkWidget *BootloadTimerSpin;
	GtkWidget *BootloadDefaultOSEntry;
	GtkWidget *BootloadDefaulOSButton;
	GtkWidget *BootloadNoPasswordSwitch;
	GtkWidget *BootloadUserAddButton;
	GtkWidget *BootloadUserEditButton;
	GtkCellRenderer *BootloadAdminCheckCell;
	GtkWidget *BootloadUserRemoveButton;
	GtkWidget *BootloadUserTree;
	GtkListStore *BootloadUsersList;

	// GtkWidget *NetworkImage;
	GtkWidget *NetworkDomainSwitch;
	GtkWidget *NetworkDomainNameEntry;
	GtkWidget *NetworkDomainAdminEntry;
	GtkWidget *NetworkDomainPasswordEntry;
	GtkWidget *NetworkNTPServerSwitch;
	GtkWidget *NetworkNTPCombo;
	GtkWidget *NetworkNTPEntry;
	GtkWidget *NetworkConnectionsBox;
	GtkWidget *NetworkConnectionsAddButton;
	GHashTable *network_connections;

	GtkCellRenderer *AdvancedDeviceChosenCell;
	GtkCellRenderer *AdvancedPartChosenCell;
	GtkWidget *AdvancedGpartedButton;
	GtkWidget *AdvancedUpdateGpartedButton;
	GtkWidget *AdvancedDeviceTree;
	GtkWidget *AdvancedVirtualDeviceCombo;
	GtkWidget *AdvancedPartitionTree;
	GtkWidget *AdvancedPartitionAddBox;
	GtkWidget *AdvancedAddButton;
	GtkWidget *AdvancedLoadTypeSwitch;
	GtkWidget *AdvancedBiosSectorSwitch;
	GtkWidget *AdvancedEFISwitch;
	GtkWidget *AdvancedSwapSwitch;
	GtkWidget *AdvancedSwapAutoSwitch;
	GtkWidget *AdvancedSwapRamSwitch;
	GtkWidget *AdvancedSwapFixedSpin;
	GtkWidget *AdvancedSwapFixedSwitch;
	GtkWidget *AdvancedSwapFixedSizeSwitch;
	GtkWidget *AdvancedSwapRevealer;
	GtkWidget *AdvancedLoadTypeRevealer;
	GtkWidget *AdvancedVirtualDeviceLabel;
	dictionary *advanced_sections;
	GSequence *advanced_partition_order;

	GtkWidget *ScrollLeftEventBox;
	GtkWidget *ScrollRightEventBox;
	GtkWidget *SliderProgressBox;
	GtkWidget *InstallationSliderArrowsOverlay;
	GtkWidget *PrevInstallationSliderImage;
	GtkWidget *NextInstallationSliderImage;

	GtkWidget *PackagesStatusImage;
	GtkWidget *PackagesStatusLabel;
	GtkWidget *PackagesStatusButton;
	GtkTreeStore *PackagesList;
	GtkCellRenderer *PackagesChosenCell;
	GtkWidget *PackagesTree;
	GtkCellRenderer *PackagesInfoIconCell;
	rmb_menu_window *PackagesMenu;

	// Configuration hub slide section
	GtkWidget *ConfigHubRebootCombo;
	GtkWidget *HubPersonalListBox;
	GtkWidget *HubSystemListBox;
	GtkWidget *HubPackagesListBox;

	// Misc section

	GFile *install_progress_file;
	GFileMonitor *install_progress_monitor;
	GFile *install_info_file;
	GFileMonitor *install_info_monitor;

	gboolean slider_stop;

	GtkWidget *root_button;
	GtkWidget *debug_button;

	GFileMonitor *db_lock_monitor;

} main_window;

enum ADVANCED_PART_TYPE
{
	ADVANCED_PART_NEW,
	ADVANCED_PART_EXISTING
};

typedef struct
{
	GtkWidget *MainBox;
	GtkWidget *SectionLabel;
	GtkWidget *SystemSectionToggle;
	GtkWidget *UserDataSectionToggle;
	GtkWidget *RemoveButton;
	GtkWidget *FormatCombo;
	GtkWidget *FormatRevealer;
	GtkWidget *SizeSpin;
	GtkWidget *SizeCombo;
	GtkWidget *PartLabelEntry;
	GtkWidget *FileSystemTypeCombo;
	GtkWidget *FileSystemLabelEntry;
	GtkWidget *EncryptionCombo;
	GtkWidget *EncryptionEntry;
	GtkWidget *EncryptionButton;
	GtkWidget *SectionPartitionLabel;
} advanced_part_widgets;

typedef struct
{
	GtkWidget *Window;
	GtkWidget *HeaderLabel;
	GtkWidget *AlwaysOpenCheck;

	GtkWidget *CloseButton;
	GtkWidget *AcceptButton;
} documentation_confirmation_window;

typedef struct
{
	GtkWidget *MainWindow;
	GtkWidget *StatusBox;
	GtkWidget *headerBar;
	GtkWidget *CancelButton;
	GtkWidget *SaveButton;
	GtkWidget *LayoutsTree;
	GtkCellRenderer *ActiveToggle;
} ubinstall_keyboard_window;

typedef struct
{
	GtkListStore *liststore1;
	GtkWidget *MainWindow;
	GtkWidget *StatusBox;
	GtkWidget *DefaultCheck;
	GtkWidget *headerBar;
	GtkWidget *CancelButton;
	GtkWidget *SaveButton;
	GtkWidget *LanguagesTree;

	GtkCellRenderer *ToggleRenderer;
} ubinstall_language_window;

typedef struct
{
	GtkWidget *CreateGroupWindow;
	GtkWidget *StatusBox;
	GtkWidget *UserCancelButton;
	GtkWidget *UserOkButton;
	GtkWidget *UserRootPasswordEntry;
	GtkWidget *RepeatPasswordEntry;
	GtkWidget *PasswordHashEntry;
	GtkWidget *HashBox;
	GtkWidget *PasswordBox;
	GtkWidget *NoEncriptionCheck;
} password_window;

typedef struct
{
	GtkWidget *Window;
	GtkWidget *ScrollWindow;
	GtkWidget *StatusBox;
	GtkWidget *HeadLabel;
	GtkWidget *LogTextView;
	GtkWidget *ScrollToEndCheck;
	GFileMonitor *monitor;

	guint timer_id;

	char *command;
} log_window;

typedef struct
{
	GtkWidget *Window;
	GtkWidget *TitleLabel;
	GtkWidget *TextLabel;
	GtkWidget *AcceptButton;
	GtkWidget *CancelButton;
} confirmation_window;

typedef struct
{
	GtkWidget *MainBox;
	GtkWidget *TypeCombo;
	GtkWidget *ConnectionCombo;
	GtkWidget *ConnectionEntry;
	GtkWidget *EnabledSwitch;
	GtkWidget *RemoveButton;
	GtkWidget *AutoGetIPSwitch;
	GtkWidget *IpRevealer;
	GtkWidget *IpAdressEntry;
	GtkWidget *GatewayEntry;
	GtkWidget *MaskEntry;
	GtkWidget *DNSEntry;
} network_info;

typedef struct
{
	GtkWidget *MainBox;
	GtkWidget *RemoveButton;
	GtkWidget *UsernameEntry;
	GtkWidget *LoginEntry;
	GtkWidget *PasswordCombo;
	GtkWidget *PasswordEntry;
	GtkWidget *PasswordButton;
	GtkWidget *AdminCheck;
	int changed;
	char *old_login;
} yon_user_struct;

typedef struct
{
	GtkWidget *MenuWindow;
	GtkWidget *BackButton;
	GtkWidget *ItemsRevealer;
	GtkWidget *ItemsListBox;
	GtkWidget *ChildrenRevealer;
	GtkWidget *ChildrenListBox;
	GtkWidget *target;

	int seat_grab;
	dictionary *menu_items;
	char *cur_selection;
	int button_pos_x;
	int button_pos_y;
} yon_menu_window;

typedef struct
{
	GtkWidget *MenuItemRow;
	GtkWidget *MenuTextLabel;
	GtkWidget *ArrowImage;

	yon_menu_window *window;

	char *name;
	char *id;
	int children;

} yon_menu_item;

typedef struct
{
	GtkWidget *row;
	GtkWidget *RowBox;
	GtkWidget *InstallCheck;
	GtkWidget *NameLabel;
	GtkWidget *DescriptionLabel;
	GtkWidget *ModulesLabel;
	GtkWidget *TagsBox;
	GtkWidget *EnableRadio;
	GtkWidget *EnableSeparator;
	GtkWidget *TagsSeparator;

	char *name;
	char *modules;
	char *package;
} kernel_row;

typedef struct
{
	GtkWidget *row;
	GtkWidget *RowBox;
	GtkWidget *InstallCheck;
	GtkWidget *NameLabel;
	GtkWidget *DescriptionLabel;
	GtkWidget *ModuleLabel;
	GtkWidget *PackageLabel;

	char *name;
	char *modules;
	char *package;
} kernel_addon_row;

typedef struct
{
	GtkWidget *row;
	GtkWidget *RowBox;
	GtkWidget *InstallCheck;
	GtkWidget *NameLabel;
	GtkWidget *DescriptionLabel;
	GtkWidget *VersionLabel;
	GtkWidget *TagsBox;
	GtkWidget *SourceLabel;
	GtkWidget *SizeLabel;

	char *name;
	char *source;
	char *modules;
	char *version;
	char *tags;
	char *description;
	unsigned long size_raw;
	GtkWidget *RowOverlay;
} os_row;

typedef struct
{
	GtkWidget *Window;
	GtkWidget *StatusBox;
	GtkWidget *UnitEntry;
	GtkWidget *ServiceEntry;
	GtkWidget *DescriptionEntry;
	GtkWidget *CancelButton;
	GtkWidget *AcceptButton;
	GtkWidget *AppLabel;
	GtkWidget *GroupLabel;
	GtkWidget *DescriptionLabel;
} startup_service_window;

struct pacman_struct
{
	main_window *widgets;
	const char *find_package;
	gsize packages_size;
	config_str packages;
};

typedef struct
{
	GtkWidget *Window;
	GtkWidget *StatusBox;
	GtkWidget *TitleLabel;

	GtkWidget *AdminCheck;
	GtkWidget *UsernameEntry;
	GtkWidget *PasswordEntry;
	GtkWidget *PasswordButton;

	GtkWidget *CancelButton;
	GtkWidget *AcceptButton;

	char *prev_name;
} bootloader_user_window;

typedef struct
{
	GtkWidget *Window;
	GtkWidget *StatusBox;
	GtkWidget *PathEntry;
	GtkWidget *PathButton;
	GtkWidget *CancelButton;
	GtkWidget *ChooseButton;
} configuration_window;

typedef struct
{
	GtkWidget *Window;
	GtkWidget *StatusBox;
	GtkWidget *CancelButton;
	GtkWidget *AcceptButton;
	GtkWidget *AutoSwitch;
	GtkWidget *AddBox;
} source_window;

typedef struct
{
	GtkWidget *MainBox;
	GtkWidget *TypeCombo;
	GtkWidget *PathEntry;
	GtkWidget *DeviceCombo;
	GtkWidget *PathButton;
	GtkWidget *RemoveButton;
	GtkWidget *AddButton;

} source_element;

enum PART_SOURCE
{
	PART_SOURCE_DEVICE,
	PART_SOURCE_PART,
	PART_SOURCE_VIRTUAL
};

typedef struct
{
	char *partition;
	char *device;
	int sys_section;
	int user_section;
	char *format;
	gulong full_part_size;
	unsigned long size;
	char size_letter;
	char *part_label;
	char *fs_type;
	char *fs_label;
	char *encryption;
	char *encryption_password;
	enum PART_SOURCE part_source;
	advanced_part_widgets *partition_widgets;
} advanced_part_data;

struct row_data
{
	main_window *widgets;
	char *version;
	char *name;
	char *tags;
	char *description;
	char *source;
	char *size;
	unsigned long size_raw;
};

typedef struct
{
	GtkWidget *Window;
	GtkWidget *StatusBox;
	GtkWidget *LanguagesTree;

	GtkWidget *CancelButton;
	GtkWidget *AcceptButton;
	GtkWidget *ManualEntry;
	GtkWidget *LoadingOverlay;
	GtkWidget *LoadingSpinner;
	GtkCellRenderer *ToggleCell;

	GtkListStore *LanguagesList;

	char *languages;
} language_window;

struct locales_struct
{
	char *locale;
	char *lang;
	char *territory;
	int chosen;
	GtkListStore *list;
};

typedef struct
{
	GtkWidget *Window;
	GtkWidget *StatusBox;
	GtkWidget *MainTree;
	GtkWidget *CancelButton;
	GtkWidget *AcceptButton;
	GtkWidget *OptionsFilterCombo;
	GtkWidget *OptionsEntry;
	GtkCellRenderer *ChosenCell;
	GtkTreeStore *list;
	GtkListStore *OptionsList;
	GtkTreeModel *OptionsFilter;
	char *parameters;
} layouts_window;

typedef struct
{
	GtkWidget *MainBox;
	GtkWidget *Image;
	GtkWidget *Label;
	enum YON_PAGES page;
} config_hub_icon;

typedef struct
{
	GtkWidget *MainBox;
	GtkWidget *TitleImage;
	GtkWidget *TitleLabel;
	GtkWidget *TextLabel;
} slider_object;

typedef struct {
    GtkWidget *MainBox;
    GtkWidget *InfoTree;
    GtkListStore *InfoList;
} info_element;

void config_init();
main_window *yon_main_window_complete();
ubinstall_language_window *yon_ubinstall_language_new();
void NewFunction(ubinstall_language_window *window, GtkBuilder *builder);
ubinstall_keyboard_window *yon_ubinstall_keyboard_new();

void on_password_accept(GtkWidget *self, dictionary *dict);

void yon_interface_update(main_window *widgets);

void on_summary_log_view(GtkWidget *, main_window *widgets);
void on_device_selection_changed(GtkWidget *self, main_window *widgets);

void on_toggle_button_switch_on(GtkWidget *, GtkToggleButton *toggle);

void on_autohostname_sensitiveness_check(GtkWidget *, int status, main_window *widgets);
void on_autohostname_check(GtkWidget *, main_window *widgets);
void on_hostname_entry_changed(GtkWidget *, main_window *widgets);

gboolean on_install_success(main_window *widgets);

gboolean on_install_error(main_window *widgets);

// confirmation_window *yon_confirmation_window_new();

void on_reboot_accepted(main_window *widgets);

int yon_configuration_path_check(const char *path);
void on_keyboard_clicked(GtkWidget *, main_window *widgets);
void on_keyboard_accept(GtkWidget *self, main_window *widgets);
void on_layout_toggle(GtkCellRendererToggle *, gchar *path, ubinstall_keyboard_window *window);
void on_language_clicked(GtkWidget *, main_window *widgets);
void yon_language_selection_changed(GtkCellRenderer *, char *path, ubinstall_language_window *window);
void on_language_window_accept(GtkWidget *, dictionary *dict);
void on_keyboard_removed(GtkWidget *, main_window *widgets);
void on_exit_accepted(main_window *widgets);
void on_gparted_open();
// void on_same_installation_device_changed(GtkWidget *, main_window *widgets);
void on_separate_installation_changed(GtkWidget *self, main_window *widgets);
void on_partition_changed(GtkWidget *self, main_window *widgets);
void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_size, GtkComboBox *size_type);
gboolean on_yon_exit(GtkWidget *, GdkEvent *, main_window *widgets);
void on_locale_changed(GtkWidget *, main_window *);
#ifdef TIMEZONEMAP_INCLUDE
void on_zone_changed(GtkWidget *, main_window *widgets);
#endif
void on_region_changed(GtkComboBox *self, main_window *widgets);
void on_page_cancel_clicked(GtkWidget *, main_window *widgets);
int yon_install_options_save(GtkWidget *device_tree, GtkWidget *part_tree, char *mode, main_window *widgets);
void on_process_log_view(GtkWidget *, main_window *widgets);
void yon_read_log(GFileMonitor *, GFile *, GFile *, GFileMonitorEvent, log_window *window);
log_window *yon_log_window_new();
void on_log_closed(GtkWidget *, log_window *window);
void on_page_changed(GtkWidget *, GtkWidget *, int page, main_window *widgets);
void yon_installation_progress_update(GFileMonitor *, GFile *, GFile *, GFileMonitorEvent, main_window *widgets);
void *on_config_save(void *data);
void *on_setup_system_configuration(void *data);
void yon_install_slider_init(main_window *widgets);
void on_install_slider_next(GtkWidget *, GdkEventButton *, main_window *widgets);
void on_install_slider_prev(GtkWidget *, GdkEventButton *, main_window *widgets);
void yon_install_slider_update(main_window *widgets);
slider_object *yon_slider_object_new();
void yon_slider_setup(slider_object *slider, char *title, char *icon, char *text_markup);
slider_object *yon_slider_new_full(char *title, char *icon, char *text_markup);
gboolean on_install_slider_hover_highlight(GtkWidget *self, GdkEvent *, main_window *);
gboolean on_install_slider_hover_highlight(GtkWidget *self, GdkEvent *, main_window *);
gboolean on_install_slider_hover_highlight_end(GtkWidget *self, GdkEvent *, main_window *);
gboolean on_install_slider_hover_highlight_end(GtkWidget *self, GdkEvent *, main_window *);
// gboolean on_image_slide(void *data);
// void on_region_resized(GtkWidget *,main_window *widgets);
// int yon_image_resize_from_container(GtkImage *target, GdkPixbuf *pixbuf_unscaled);
void on_configuration_mode_switch(GtkWidget *self, main_window *widgets);
double yon_size_long_convert_automatic(unsigned long bytes, char *size);
double yon_size_long_convert_to_mod(double size, char mod);
void on_root_get_root(char *argline);
void on_config_custom_save(GtkWidget *, main_window *widgets);
void on_config_global_save(GtkWidget *, main_window *widgets);
void on_config_local_save(GtkWidget *, main_window *widgets);
void on_config_global_local_save(GtkWidget *, main_window *widgets);
void on_config_custom_load_last(GtkWidget *, main_window *widgets);
void on_config_custom_load(GtkWidget *, main_window *);
void on_config_local_load(GtkWidget *, main_window *widgets);
void yon_config_save_proceed(char *path, YON_CONFIG_TYPE type);
void on_page_next_clicked(GtkWidget *, main_window *widgets);
void on_page_prev_clicked(GtkWidget *, main_window *widgets);
void yon_load_proceed(YON_CONFIG_TYPE type);
void _yon_saving_threaded(char *final_command);
enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page);
enum YON_PAGES yon_page_get_prev(main_window *widgets,enum YON_PAGES page);
enum YON_PAGES yon_sections_get_next_page(main_window *widgets);
enum YON_PAGES yon_recovery_get_next(main_window *widgets);
enum YON_PAGES yon_page_get_current(GtkNotebook *target);
void yon_switch_page_render(main_window *widgets);
void yon_page_update(main_window *);
void yon_navigation_buttons_set_sensetiveness(main_window *widgets);
int yon_region_save(main_window *widgets);
int yon_keyboard_save(main_window *widgets);
int yon_install_common_save(main_window *widgets);
int yon_install_separate_save(main_window *widgets);
int yon_install_same_partition_save(main_window *widgets);
int yon_grub_install_save(main_window *widgets);
int yon_grub_update_save(main_window *widgets);
int yon_os_components_save(main_window *widgets);
int yon_software_save(main_window *widgets);
int yon_kernel_save(main_window *widgets);
int yon_page_save(main_window *widgets, enum YON_PAGES page);
int yon_users_save(main_window *widgets);
int yon_bootloader_save(main_window *widgets);
int yon_startup_save(main_window *widgets);
network_info *yon_network_info_new();
int yon_install_advanced_save(main_window *widgets);
int yon_network_save(main_window *widgets);
void on_connection_add(GtkWidget *, main_window *widgets);
void on_ntp_sync(GtkWidget *, main_window *widgets);
// int yon_advanced_sections_save(dictionary *dict);
void yon_configuration_mode_check(main_window *widgets);
void on_configuration_mode_switch(GtkWidget *self, main_window *widgets);
void *_yon_installation_start(main_window *widgets);
int yon_installation_start(main_window *widgets);
enum INSTALL_TYPE yon_ubl_get_install_mode();
int yon_user_save(yon_user_struct *user);
void on_user_add(GtkWidget *, main_window *widgets);
yon_user_struct *yon_user_struct_new();
void on_user_remove_clicked(GtkWidget *, yon_user_struct *user);
void yon_password_new(GtkWidget *, yon_user_struct *user);
void yon_password_root_new(GtkWidget *, main_window *widgets);
yon_menu_item *yon_menu_item_new();
yon_menu_window *yon_menu_window_new();
void on_menu_window_size_reallocated(GtkWidget *self, GtkAllocation *, yon_menu_window *window);
void on_children_clean(GtkWidget *, yon_menu_window *window);
gboolean yon_on_revealer_switched(yon_menu_window *window);
gboolean on_menu_clicked(GtkWidget *, GdkEventButton *event, yon_menu_window *window);
yon_menu_window *yon_menu_window_open(GtkWidget *, main_window *widgets);
void on_submenu_open(GtkWidget *, yon_menu_item *item);
void yon_kernel_init(main_window *widgets);
void yon_kernel_row_setup(kernel_row *row, char *name, char *modules, char *package, char *tags, char *description);
void yon_kernel_row_setup_tags(kernel_row *row, char *tags);
int yon_tag_add(GtkBox *target, char *tag_label, char *tag_style, char *icon_name);
kernel_row *yon_kernel_row_new();
void yon_kernel_resize(main_window *widgets);
void yon_kernel_addon_init(main_window *widgets);
void yon_kernel_addon_resize(main_window *widgets);
void yon_startup_services_init(main_window *widgets);
void on_srartup_services_toggled(GtkCellRenderer *, char *path, main_window *widgets);
void on_startup_service_edit(GtkWidget *, main_window *widgets);
void on_startup_service_add(GtkWidget *, main_window *widgets);
startup_service_window *yon_startup_service_window_new();
void on_startup_edit_accept(GtkWidget *, main_window *widgets);
void on_startup_add_accept(GtkWidget *, main_window *widgets);
void yon_startup_services_init(main_window *widgets);
void on_startup_services_remove(GtkWidget *self, main_window *widgets);
void on_startup_services_selection_changed(GtkWidget *, main_window *widgets);
void on_pacman_software_all_toggled(GtkWidget *, char *path, main_window *widgets);
void on_pacman_software_chosen_toggled(GtkWidget *, char *path, main_window *widgets);
int yon_pacman_software_save(main_window *widgets);
void on_pacman_icon_press(GtkEntry *self, GtkEntryIconPosition icon_pos, GdkEvent *event, main_window *widgets);
gboolean yon_pacman_fill(struct pacman_struct *pacman);
void *yon_pacman_load(struct pacman_struct *pacman);
int yon_kernel_addon_save(main_window *widgets);
void yon_password_change(GtkWidget *, bootloader_user_window *window);
bootloader_user_window *yon_bootloader_user_window_new();
void on_bootloader_user_add(GtkWidget *, main_window *widgets);
void on_bootloader_user_accept(GtkWidget *, bootloader_user_window *window);
void yon_bootloader_interface_update(main_window *widgets);
void on_type_changed(GtkComboBox *self, network_info *info);
void yon_network_init(main_window *widgets);
void yon_page_init(main_window *widgets, enum YON_PAGES page);
void yon_bootloader_init(main_window *widgets);
void on_kernel_install_enabled(GtkWidget *, kernel_row *row);
void yon_user_init(main_window *widgets);
void yon_region_init(main_window *widgets);
void yon_keyboard_init(main_window *widgets);
void yon_install_init(main_window *widgets, enum YON_PAGES page);
void yon_install_advanced_init(main_window *widgets);
void yon_os_components_init(main_window *widgets);
void yon_pacman_init(main_window *widgets);
void yon_software_init(main_window *widgets);
void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_window *widgets);
void on_install_advanced_partition_chosen(GtkCellRenderer *, gchar *path, main_window *widgets);
void yon_devices_setup(main_window *widgets);
void on_advanced_password_clicked(GtkWidget *, advanced_part_widgets *part);
advanced_part_widgets *yon_advanced_partition_new();
void on_advanced_part_remove_device(GtkWidget *self, main_window *widgets);
void on_advanced_part_remove_part(GtkWidget *self, main_window *widgets);
void on_advanced_part_remove_virtual(GtkWidget *self, main_window *widgets);
int yon_advanced_get_part_size(main_window *widgets);
void yon_advanced_partition_clear(main_window *widgets);
void yon_os_row_setup(os_row *row, char *name, char *version, char *tags, char *description, char *source, char *size);
os_row *yon_os_row_new();
void yon_quick_install(GtkWidget *, main_window *widgets);
void on_keyboard_layout_chosen(GtkCellRenderer *self, gchar *path, main_window *widgets);
void configuration_mode_accept(GtkWidget *, configuration_window *window);
void on_path_choose(GtkWidget *, configuration_window *window);
void on_configuration_exit(GtkWidget *, configuration_window *window);
int yon_config_save(main_window *widgets);
void yon_config_restore(main_window *widgets);
void on_source_clicked(GtkWidget *, main_window *widgets);
source_window *yon_source_window_new();
void on_source_accept(GtkWidget *, source_window *window);
void on_source_choose(GtkWidget *self);
void on_source_remove(GtkWidget *, source_element *element);
void on_source_add(GtkWidget *, source_window *window);
void yon_source_element_add(char *key, void *, source_window *window);
source_element *yon_source_element_new();
void on_rdp_toggled(GtkWidget *self, main_window *);
void on_vnc_toggled(GtkWidget *self, main_window *widgets);
void yon_main_window_create(main_window *widgets);
void yon_set_locales_list(main_window *widgets);
void on_installer_language_changed(GtkWidget *self, GtkTreePath *, GtkTreeViewColumn *, main_window *widgets);
gboolean on_country_filter(GtkTreeModel *self, GtkTreeIter *iter, main_window *widgets);
gboolean yon_os_component_insert(struct row_data *row_input);
gboolean yon_spinner_switch_off(GtkSpinner *target);
void yon_fs_type_setup(GtkComboBoxText *target);
int yon_advanced_save(main_window *widgets);
void on_format_changed(GtkWidget *self, advanced_part_widgets *part);
int yon_layouts_get();
void on_link(GtkWidget *self, char *uri, gpointer);
void on_source_changed(GtkComboBox *self);
void yon_focus_set(GtkWidget *, GtkWidget *target);
void on_main_window_close(GtkWidget *, main_window *);
gboolean yon_maximize_start(main_window *widgets);
void *yon_maximize(main_window *widgets);
kernel_addon_row *yon_kernel_addon_row_new();
void yon_kernel_addon_row_setup(kernel_addon_row *row, char *name, char *modules, char *package, char *description);
void on_kernel_addon_install_enabled(GtkWidget *, kernel_addon_row *row);
gboolean on_kernel_addon_info(GtkLabel *self, char *, kernel_addon_row *row);
void yon_license_init(main_window *widgets);
void on_locale_toggle(GtkCellRenderer *, gchar *path, language_window *window);
void on_locale_accept(GtkWidget *self, language_window *window);
gboolean yon_locale_window_set_locales(struct locales_struct *data);
gboolean yon_locale_window_unlock(GtkWidget *spinner);
void *yon_locales_load_func(language_window *window);
language_window *yon_language_window_new();
void on_language_open(GtkWidget *, main_window *widgets);
void on_language_remove(GtkWidget *, main_window *widgets);
void on_language_default_toggled(GtkWidget *, int status, main_window *widgets);
void on_locale_toggled(GtkCellRenderer *, gchar *path, main_window *widgets);
void yon_language_update(main_window *widgets);
int yon_language_save(main_window *widgets);
void yon_language_init(main_window *widgets);
void on_layouts_accept(GtkWidget *self, layouts_window *window);
void on_layouts_chosen(GtkCellRenderer *, gchar *path, layouts_window *window);
void on_system_layouts_add(GtkWidget *, main_window *widgets);
layouts_window *yon_layouts_window_new();
void yon_layouts_add(GtkTreeView *, GtkListStore *, main_window *widgets);
void yon_layouts_remove(GtkTreeView *tree, GtkListStore *cur_list, main_window *widgets);
void on_system_layouts_remove(GtkWidget *, main_window *widgets);
config_str yon_layout_get_children(char *layout_id, int *size);
void yon_layout_load(char *layout, main_window *widgets);
void yon_layout_build(layouts_window *window);
void on_layout_move_up(GtkWidget *, main_window *widgets);
void on_layout_move_down(GtkWidget *, main_window *widgets);
void on_layout_default_sensitive_toggled(GtkWidget *, int status, main_window *widgets);
void on_layout_default_toggled(GtkWidget *, int status, main_window *widgets);
void on_layout_selection_changed(GtkTreeView *self, main_window *widgets);
void on_model_changed(GtkComboBoxText *self, main_window *widgets);
void on_options_save(GtkWidget *, main_window *widgets);
void yon_packages_tab_init(main_window *widgets);
void yon_on_packages_selected(GtkWidget *, main_window *widgets);
void yon_on_packages_chosen(GtkWidget *, char *path, main_window *widgets);
void yon_on_packages_activated(GtkWidget *, GtkTreePath *path, GtkTreeViewColumn *, main_window *widgets);
void on_additional_page_clicked(GtkWidget *, main_window *widgets);
void on_kernel_components_page_clicked(GtkWidget *, main_window *widgets);
void on_kernel_page_clicked(GtkWidget *, main_window *widgets);
void on_additional_packages_page_clicked(GtkWidget *, main_window *widgets);
void on_configuration_hub_open(GtkFlowBox *, GtkFlowBoxChild *child, main_window *widgets);
void yon_configuration_hub_add(GtkFlowBox *target, char *name, char *icon, enum YON_PAGES page);
void yon_configuration_hub_init(main_window *widgets);
void yon_flow_box_clear(GtkFlowBox *target);
void yon_configuration_hub_section_get_max_size(GtkFlowBox *target, int *ret_width, int *ret_height);
void yon_configuration_hub_section_set_max_size(GtkFlowBox *target, int width, int height);
void yon_configuration_hub_resize(main_window *widgets);
void on_configuration_hub_selected(GtkWidget *self, main_window *widgets);
gboolean yon_software_insert(struct row_data *row_input);
int yon_configuration_hub_save(main_window *widgets);
int yon_packages_tab_save(main_window *widgets);
gboolean on_install_slider_slide_proceed(main_window *widgets);
gboolean on_install_slider_slide(main_window *widgets);

void on_srartup_apps_toggled(GtkWidget *, char *path, main_window *widgets);
void on_startup_apps_selection_changed(GtkWidget *, main_window *widgets);
void on_startup_apps_remove(GtkWidget *self, main_window *widgets);
void yon_startup_apps_init(main_window *widgets);
void on_startup_app_add_accept(GtkWidget *self, main_window *widgets);
void on_startup_app_edit_accept(GtkWidget *self, main_window *widgets);
startup_service_window *yon_startup_app_window_new();
void on_startup_app_add(GtkWidget *, main_window *widgets);
void on_startup_app_edit(GtkWidget *, main_window *widgets);
int yon_startup_app_save(main_window *widgets);
void yon_on_about(GtkWidget *, main_window *);
void on_gparted_update(GtkWidget *, main_window *widgets);
void yon_menu_open_submenu(yon_menu_window *window, yon_menu_item *item);
yon_menu_item *yon_menu_add_item(yon_menu_window *target_menu, const char *id, const char *name, int children);
void yon_menu_ungrab(yon_menu_window *window);
void on_menu_chosen(GtkWidget *, GtkListBoxRow *row, yon_menu_window *window);
gboolean yon_locale_window_load(language_window *window);
void yon_os_password_open(GtkWidget *, main_window *widgets);
void yon_userdata_password_open(GtkWidget *, main_window *widgets);
double yon_password_check_func(const char *password_string);
char *yon_password_check_error(const char *password_string);
void yon_source_update(source_window *window);
void yon_main_window_update_locale(main_window *widgets);
gboolean yon_progress_bar_start(main_window *widgets);
void *yon_progress_file_buzyfy(void *);
void yon_startup_language_init();
gboolean on_languages_search_func(GtkTreeModel *model, gint col, const char *key, GtkTreeIter *iter, main_window *widgets);
void yon_installer_update_translation(main_window *widgets);
void yon_installer_translation_init(GtkBuilder *builder);
void yon_licence_load(main_window *widgets);
void on_network_removed(GtkWidget *, network_info *info);
char *yon_bootloader_get_os_name(char *parameter);
gboolean on_region_refilter(GtkTreeModel *model, GtkTreeIter *iter, main_window *widgets);
void on_region_entry_changed(GtkWidget *, main_window *widgets);
char *yon_size_get_name_from_letter(char letter);
void yon_map_status_hide(main_window *widgets);
gboolean yon_map_status_hide_timeout(main_window *widgets);
void yon_map_status_show(main_window *widgets, char *icon_name, char *title, char *title_info);
gboolean on_map_box_ckicked_skip();
gboolean on_time_zone_status_hover(GtkWidget *, GdkEvent *, main_window *widgets);
gboolean on_time_zone_status_hover_end(GtkWidget *, GdkEvent *, main_window *widgets);
void yon_map_update(main_window *widgets, const char *timezone);
void on_partition_size_changed(GtkWidget *self, main_window *widgets);
void *yon_partitions_list_load(main_window *widgets);
void *yon_modules_list_load(main_window *widgets);
void yon_size_changed(GtkSpinButton *self, main_window *widgets);
void yon_pacman_software_update_overall_size(main_window *widgets);
int yon_installation_check_packages_size(main_window *widgets);
config_str yon_os_components_get_modules(int *size);
int yon_os_components_check_packages_size(GtkWidget *, main_window *widgets);
void on_pacman_search_enter(GtkEntry *self, main_window *widgets);
gboolean yon_log_scroll(log_window *window);
gboolean on_log_window_exit(GtkWidget *, GdkEvent *, log_window *window);
void yon_modules_missed_func(main_window *widgets);
void yon_scroll_block_for_builder(GtkBuilder *builder);
void yon_advanced_device_choose(main_window *widgets, const char *device);
void yon_advanced_part_choose(main_window *widgets, const char *part);
advanced_part_data *yon_advanced_part_data_new();
char *yon_advanced_part_data_get_parameter(const char *config_param, int pos);
advanced_part_data *yon_advanced_get_config_data(int pos);
void yon_advanced_part_create_for_device(GtkTreeIter *iter, main_window *widgets);
void yon_advanced_part_add_parts_for_device(const char *device_name, main_window *widgets);
void yon_advanced_part_remove_parts_for_device(const char *device_name, main_window *widgets);
void yon_advanced_init(main_window *widgets);
advanced_part_widgets *yon_advanced_part_create(advanced_part_data *part_data);
void on_advanced_virtual_device_changed(GtkWidget *, main_window *widgets);
void on_advanced_part_create(GtkWidget *self, main_window *widgets);
int yon_advanced_part_select_for_data(advanced_part_data *data, main_window *widgets);
int yon_advanced_part_check_count(main_window *widgets);
advanced_part_widgets *yon_advanced_part_get_for_name(const char *part_name, main_window *widgets);
void yon_advanced_part_create_for_part(GtkTreeIter *iter, main_window *widgets);
int yon_advanced_part_get_pos(advanced_part_widgets *part, main_window *widgets);
int yon_advanced_part_get_size(advanced_part_widgets *part, main_window *widgets);
void yon_advanced_part_update_from_data(advanced_part_widgets *part, advanced_part_data *data);
void yon_advanced_part_data_unref(advanced_part_data *data);
void on_advanced_part_content_changed(GtkWidget *, GtkWidget *, main_window *widgets);
gboolean on_keyboard_search_func(GtkTreeModel *model, gint, const char *key, GtkTreeIter *iter, main_window *);
void yon_update_part_sections(main_window *widgets);
void on_advanced_part_toggled(GtkWidget *self);
gboolean yon_advanced_part_save(main_window *widgets);
void yon_advanced_part_clean_config();
void yon_advanced_part_to_data(advanced_part_widgets *part, advanced_part_data *data);
gboolean yon_advanced_part_save_part(advanced_part_data *data);
void yon_advanced_part_remove_for_part(const char *part_name, main_window *widgets);
int yon_software_check_packages_size(GtkWidget *, main_window *widgets);
void yon_user_admin_check(GtkWidget *self, main_window *widgets);
void yon_installer_widget_set_translation(GtkWidget *target);
void on_bootloader_user_edit(GtkWidget *, main_window *widgets);
void on_bootloader_admin_toggled(GtkWidget *, char *path, main_window *widgets);
void on_bootloader_user_remove(GtkWidget *, main_window *widgets);
void on_software_switch_all(GtkWidget *, main_window *widgets);
gboolean on_kernel_enabled_toggled(GtkWidget *self, GdkEventButton *, kernel_row *row);
void on_status_update(GtkWidget *,main_window *widgets);
gboolean on_kernel_addon_menu_block(GObject *self, GdkEventButton *event);
void on_os_components_switch_all(GtkWidget *,main_window *widgets);
gboolean yon_os_components_load(main_window *widgets);
gboolean on_user_autoloin_switch(GtkWidget *, int status, main_window *);
void on_locale_selected(GtkTreeView *self,main_window *widgets);
yon_window *yon_package_info_window_create(const char *package);
info_element *yon_package_info_element_new();
void yon_gtk_label_set_font(GtkLabel *label);
void on_kernel_info(GtkWidget *, char *link, kernel_row *row);
gboolean on_os_components_info(GtkWidget *, GdkEventButton *, os_row *row);
void on_software_info(GtkWidget*, main_window *widgets);
void yon_packages_remove_empty_groups(main_window *widgets);
void yon_config_mode_start(main_window *widgets);
void on_bootloader_selected(GtkTreeView *,main_window *widgets);
void yon_update_page(main_window *widgets);
void *yon_db_update(main_window *widgets);
void on_status_button_update(GtkWidget *, main_window *widgets);
void yon_container_start_loading(GtkWidget *target);
void yon_container_stop_loading(GtkWidget *target);
void yon_status_thread_update_inactive(main_window *widgets);
void yon_status_thread_update_active(main_window *widgets);
void *yon_status_thread_update(main_window *widgets);
void yon_db_lock_update(GFileMonitor *,GFile *,GFile *,GFileMonitorEvent ,main_window *widgets);
void yon_db_unlock_update(GFileMonitor *,GFile *,GFile *,GFileMonitorEvent ,main_window *widgets);
void on_config_install_success(GtkWidget *self, int state, main_window *widgets);
void *on_quick_install_start(void *data);
void on_autoinstall_start(GtkWidget *self, main_window *widgets);
void *on_auto_install_start(void *data);
void yon_gparted_update_unlock(main_window *widgets);
void *yon_devices_list_load(main_window *widgets);
gboolean on_pacman_info(GtkWidget *self, GdkEventButton *event,main_window *widgets);
gboolean on_software_info_event(GtkWidget *self, GdkEventButton *event,main_window *);