From bf7bf26ad66e338b4b7fd0e1bdda222ac489415c Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 2 Jul 2025 18:00:44 +0600 Subject: [PATCH 01/18] WIP code structure changes --- source/CMakeLists.txt | 11 + source/ubinstall-gtk-bootloader.c | 27 + source/ubinstall-gtk-components.c | 91 + source/ubinstall-gtk-grub.c | 49 + source/ubinstall-gtk-installation.c | 220 ++ source/ubinstall-gtk-keyboard.c | 224 ++ source/ubinstall-gtk-network.c | 21 + source/ubinstall-gtk-page-switch.c | 192 ++ source/ubinstall-gtk-region.c | 43 + source/ubinstall-gtk-separate.c | 26 + source/ubinstall-gtk-users.c | 89 + source/ubinstall-gtk.c | 3948 +++++++++------------- source/ubinstall-gtk.h | 238 +- source/ubl-strings.h | 8 +- ubinstall-gtk-advanced-box.glade | 416 +++ ubinstall-gtk-network-box.glade | 300 ++ ubinstall-gtk.css | 7 + ubinstall-gtk.glade | 4698 ++++++++++++++++----------- 18 files changed, 6307 insertions(+), 4301 deletions(-) create mode 100644 source/ubinstall-gtk-bootloader.c create mode 100644 source/ubinstall-gtk-components.c create mode 100644 source/ubinstall-gtk-grub.c create mode 100644 source/ubinstall-gtk-installation.c create mode 100644 source/ubinstall-gtk-keyboard.c create mode 100644 source/ubinstall-gtk-network.c create mode 100644 source/ubinstall-gtk-page-switch.c create mode 100644 source/ubinstall-gtk-region.c create mode 100644 source/ubinstall-gtk-separate.c create mode 100644 source/ubinstall-gtk-users.c create mode 100644 ubinstall-gtk-advanced-box.glade create mode 100644 ubinstall-gtk-network-box.glade diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index a3e0cae..c81cf69 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -105,6 +105,16 @@ endif() set(SOURCE_FILES ubinstall-gtk.c + ubinstall-gtk-page-switch.c + ubinstall-gtk-keyboard.c + ubinstall-gtk-region.c + ubinstall-gtk-bootloader.c + ubinstall-gtk-components.c + ubinstall-gtk-grub.c + ubinstall-gtk-installation.c + ubinstall-gtk-network.c + ubinstall-gtk-separate.c + ubinstall-gtk-users.c ubinstall-gtk.h ubl-strings.h ) @@ -118,6 +128,7 @@ set(LIBRARIES pthread ublsettings ublsettings-gtk3 + ublsettingsui-gtk3 ) diff --git a/source/ubinstall-gtk-bootloader.c b/source/ubinstall-gtk-bootloader.c new file mode 100644 index 0000000..367d126 --- /dev/null +++ b/source/ubinstall-gtk-bootloader.c @@ -0,0 +1,27 @@ +#include "ubinstall-gtk.h" + +int yon_bootloader_save(main_window *widgets){ + if (gtk_switch_get_active(GTK_SWITCH(widgets->BootloadTimerSwitch))){ + // long time = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->BootloadTimerSpin)); + // yon_config_register(,,yon_char_from_long(time)); + } + char *OS = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->BootloadDefaultOSEntry)); + if (strcmp(OS,DEFAULT_BOOTLOAD_MENU_ITEM_LABEL)){ + // yon_config_register(,,OS); + } else { + // yon_config_remove_by_key(); + } + if (gtk_switch_get_active(GTK_SWITCH(widgets->BootloadNoPasswordSwitch))){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->BootloadUsersList); + for_iter(model,&iter){ + int is_admin; + char *username, *password; + gtk_tree_model_get(model,&iter,0,&is_admin,1,&username,2,&password,-1); + // yon_config_register(,,); + } + } else { + // yon_config_remove_by_key(); + } + return 1; +} \ No newline at end of file diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c new file mode 100644 index 0000000..245bd14 --- /dev/null +++ b/source/ubinstall-gtk-components.c @@ -0,0 +1,91 @@ +#include "ubinstall-gtk.h" + +int yon_kernel_save(main_window *widgets){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->KernelsList); + int size = 0; + config_str kernels = NULL; + for_iter(model,&iter){ + char *target; + int status,loaded; + gtk_tree_model_get(model,&iter,0,&status,1,&loaded,2,&target,-1); + if (status){ + yon_char_parsed_add_or_create_if_exists(kernels,&size,target); + } + } + if (!size){ + return 0; + } + return 1; + +} + +int yon_os_components_save(main_window *widgets){ + + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->OSSoftwareList); + int size = 0; + config_str modules = NULL; + for_iter(model,&iter){ + char *target; + int status; + gtk_tree_model_get(model,&iter,0,&status,1,&target,-1); + if (status){ + yon_char_parsed_add_or_create_if_exists(modules,&size,target); + } + } + if (size){ + char *final = yon_char_parsed_to_string(modules,size,","); + yon_config_register(modules_parameter,modules_parameter_command,final); + } else { + yon_config_remove_by_key(modules_parameter); + } + return 1; +} + +int yon_software_save(main_window *widgets){ + + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->AdditionalSoftwareList); + int size = 0; + config_str modules = NULL; + for_iter(model,&iter){ + char *target; + int status; + gtk_tree_model_get(model,&iter,0,&status,1,&target,-1); + if (status){ + yon_char_parsed_add_or_create_if_exists(modules,&size,target); + } + } + if (size){ + char *final = yon_char_parsed_to_string(modules,size,","); + yon_config_register(modules_extra_parameter,modules_extra_parameter_command,final); + } else { + yon_config_remove_by_key(modules_extra_parameter); + } + return 1; +} + +int yon_startup_save(main_window *widgets){ + + + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->StartupList); + int size = 0; + config_str modules = NULL; + for_iter(model,&iter){ + char *target; + int status; + gtk_tree_model_get(model,&iter,0,&status,1,&target,-1); + if (status){ + yon_char_parsed_add_or_create_if_exists(modules,&size,target); + } + } + if (size){ + // char *final = yon_char_parsed_to_string(modules,size,","); + // yon_config_register(modules_extra_parameter,modules_extra_parameter_command,final); + } else { + // yon_config_remove_by_key(modules_extra_parameter); + } + return 1; +} \ No newline at end of file diff --git a/source/ubinstall-gtk-grub.c b/source/ubinstall-gtk-grub.c new file mode 100644 index 0000000..ea8b0fa --- /dev/null +++ b/source/ubinstall-gtk-grub.c @@ -0,0 +1,49 @@ +#include "ubinstall-gtk.h" + +int yon_grub_install_save(main_window *widgets){ + GtkTreeIter iter; + GtkTreeModel *model; + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GrubInstallDevicesTree)),&model,&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->GrubInstallDevicesTree)); + return 0; + } + char *cur_device; + gtk_tree_model_get(model,&iter,0,&cur_device,-1); + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GrubInstallPartitionTree)),&model,&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->GrubInstallPartitionTree)); + return 0; + } + char *partition; + gtk_tree_model_get(model,&iter,0,&partition,-1); + yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,cur_device); + yon_config_register(part_parameter,part_parameter_command,partition); + yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"grub_install"); + yon_config_remove_by_key(part_parameter); + return 1; +} + +int yon_grub_update_save(main_window *widgets){ + GtkTreeIter iter; + GtkTreeModel *model; + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GrubUpdateDevicesTree)),&model,&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->GrubUpdateDevicesTree)); + return 0; + } + char *cur_device; + gtk_tree_model_get(model,&iter,0,&cur_device,-1); + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GrubUpdatePartitionTree)),&model,&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->GrubUpdatePartitionTree)); + return 0; + } + char *partition; + gtk_tree_model_get(model,&iter,0,&partition,-1); + yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,cur_device); + yon_config_register(part_parameter,part_parameter_command,partition); + yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"grub_update"); + yon_config_remove_by_key(part_parameter); + return 1; +} \ No newline at end of file diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c new file mode 100644 index 0000000..6f2c073 --- /dev/null +++ b/source/ubinstall-gtk-installation.c @@ -0,0 +1,220 @@ +#include "ubinstall-gtk.h" + +int yon_install_common_save(main_window *widgets){ + GtkTreeModel *model; + GtkTreeIter iter; + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->CommonInstallationDevicesTree)),&model,&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->CommonInstallationDevicesTree)); + return 0; + } + char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->CommonInstallationFilesystemTypeCombo)); + char *device_name = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->CommonInstallationSectionNameEntry)); + char *device; + yon_config_remove_by_key(part_size_parameter); + yon_config_remove_by_key(part_parameter); + gtk_tree_model_get(model,&iter,0,&device,-1); + yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"fast"); + yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,device); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->CommonSectionSensitiveCheck))){ + yon_config_register(device_label_parameter,device_label_parameter_command,device_name); + } else { + yon_config_remove_by_key(device_label_parameter); + } + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->CommonFilesystemSensitiveCheck))){ + yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type); + } else { + yon_config_remove_by_key(part_type_parameter); + } + return 1; +} + +int yon_install_separate_save(main_window *widgets){ + GtkTreeModel *model; + GtkTreeIter iter; + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->InstallationNearSysDevicesTree)),&model,&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->CommonInstallationDevicesTree)); + return 0; + } + char *device; + gtk_tree_model_get(model,&iter,0,&device,-1); + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->InstallationNearSysSectionTree)),&model,&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->CommonInstallationDevicesTree)); + return 0; + } + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextSizeSensitiveCheck))){ + double part_size = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)); + if (part_size){ + char *size_letter = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin)); + char *size_final = yon_char_append(yon_char_from_long((long)part_size),size_letter); + yon_config_register(part_size_parameter,part_size_parameter_command,size_final); + } else yon_config_remove_by_key(part_size_parameter); + } else yon_config_remove_by_key(part_size_parameter); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextLabelSensitiveCheck))){ + char *device_name = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry)); + yon_config_register(device_label_parameter,device_label_parameter_command,device_name); + } else { + yon_config_remove_by_key(device_label_parameter); + } + char *part; + gtk_tree_model_get(model,&iter,0,&part,-1); + yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"next"); + yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,device); + yon_config_register(part_parameter,part_parameter_command,part); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextFSTypeSensitiveCheck))){ + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck))){ + yon_config_register(device_format_parameter,device_format_parameter_command,"no"); + yon_config_remove_by_key(part_type_parameter); + } else { + char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->NextInstallationFilesystemTypeCombo)); + yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type); + yon_config_remove_by_key(device_format_parameter); + } + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck))) + yon_config_register(device_format_parameter,device_format_parameter_command,"no"); + } else { + yon_config_remove_by_key(part_type_parameter); + yon_config_remove_by_key(device_format_parameter); + } + return 1; +} + +int yon_install_same_partition_save(main_window *widgets){ + GtkTreeModel *model; + GtkTreeIter iter; + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SamePlaceDeviceTree)),&model,&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->CommonInstallationDevicesTree)); + return 0; + } + char *device; + gtk_tree_model_get(model,&iter,0,&device,-1); + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SamePlacePartTree)),&model,&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->CommonInstallationDevicesTree)); + return 0; + } + yon_config_remove_by_key(part_size_parameter); + char *part; + gtk_tree_model_get(model,&iter,0,&part,-1); + yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"part"); + yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,device); + yon_config_register(part_parameter,part_parameter_command,part); + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->SameLabelSensitiveCheck))){ + char *device_name = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry)); + yon_config_register(device_label_parameter,device_label_parameter_command,device_name); + } else { + yon_config_remove_by_key(device_label_parameter); + } + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->SameFSTypeSensitiveCheck))){ + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->SameInstallationFormatCheck))){ + yon_config_register(device_format_parameter,device_format_parameter_command,"no"); + yon_config_remove_by_key(part_type_parameter); + } else { + char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->SameInstallationFilesystemTypeCombo)); + yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type); + yon_config_remove_by_key(device_format_parameter); + } + } else { + yon_config_remove_by_key(device_format_parameter); + yon_config_remove_by_key(part_type_parameter); + + } + return 1; +} + +int yon_advanced_sections_save(dictionary *dict){ + if (!dict) return 0; + advanced_section *first_section = yon_dictionary_get_data(dict->first,advanced_section*); + advanced_section *last_section = NULL; + if (dict->first->next){ + last_section = yon_dictionary_get_data(dict->first->next,advanced_section*); + } + + char *part_first = first_section->part; + char *part_last = last_section?last_section->part:NULL; + char *part = yon_char_unite(part_first,last_section?",":NULL,part_last,NULL); + yon_config_register(part_parameter,part_parameter_command,part); + + char * format_first = gtk_switch_get_active(GTK_SWITCH(first_section->FormatSwitch))?"yes":"no"; + char * format_last = last_section?gtk_switch_get_active(GTK_SWITCH(last_section->FormatSwitch))?"yes":"no":NULL; + char *format = yon_char_unite(format_first,part_last?",":NULL,format_last,NULL); + yon_config_register(part_format_parameter,part_format_parameter_command,format); + + if (!yon_char_is_empty(format)){ + char *size_first = g_strdup_printf("%d%s",gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(first_section->SizeSpin)),yon_size_get_mod(gtk_combo_box_get_active(GTK_COMBO_BOX(first_section->SizeCombo)))); + char *size_last = last_section&&!strcmp(format_last,"yes")?g_strdup_printf("%d%s",gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(last_section->SizeSpin)),yon_size_get_mod(gtk_combo_box_get_active(GTK_COMBO_BOX(last_section->SizeCombo)))):NULL; + char *size = yon_char_unite(size_first,size_last?",":NULL,size_last,NULL); + yon_config_register(part_size_parameter,part_size_parameter_command,size); + + char *device_label_first = gtk_entry_get_text(GTK_ENTRY(first_section->SectionMarkEntry)); + char *device_label_last = last_section&&!strcmp(format_last,"yes")?gtk_entry_get_text(GTK_ENTRY(last_section->SectionMarkEntry)):NULL; + char *device_label = yon_char_unite(device_label_first,device_label_last?",":NULL,device_label_last,NULL); + yon_config_register(device_label_parameter,device_label_parameter_command,device_label); + + char *fs_label_first = gtk_entry_get_text(GTK_ENTRY(first_section->FileSystemMarkentry)); + char *fs_label_last = last_section&&!strcmp(format_last,"yes")?gtk_entry_get_text(GTK_ENTRY(last_section->FileSystemMarkentry)):NULL; + char *fs_label = yon_char_unite(fs_label_first,fs_label_last?",":NULL,fs_label_last,NULL); + yon_config_register(part_fs_label_parameter,part_fs_label_parameter_command,fs_label); + + char *fs_type_first = gtk_combo_box_get_active_id(GTK_COMBO_BOX(first_section->FileSystemTypeCombo)); + char *fs_type_last = last_section&&!strcmp(format_last,"yes")?gtk_combo_box_get_active_id(GTK_COMBO_BOX(last_section->FileSystemTypeCombo)):NULL; + char *fs_type = yon_char_unite(fs_type_first,fs_type_last?",":NULL,fs_type_last,NULL); + yon_config_register(part_type_parameter,part_type_parameter_command,fs_type); + + char *part_crypt_first = gtk_combo_box_get_active(first_section->EncryptionCombo)?gtk_entry_get_text(GTK_ENTRY(first_section->EncryptionEntry)):NULL; + char *part_crypt_last = last_section&&!strcmp(format_last,"yes")&>k_combo_box_get_active(last_section->EncryptionCombo)?gtk_entry_get_text(GTK_ENTRY(first_section->EncryptionEntry)):NULL; + char *part_crypt = NULL; + if (part_crypt_first||part_crypt_last){ + part_crypt = yon_char_unite(part_crypt_first,part_crypt_last?",":NULL,part_crypt_last,NULL); + } + if (part_crypt){ + yon_config_register(part_crypt_parameter,part_crypt_parameter_command,part_crypt); + } else { + yon_config_remove_by_key(part_crypt_parameter); + } + } + return 1; +} + +int yon_install_advanced_save(main_window *widgets){ + + GtkTreeModel *model; + GtkTreeIter iter; + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->AdvancedDeviceTree)),&model,&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->AdvancedDeviceTree)); + return 0; + } + char *device; + gtk_tree_model_get(model,&iter,0,&device,-1); + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->AdvancedPartitionTree)),&model,&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->AdvancedPartitionTree)); + return 0; + } + yon_config_remove_by_key(part_size_parameter); + char *part; + gtk_tree_model_get(model,&iter,0,&part,-1); + + yon_advanced_section_get_string(widgets->advanced_sections); + + if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapSwitch))){ + if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapAutoSwitch))){ + yon_config_register(swap_parameter,swap_parameter_command,"auto"); + } else if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapRamSwitch))){ + yon_config_register(swap_parameter,swap_parameter_command,"yes"); + yon_config_register(swap_size_parameter,swap_size_parameter_command,"ram"); + } else { + yon_config_register(swap_parameter,swap_parameter_command,"yes"); + char *swap = g_strdup_printf("%d%s",gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->AdvancedSwapFixedSpin)),yon_size_get_mod(gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->AdvancedSwapFixedSizeSwitch))+1)); + yon_config_register(swap_size_parameter,swap_size_parameter_command,swap); + } + } + + return 1; +} \ No newline at end of file diff --git a/source/ubinstall-gtk-keyboard.c b/source/ubinstall-gtk-keyboard.c new file mode 100644 index 0000000..b83ea1e --- /dev/null +++ b/source/ubinstall-gtk-keyboard.c @@ -0,0 +1,224 @@ +#include "ubinstall-gtk.h" + +int yon_keyboard_save(main_window *widgets){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio))){ + GtkTreeIter iter; + if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->LayoutList),&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),LAYOUTS_CHOSEN_BUT_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(widgets->ManualLayoutRadio); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->LayoutTree)); + return 0; + } + } + char *layouts_list=""; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio))&>k_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LayoutSensitiveCheck))){ + GtkTreeModel *layouts_model=GTK_TREE_MODEL(widgets->LayoutList); + GtkTreeIter iter; + char *cur_layout=NULL; + for_iter(layouts_model,&iter){ + int chosen=0; + gtk_tree_model_get(layouts_model,&iter,0,&cur_layout,3,&chosen,-1); + if (chosen) + layouts_list = yon_char_unite(layouts_list,yon_char_is_empty(layouts_list)?"":",",cur_layout,NULL); + } + } + + if (yon_char_is_empty(layouts_list)&>k_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LayoutSensitiveCheck))) + yon_config_register(xkblayout_parameter,xkblayout_parameter_command,layouts_list); + else + yon_config_remove_by_key(xkblayout_parameter); + + if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo))&>k_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->KeyboardModelSensitiveCheck))){ + char *model = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo)); + if (!yon_char_is_empty(model)) + yon_config_register(xkbmodel_parameter,xkbmodel_parameter_command,model); + } else{ + yon_config_remove_by_key(xkbmodel_parameter); + } + + if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->LayoutBindingCombo))&>k_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->OptionsSensitiveCheck))){ + char *options = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->LayoutBindingCombo)); + if (options){}; + yon_config_register(xkboptions_parameter,xkboptions_parameter_command,options); + } else { + yon_config_remove_by_key(xkboptions_parameter); + } + return 1; +} + +ubinstall_keyboard_window *yon_ubinstall_keyboard_new(){ +void on_additional_software_toggled(); + ubinstall_keyboard_window *window = malloc(sizeof(ubinstall_keyboard_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubinstall_keyboard); + window->MainWindow=yon_gtk_builder_get_widget(builder,"MainWindow"); + window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); + window->headerBar=yon_gtk_builder_get_widget(builder,"headerBar"); + window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton"); + window->SaveButton=yon_gtk_builder_get_widget(builder,"SaveButton"); + window->LayoutsTree=yon_gtk_builder_get_widget(builder,"LayoutsTree"); + window->ActiveToggle = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ActiveToggle")); + + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + +return window; +} + +void on_keyboard_removed(GtkWidget *, main_window *widgets){ + GtkTreeModel *model; + GtkTreeIter iter, childiter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->LayoutTree)),&model,&iter)){ + gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),&childiter,&iter); + gtk_tree_store_set(widgets->LayoutList,&childiter,3,0,-1); + } +} + +void yon_language_selection_changed(GtkCellRenderer *, char *path, ubinstall_language_window *window){ + GtkTreeIter iter; + int state; + + if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->liststore1),&iter,path)){ + gtk_tree_model_get(GTK_TREE_MODEL(window->liststore1),&iter,0,&state,-1); + gtk_list_store_set(window->liststore1,&iter,0,!state,-1); + } +} + +void on_language_window_accept(GtkWidget *,dictionary *dict){ + main_window *widgets= yon_dictionary_get_data(dict->first,main_window*); + ubinstall_language_window *window = yon_dictionary_get_data(dict->first->next,ubinstall_language_window*); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultCheck))){ + gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); + GtkTreeIter iter; + int size; + config_str lang_parsed = default_langs(&size); + + char *final = ""; + for_iter(widgets->LanguagesList,&iter){ + char *code, *labl; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,1,&labl,2,&code,-1); + if (yon_char_parsed_check_exist(lang_parsed,size,code)!=-1){ + gtk_list_store_set(widgets->LanguagesList,&iter,0,1,-1); + char *tmp = yon_char_unite(final,!yon_char_is_empty(final)?";":"",labl,NULL); + if (!yon_char_is_empty(final)) free(final); + final = tmp; + } else + gtk_list_store_set(widgets->LanguagesList,&iter,0,0,-1); + } + if (!yon_char_is_empty(final)){ + gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),final); + } + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguagesCombo),-1); + gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); + } else { + yon_gtk_list_store_copy_full(widgets->LanguagesList,window->liststore1); + gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); + config_str parsed = NULL; + int size; + GtkTreeIter iter; + for_iter(GTK_TREE_MODEL(window->liststore1),&iter){ + char *current; + int status; + gtk_tree_model_get(GTK_TREE_MODEL(window->liststore1),&iter,0,&status,1,¤t,-1); + if (status) + yon_char_parsed_add_or_create_if_exists(parsed,&size,current); + } + if (parsed){ + char *final = yon_char_parsed_to_string(parsed,size,"; "); + gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),!yon_char_is_empty(final)?final:""); + if (yon_char_is_empty(final)) { + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguagesCombo),-1); + } + if (final) free(final); + yon_char_parsed_free(parsed,size); + } else + gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); + + } + on_subwindow_close(window->MainWindow); + free(window); +} + +ubinstall_language_window *yon_ubinstall_language_new(){ + ubinstall_language_window *window = malloc(sizeof(ubinstall_language_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubinstall_language); + window->liststore1=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1")); + window->MainWindow=yon_gtk_builder_get_widget(builder,"MainWindow"); + window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); + window->DefaultCheck=yon_gtk_builder_get_widget(builder,"DefaultCheck"); + window->LanguagesTree=yon_gtk_builder_get_widget(builder,"LanguagesTree"); + window->headerBar=yon_gtk_builder_get_widget(builder,"headerBar"); + window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton"); + window->SaveButton=yon_gtk_builder_get_widget(builder,"SaveButton"); + window->ToggleRenderer=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ToggleRenderer")); + + g_signal_connect(G_OBJECT(window->DefaultCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->LanguagesTree); + g_signal_connect(G_OBJECT(window->ToggleRenderer),"toggled",G_CALLBACK(yon_language_selection_changed),window); + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); +return window; +} + +void on_language_clicked(GtkWidget *, main_window *widgets){ + ubinstall_language_window *window = yon_ubinstall_language_new(); + g_object_ref(G_OBJECT(window->liststore1)); + gtk_tree_view_set_model(GTK_TREE_VIEW(window->LanguagesTree),NULL); + yon_gtk_list_store_copy_full(window->liststore1,widgets->LanguagesList); + gtk_tree_view_set_model(GTK_TREE_VIEW(window->LanguagesTree),GTK_TREE_MODEL(window->liststore1)); + yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->MainWindow),TITLE_LABEL,icon_path,"language-chooser-window"); + + if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->AvailableLanguagesEntry)))){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DefaultCheck),1); + } + + int size; + int found=0; + int statusfound=0; + config_str langs = default_langs(&size); + GtkTreeIter iter; + for_iter(widgets->LanguagesList,&iter){ + char *cur; + int status; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,0,&status,2,&cur,-1); + if (status){ + statusfound++; + if (yon_char_parsed_check_exist(langs,size,cur)>-1) + found++; + } + } + if ((found==size)&&statusfound==size){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DefaultCheck),1); + } + + dictionary *dict=NULL; + yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); + yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); + g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_language_window_accept),dict); + gtk_widget_show(window->MainWindow); + +} + + +void on_layout_toggle(GtkCellRendererToggle*, gchar* path, ubinstall_keyboard_window *window){ + GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(window->LayoutsTree)); + GtkTreeIter iter; + if (gtk_tree_model_get_iter_from_string(model,&iter,path)){ + int status=0; + gtk_tree_model_get(model,&iter,3,&status,-1); + gtk_tree_store_set(GTK_TREE_STORE(model),&iter,3,!status,-1); + } +} + + +void on_keyboard_accept(GtkWidget *self,main_window *widgets){ + gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter)); + on_subwindow_close(self); +} + + +void on_keyboard_clicked (GtkWidget *, main_window *widgets){ + ubinstall_keyboard_window *window = yon_ubinstall_keyboard_new(); + yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->MainWindow),KEYBOARD_TITLE_LABEL,icon_path,"keyboard-window"); + gtk_tree_view_set_model(GTK_TREE_VIEW(window->LayoutsTree),GTK_TREE_MODEL(widgets->LayoutList)); + + g_signal_connect(G_OBJECT(window->ActiveToggle),"toggled",G_CALLBACK(on_layout_toggle),window); + g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_keyboard_accept),widgets); + gtk_widget_show(window->MainWindow); +} \ No newline at end of file diff --git a/source/ubinstall-gtk-network.c b/source/ubinstall-gtk-network.c new file mode 100644 index 0000000..6df7f1f --- /dev/null +++ b/source/ubinstall-gtk-network.c @@ -0,0 +1,21 @@ +#include "ubinstall-gtk.h" + +network_info *yon_network_info_new(){ + network_info *info = new(network_info); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_network_info); + info->MainBox = yon_gtk_builder_get_widget(builder,"MainBox"); + info->TypeCombo = yon_gtk_builder_get_widget(builder,"TypeCombo"); + info->ConnectionCombo = yon_gtk_builder_get_widget(builder,"ConnectionCombo"); + info->EnabledSwitch = yon_gtk_builder_get_widget(builder,"EnabledSwitch"); + info->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton"); + info->AutoGetIPSwitch = yon_gtk_builder_get_widget(builder,"AutoGetIPSwitch"); + info->IpAdressEntry = yon_gtk_builder_get_widget(builder,"IpAdressEntry"); + info->GatewayEntry = yon_gtk_builder_get_widget(builder,"GatewayEntry"); + info->MaskEntry = yon_gtk_builder_get_widget(builder,"MaskEntry"); + info->DNSEntry = yon_gtk_builder_get_widget(builder,"DNSEntry"); + + g_object_set_data(G_OBJECT(info->RemoveButton),"network_info",info); + g_object_set_data(G_OBJECT(info->MainBox),"network_info",info); + + return info; +} \ No newline at end of file diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c new file mode 100644 index 0000000..102f13f --- /dev/null +++ b/source/ubinstall-gtk-page-switch.c @@ -0,0 +1,192 @@ +#include "ubinstall-gtk.h" + +enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ + switch (page){ + case YON_PAGE_WELCOME: return YON_PAGE_LICENCE; break; + case YON_PAGE_LICENCE: return YON_PAGE_SECTIONS; break; + case YON_PAGE_SECTIONS: return yon_sections_get_next_page(widgets); break; + case YON_PAGE_OS_COMPONENTS: return YON_PAGE_INSTALLATION_BEGIN; break; + case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_KERNEL; break; + case YON_PAGE_KERNEL: return YON_PAGE_SOFTWARE; break; + case YON_PAGE_SOFTWARE: return YON_PAGE_REGION; break; + case YON_PAGE_REGION: return YON_PAGE_KEYBOARD; break; + case YON_PAGE_KEYBOARD: return YON_PAGE_USERS; break; + case YON_PAGE_USERS: return YON_PAGE_STARTUP; break; + case YON_PAGE_STARTUP: return YON_PAGE_BOOTLOADER; break; + case YON_PAGE_BOOTLOADER: return YON_PAGE_NETWORK; break; + case YON_PAGE_NETWORK: return YON_PAGE_INSTALLATION; break; + case YON_PAGE_INSTALL_COMMON: return YON_PAGE_KERNEL; break; + case YON_PAGE_INSTALL_SEPARATE: return YON_PAGE_KERNEL; break; + case YON_PAGE_INSTALL_SAME_PARTITION: return YON_PAGE_KERNEL; break; + case YON_PAGE_INSTALL_ADVANCED: return YON_PAGE_KERNEL; break; + case YON_PAGE_INSTALL_RECOVERY: return yon_recovery_get_next(widgets); break; + case YON_PAGE_RECOVERY_GRUB_INSTALL: return YON_PAGE_INSTALLATION; break; + case YON_PAGE_RECOVERY_GRUB_UPDATE: return YON_PAGE_INSTALLATION; break; + case YON_PAGE_RECOVERY_OS_ONLY: return YON_PAGE_INSTALLATION; break; + case YON_PAGE_RECOVERY_USRDATA_ONLY: return YON_PAGE_INSTALLATION; break; + default:return YON_PAGE_WELCOME; + } + return YON_PAGE_WELCOME; +} + +enum YON_PAGES yon_page_get_prev(enum YON_PAGES page){ + switch (page){ + case YON_PAGE_WELCOME: return YON_PAGE_WELCOME; break; + case YON_PAGE_LICENCE: return YON_PAGE_WELCOME; break; + case YON_PAGE_SECTIONS: return YON_PAGE_LICENCE; break; + case YON_PAGE_OS_COMPONENTS: return YON_PAGE_SECTIONS; break; + case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_SECTIONS; break; + case YON_PAGE_KERNEL: return YON_PAGE_SECTIONS; break; + case YON_PAGE_SOFTWARE: return YON_PAGE_KERNEL; break; + case YON_PAGE_REGION: return YON_PAGE_SOFTWARE; break; + case YON_PAGE_KEYBOARD: return YON_PAGE_REGION; break; + case YON_PAGE_USERS: return YON_PAGE_KEYBOARD; break; + case YON_PAGE_STARTUP: return YON_PAGE_USERS; break; + case YON_PAGE_BOOTLOADER: return YON_PAGE_STARTUP; break; + case YON_PAGE_NETWORK: return YON_PAGE_BOOTLOADER; break; + case YON_PAGE_INSTALLATION: return YON_PAGE_INSTALLATION; break; + case YON_PAGE_CONFIGURE_END: return YON_PAGE_CONFIGURE_END; break; + case YON_PAGE_INSTALL_COMMON: return YON_PAGE_SECTIONS; break; + case YON_PAGE_INSTALL_SEPARATE: return YON_PAGE_SECTIONS; break; + case YON_PAGE_INSTALL_SAME_PARTITION: return YON_PAGE_SECTIONS; break; + case YON_PAGE_INSTALL_ADVANCED: return YON_PAGE_SECTIONS; break; + case YON_PAGE_INSTALL_RECOVERY: return YON_PAGE_SECTIONS; break; + case YON_PAGE_RECOVERY_GRUB_INSTALL: return YON_PAGE_INSTALL_RECOVERY; break; + case YON_PAGE_RECOVERY_GRUB_UPDATE: return YON_PAGE_INSTALL_RECOVERY; break; + case YON_PAGE_RECOVERY_OS_ONLY: return YON_PAGE_INSTALL_RECOVERY; break; + case YON_PAGE_RECOVERY_USRDATA_ONLY: return YON_PAGE_INSTALL_RECOVERY; break; + default:return YON_PAGE_WELCOME; + } + return YON_PAGE_WELCOME; +} + +enum YON_PAGES yon_page_get_current(GtkNotebook *target){ + enum YON_PAGES page = gtk_notebook_get_current_page(target); + return page; +} + +void yon_navigation_buttons_set_sensetiveness(main_window *widgets){ + enum YON_PAGES page = yon_page_get_current(GTK_NOTEBOOK(widgets->Notebook)); + + switch(page){ + case YON_PAGE_WELCOME: + gtk_widget_hide(widgets->BackButton); + gtk_widget_set_sensitive(widgets->NextButton,1); + break; + case YON_PAGE_LICENCE: + gtk_widget_show(widgets->BackButton); + gtk_widget_set_sensitive(widgets->BackButton,1); + gtk_widget_set_sensitive(widgets->NextButton,1); + gtk_widget_set_sensitive(widgets->CancelInstallButton,1); + break; + case YON_PAGE_INSTALLATION: + gtk_widget_set_sensitive(widgets->NextButton,0); + gtk_widget_set_sensitive(widgets->BackButton,0); + break; + case YON_PAGE_KERNEL: + gtk_widget_set_sensitive(widgets->BackButton,0); + break; + case YON_PAGE_COMPLETED: + case YON_PAGE_INSTALL_ERROR: + case YON_PAGE_CONFIGURE_SAVE: + case YON_PAGE_CONFIGURE_END: + case YON_PAGE_COMPLETION: + gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL); + gtk_widget_set_sensitive(widgets->BackButton,0); + break; + default: + gtk_widget_set_sensitive(widgets->BackButton,1); + gtk_widget_set_sensitive(widgets->NextButton,1); + gtk_widget_set_sensitive(widgets->CancelInstallButton,1); + break; + } +} + +int yon_page_save(main_window *widgets, enum YON_PAGES page){ + switch (page){ + case YON_PAGE_OS_COMPONENTS: + return yon_os_components_save(widgets); + break; + case YON_PAGE_KERNEL: + return yon_kernel_save(widgets); + break; + case YON_PAGE_SOFTWARE: + return yon_software_save(widgets); + break; + case YON_PAGE_REGION: + return yon_region_save(widgets); + break; + case YON_PAGE_KEYBOARD: + return yon_keyboard_save(widgets); + break; + case YON_PAGE_USERS: + return yon_users_save(widgets); + break; + case YON_PAGE_STARTUP: + return yon_startup_save(widgets); + break; + case YON_PAGE_BOOTLOADER: + return yon_bootloader_save(widgets); + break; + case YON_PAGE_NETWORK: + // return yon_network_save(widgets); + break; + case YON_PAGE_INSTALL_COMMON: + return yon_install_common_save(widgets); + break; + case YON_PAGE_INSTALL_SEPARATE: + return yon_install_separate_save(widgets); + break; + case YON_PAGE_INSTALL_SAME_PARTITION: + return yon_install_same_partition_save(widgets); + break; + case YON_PAGE_INSTALL_ADVANCED: + return yon_install_advanced_save(widgets); + break; + case YON_PAGE_RECOVERY_GRUB_INSTALL: + return yon_grub_install_save(widgets); + break; + case YON_PAGE_RECOVERY_GRUB_UPDATE: + return yon_grub_update_save(widgets); + break; + case YON_PAGE_RECOVERY_OS_ONLY: + return yon_install_options_save(widgets->OSDevicesTree,widgets->OSSysSectionTree,"system_only",widgets); + break; + case YON_PAGE_RECOVERY_USRDATA_ONLY: + return yon_install_options_save(widgets->UserdataDevicesTree,widgets->UserdataSysSectionTree,"data_only",widgets); + break; + default:return 1; + } + return 1; +} + +void yon_page_update(main_window *widgets){ + yon_navigation_buttons_set_sensetiveness(widgets); + yon_switch_page_render(widgets); +} + +enum YON_PAGES yon_sections_get_next_page(main_window *widgets){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->InstallationRadio))) + return YON_PAGE_INSTALL_COMMON; + else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->InstallationNearRadio))) + return YON_PAGE_INSTALL_SEPARATE; + else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->InstallationLinuxRadio))) + return YON_PAGE_INSTALL_SAME_PARTITION; + else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio))) + return YON_PAGE_INSTALL_ADVANCED; + else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->InstallationOptionsRadio))) + return YON_PAGE_INSTALL_RECOVERY; + return YON_PAGE_SECTIONS; +} + +enum YON_PAGES yon_recovery_get_next(main_window *widgets){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->GrubInstallRadio))) + return YON_PAGE_RECOVERY_GRUB_INSTALL; + else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->GrubUpdateRadio))) + return YON_PAGE_RECOVERY_GRUB_UPDATE; + else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->OSRadio))) + return YON_PAGE_RECOVERY_OS_ONLY; + else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UserDataOnlyRadio))) + return YON_PAGE_RECOVERY_USRDATA_ONLY; + return YON_PAGE_SECTIONS; +} \ No newline at end of file diff --git a/source/ubinstall-gtk-region.c b/source/ubinstall-gtk-region.c new file mode 100644 index 0000000..80439cb --- /dev/null +++ b/source/ubinstall-gtk-region.c @@ -0,0 +1,43 @@ +#include "ubinstall-gtk.h" + +int yon_region_save(main_window *widgets){ + if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->RegionCombo))==-1){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),REGION_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(widgets->RegionCombo); + return 0; + } else if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->ZoneCombo))==-1){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),ZONE_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(widgets->ZoneCombo); + return 0; + } + char *languages = ""; + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->LanguagesFilter); + char *lang_code=NULL; + for_iter(model,&iter){ + gtk_tree_model_get(model,&iter,2,&lang_code,-1); + languages = yon_char_unite(languages,!yon_char_is_empty(languages)?",":"",lang_code,NULL); + } + if (yon_char_is_empty(languages)||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->MainLanguageSensitiveCheck))){ + yon_config_remove_by_key(locale_parameter); + } else { + yon_config_register(locale_parameter,locale_parameter_command,languages); + free(languages); + } + if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->LanguagesCombo))==-1||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck))){ + yon_config_remove_by_key(lang_parameter); + } else { + char *language = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->LanguagesCombo)); + yon_config_register(lang_parameter,lang_parameter_command,language); + } + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck))){ + char *region = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->RegionCombo)); + char *zone = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->ZoneCombo)); + yon_debug_output("%s",region); + yon_debug_output("/%s\n\n",zone); + yon_config_register(zone_parameter,zone_parameter_command,yon_char_unite(region,"/",zone,NULL)); + } else { + yon_config_remove_by_key(zone_parameter); + } + return 1; +} \ No newline at end of file diff --git a/source/ubinstall-gtk-separate.c b/source/ubinstall-gtk-separate.c new file mode 100644 index 0000000..61a7a64 --- /dev/null +++ b/source/ubinstall-gtk-separate.c @@ -0,0 +1,26 @@ +#include "ubinstall-gtk.h" + +int yon_install_options_save(GtkWidget *device_tree, GtkWidget *part_tree,char *mode,main_window *widgets){ + GtkTreeIter iter,itar; + GtkTreeModel *model,*model2; + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(device_tree)),&model,&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(device_tree)); + return 0; + } + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(part_tree)),&model2,&itar)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(part_tree)); + return 0; + } + char *cur_device, *cur_section; + gtk_tree_model_get(model,&iter,0,&cur_device,-1); + gtk_tree_model_get(model2,&itar,0,&cur_section,-1); + yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,cur_device); + yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,mode); + yon_config_register(part_parameter,part_parameter_command,cur_section); + + if(cur_section) free(cur_section); + if(cur_device) free(cur_device); + return 1; +} \ No newline at end of file diff --git a/source/ubinstall-gtk-users.c b/source/ubinstall-gtk-users.c new file mode 100644 index 0000000..14d4d3a --- /dev/null +++ b/source/ubinstall-gtk-users.c @@ -0,0 +1,89 @@ +#include "ubinstall-gtk.h" + +int yon_users_save(main_window *widgets){ + if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UsernameSensitiveCheck))){ + yon_config_remove_by_key(user_gecos_parameter); + } else { + char *username = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry)); + if (username){}; + yon_config_register(user_gecos_parameter,user_gecos_parameter_command,username); + } + + if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck))){ + yon_config_remove_by_key(user_name_parameter); + } else { + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck))){ + yon_config_register(user_name_parameter,user_name_parameter_command,"root"); + } else { + char *login = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)); + if (login){}; + yon_config_register(user_name_parameter,user_name_parameter_command,login); + } + } + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->PasswordSensitiveCheck))){ + if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->PasswordCombo))==1){ + if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->PasswordEntry)))){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(widgets->PasswordEntry); + return 0; + } else { + char *password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->PasswordEntry)); + if (password){}; + + yon_config_register(user_password_parameter,user_password_parameter_command,password); + + } + } else { + yon_config_remove_by_key(user_password_parameter); + } + }else { + yon_config_remove_by_key(user_password_parameter); + + } + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->RootPasswordSensitiveCheck))){ + if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo))==1){ + if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->AdminPasswordEntry)))){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(widgets->AdminPasswordEntry); + return 0; + } else { + char *root_password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->AdminPasswordEntry)); + if (root_password){}; + yon_config_register(root_password_parameter,root_password_parameter_command,root_password); + + } + } else { + yon_config_remove_by_key(root_password_parameter); + } + } else { + yon_config_remove_by_key(root_password_parameter); + } + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck))){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ + yon_config_register(hostname_parameter,hostname_parameter_command,"auto"); + } else { + if (!yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->HotnameEntry)))){ + char *hostname = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->HotnameEntry)); + if (hostname){}; + yon_config_register(hostname_parameter,hostname_parameter_command,hostname); + + } else { + yon_config_remove_by_key(hostname_parameter); + + } + } + } else { + yon_config_remove_by_key(hostname_parameter); + } + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutologinSensitiveCheck))){ + char *autologin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck))?"yes":"no"; + yon_config_register(autologin_parameter,autologin_parameter_command,autologin); + } else { + yon_config_remove_by_key(autologin_parameter); + } + return 1; +} \ No newline at end of file diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 0d43cb0..97f7898 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -2,2275 +2,1432 @@ config main_config; -//functions - -void on_layout_toggle_button_switch(GtkWidget *self, main_window *widgets){ - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self))){ - gtk_widget_set_sensitive(widgets->DefaultLayoutRadio,1); - gtk_widget_set_sensitive(widgets->ManualLayoutRadio,1); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio))){ - gtk_widget_set_sensitive(widgets->LayoutTree,1); - gtk_widget_set_sensitive(widgets->AddButton,1); - gtk_widget_set_sensitive(widgets->RemoveButton,1); - } else { - gtk_widget_set_sensitive(widgets->LayoutTree,0); - gtk_widget_set_sensitive(widgets->AddButton,0); - gtk_widget_set_sensitive(widgets->RemoveButton,0); - } - } else { - gtk_widget_set_sensitive(widgets->DefaultLayoutRadio,0); - gtk_widget_set_sensitive(widgets->ManualLayoutRadio,0); - gtk_widget_set_sensitive(widgets->LayoutTree,0); - gtk_widget_set_sensitive(widgets->AddButton,0); - gtk_widget_set_sensitive(widgets->RemoveButton,0); +int cur_slide=0; - } -} +// //functions + +// void on_layout_toggle_button_switch(GtkWidget *self, main_window *widgets){ +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self))){ +// gtk_widget_set_sensitive(widgets->DefaultLayoutRadio,1); +// gtk_widget_set_sensitive(widgets->ManualLayoutRadio,1); +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio))){ +// gtk_widget_set_sensitive(widgets->LayoutTree,1); +// gtk_widget_set_sensitive(widgets->AddButton,1); +// gtk_widget_set_sensitive(widgets->RemoveButton,1); +// } else { +// gtk_widget_set_sensitive(widgets->LayoutTree,0); +// gtk_widget_set_sensitive(widgets->AddButton,0); +// gtk_widget_set_sensitive(widgets->RemoveButton,0); +// } +// } else { +// gtk_widget_set_sensitive(widgets->DefaultLayoutRadio,0); +// gtk_widget_set_sensitive(widgets->ManualLayoutRadio,0); +// gtk_widget_set_sensitive(widgets->LayoutTree,0); +// gtk_widget_set_sensitive(widgets->AddButton,0); +// gtk_widget_set_sensitive(widgets->RemoveButton,0); +// +// } +// } void on_toggle_button_switch_on(GtkWidget *, GtkToggleButton *toggle){ gtk_toggle_button_set_active(toggle,1); } -void on_autohostname_check(GtkWidget *, main_window *widgets){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ - gtk_widget_set_sensitive(widgets->HotnameEntry,0); - gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"auto"); - }else{ - gtk_widget_set_sensitive(widgets->HotnameEntry,1); - gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"ublinux-install"); - } -} - -void yon_password_set_sensitive_from_toggle(GtkWidget *self, main_window *widgets); -void yon_password_set_sensitive_from_toggle(GtkWidget *self, main_window *widgets){ - GtkWidget *combo = NULL; - GtkWidget *entry = NULL; - if (self == widgets->PasswordSensitiveCheck){ - combo = widgets->PasswordCombo; - entry = widgets->PasswordEntry; - } else { - combo = widgets->AdminPasswordCombo; - entry = widgets->AdminPasswordEntry; - } - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self))){ - gtk_widget_set_sensitive(combo,1); - if (gtk_combo_box_get_active(GTK_COMBO_BOX(combo))){ - gtk_widget_set_sensitive(entry,1); - } else { - gtk_widget_set_sensitive(entry,0); - } - } else { - gtk_widget_set_sensitive(combo,0); - gtk_widget_set_sensitive(entry,0); - - } -} - -void yon_password_combo_set_sensitive(GtkWidget *self, main_window *widgets); -void yon_password_combo_set_sensitive(GtkWidget *self, main_window *widgets){ - GtkWidget *entry = NULL; - GtkWidget *toggle = NULL; - if (self == widgets->PasswordCombo){ - entry = widgets->PasswordEntry; - toggle = widgets->PasswordSensitiveCheck; - } else if (self == widgets->AdminPasswordCombo){ - entry = widgets->AdminPasswordEntry; - toggle = widgets->RootPasswordSensitiveCheck; - } - if (gtk_combo_box_get_active(GTK_COMBO_BOX(self))&>k_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle))){ - gtk_widget_set_sensitive(entry,1); - } else { - gtk_widget_set_sensitive(entry,0); - - } -} - -void on_autohostname_sensitiveness_check(GtkWidget *, main_window *widgets){ - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck))){ - gtk_widget_set_sensitive(widgets->AutoHostnameCheck,1); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ - gtk_widget_set_sensitive(widgets->HotnameEntry,0); - } else - gtk_widget_set_sensitive(widgets->HotnameEntry,1); - } else { - gtk_widget_set_sensitive(widgets->HotnameEntry,0); - gtk_widget_set_sensitive(widgets->AutoHostnameCheck,0); - } -} - -void on_hostname_entry_changed (GtkWidget *, main_window *widgets){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0); -} - -void _yon_saving_threaded(char *final_command); -void _yon_saving_threaded(char *final_command){ - FILE *file = popen(final_command,"r"); - int file_save; - config_str file_return = yon_config_load_file(file,&file_save); - pclose(file); - file_return = yon_char_parsed_append(file_return,&file_save,final_command); - char *result = yon_char_parsed_to_string(file_return,file_save,""); - yon_debug_output("%s\n",result); - yon_char_parsed_free(file_return,file_save); - free(result); -} - -void yon_save_proceed(char *path, YON_CONFIG_TYPE type); -void yon_save_proceed(char *path, YON_CONFIG_TYPE type){ - yon_debug_output("%s\n",yon_config_save_simple(type,path)); -} +// void on_autohostname_check(GtkWidget *, main_window *widgets){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ +// gtk_widget_set_sensitive(widgets->HotnameEntry,0); +// gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"auto"); +// }else{ +// gtk_widget_set_sensitive(widgets->HotnameEntry,1); +// gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"ublinux-install"); +// } +// } + +// void yon_password_set_sensitive_from_toggle(GtkWidget *self, main_window *widgets){ +// GtkWidget *combo = NULL; +// GtkWidget *entry = NULL; +// if (self == widgets->PasswordSensitiveCheck){ +// combo = widgets->PasswordCombo; +// entry = widgets->PasswordEntry; +// } else { +// combo = widgets->AdminPasswordCombo; +// entry = widgets->AdminPasswordEntry; +// } +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self))){ +// gtk_widget_set_sensitive(combo,1); +// if (gtk_combo_box_get_active(GTK_COMBO_BOX(combo))){ +// gtk_widget_set_sensitive(entry,1); +// } else { +// gtk_widget_set_sensitive(entry,0); +// } +// } else { +// gtk_widget_set_sensitive(combo,0); +// gtk_widget_set_sensitive(entry,0); +// +// } +// } + +// void yon_password_combo_set_sensitive(GtkWidget *self, main_window *widgets){ +// GtkWidget *entry = NULL; +// GtkWidget *toggle = NULL; +// if (self == widgets->PasswordCombo){ +// entry = widgets->PasswordEntry; +// toggle = widgets->PasswordSensitiveCheck; +// } else if (self == widgets->AdminPasswordCombo){ +// entry = widgets->AdminPasswordEntry; +// toggle = widgets->RootPasswordSensitiveCheck; +// } +// if (gtk_combo_box_get_active(GTK_COMBO_BOX(self))&>k_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle))){ +// gtk_widget_set_sensitive(entry,1); +// } else { +// gtk_widget_set_sensitive(entry,0); +// +// } +// } + +// void on_autohostname_sensitiveness_check(GtkWidget *, main_window *widgets){ +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck))){ +// gtk_widget_set_sensitive(widgets->AutoHostnameCheck,1); +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ +// gtk_widget_set_sensitive(widgets->HotnameEntry,0); +// } else +// gtk_widget_set_sensitive(widgets->HotnameEntry,1); +// } else { +// gtk_widget_set_sensitive(widgets->HotnameEntry,0); +// gtk_widget_set_sensitive(widgets->AutoHostnameCheck,0); +// } +// } + +// void on_hostname_entry_changed (GtkWidget *, main_window *widgets){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0); +// } + +// void _yon_saving_threaded(char *final_command){ +// FILE *file = popen(final_command,"r"); +// int file_save; +// config_str file_return = yon_config_load_file(file,&file_save); +// pclose(file); +// file_return = yon_char_parsed_append(file_return,&file_save,final_command); +// char *result = yon_char_parsed_to_string(file_return,file_save,""); +// yon_debug_output("%s\n",result); +// yon_char_parsed_free(file_return,file_save); +// free(result); +// } + +// void yon_save_proceed(char *path, YON_CONFIG_TYPE type){ +// yon_debug_output("%s\n",yon_config_save_simple(type,path)); +// } -void yon_load_proceed(YON_CONFIG_TYPE type); -void yon_load_proceed(YON_CONFIG_TYPE type){ - yon_config_clean(); - if (!yon_char_is_empty(config_get_default_command)) - yon_config_load_config(YON_CONFIG_DEFAULT,yon_debug_output("%s\n",config_get_default_command),NULL); - if (type==YON_CONFIG_GLOBAL){ - yon_config_load_config(type,yon_debug_output("%s\n",config_get_global_command),NULL); - } else if (type==YON_CONFIG_LOCAL){ - yon_config_load_config(type,yon_debug_output("%s\n",config_get_local_command),NULL); - } else if (type==YON_CONFIG_CUSTOM){ - char *path=""; - GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL); - yon_gtk_window_setup(GTK_WINDOW(dialog),NULL,TITLE_LABEL,icon_path,"FileChooserWindow"); - textdomain(LocaleName); - gtk_window_set_icon_name(GTK_WINDOW(dialog),"com.ublinux.ubinstall"); - gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL); - GtkFileFilter *filter = gtk_file_filter_new(); - gtk_file_filter_add_pattern(filter,"*.ini"); - gtk_file_filter_set_name(filter, "*.ini"); - gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); - gtk_widget_show(dialog); - int response = gtk_dialog_run(GTK_DIALOG(dialog)); - if (response == GTK_RESPONSE_ACCEPT){ - char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); - if (!yon_char_is_empty(file)){ - path=yon_char_unite("'",file,"'",NULL); - free(file); - } - gtk_widget_destroy(dialog); - } else { - gtk_widget_destroy(dialog); - } - yon_config_load_config(type,yon_debug_output("%s\n",yon_config_get_custom_command(path)),NULL); - if (path) free(path); - } -} - -void yon_interface_update(main_window *widgets){ - if (widgets){}; - enum YON_PAGES page=YON_PAGE_COMPLETED; - char *type = config(AUTOINSTALL_TYPE_INSTALL); - if (!yon_char_is_empty(type)){ - if (!strcmp(type,"fast")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationRadio),1); - page = YON_PAGE_INSTALL_COMMON; - } else if (!strcmp(type,"next")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationNearRadio),1); - page = YON_PAGE_INSTALL_SEPARATE; - } else if (!strcmp(type,"part")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationLinuxRadio),1); - page = YON_PAGE_INSTALL_SAME_PARTITION; - } else if (!strcmp(type,"grub_install")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->GrubInstallRadio),1); - page = YON_PAGE_OPTIONS_GRUB_INSTALL; - } else if (!strcmp(type,"grub_update")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->GrubUpdateRadio),1); - page = YON_PAGE_OPTIONS_GRUB_UPDATE; - } else if (!strcmp(type,"system_only")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->OSRadio),1); - page = YON_PAGE_OPTIONS_OS_ONLY; - } else if (!strcmp(type,"data_only")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserDataOnlyRadio),1); - page = YON_PAGE_OPTIONS_USRDATA_ONLY; - } else if (!strcmp(type,"custom")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SeparateRadio),1); - page = YON_PAGE_OPTIONS_SEPARATE; - } - } - char *device = config(AUTOINSTALL_DEVICE); - char *part = NULL; - if (page!=YON_PAGE_INSTALL_COMMON) - part = config(part_parameter); - char *fs_type = config(part_type_parameter); - char *device_label = config(device_label_parameter); - char *format = config(device_format_parameter); - char *part_size = config(part_size_parameter); - GtkListStore *device_list = widgets->DevicesList; - GtkListStore *part_list=widgets->PartitionsList; - GtkWidget *device_tree=NULL; - GtkWidget *part_tree=NULL; - switch (page){ - case YON_PAGE_INSTALL_COMMON:{ - device_tree = widgets->CommonInstallationDevicesTree; - } break; - - case YON_PAGE_INSTALL_SEPARATE:{ - device_tree = widgets->InstallationNearSysDevicesTree; - part_tree = widgets->InstallationNearSysSectionTree; - if (!yon_char_is_empty(part_size)){ - gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),atof(part_size)); - if (part_size[strlen(part_size)-1]=='M') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),0); - if (part_size[strlen(part_size)-1]=='G') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),1); - if (part_size[strlen(part_size)-1]=='T') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),2); - } - if (format&&!strcmp(format,"yes")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck),1); - else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck),main_config.format_default); - if (!yon_char_is_empty(fs_type)) - gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->NextInstallationFilesystemTypeCombo),fs_type); - if (device_label) - gtk_entry_set_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry),device_label); - else - gtk_entry_set_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry),""); - - } break; - - case YON_PAGE_INSTALL_SAME_PARTITION:{ - device_tree = widgets->SamePlaceDeviceTree; - part_tree = widgets->SamePlacePartTree; - if (!yon_char_is_empty(fs_type)) - gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->SameInstallationFilesystemTypeCombo),fs_type); - if (format&&!strcmp(format,"yes")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SameInstallationFormatCheck),1); - else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SameInstallationFormatCheck),main_config.format_default); - if (device_label) - gtk_entry_set_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry),device_label); - else - gtk_entry_set_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry),""); - - } break; - case YON_PAGE_OPTIONS_GRUB_INSTALL:{ - device_tree = widgets->GrubInstallDevicesTree; - } break; - - case YON_PAGE_OPTIONS_GRUB_UPDATE:{ - device_tree = widgets->GrubUpdateDevicesTree; - } break; - - case YON_PAGE_OPTIONS_SEPARATE:{ - GtkTreeIter iter; - device_tree = widgets->SeparateDevicesTree; - part_tree = widgets->SeparateSysSectionTree; - for_iter(GTK_TREE_MODEL(device_list),&iter){ - char *cur_device; - gtk_tree_model_get(GTK_TREE_MODEL(device_list),&iter, 0,&cur_device,-1); - if (!strcmp(cur_device,device)){ - gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(device_tree)),&iter); - break; - } - } - on_near_installation_device_changed(device_tree,widgets); - for_iter(GTK_TREE_MODEL(part_list),&iter){ - char *cur_part; - gtk_tree_model_get(GTK_TREE_MODEL(device_list),&iter, 0,&cur_part,-1); - if (!strcmp(cur_part,part)){ - gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(part_tree)),&iter); - } - } - } break; - - case YON_PAGE_OPTIONS_OS_ONLY:{ - device_tree = widgets->OSDevicesTree; - part_tree = widgets->OSSysSectionTree; - } break; - - case YON_PAGE_OPTIONS_USRDATA_ONLY:{ - device_tree = widgets->UserdataDevicesTree; - part_tree = widgets->UserdataSysSectionTree; - } break; - - default:{}break; - } - GtkTreeIter iter; - char *cur_device=""; - if (page!=YON_PAGE_OPTIONS_SEPARATE && !yon_char_is_empty(device)){ - for_iter (widgets->DevicesList,&iter){ - gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),&iter,0,&cur_device,-1); - if (!strcmp(device,cur_device)){ - gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(device_tree)),&iter); - break; - } - } - on_near_installation_device_changed(device_tree,widgets); - if (!yon_char_is_empty(part)){ - for_iter (widgets->PartitionsList,&iter){ - gtk_tree_model_get(GTK_TREE_MODEL(widgets->PartitionsList),&iter,0,&part,-1); - if (!strcmp(device,cur_device)){ - gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(part_tree)),&iter); - break; - } - } - } - } - char *system_locale = config(locale_parameter); - if (!yon_char_is_empty(system_locale)){ - char *chosen_langs = ""; - for_iter(widgets->LanguagesList,&iter){ - char *cur=NULL, *render = NULL; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,1,&render,2,&cur,-1); - if (strstr(system_locale,cur)){ - gtk_list_store_set((widgets->LanguagesList),&iter,0,1,-1); - chosen_langs = yon_char_unite(chosen_langs,!yon_char_is_empty(chosen_langs)?";":"",render,NULL); - } else { - gtk_list_store_set((widgets->LanguagesList),&iter,0,0,-1); - } - } - if (!yon_char_is_empty(chosen_langs)){ - gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),chosen_langs); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),1); - free(chosen_langs); - } else { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); - gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); - } - } else { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); - gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); - int langsize; - config_str lang = default_langs(&langsize); - for_iter(widgets->LanguagesList,&iter){ - char *cur=NULL; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,2,&cur,-1); - if (lang&&yon_char_parsed_check_exist(lang,langsize,cur)>-1){ - gtk_list_store_set(widgets->LanguagesList,&iter,0,1,-1); - } else { - gtk_list_store_set(widgets->LanguagesList,&iter,0,0,-1); - } - if (cur) free(cur); - } - if (langsize) yon_char_parsed_free(lang,langsize); - } - char *zone = config(zone_parameter); - char *region = NULL; - - if (!yon_char_is_empty(zone)) region = yon_char_divide_search(zone,"/",-1); else {gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck),0);} - if (!yon_char_is_empty(region)){ - gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->RegionCombo),region); - } else { - gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->RegionCombo),"Europe"); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck),0); - } - if (!yon_char_is_empty(zone)){ - gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->ZoneCombo),zone); - } else { - gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->ZoneCombo),"Moscow"); - } - char *language = config(lang_parameter); - if (!yon_char_is_empty(language)){ - gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LanguageCombo),language); - } else { - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguageCombo),0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->MainLanguageSensitiveCheck),0); - } - char *kbmodel = config (xkbmodel_parameter); - char *optinos = config(xkboptions_parameter); - char *layout = config(xkblayout_parameter); - if (!yon_char_is_empty(kbmodel)){ - gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo),kbmodel); - } else { - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo),0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->KeyboardModelSensitiveCheck),0); - - } - if (!yon_char_is_empty(optinos)){ - gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LayoutBindingCombo),optinos); - } else { - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LayoutBindingCombo),0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->OptionsSensitiveCheck),0); - } - if (!yon_char_is_empty(layout)){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio),1); - for_iter(widgets->LayoutList,&iter){ - char *cur=NULL; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutList),&iter,0,&cur,-1); - if (strstr(layout,cur)){ - gtk_tree_store_set(widgets->LayoutList,&iter,3,1,-1); - } else { - gtk_tree_store_set(widgets->LayoutList,&iter,3,0,-1); - } - } - } else { - for_iter(widgets->LayoutList,&iter){ - char *id; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutList),&iter,0,&id,-1); - if (!strcmp(id,"ru")||!strcmp(id,"us")){ - gtk_tree_store_set(widgets->LayoutList,&iter,3,1,-1); - } else { - gtk_tree_store_set((widgets->LayoutList),&iter,3,0,-1); - } - } - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LayoutSensitiveCheck),0); - } - char *user_name = config(user_name_parameter); - char *user_gecos = config(user_gecos_parameter); - char *user_password = config(user_password_parameter); - char *root_password = config(root_password_parameter); - char *autologin = config(autologin_parameter); - char *hostname = config(hostname_parameter); - if (!yon_char_is_empty(user_name)){ - if (!strcmp(user_name,"root")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck),1); - } else { - gtk_entry_set_text(GTK_ENTRY(widgets->LoginEntry),user_name); - } - } else { - gtk_entry_set_text(GTK_ENTRY(widgets->LoginEntry),""); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck),0); - } - if (!yon_char_is_empty(user_gecos)){ - gtk_entry_set_text(GTK_ENTRY(widgets->UserNameEntry),_(user_gecos)); - } else { - gtk_entry_set_text(GTK_ENTRY(widgets->UserNameEntry),""); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UsernameSensitiveCheck),0); - } - int def_size=0; - config_str default_password = NULL; - if (!getuid()){ - default_password = yon_config_load(yon_debug_output("%s\n",get_default_password_command), &def_size); - if (def_size>0&&default_password){ - yon_char_remove_last_symbol(default_password[0],'\n'); - } - } - if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->PasswordCombo),0); - gtk_entry_set_text(GTK_ENTRY(widgets->PasswordEntry),""); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->PasswordSensitiveCheck),0); - - } else if (!yon_char_is_empty(user_password)){ - gtk_entry_set_text(GTK_ENTRY(widgets->PasswordEntry),user_password); - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->PasswordCombo),1); - } - if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo),0); - gtk_entry_set_text(GTK_ENTRY(widgets->AdminPasswordEntry),""); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RootPasswordSensitiveCheck),0); - - } else if (!yon_char_is_empty(root_password)){ - gtk_entry_set_text(GTK_ENTRY(widgets->AdminPasswordEntry),root_password); - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo),1); - } - if (!yon_char_is_empty(autologin)){ - if (!strcmp(autologin,"yes")) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),1); - else - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),0); - } else { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),main_config.autologin_default); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinSensitiveCheck),0); - } - if (!yon_char_is_empty(hostname)){ - if (strcmp(hostname,"auto")){ - gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),hostname); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); - } else{ - gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),""); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),1); - } - } else { - gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),""); - g_signal_handlers_block_by_func(G_OBJECT(widgets->AutoHostnameCheck),on_autohostname_check,widgets); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),1); - g_signal_handlers_unblock_by_func(G_OBJECT(widgets->AutoHostnameCheck),on_autohostname_check,widgets); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),0); - } -} - -void on_config_local_load(GtkWidget *,main_window *widgets); -void on_config_local_load(GtkWidget *,main_window *widgets){ - yon_load_proceed(YON_CONFIG_LOCAL); - yon_interface_update(widgets); - main_config.load_mode=1; -} - -void on_config_global_load(GtkWidget *,main_window *); -void on_config_global_load(GtkWidget *,main_window *widgets){ - yon_load_proceed(YON_CONFIG_GLOBAL); - yon_interface_update(widgets); - main_config.load_mode=0; -} - -void on_config_custom_load(GtkWidget *,main_window *); -void on_config_custom_load(GtkWidget *,main_window *widgets){ - yon_load_proceed(YON_CONFIG_CUSTOM); - yon_interface_update(widgets); - main_config.load_mode=3; -} - -void on_config_global_local_save(GtkWidget *,main_window *widgets); -void on_config_global_local_save(GtkWidget *,main_window *widgets){ - yon_save_proceed(NULL,YON_CONFIG_BOTH); - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); -} - -void on_config_local_save(GtkWidget *,main_window *widgets); -void on_config_local_save(GtkWidget *,main_window *widgets){ - yon_save_proceed("system",YON_CONFIG_LOCAL); - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); - -} - -void on_config_global_save(GtkWidget *,main_window *widgets); -void on_config_global_save(GtkWidget *,main_window *widgets){ - yon_save_proceed("global",YON_CONFIG_GLOBAL); - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); - -} - -void on_config_custom_save(GtkWidget *, main_window *widgets); -void on_config_custom_save(GtkWidget *, main_window *widgets){ - char *path = NULL; - GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,SAVE_LABEL,GTK_RESPONSE_ACCEPT,NULL); - textdomain(TITLE_LABEL); - GtkFileFilter *filter = gtk_file_filter_new(); - gtk_window_set_icon_name(GTK_WINDOW(dialog),yon_char_append("com.ublinux.",LocaleName)); - gtk_file_filter_add_pattern(filter,"*.ini"); - gtk_file_filter_set_name(filter, "*.ini"); - gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); - int response = gtk_dialog_run(GTK_DIALOG(dialog)); - if (response == GTK_RESPONSE_ACCEPT){ - char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); - if (!yon_char_is_empty(file)){ - if (!strstr(file,".ini")) file = yon_char_append(file,".ini"); - if (access(file,0)!=F_OK){ - char *command_creation = ubconfig_file_create(file); - int a = system(yon_debug_output("%s\n",command_creation)); - if (access(file,0)!=F_OK||a){ - yon_ubl_status_box_render(CUSTOM_CONFIG_CREATION_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); - return; - } - } - } - path = yon_char_unite("'",file,"'",NULL); - free(file); - gtk_widget_destroy(dialog); - } else { - gtk_widget_destroy(dialog); - return; - } - yon_save_proceed(path,YON_CONFIG_CUSTOM); - if (path) free(path); - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); -} - -void yon_open_browser(GtkWidget *, char *link); -void yon_open_browser(GtkWidget *, char *link){ - GtkWidget *window = yon_ubl_browser_window_open(link,TITLE_LABEL); - if (window) - gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",LocaleName)); -} - -void on_open_documentation_confirmation(GtkWidget *self, char *link); -void on_open_documentation_confirmation(GtkWidget *self, char *link){ - if (main_config.always_open_documentation==0){ - GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_documentation); - documentation_confirmation_window *window = malloc(sizeof(documentation_confirmation_window)); - window->Window = yon_gtk_builder_get_widget(builder,"helpConfirmationWindow"); - window->AcceptButton = yon_gtk_builder_get_widget(builder,"ReadHelpButton"); - window->CloseButton = yon_gtk_builder_get_widget(builder,"CancelHelpButton"); - window->HeaderLabel = yon_gtk_builder_get_widget(builder,"webHeaderNameLabel"); - window->AlwaysOpenCheck = yon_gtk_builder_get_widget(builder,"AlwaysOpenDocumentationCheckbox"); - gtk_label_set_text(GTK_LABEL(window->HeaderLabel),TITLE_LABEL); - gtk_widget_show_all(window->Window); - g_signal_connect(G_OBJECT(window->CloseButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); - g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(yon_open_browser),yon_char_new(link)); - g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); - - - } else { - yon_open_browser(self,link); - } -} - -void on_link(GtkWidget *self, char* uri); -void on_link(GtkWidget *self, char* uri){ - gtk_widget_destroy(self); - on_open_documentation_confirmation(self,uri); -} - -void on_about(GtkWidget *); -void on_about(GtkWidget *){ - GtkBuilder *builder=gtk_builder_new_from_resource(ui_glade_path_about); - GtkWidget *window=yon_gtk_builder_get_widget(builder,"AboutWindow"); - GtkWidget *title=yon_gtk_builder_get_widget(builder,"headerAboutTopic"); - GtkWidget *hideButtonBox=yon_gtk_builder_get_widget(builder,"buttonBoxHide"); - gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),version_application); - gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),TITLE_LABEL); - gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(window),yon_char_append("com.ublinux.",LocaleName)); - gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",LocaleName)); - gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(window),LocaleName); - gtk_label_set_text(GTK_LABEL(title),TITLE_LABEL); - g_signal_connect(G_OBJECT(window),"activate-link",G_CALLBACK(on_link),WIKI_LINK); - gtk_widget_set_visible(hideButtonBox,0); - gtk_widget_destroy(hideButtonBox); - gtk_widget_show(window); -} - -double yon_size_long_convert_automatic(unsigned long bytes, char *size); -double yon_size_long_convert_automatic(unsigned long bytes, char *size){ - int repeats; - double byte_float=bytes; - for (repeats=-1;byte_float>1024;repeats++){ - byte_float=byte_float/1024; - } - if (repeats==-1) { - repeats=0; - byte_float=byte_float/1024; - } - switch(repeats){ - case 0: (*size)='K'; - break; - case 1: (*size)='M'; - break; - case 2: (*size)='G'; - break; - case 3: (*size)='T'; - break; - } - return byte_float; -} - -// standard functions - -void on_keyboard_accept(GtkWidget *self,main_window *widgets); -void on_keyboard_accept(GtkWidget *self,main_window *widgets){ - gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter)); - on_subwindow_close(self); -} - -void on_layout_toggle(GtkCellRendererToggle*, gchar* path, ubinstall_keyboard_window *window); -void on_layout_toggle(GtkCellRendererToggle*, gchar* path, ubinstall_keyboard_window *window){ - GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(window->LayoutsTree)); - GtkTreeIter iter; - if (gtk_tree_model_get_iter_from_string(model,&iter,path)){ - int status=0; - gtk_tree_model_get(model,&iter,3,&status,-1); - gtk_tree_store_set(GTK_TREE_STORE(model),&iter,3,!status,-1); - } -} - -ubinstall_keyboard_window *yon_ubinstall_keyboard_new(){ - ubinstall_keyboard_window *window = malloc(sizeof(ubinstall_keyboard_window)); - GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubinstall_keyboard); - window->MainWindow=yon_gtk_builder_get_widget(builder,"MainWindow"); - window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); - window->headerBar=yon_gtk_builder_get_widget(builder,"headerBar"); - window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton"); - window->SaveButton=yon_gtk_builder_get_widget(builder,"SaveButton"); - window->LayoutsTree=yon_gtk_builder_get_widget(builder,"LayoutsTree"); - window->ActiveToggle = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ActiveToggle")); - - g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); - -return window; -} - -void on_keyboard_clicked (GtkWidget *, main_window *widgets); -void on_keyboard_clicked (GtkWidget *, main_window *widgets){ - ubinstall_keyboard_window *window = yon_ubinstall_keyboard_new(); - yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->MainWindow),KEYBOARD_TITLE_LABEL,icon_path,"keyboard-window"); - gtk_tree_view_set_model(GTK_TREE_VIEW(window->LayoutsTree),GTK_TREE_MODEL(widgets->LayoutList)); - - g_signal_connect(G_OBJECT(window->ActiveToggle),"toggled",G_CALLBACK(on_layout_toggle),window); - g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_keyboard_accept),widgets); - gtk_widget_show(window->MainWindow); -} - -void on_keyboard_removed(GtkWidget *, main_window *widgets); -void on_keyboard_removed(GtkWidget *, main_window *widgets){ - GtkTreeModel *model; - GtkTreeIter iter, childiter; - if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->LayoutTree)),&model,&iter)){ - gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),&childiter,&iter); - gtk_tree_store_set(widgets->LayoutList,&childiter,3,0,-1); - } -} - -void yon_language_selection_changed(GtkCellRenderer *, char *path, ubinstall_language_window *window); -void yon_language_selection_changed(GtkCellRenderer *, char *path, ubinstall_language_window *window){ - GtkTreeIter iter; - int state; - - if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->liststore1),&iter,path)){ - gtk_tree_model_get(GTK_TREE_MODEL(window->liststore1),&iter,0,&state,-1); - gtk_list_store_set(window->liststore1,&iter,0,!state,-1); - } -} - -void on_language_window_accept(GtkWidget *,dictionary *dict); -void on_language_window_accept(GtkWidget *,dictionary *dict){ - main_window *widgets= yon_dictionary_get_data(dict->first,main_window*); - ubinstall_language_window *window = yon_dictionary_get_data(dict->first->next,ubinstall_language_window*); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultCheck))){ - gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); - GtkTreeIter iter; - int size; - config_str lang_parsed = default_langs(&size); - - char *final = ""; - for_iter(widgets->LanguagesList,&iter){ - char *code, *labl; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,1,&labl,2,&code,-1); - if (yon_char_parsed_check_exist(lang_parsed,size,code)!=-1){ - gtk_list_store_set(widgets->LanguagesList,&iter,0,1,-1); - char *tmp = yon_char_unite(final,!yon_char_is_empty(final)?";":"",labl,NULL); - if (!yon_char_is_empty(final)) free(final); - final = tmp; - } else - gtk_list_store_set(widgets->LanguagesList,&iter,0,0,-1); - } - if (!yon_char_is_empty(final)){ - gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),final); - } - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguagesCombo),-1); - gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); - } else { - yon_gtk_list_store_copy_full(widgets->LanguagesList,window->liststore1); - gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); - config_str parsed = NULL; - int size; - GtkTreeIter iter; - for_iter(GTK_TREE_MODEL(window->liststore1),&iter){ - char *current; - int status; - gtk_tree_model_get(GTK_TREE_MODEL(window->liststore1),&iter,0,&status,1,¤t,-1); - if (status) - yon_char_parsed_add_or_create_if_exists(parsed,&size,current); - } - if (parsed){ - char *final = yon_char_parsed_to_string(parsed,size,"; "); - gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),!yon_char_is_empty(final)?final:""); - if (yon_char_is_empty(final)) { - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguagesCombo),-1); - } - if (final) free(final); - yon_char_parsed_free(parsed,size); - } else - gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); - - } - on_subwindow_close(window->MainWindow); - free(window); -} - -ubinstall_language_window *yon_ubinstall_language_new(){ - ubinstall_language_window *window = malloc(sizeof(ubinstall_language_window)); - GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubinstall_language); - window->liststore1=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1")); - window->MainWindow=yon_gtk_builder_get_widget(builder,"MainWindow"); - window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); - window->DefaultCheck=yon_gtk_builder_get_widget(builder,"DefaultCheck"); - window->LanguagesTree=yon_gtk_builder_get_widget(builder,"LanguagesTree"); - window->headerBar=yon_gtk_builder_get_widget(builder,"headerBar"); - window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton"); - window->SaveButton=yon_gtk_builder_get_widget(builder,"SaveButton"); - window->ToggleRenderer=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ToggleRenderer")); - - g_signal_connect(G_OBJECT(window->DefaultCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->LanguagesTree); - g_signal_connect(G_OBJECT(window->ToggleRenderer),"toggled",G_CALLBACK(yon_language_selection_changed),window); - g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); -return window; -} - -void on_language_clicked(GtkWidget *, main_window *widgets); -void on_language_clicked(GtkWidget *, main_window *widgets){ - ubinstall_language_window *window = yon_ubinstall_language_new(); - g_object_ref(G_OBJECT(window->liststore1)); - gtk_tree_view_set_model(GTK_TREE_VIEW(window->LanguagesTree),NULL); - yon_gtk_list_store_copy_full(window->liststore1,widgets->LanguagesList); - gtk_tree_view_set_model(GTK_TREE_VIEW(window->LanguagesTree),GTK_TREE_MODEL(window->liststore1)); - yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->MainWindow),TITLE_LABEL,icon_path,"language-chooser-window"); - - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->AvailableLanguagesEntry)))){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DefaultCheck),1); - } - - int size; - int found=0; - int statusfound=0; - config_str langs = default_langs(&size); - GtkTreeIter iter; - for_iter(widgets->LanguagesList,&iter){ - char *cur; - int status; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,0,&status,2,&cur,-1); - if (status){ - statusfound++; - if (yon_char_parsed_check_exist(langs,size,cur)>-1) - found++; - } - } - if ((found==size)&&statusfound==size){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DefaultCheck),1); - } - - dictionary *dict=NULL; - yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); - yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); - g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_language_window_accept),dict); - gtk_widget_show(window->MainWindow); - -} - -/**config_init() - * [EN] - * - * [RU] - * Функция инициализации всех параметров конфигурации -*/ -void config_init(){ - main_config.always_open_documentation=0; - main_config.socket_id=-1; - main_config.save_socket_id=-1; - main_config.load_socket_id=-1; - main_config.lock_help=0; - main_config.lock_help=0; - main_config.lock_load_global=0; - main_config.lock_save_global=0; - main_config.lock_save_local=0; - main_config.debug_mode=0; - main_config.slider_thread=0; - main_config.install_thread=0; - main_config.progress_thread=0; - main_config.install_complete=0; - main_config.save_done=0; - main_config.save_configured=0; - main_config.configure_mode=0; - main_config.load_mode=-1; - main_config.log_progress_buzy=0; - main_config.log_end=0; - main_config.exit_accepted=0; -} - -void on_root_get_root(char *argline); -void on_root_get_root(char *argline){ - yon_launch(argline); -} - -void on_configuration_mode_switch(GtkWidget *self,main_window *widgets); -void on_configuration_mode_switch(GtkWidget *self,main_window *widgets){ - if (getuid()) { - if (main_config.configure_mode==1){ - char *argline = LocaleName; - for (int i=1;iMainWindow); - } - } - } - main_config.configure_mode = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(self)); -} - -int cur_slide=0; - -int yon_image_resize_from_container(GtkImage *target, GdkPixbuf *pixbuf_unscaled); -int yon_image_resize_from_container(GtkImage *target, GdkPixbuf *pixbuf_unscaled){ - int width = gtk_widget_get_allocated_width((gtk_widget_get_parent(GTK_WIDGET(target)))); - int height = gtk_widget_get_allocated_height((gtk_widget_get_parent(GTK_WIDGET(target)))); - - int newImgWidthDef = (width <= 217) ? width : width - 30; - int newImgHeightDef = (height <= 120) ? height : height - 80; - - int originalWidth = gdk_pixbuf_get_width(pixbuf_unscaled); - int originalHeight = gdk_pixbuf_get_height(pixbuf_unscaled); - int newImgHeight = (int)(originalHeight / ((double) originalWidth / newImgWidthDef)); - - if (newImgHeight > newImgHeightDef) { - newImgHeight = newImgHeightDef; - newImgWidthDef = (int)(originalWidth / ((double) originalHeight / newImgHeight)); - } - int newImageWidth = (int)(originalWidth / ((double) originalHeight / newImgHeight)); - - GdkPixbuf *scaledPixBuf = gdk_pixbuf_scale_simple(pixbuf_unscaled, newImageWidth, newImgHeight, GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(target, scaledPixBuf); - - g_object_unref(scaledPixBuf); - - return 1; -} - -void on_region_resized(GtkWidget *,main_window *widgets); -void on_region_resized(GtkWidget *,main_window *widgets){ - yon_image_resize_from_container(GTK_IMAGE(widgets->SlidesImage), (GdkPixbuf*)g_list_nth_data(widgets->slides_original,cur_slide)); - yon_image_resize_from_container(GTK_IMAGE(widgets->RegionImage), widgets->regions_original); - yon_image_resize_from_container(GTK_IMAGE(widgets->KeyboardImage), widgets->keyboard_original); -} - -void yon_switch_page_render(main_window *widgets, int page); -void yon_switch_page_render(main_window *widgets, int page){ - if (widgets&&page){}; - GtkContainer *parent = GTK_CONTAINER(gtk_widget_get_parent(widgets->UsersToggle)); - GList *list = gtk_container_get_children(parent); - for (guint i=0;iSlidesImage),(GdkPixbuf*)g_list_nth_data(widgets->slides_original,cur_slide)); - // gtk_widget_queue_draw(widgets->SlidesImage); - if (cur_slideInstallationLabel), current_copy); - gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress), fraction / 100); - gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress), 0); - gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), ""); - } else { - gtk_widget_show(gtk_widget_get_parent(widgets->PackageInstallationProgress)); - - config_str parsed = yon_char_parse(current_copy, &size, " "); - if (size >= 3) { - double fraction = atof(parsed[2]) / 100; - gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress), fraction); - gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), yon_char_parsed_to_string(parsed, size, " ")); - } - } - - } - yon_char_parsed_free(text, size); - } - - g_mutex_lock(&main_config.install_mutex); - if (main_config.install_thread) { - g_mutex_unlock(&main_config.install_mutex); - return 1; - } else { - g_mutex_unlock(&main_config.install_mutex); - gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), ""); - return 0; - } -} - -void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets); -void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){ - if (widgets){}; +// void yon_load_proceed(YON_CONFIG_TYPE type){ +// yon_config_clean(); +// if (!yon_char_is_empty(config_get_default_command)) +// yon_config_load_config(YON_CONFIG_DEFAULT,yon_debug_output("%s\n",config_get_default_command),NULL); +// if (type==YON_CONFIG_GLOBAL){ +// yon_config_load_config(type,yon_debug_output("%s\n",config_get_global_command),NULL); +// } else if (type==YON_CONFIG_LOCAL){ +// yon_config_load_config(type,yon_debug_output("%s\n",config_get_local_command),NULL); +// } else if (type==YON_CONFIG_CUSTOM){ +// char *path=""; +// GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL); +// yon_gtk_window_setup(GTK_WINDOW(dialog),NULL,TITLE_LABEL,icon_path,"FileChooserWindow"); +// textdomain(LocaleName); +// gtk_window_set_icon_name(GTK_WINDOW(dialog),"com.ublinux.ubinstall"); +// gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL); +// GtkFileFilter *filter = gtk_file_filter_new(); +// gtk_file_filter_add_pattern(filter,"*.ini"); +// gtk_file_filter_set_name(filter, "*.ini"); +// gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); +// gtk_widget_show(dialog); +// int response = gtk_dialog_run(GTK_DIALOG(dialog)); +// if (response == GTK_RESPONSE_ACCEPT){ +// char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); +// if (!yon_char_is_empty(file)){ +// path=yon_char_unite("'",file,"'",NULL); +// free(file); +// } +// gtk_widget_destroy(dialog); +// } else { +// gtk_widget_destroy(dialog); +// } +// yon_config_load_config(type,yon_debug_output("%s\n",yon_config_get_custom_command(path)),NULL); +// if (path) free(path); +// } +// } + +// void yon_interface_update(main_window *widgets){ +// if (widgets){}; +// enum YON_PAGES page=YON_PAGE_COMPLETED; +// char *type = config(AUTOINSTALL_TYPE_INSTALL); +// if (!yon_char_is_empty(type)){ +// if (!strcmp(type,"fast")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationRadio),1); +// page = YON_PAGE_INSTALL_COMMON; +// } else if (!strcmp(type,"next")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationNearRadio),1); +// page = YON_PAGE_INSTALL_SEPARATE; +// } else if (!strcmp(type,"part")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationLinuxRadio),1); +// page = YON_PAGE_INSTALL_SAME_PARTITION; +// } else if (!strcmp(type,"grub_install")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->GrubInstallRadio),1); +// page = YON_PAGE_OPTIONS_GRUB_INSTALL; +// } else if (!strcmp(type,"grub_update")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->GrubUpdateRadio),1); +// page = YON_PAGE_OPTIONS_GRUB_UPDATE; +// } else if (!strcmp(type,"system_only")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->OSRadio),1); +// page = YON_PAGE_OPTIONS_OS_ONLY; +// } else if (!strcmp(type,"data_only")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserDataOnlyRadio),1); +// page = YON_PAGE_OPTIONS_USRDATA_ONLY; +// } else if (!strcmp(type,"custom")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SeparateRadio),1); +// page = YON_PAGE_OPTIONS_SEPARATE; +// } +// } +// char *device = config(AUTOINSTALL_DEVICE); +// char *part = NULL; +// if (page!=YON_PAGE_INSTALL_COMMON) +// part = config(part_parameter); +// char *fs_type = config(part_type_parameter); +// char *device_label = config(device_label_parameter); +// char *format = config(device_format_parameter); +// char *part_size = config(part_size_parameter); +// GtkListStore *device_list = widgets->DevicesList; +// GtkListStore *part_list=widgets->PartitionsList; +// GtkWidget *device_tree=NULL; +// GtkWidget *part_tree=NULL; +// switch (page){ +// case YON_PAGE_INSTALL_COMMON:{ +// device_tree = widgets->CommonInstallationDevicesTree; +// } break; +// +// case YON_PAGE_INSTALL_SEPARATE:{ +// device_tree = widgets->InstallationNearSysDevicesTree; +// part_tree = widgets->InstallationNearSysSectionTree; +// if (!yon_char_is_empty(part_size)){ +// gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),atof(part_size)); +// if (part_size[strlen(part_size)-1]=='M') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),0); +// if (part_size[strlen(part_size)-1]=='G') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),1); +// if (part_size[strlen(part_size)-1]=='T') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),2); +// } +// if (format&&!strcmp(format,"yes")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck),1); +// else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck),main_config.format_default); +// if (!yon_char_is_empty(fs_type)) +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->NextInstallationFilesystemTypeCombo),fs_type); +// if (device_label) +// gtk_entry_set_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry),device_label); +// else +// gtk_entry_set_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry),""); +// +// } break; +// +// case YON_PAGE_INSTALL_SAME_PARTITION:{ +// device_tree = widgets->SamePlaceDeviceTree; +// part_tree = widgets->SamePlacePartTree; +// if (!yon_char_is_empty(fs_type)) +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->SameInstallationFilesystemTypeCombo),fs_type); +// if (format&&!strcmp(format,"yes")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SameInstallationFormatCheck),1); +// else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SameInstallationFormatCheck),main_config.format_default); +// if (device_label) +// gtk_entry_set_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry),device_label); +// else +// gtk_entry_set_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry),""); +// +// } break; +// case YON_PAGE_OPTIONS_GRUB_INSTALL:{ +// device_tree = widgets->GrubInstallDevicesTree; +// } break; +// +// case YON_PAGE_OPTIONS_GRUB_UPDATE:{ +// device_tree = widgets->GrubUpdateDevicesTree; +// } break; +// +// case YON_PAGE_OPTIONS_SEPARATE:{ +// GtkTreeIter iter; +// device_tree = widgets->SeparateDevicesTree; +// part_tree = widgets->SeparateSysSectionTree; +// for_iter(GTK_TREE_MODEL(device_list),&iter){ +// char *cur_device; +// gtk_tree_model_get(GTK_TREE_MODEL(device_list),&iter, 0,&cur_device,-1); +// if (!strcmp(cur_device,device)){ +// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(device_tree)),&iter); +// break; +// } +// } +// on_near_installation_device_changed(device_tree,widgets); +// for_iter(GTK_TREE_MODEL(part_list),&iter){ +// char *cur_part; +// gtk_tree_model_get(GTK_TREE_MODEL(device_list),&iter, 0,&cur_part,-1); +// if (!strcmp(cur_part,part)){ +// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(part_tree)),&iter); +// } +// } +// } break; +// +// case YON_PAGE_OPTIONS_OS_ONLY:{ +// device_tree = widgets->OSDevicesTree; +// part_tree = widgets->OSSysSectionTree; +// } break; +// +// case YON_PAGE_OPTIONS_USRDATA_ONLY:{ +// device_tree = widgets->UserdataDevicesTree; +// part_tree = widgets->UserdataSysSectionTree; +// } break; +// +// default:{}break; +// } +// GtkTreeIter iter; +// char *cur_device=""; +// if (page!=YON_PAGE_OPTIONS_SEPARATE && !yon_char_is_empty(device)){ +// for_iter (widgets->DevicesList,&iter){ +// gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),&iter,0,&cur_device,-1); +// if (!strcmp(device,cur_device)){ +// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(device_tree)),&iter); +// break; +// } +// } +// on_near_installation_device_changed(device_tree,widgets); +// if (!yon_char_is_empty(part)){ +// for_iter (widgets->PartitionsList,&iter){ +// gtk_tree_model_get(GTK_TREE_MODEL(widgets->PartitionsList),&iter,0,&part,-1); +// if (!strcmp(device,cur_device)){ +// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(part_tree)),&iter); +// break; +// } +// } +// } +// } +// char *system_locale = config(locale_parameter); +// if (!yon_char_is_empty(system_locale)){ +// char *chosen_langs = ""; +// for_iter(widgets->LanguagesList,&iter){ +// char *cur=NULL, *render = NULL; +// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,1,&render,2,&cur,-1); +// if (strstr(system_locale,cur)){ +// gtk_list_store_set((widgets->LanguagesList),&iter,0,1,-1); +// chosen_langs = yon_char_unite(chosen_langs,!yon_char_is_empty(chosen_langs)?";":"",render,NULL); +// } else { +// gtk_list_store_set((widgets->LanguagesList),&iter,0,0,-1); +// } +// } +// if (!yon_char_is_empty(chosen_langs)){ +// gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),chosen_langs); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),1); +// free(chosen_langs); +// } else { +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); +// gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); +// } +// } else { +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); +// gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); +// int langsize; +// config_str lang = default_langs(&langsize); +// for_iter(widgets->LanguagesList,&iter){ +// char *cur=NULL; +// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,2,&cur,-1); +// if (lang&&yon_char_parsed_check_exist(lang,langsize,cur)>-1){ +// gtk_list_store_set(widgets->LanguagesList,&iter,0,1,-1); +// } else { +// gtk_list_store_set(widgets->LanguagesList,&iter,0,0,-1); +// } +// if (cur) free(cur); +// } +// if (langsize) yon_char_parsed_free(lang,langsize); +// } +// char *zone = config(zone_parameter); +// char *region = NULL; +// +// if (!yon_char_is_empty(zone)) region = yon_char_divide_search(zone,"/",-1); else {gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck),0);} +// if (!yon_char_is_empty(region)){ +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->RegionCombo),region); +// } else { +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->RegionCombo),"Europe"); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck),0); +// } +// if (!yon_char_is_empty(zone)){ +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->ZoneCombo),zone); +// } else { +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->ZoneCombo),"Moscow"); +// } +// char *language = config(lang_parameter); +// if (!yon_char_is_empty(language)){ +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LanguageCombo),language); +// } else { +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguageCombo),0); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->MainLanguageSensitiveCheck),0); +// } +// char *kbmodel = config (xkbmodel_parameter); +// char *optinos = config(xkboptions_parameter); +// char *layout = config(xkblayout_parameter); +// if (!yon_char_is_empty(kbmodel)){ +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo),kbmodel); +// } else { +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo),0); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->KeyboardModelSensitiveCheck),0); +// +// } +// if (!yon_char_is_empty(optinos)){ +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LayoutBindingCombo),optinos); +// } else { +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LayoutBindingCombo),0); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->OptionsSensitiveCheck),0); +// } +// if (!yon_char_is_empty(layout)){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio),1); +// for_iter(widgets->LayoutList,&iter){ +// char *cur=NULL; +// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutList),&iter,0,&cur,-1); +// if (strstr(layout,cur)){ +// gtk_tree_store_set(widgets->LayoutList,&iter,3,1,-1); +// } else { +// gtk_tree_store_set(widgets->LayoutList,&iter,3,0,-1); +// } +// } +// } else { +// for_iter(widgets->LayoutList,&iter){ +// char *id; +// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutList),&iter,0,&id,-1); +// if (!strcmp(id,"ru")||!strcmp(id,"us")){ +// gtk_tree_store_set(widgets->LayoutList,&iter,3,1,-1); +// } else { +// gtk_tree_store_set((widgets->LayoutList),&iter,3,0,-1); +// } +// } +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LayoutSensitiveCheck),0); +// } +// char *user_name = config(user_name_parameter); +// char *user_gecos = config(user_gecos_parameter); +// char *user_password = config(user_password_parameter); +// char *root_password = config(root_password_parameter); +// char *autologin = config(autologin_parameter); +// char *hostname = config(hostname_parameter); +// if (!yon_char_is_empty(user_name)){ +// if (!strcmp(user_name,"root")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck),1); +// } else { +// gtk_entry_set_text(GTK_ENTRY(widgets->LoginEntry),user_name); +// } +// } else { +// gtk_entry_set_text(GTK_ENTRY(widgets->LoginEntry),""); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck),0); +// } +// if (!yon_char_is_empty(user_gecos)){ +// gtk_entry_set_text(GTK_ENTRY(widgets->UserNameEntry),_(user_gecos)); +// } else { +// gtk_entry_set_text(GTK_ENTRY(widgets->UserNameEntry),""); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UsernameSensitiveCheck),0); +// } +// int def_size=0; +// config_str default_password = NULL; +// if (!getuid()){ +// default_password = yon_config_load(yon_debug_output("%s\n",get_default_password_command), &def_size); +// if (def_size>0&&default_password){ +// yon_char_remove_last_symbol(default_password[0],'\n'); +// } +// } +// if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->PasswordCombo),0); +// gtk_entry_set_text(GTK_ENTRY(widgets->PasswordEntry),""); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->PasswordSensitiveCheck),0); +// +// } else if (!yon_char_is_empty(user_password)){ +// gtk_entry_set_text(GTK_ENTRY(widgets->PasswordEntry),user_password); +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->PasswordCombo),1); +// } +// if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo),0); +// gtk_entry_set_text(GTK_ENTRY(widgets->AdminPasswordEntry),""); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RootPasswordSensitiveCheck),0); +// +// } else if (!yon_char_is_empty(root_password)){ +// gtk_entry_set_text(GTK_ENTRY(widgets->AdminPasswordEntry),root_password); +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo),1); +// } +// if (!yon_char_is_empty(autologin)){ +// if (!strcmp(autologin,"yes")) +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),1); +// else +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),0); +// } else { +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),main_config.autologin_default); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinSensitiveCheck),0); +// } +// if (!yon_char_is_empty(hostname)){ +// if (strcmp(hostname,"auto")){ +// gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),hostname); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); +// } else{ +// gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),""); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),1); +// } +// } else { +// gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),""); +// g_signal_handlers_block_by_func(G_OBJECT(widgets->AutoHostnameCheck),on_autohostname_check,widgets); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),1); +// g_signal_handlers_unblock_by_func(G_OBJECT(widgets->AutoHostnameCheck),on_autohostname_check,widgets); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),0); +// } +// } + +// void on_config_local_load(GtkWidget *,main_window *widgets){ +// yon_load_proceed(YON_CONFIG_LOCAL); +// yon_interface_update(widgets); +// main_config.load_mode=1; +// } + +// void on_config_global_load(GtkWidget *,main_window *widgets){ +// yon_load_proceed(YON_CONFIG_GLOBAL); +// yon_interface_update(widgets); +// main_config.load_mode=0; +// } + +// void on_config_custom_load(GtkWidget *,main_window *widgets){ +// yon_load_proceed(YON_CONFIG_CUSTOM); +// yon_interface_update(widgets); +// main_config.load_mode=3; +// } + +// void on_config_global_local_save(GtkWidget *,main_window *widgets){ +// yon_save_proceed(NULL,YON_CONFIG_BOTH); +// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); +// } + +// void on_config_local_save(GtkWidget *,main_window *widgets){ +// yon_save_proceed("system",YON_CONFIG_LOCAL); +// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); +// +// } + +// void on_config_global_save(GtkWidget *,main_window *widgets){ +// yon_save_proceed("global",YON_CONFIG_GLOBAL); +// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); +// +// } + +// void on_config_custom_save(GtkWidget *, main_window *widgets){ +// char *path = NULL; +// GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,SAVE_LABEL,GTK_RESPONSE_ACCEPT,NULL); +// textdomain(TITLE_LABEL); +// GtkFileFilter *filter = gtk_file_filter_new(); +// gtk_window_set_icon_name(GTK_WINDOW(dialog),yon_char_append("com.ublinux.",LocaleName)); +// gtk_file_filter_add_pattern(filter,"*.ini"); +// gtk_file_filter_set_name(filter, "*.ini"); +// gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); +// int response = gtk_dialog_run(GTK_DIALOG(dialog)); +// if (response == GTK_RESPONSE_ACCEPT){ +// char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); +// if (!yon_char_is_empty(file)){ +// if (!strstr(file,".ini")) file = yon_char_append(file,".ini"); +// if (access(file,0)!=F_OK){ +// char *command_creation = ubconfig_file_create(file); +// int a = system(yon_debug_output("%s\n",command_creation)); +// if (access(file,0)!=F_OK||a){ +// yon_ubl_status_box_render(CUSTOM_CONFIG_CREATION_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); +// return; +// } +// } +// } +// path = yon_char_unite("'",file,"'",NULL); +// free(file); +// gtk_widget_destroy(dialog); +// } else { +// gtk_widget_destroy(dialog); +// return; +// } +// yon_save_proceed(path,YON_CONFIG_CUSTOM); +// if (path) free(path); +// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); +// } +// +// void yon_open_browser(GtkWidget *, char *link); +// void yon_open_browser(GtkWidget *, char *link){ +// GtkWidget *window = yon_ubl_browser_window_open(link,TITLE_LABEL); +// if (window) +// gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",LocaleName)); +// } + +// void on_open_documentation_confirmation(GtkWidget *self, char *link); +// void on_open_documentation_confirmation(GtkWidget *self, char *link){ +// if (main_config.always_open_documentation==0){ +// GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_documentation); +// documentation_confirmation_window *window = malloc(sizeof(documentation_confirmation_window)); +// window->Window = yon_gtk_builder_get_widget(builder,"helpConfirmationWindow"); +// window->AcceptButton = yon_gtk_builder_get_widget(builder,"ReadHelpButton"); +// window->CloseButton = yon_gtk_builder_get_widget(builder,"CancelHelpButton"); +// window->HeaderLabel = yon_gtk_builder_get_widget(builder,"webHeaderNameLabel"); +// window->AlwaysOpenCheck = yon_gtk_builder_get_widget(builder,"AlwaysOpenDocumentationCheckbox"); +// gtk_label_set_text(GTK_LABEL(window->HeaderLabel),TITLE_LABEL); +// gtk_widget_show_all(window->Window); +// g_signal_connect(G_OBJECT(window->CloseButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); +// g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(yon_open_browser),yon_char_new(link)); +// g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); +// +// +// } else { +// yon_open_browser(self,link); +// } +// } + +// void on_link(GtkWidget *self, char* uri); +// void on_link(GtkWidget *self, char* uri){ +// gtk_widget_destroy(self); +// on_open_documentation_confirmation(self,uri); +// } + +// void on_about(GtkWidget *); +// void on_about(GtkWidget *){ +// GtkBuilder *builder=gtk_builder_new_from_resource(ui_glade_path_about); +// GtkWidget *window=yon_gtk_builder_get_widget(builder,"AboutWindow"); +// GtkWidget *title=yon_gtk_builder_get_widget(builder,"headerAboutTopic"); +// GtkWidget *hideButtonBox=yon_gtk_builder_get_widget(builder,"buttonBoxHide"); +// gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),version_application); +// gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),TITLE_LABEL); +// gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(window),yon_char_append("com.ublinux.",LocaleName)); +// gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",LocaleName)); +// gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(window),LocaleName); +// gtk_label_set_text(GTK_LABEL(title),TITLE_LABEL); +// g_signal_connect(G_OBJECT(window),"activate-link",G_CALLBACK(on_link),WIKI_LINK); +// gtk_widget_set_visible(hideButtonBox,0); +// gtk_widget_destroy(hideButtonBox); +// gtk_widget_show(window); +// } + +// double yon_size_long_convert_automatic(unsigned long bytes, char *size){ +// int repeats; +// double byte_float=bytes; +// for (repeats=-1;byte_float>1024;repeats++){ +// byte_float=byte_float/1024; +// } +// if (repeats==-1) { +// repeats=0; +// byte_float=byte_float/1024; +// } +// switch(repeats){ +// case 0: (*size)='K'; +// break; +// case 1: (*size)='M'; +// break; +// case 2: (*size)='G'; +// break; +// case 3: (*size)='T'; +// break; +// } +// return byte_float; +// } + +// // standard functions +// /**config_init() +// * [EN] +// * +// * [RU] +// * Функция инициализации всех параметров конфигурации +// */ +// void config_init(){ +// main_config.always_open_documentation=0; +// main_config.socket_id=-1; +// main_config.save_socket_id=-1; +// main_config.load_socket_id=-1; +// main_config.lock_help=0; +// main_config.lock_help=0; +// main_config.lock_load_global=0; +// main_config.lock_save_global=0; +// main_config.lock_save_local=0; +// main_config.debug_mode=0; +// main_config.slider_thread=0; +// main_config.install_thread=0; +// main_config.progress_thread=0; +// main_config.install_complete=0; +// main_config.save_done=0; +// main_config.save_configured=0; +// main_config.configure_mode=0; +// main_config.load_mode=-1; +// main_config.log_progress_buzy=0; +// main_config.log_end=0; +// main_config.exit_accepted=0; +// } + +// void on_root_get_root(char *argline){ +// yon_launch(argline); +// } + +// void on_configuration_mode_switch(GtkWidget *self,main_window *widgets){ +// if (getuid()) { +// if (main_config.configure_mode==1){ +// char *argline = LocaleName; +// for (int i=1;iMainWindow); +// } +// } +// } +// main_config.configure_mode = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(self)); +// } + +// int yon_image_resize_from_container(GtkImage *target, GdkPixbuf *pixbuf_unscaled){ +// int width = gtk_widget_get_allocated_width((gtk_widget_get_parent(GTK_WIDGET(target)))); +// int height = gtk_widget_get_allocated_height((gtk_widget_get_parent(GTK_WIDGET(target)))); +// +// int newImgWidthDef = (width <= 217) ? width : width - 30; +// int newImgHeightDef = (height <= 120) ? height : height - 80; +// +// int originalWidth = gdk_pixbuf_get_width(pixbuf_unscaled); +// int originalHeight = gdk_pixbuf_get_height(pixbuf_unscaled); +// int newImgHeight = (int)(originalHeight / ((double) originalWidth / newImgWidthDef)); +// +// if (newImgHeight > newImgHeightDef) { +// newImgHeight = newImgHeightDef; +// newImgWidthDef = (int)(originalWidth / ((double) originalHeight / newImgHeight)); +// } +// int newImageWidth = (int)(originalWidth / ((double) originalHeight / newImgHeight)); +// +// GdkPixbuf *scaledPixBuf = gdk_pixbuf_scale_simple(pixbuf_unscaled, newImageWidth, newImgHeight, GDK_INTERP_BILINEAR); +// gtk_image_set_from_pixbuf(target, scaledPixBuf); +// +// g_object_unref(scaledPixBuf); +// +// return 1; +// } + +// void on_region_resized(GtkWidget *,main_window *widgets){ +// yon_image_resize_from_container(GTK_IMAGE(widgets->SlidesImage), (GdkPixbuf*)g_list_nth_data(widgets->slides_original,cur_slide)); +// yon_image_resize_from_container(GTK_IMAGE(widgets->RegionImage), widgets->regions_original); +// yon_image_resize_from_container(GTK_IMAGE(widgets->KeyboardImage), widgets->keyboard_original); +// } + +void yon_switch_page_render(main_window *widgets){ + + enum YON_PAGES page = yon_page_get_current(GTK_NOTEBOOK(widgets->Notebook)); switch(page){ - case YON_PAGE_WELCOME: { - gtk_widget_hide(widgets->SaveButton); - gtk_widget_set_sensitive(widgets->CancelInstallButton,0); - gtk_widget_set_sensitive(widgets->BackButton,0); - gtk_widget_set_sensitive(widgets->NextButton,1); - textdomain(LocaleName); - gtk_button_set_label(GTK_BUTTON(widgets->NextButton),NEXT_LABEL); - gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),CANCEL_LABEL); - gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))),"com.ublinux.ubinstall-gtk.arrow-right-symbolic",GTK_ICON_SIZE_BUTTON); - gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->CancelInstallButton))),"com.ublinux.ubinstall-gtk.circle-exit-symbolic",GTK_ICON_SIZE_BUTTON); - gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,1); - yon_switch_page_render(widgets,0); - } break; - - case YON_PAGE_LICENCE:{ - gtk_widget_set_sensitive(widgets->CancelInstallButton,1); - gtk_widget_set_sensitive(widgets->BackButton,1); - yon_switch_page_render(widgets,1); - } break; - - case YON_PAGE_REGION: { - yon_image_resize_from_container(GTK_IMAGE(widgets->RegionImage), widgets->regions_original); - yon_switch_page_render(widgets,4); - } break; - - case YON_PAGE_KEYBOARD: { - - yon_switch_page_render(widgets,5); - yon_image_resize_from_container(GTK_IMAGE(widgets->KeyboardImage), widgets->keyboard_original); - } break; - - case YON_PAGE_OS_COMPONENTS: - case YON_PAGE_SOFTWARE: - case YON_PAGE_INSTALLATION_BEGIN: - yon_switch_page_render(widgets,3); - - break; - case YON_PAGE_INSTALLATION:{ - yon_switch_page_render(widgets,3); - gtk_widget_set_sensitive(widgets->BackButton,0); - if ((!main_config.configure_mode)) - gtk_widget_set_sensitive(widgets->CancelInstallButton,0); - if (!main_config.progress_thread&&!main_config.configure_mode) - main_config.progress_thread = gdk_threads_add_timeout(500,(GSourceFunc)yon_installation_progress_update,widgets); - - if (!main_config.slider_thread&&!main_config.configure_mode) - main_config.slider_thread = g_timeout_add(5000,(GSourceFunc)on_image_slide,widgets); - gtk_widget_show(gtk_widget_get_parent(widgets->InstallationProgress)); - } break; - - case YON_PAGE_USERS: - yon_switch_page_render(widgets,6); - gtk_widget_set_sensitive(widgets->NextButton,1); - gtk_widget_hide(widgets->SaveButton); + case YON_PAGE_WELCOME: + page = 0; break; - - case YON_PAGE_INSTALL_ERROR:{ - on_summary_log_view((GtkWidget*)NULL,widgets); - - yon_switch_page_render(widgets,7); - gtk_widget_set_sensitive(widgets->BackButton,0); - gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); - gtk_widget_hide(widgets->InstallationLabel); - gtk_widget_hide(widgets->PackageInstallationLabel); - gtk_widget_set_sensitive(widgets->NextButton,1); - gtk_widget_set_sensitive(widgets->CancelInstallButton,1); - g_mutex_lock(&main_config.install_mutex); - main_config.install_complete=0; - g_mutex_unlock(&main_config.install_mutex); - main_config.save_done=0; - textdomain(LocaleName); - gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL); - gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); - gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), - "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); - - } break; - case YON_PAGE_COMPLETION:{ - yon_switch_page_render(widgets,7); - gtk_widget_set_sensitive(widgets->BackButton,0); - gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); - gtk_widget_hide(widgets->InstallationLabel); - gtk_widget_hide(widgets->PackageInstallationLabel); - gtk_widget_set_sensitive(widgets->NextButton,1); - gtk_widget_set_sensitive(widgets->CancelInstallButton,1); - g_mutex_lock(&main_config.install_mutex); - main_config.install_complete=0; - g_mutex_unlock(&main_config.install_mutex); - main_config.save_done=0; - textdomain(LocaleName); - gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL); - gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); - gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), - "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); - } - gtk_widget_hide(gtk_widget_get_parent(widgets->InstallationProgress)); - gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); + case YON_PAGE_LICENCE: + page = 1; break; - - case YON_PAGE_COMPLETED:{ - yon_switch_page_render(widgets,7); - gtk_widget_set_sensitive(widgets->BackButton,1); - gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); - gtk_widget_hide(widgets->InstallationLabel); - gtk_widget_hide(widgets->PackageInstallationLabel); - gtk_widget_set_sensitive(widgets->NextButton,0); - gtk_widget_set_sensitive(widgets->CancelInstallButton,1); - g_mutex_lock(&main_config.install_mutex); - main_config.install_complete=0; - g_mutex_unlock(&main_config.install_mutex); - main_config.save_done=0; - textdomain(LocaleName); - gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); - gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), - "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); - - }break; - case YON_PAGE_SECTIONS: + case YON_PAGE_OS_COMPONENTS: case YON_PAGE_INSTALL_COMMON: - case YON_PAGE_INSTALL_SEPARATE: case YON_PAGE_INSTALL_SAME_PARTITION: - case YON_PAGE_INSTALL_OPTIONS: - case YON_PAGE_OPTIONS_GRUB_INSTALL: - case YON_PAGE_OPTIONS_GRUB_UPDATE: - case YON_PAGE_OPTIONS_SEPARATE: - case YON_PAGE_OPTIONS_SEPARATE_USRDATA: - case YON_PAGE_OPTIONS_OS_ONLY: - case YON_PAGE_OPTIONS_USRDATA_ONLY: { - yon_switch_page_render(widgets,2); - } break; - case YON_PAGE_CONFIGURE_END: { - gtk_widget_set_sensitive(widgets->BackButton,1); - gtk_widget_set_sensitive(widgets->NextButton,0); - gtk_widget_set_sensitive(widgets->CancelInstallButton,1); - gtk_widget_show(widgets->SaveButton); - } + case YON_PAGE_INSTALL_SEPARATE: + case YON_PAGE_INSTALL_ADVANCED: + case YON_PAGE_INSTALL_RECOVERY: + case YON_PAGE_INSTALLATION_BEGIN: + case YON_PAGE_KERNEL: + case YON_PAGE_SOFTWARE: + case YON_PAGE_RECOVERY_GRUB_INSTALL: + case YON_PAGE_RECOVERY_GRUB_UPDATE: + case YON_PAGE_RECOVERY_OS_ONLY: + case YON_PAGE_RECOVERY_USRDATA_ONLY: + page = 2; + break; + case YON_PAGE_REGION: + page = 3; + break; + case YON_PAGE_KEYBOARD: + page = 4; + break; + case YON_PAGE_USERS: + page = 5; + break; + case YON_PAGE_BOOTLOADER: + case YON_PAGE_STARTUP: + case YON_PAGE_NETWORK: + page = 6; + break; + case YON_PAGE_INSTALLATION: + page = 7; + break; + case YON_PAGE_COMPLETED: + case YON_PAGE_COMPLETION: + case YON_PAGE_INSTALL_ERROR: + case YON_PAGE_CONFIGURE_END: + case YON_PAGE_CONFIGURE_SAVE: + page=8; + break; } -} - -gboolean on_install_success(main_window *widgets){ - gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),""); - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION); - - return 0; -} -gboolean on_install_error(main_window *widgets){ - gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),""); - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_ERROR); - return 0; -} - -void *on_setup_system_configuration(void * data){ - yon_debug_output("%s\n","Entered thread"); - main_window *widgets = (main_window*)data; if (widgets){}; - int size; - config_str all_parameters = yon_config_get_selection_by_key(&size, - user_name_parameter, - user_gecos_parameter, - user_password_parameter, - root_password_parameter, - autologin_parameter, - xkbmodel_parameter, - xkblayout_parameter, - xkbvariant_parameter, - xkboptions_parameter, - hostname_parameter, - zone_parameter, - lang_parameter, - locale_parameter, - NULL); - if (all_parameters){ - char *parameter_string = yon_char_parsed_to_string(all_parameters,size," "); - char *command = set_user_config_command(parameter_string); - if (system(yon_debug_output("%s\n",command))){}; - yon_char_parsed_free(all_parameters,size); - free(command); - if (parameter_string) free(parameter_string); - } - g_idle_add((GSourceFunc)on_install_success,widgets); - return NULL; -} - -void on_log_closed(GtkWidget *, dictionary *dict); -void on_log_closed(GtkWidget *, dictionary *dict){ - main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); - log_window *window = yon_dictionary_get_data(dict->first->next,log_window*); - - gtk_widget_set_sensitive(widgets->ReadFullLogButton,1); - gtk_widget_set_sensitive(widgets->ReadShortLogButton,1); - - free(window->command); - window->Window=NULL; -} - -log_window *yon_log_window_new(); -log_window *yon_log_window_new(){ - log_window *window = malloc(sizeof(log_window)); - GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_log_view); - window->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); - window->ScrollWindow = yon_gtk_builder_get_widget(builder,"ScrollWindow"); - window->HeadLabel = yon_gtk_builder_get_widget(builder,"headerTopic"); - window->LogLabel = yon_gtk_builder_get_widget(builder,"LogLabel"); - window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); - window->ScrollToEndCheck = yon_gtk_builder_get_widget(builder,"ScrollToEndCheck"); - gtk_widget_show(window->Window); - return window; -} - -gboolean yon_read_log(void *data); -gboolean yon_read_log(void *data){ - log_window *window = (log_window*)data; - if (window->Window){ - int size; - g_mutex_lock(&main_config.progress_mutex); - config_str parsed = yon_file_open(window->command,&size); - g_mutex_unlock(&main_config.progress_mutex); - if (size){ - char *final = yon_char_parsed_to_string(parsed,size,""); - gtk_label_set_text(GTK_LABEL(window->LogLabel),final); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck))){ - gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)),gtk_adjustment_get_upper(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)))); - } - free(final); - yon_char_parsed_free(parsed,size); - } - g_mutex_lock(&main_config.install_mutex); - if (!main_config.install_complete){ - g_mutex_unlock(&main_config.install_mutex); - return 1; - } else { - g_mutex_unlock(&main_config.install_mutex); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck),0); - gtk_widget_set_sensitive(window->ScrollToEndCheck,0); - } - } -return 0; -} - -void on_process_log_view(GtkWidget *,main_window *widgets); -void on_process_log_view(GtkWidget *,main_window *widgets){ - log_window *window = yon_log_window_new(); - dictionary *dict=NULL; - yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); - yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); - g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),dict); - gtk_widget_set_sensitive(widgets->ReadFullLogButton,0); - gtk_widget_set_sensitive(widgets->ReadShortLogButton,0); - yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,INSTALL_LOG_LABEL,icon_path,"log_viewer"); - window->command = yon_char_new(short_log_path); - gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); -} - -void on_summary_log_view(GtkWidget *,main_window *widgets){ - log_window *window = yon_log_window_new(); - dictionary *dict=NULL; - yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); - yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); - g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),dict); - gtk_widget_set_sensitive(widgets->ReadFullLogButton,0); - gtk_widget_set_sensitive(widgets->ReadShortLogButton,0); - yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,PROGRESS_LOG_LABEL,icon_path,"log_viewer"); - window->command = yon_char_new(full_log_path); - gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); - -} - -void yon_install_options_save(GtkWidget *device_tree, GtkWidget *part_tree,char *mode,main_window *widgets); -void yon_install_options_save(GtkWidget *device_tree, GtkWidget *part_tree,char *mode,main_window *widgets){ - GtkTreeIter iter,itar; - GtkTreeModel *model,*model2; - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(device_tree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(device_tree)); - return; - } - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(part_tree)),&model2,&itar)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(part_tree)); - return; - } - char *cur_device, *cur_section; - gtk_tree_model_get(model,&iter,0,&cur_device,-1); - gtk_tree_model_get(model2,&itar,0,&cur_section,-1); - yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,cur_device); - yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,mode); - yon_config_register(part_parameter,part_parameter_command,cur_section); - - if(cur_section) free(cur_section); - if(cur_device) free(cur_device); - if (!main_config.configure_mode) - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION_BEGIN); - else - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_REGION); -} - -void on_page_navigation_clicked(GtkWidget *self, main_window *widgets); -void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){ - int mode = self==widgets->NextButton ? 1 : self == widgets->BackButton ? -1 : self==widgets->CancelInstallButton?-2:0; - int page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); - switch (mode){ - case 1: { // Next - switch (page){ - case YON_PAGE_WELCOME:{ - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_LICENCE); - gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,0); - } break; - - case YON_PAGE_SECTIONS:{ //sections - int active_id=-1; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->InstallationRadio))) - active_id=0; - else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->InstallationNearRadio))) - active_id=1; - else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->InstallationLinuxRadio))) - active_id=2; - else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio))) - active_id=3; - else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->InstallationRadio))) - active_id=4; - main_config.install_mode=active_id; - switch (active_id){ - case 0:{ // normal installation - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_COMMON); - } break; - case 1: - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_SEPARATE); - break; - case 2: - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_SAME_PARTITION); - break; - case 3: - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_OPTIONS); - } - }break; - case YON_PAGE_REGION:{ //region - gtk_widget_set_sensitive(widgets->BackButton,1); - if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->RegionCombo))==-1){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),REGION_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(widgets->RegionCombo); - return; - } else if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->ZoneCombo))==-1){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),ZONE_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(widgets->ZoneCombo); - return; - } - char *languages = ""; - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->LanguagesFilter); - char *lang_code=NULL; - for_iter(model,&iter){ - gtk_tree_model_get(model,&iter,2,&lang_code,-1); - languages = yon_char_unite(languages,!yon_char_is_empty(languages)?",":"",lang_code,NULL); - } - if (yon_char_is_empty(languages)||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->MainLanguageSensitiveCheck))){ - yon_config_remove_by_key(locale_parameter); - } else { - yon_config_register(locale_parameter,locale_parameter_command,languages); - free(languages); - } - if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->LanguagesCombo))==-1||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck))){ - yon_config_remove_by_key(lang_parameter); - } else { - char *language = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->LanguagesCombo)); - yon_config_register(lang_parameter,lang_parameter_command,language); - } - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck))){ - char *region = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->RegionCombo)); - char *zone = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->ZoneCombo)); - yon_debug_output("%s",region); - yon_debug_output("/%s\n\n",zone); - yon_config_register(zone_parameter,zone_parameter_command,yon_char_unite(region,"/",zone,NULL)); - } else { - yon_config_remove_by_key(zone_parameter); - } - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page+1); - }break; - - case YON_PAGE_KEYBOARD: { //keyboard - gtk_widget_set_sensitive(widgets->BackButton,1); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio))){ - GtkTreeIter iter; - if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->LayoutList),&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),LAYOUTS_CHOSEN_BUT_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(widgets->ManualLayoutRadio); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->LayoutTree)); - } - } - char *layouts_list=""; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio))&>k_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LayoutSensitiveCheck))){ - GtkTreeModel *layouts_model=GTK_TREE_MODEL(widgets->LayoutList); - GtkTreeIter iter; - char *cur_layout=NULL; - for_iter(layouts_model,&iter){ - int chosen=0; - gtk_tree_model_get(layouts_model,&iter,0,&cur_layout,3,&chosen,-1); - if (chosen) - layouts_list = yon_char_unite(layouts_list,yon_char_is_empty(layouts_list)?"":",",cur_layout,NULL); - } - } else { - yon_config_remove_by_key(xkblayout_parameter); - } - if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo))&>k_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->KeyboardModelSensitiveCheck))){ - char *model = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo)); - // char *layout_switch; - if (!yon_char_is_empty(model)) - yon_config_register(xkbmodel_parameter,xkbmodel_parameter_command,model); - } else{ - yon_config_remove_by_key(xkbmodel_parameter); - } - if (yon_char_is_empty(layouts_list)&>k_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LayoutSensitiveCheck))) - yon_config_register(xkblayout_parameter,xkblayout_parameter_command,layouts_list); - else - yon_config_remove_by_key(xkblayout_parameter); - - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page+1); - } break; - - default:{ // all other pages - gtk_widget_set_sensitive(widgets->BackButton,1); - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page+1); - }break; - - case YON_PAGE_INSTALL_COMMON: { - GtkTreeModel *model; - GtkTreeIter iter; - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->CommonInstallationDevicesTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->CommonInstallationDevicesTree)); - return; - } - char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->CommonInstallationFilesystemTypeCombo)); - char *device_name = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->CommonInstallationSectionNameEntry)); - char *device; - yon_config_remove_by_key(part_size_parameter); - yon_config_remove_by_key(part_parameter); - gtk_tree_model_get(model,&iter,0,&device,-1); - yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"fast"); - yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,device); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->CommonSectionSensitiveCheck))){ - yon_config_register(device_label_parameter,device_label_parameter_command,device_name); - } else { - yon_config_remove_by_key(device_label_parameter); - } - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->CommonFilesystemSensitiveCheck))){ - yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type); - } else { - yon_config_remove_by_key(part_type_parameter); - } - - if (!main_config.configure_mode) - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION_BEGIN); - else - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_REGION); - }break; - - case YON_PAGE_INSTALL_SEPARATE: - { - GtkTreeModel *model; - GtkTreeIter iter; - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->InstallationNearSysDevicesTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->CommonInstallationDevicesTree)); - return; - } - char *device; - gtk_tree_model_get(model,&iter,0,&device,-1); - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->InstallationNearSysSectionTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->CommonInstallationDevicesTree)); - return; - } - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextSizeSensitiveCheck))){ - double part_size = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)); - if (part_size){ - char *size_letter = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin)); - char *size_final = yon_char_append(yon_char_from_long((long)part_size),size_letter); - yon_config_register(part_size_parameter,part_size_parameter_command,size_final); - } else yon_config_remove_by_key(part_size_parameter); - } else yon_config_remove_by_key(part_size_parameter); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextLabelSensitiveCheck))){ - char *device_name = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry)); - yon_config_register(device_label_parameter,device_label_parameter_command,device_name); - } else { - yon_config_remove_by_key(device_label_parameter); - } - char *part; - gtk_tree_model_get(model,&iter,0,&part,-1); - yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"next"); - yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,device); - yon_config_register(part_parameter,part_parameter_command,part); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextFSTypeSensitiveCheck))){ - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck))){ - yon_config_register(device_format_parameter,device_format_parameter_command,"no"); - yon_config_remove_by_key(part_type_parameter); - } else { - char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->NextInstallationFilesystemTypeCombo)); - yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type); - yon_config_remove_by_key(device_format_parameter); - } - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck))) - yon_config_register(device_format_parameter,device_format_parameter_command,"no"); - } else { - yon_config_remove_by_key(part_type_parameter); - yon_config_remove_by_key(device_format_parameter); - } - if (!main_config.configure_mode) - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION_BEGIN); - else - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_REGION); - } - break; - - case YON_PAGE_INSTALL_SAME_PARTITION: - { - GtkTreeModel *model; - GtkTreeIter iter; - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SamePlaceDeviceTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->CommonInstallationDevicesTree)); - return; - } - char *device; - gtk_tree_model_get(model,&iter,0,&device,-1); - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SamePlacePartTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->CommonInstallationDevicesTree)); - return; - } - yon_config_remove_by_key(part_size_parameter); - char *part; - gtk_tree_model_get(model,&iter,0,&part,-1); - yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"part"); - yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,device); - yon_config_register(part_parameter,part_parameter_command,part); - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->SameLabelSensitiveCheck))){ - char *device_name = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry)); - yon_config_register(device_label_parameter,device_label_parameter_command,device_name); - } else { - yon_config_remove_by_key(device_label_parameter); - } - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->SameFSTypeSensitiveCheck))){ - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->SameInstallationFormatCheck))){ - yon_config_register(device_format_parameter,device_format_parameter_command,"no"); - yon_config_remove_by_key(part_type_parameter); - } else { - char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->SameInstallationFilesystemTypeCombo)); - yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type); - yon_config_remove_by_key(device_format_parameter); - } - } else { - yon_config_remove_by_key(device_format_parameter); - yon_config_remove_by_key(part_type_parameter); - - } - - if (!main_config.configure_mode) - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION_BEGIN); - else - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_REGION); - }break; - - case YON_PAGE_USERS:{ //users - - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UsernameSensitiveCheck))){ - yon_config_remove_by_key(user_gecos_parameter); - } else { - char *username = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry)); - if (username){}; - yon_config_register(user_gecos_parameter,user_gecos_parameter_command,username); - } - - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck))){ - yon_config_remove_by_key(user_name_parameter); - } else { - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck))){ - yon_config_register(user_name_parameter,user_name_parameter_command,"root"); - } else { - char *login = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)); - if (login){}; - yon_config_register(user_name_parameter,user_name_parameter_command,login); - } - } - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->PasswordSensitiveCheck))){ - if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->PasswordCombo))==1){ - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->PasswordEntry)))){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(widgets->PasswordEntry); - return; - } else { - char *password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->PasswordEntry)); - if (password){}; - - yon_config_register(user_password_parameter,user_password_parameter_command,password); - - } - } else { - yon_config_remove_by_key(user_password_parameter); - } - }else { - yon_config_remove_by_key(user_password_parameter); - - } - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->RootPasswordSensitiveCheck))){ - if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo))==1){ - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->AdminPasswordEntry)))){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(widgets->AdminPasswordEntry); - return; - } else { - char *root_password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->AdminPasswordEntry)); - if (root_password){}; - yon_config_register(root_password_parameter,root_password_parameter_command,root_password); - - } - } else { - yon_config_remove_by_key(root_password_parameter); - } - } else { - yon_config_remove_by_key(root_password_parameter); - } - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck))){ - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ - yon_config_register(hostname_parameter,hostname_parameter_command,"auto"); - } else { - if (!yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->HotnameEntry)))){ - char *hostname = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->HotnameEntry)); - if (hostname){}; - yon_config_register(hostname_parameter,hostname_parameter_command,hostname); - - } else { - yon_config_remove_by_key(hostname_parameter); - - } - } - } else { - yon_config_remove_by_key(hostname_parameter); - } - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutologinSensitiveCheck))){ - char *autologin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck))?"yes":"no"; - if (autologin){}; - yon_config_register(autologin_parameter,autologin_parameter_command,autologin); - } else { - yon_config_remove_by_key(autologin_parameter); - } - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LayoutSensitiveCheck))){ - GtkTreeIter iter; - if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->LayoutsFilter),&iter)){ - char *locales=""; - for_iter (GTK_TREE_MODEL(widgets->LayoutsFilter),&iter){ - char *id; - int status; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutsFilter),&iter,0,&id,3,&status,-1); - if (status){ - char *temp = yon_char_unite(locales,!yon_char_is_empty(locales)?",":"",id,NULL); - locales=temp; - } - } - if (!yon_char_is_empty(locales)){ - printf("%s\n",locales); - yon_config_register(xkblayout_parameter,xkblayout_parameter_command,locales); - } else { - yon_config_remove_by_key(xkblayout_parameter); - } - } - } else { - yon_config_remove_by_key(xkblayout_parameter); - } - - if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->LayoutBindingCombo))&>k_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->OptionsSensitiveCheck))){ - char *options = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->LayoutBindingCombo)); - if (options){}; - yon_config_register(xkboptions_parameter,xkboptions_parameter_command,options); - } else { - yon_config_remove_by_key(xkboptions_parameter); - } - - if (!main_config.configure_mode){ - g_mutex_lock(&main_config.install_mutex); - if (main_config.install_complete){ - g_mutex_unlock(&main_config.install_mutex); - yon_debug_output("%s\n","Entered saving before installation done"); - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION); - gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),CONFIGURATION_LABEL); - yon_debug_output("%s\n","installation ending configuration startup"); - pthread_t tid; - pthread_create(&tid,NULL,on_setup_system_configuration,widgets); - - gtk_widget_set_sensitive(widgets->CancelInstallButton,0); - gtk_widget_set_sensitive(widgets->NextButton,0); - gtk_widget_set_sensitive(widgets->BackButton,0); - main_config.save_done=1; - } - else if (!main_config.install_complete){ - g_mutex_unlock(&main_config.install_mutex); - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION); - - gtk_widget_set_sensitive(widgets->CancelInstallButton,0); - gtk_widget_set_sensitive(widgets->NextButton,0); - gtk_widget_set_sensitive(widgets->BackButton,0); - main_config.save_configured=1; - } - } else { - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_CONFIGURE_END); - } - }break; - - case YON_PAGE_INSTALLATION_BEGIN:{ - g_mutex_lock(&main_config.install_mutex); - if (!main_config.install_thread){ - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_t tid; - - pthread_create(&tid,&attr,on_config_save,widgets); - memcpy(&main_config.install_thread,&tid,sizeof(pthread_t)); - g_mutex_unlock(&main_config.install_mutex); - } - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION); - } break; - - case YON_PAGE_INSTALL_ERROR: - case YON_PAGE_COMPLETION:{ - confirmation_window *window = yon_confirmation_window_new(); - dictionary *dict = NULL; - yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); - yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); - g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_reboot_accepted),dict); - gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->MainWindow)); - gtk_window_set_title(GTK_WINDOW(window->Window),TITLE_LABEL); - gtk_window_set_icon_name(GTK_WINDOW(window->Window),icon_path); - gtk_label_set_text(GTK_LABEL(window->TextLabel),WARNING_REBOOT_TEXT_LABEL); - gtk_label_set_text(GTK_LABEL(window->TitleLabel),WARNING_TITLE_LABEL); - gtk_widget_show(window->Window); - } - break; - - case YON_PAGE_INSTALL_OPTIONS: { - int mode = -1; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->GrubInstallRadio))){ - mode = 0; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->GrubUpdateRadio))){ - mode = 1; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->SeparateRadio))){ - mode = 2; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->OSRadio))){ - mode = 3; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UserDataOnlyRadio))){ - mode = 4; - } - switch(mode){ - case 0: gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_OPTIONS_GRUB_INSTALL); - break; - case 1: gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_OPTIONS_GRUB_UPDATE); - break; - case 2: gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_OPTIONS_SEPARATE); - break; - case 3: gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_OPTIONS_OS_ONLY); - break; - case 4: gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_OPTIONS_USRDATA_ONLY); - break; - } - } break; - - case YON_PAGE_OPTIONS_GRUB_INSTALL:{ - GtkTreeIter iter; - GtkTreeModel *model; - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GrubInstallDevicesTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->GrubInstallDevicesTree)); - return; - } - char *cur_device; - gtk_tree_model_get(model,&iter,0,&cur_device,-1); - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GrubInstallPartitionTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->GrubInstallPartitionTree)); - return; - } - char *partition; - gtk_tree_model_get(model,&iter,0,&partition,-1); - yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,cur_device); - yon_config_register(part_parameter,part_parameter_command,partition); - yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"grub_install"); - yon_config_remove_by_key(part_parameter); - if (!main_config.configure_mode) - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION_BEGIN); - else - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_CONFIGURE_END); - - } break; - - case YON_PAGE_OPTIONS_GRUB_UPDATE:{ - GtkTreeIter iter; - GtkTreeModel *model; - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GrubUpdateDevicesTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->GrubUpdateDevicesTree)); - return; - } - char *cur_device; - gtk_tree_model_get(model,&iter,0,&cur_device,-1); - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GrubUpdatePartitionTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->GrubUpdatePartitionTree)); - return; - } - char *partition; - gtk_tree_model_get(model,&iter,0,&partition,-1); - yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,cur_device); - yon_config_register(part_parameter,part_parameter_command,partition); - yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"grub_update"); - yon_config_remove_by_key(part_parameter); - if (!main_config.configure_mode) - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION_BEGIN); - else - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_CONFIGURE_END); - }break; - - case YON_PAGE_OPTIONS_SEPARATE:{ - GtkTreeModel *model; - GtkTreeIter iter; - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SeparateDevicesTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->SeparateDevicesTree)); - return; - } - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SeparateSysSectionTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->SeparateSysSectionTree)); - return; - } - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_OPTIONS_SEPARATE_USRDATA); - }break; - - case YON_PAGE_OPTIONS_SEPARATE_USRDATA:{ - GtkTreeIter iter,itar; - GtkTreeModel *model,*model2; - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->OSSysSectionTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->OSSysSectionTree)); - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_OPTIONS_OS_ONLY); - return; - } - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SeparateUserDevicesTree)),&model2,&itar)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->SeparateUserDevicesTree)); - return; - } - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SeparateUserSysSectionTree)),&model2,&itar)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->SeparateUserSysSectionTree)); - return; - } - char *cur_device, *system_section, *user_section; - gtk_tree_model_get(model,&iter,0,&cur_device,-1); - gtk_tree_model_get(model2,&itar,0,&system_section,-1); - - gtk_tree_model_get(model2,&itar,0,&user_section,-1); - yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,cur_device); - char *installation_parts = yon_char_unite(system_section,",",user_section,NULL); - yon_config_register(part_parameter,part_parameter_command,installation_parts); - free(installation_parts); - yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"custom"); - if (!main_config.configure_mode) - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION_BEGIN); - else - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_REGION); - - } break; - - case YON_PAGE_OPTIONS_OS_ONLY:{ - yon_install_options_save(widgets->OSDevicesTree,widgets->OSSysSectionTree,"system_only",widgets); - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_CONFIGURE_END); - } break; - - case YON_PAGE_OPTIONS_USRDATA_ONLY:{ - yon_install_options_save(widgets->UserdataDevicesTree,widgets->UserdataSysSectionTree,"data_only",widgets); - } break; - } - } break; - case -1: { // Previous - switch (page){ - case YON_PAGE_REGION: { - if (!main_config.configure_mode){ - gtk_widget_set_sensitive(widgets->BackButton,0); - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page-1); - } else { - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_SECTIONS); - } - }break; - - case YON_PAGE_INSTALL_COMMON: - case YON_PAGE_INSTALL_SEPARATE: - case YON_PAGE_INSTALL_SAME_PARTITION: - case YON_PAGE_INSTALL_OPTIONS: - { - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_SECTIONS); - } break; - - case YON_PAGE_OPTIONS_GRUB_INSTALL: - case YON_PAGE_OPTIONS_GRUB_UPDATE: - case YON_PAGE_OPTIONS_SEPARATE: - case YON_PAGE_OPTIONS_OS_ONLY: - case YON_PAGE_OPTIONS_USRDATA_ONLY: - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_OPTIONS); - break; - - case YON_PAGE_INSTALLATION_BEGIN: - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_SECTIONS); - break; - - case YON_PAGE_CONFIGURE_END:{ - if (main_config.install_mode==3&&(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->GrubInstallRadio))||gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->GrubUpdateRadio))||gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->OSRadio)))){ - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_OPTIONS); - gtk_widget_set_sensitive(widgets->BackButton,1); - gtk_widget_set_sensitive(widgets->NextButton,1); - gtk_widget_set_sensitive(widgets->CancelInstallButton,1); - - } else { //||||gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UserDataOnlyRadio)) - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_USERS); - } - } break; - - case YON_PAGE_COMPLETED:{ - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_USERS); - } break; - - default:{ - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page-1); - } - } - - } break; - case -2: { // Cancel/repeat - switch (page){ - case YON_PAGE_COMPLETION: - case YON_PAGE_INSTALL_ERROR:{ - gtk_main_quit(); - }break; - default:{ - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),0); - } - } - }break; - } -} - -void on_region_changed(GtkComboBox *self, main_window *widgets); -void on_region_changed(GtkComboBox *self, main_window *widgets){ - char *active = (char*)gtk_combo_box_get_active_id(self); - active = yon_char_append("/usr/share/zoneinfo/",active); - int size; - gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo)); - if (yon_file_is_directory(active)){ - config_str parsed = yon_file_ls(active,&size); - for (int i=0;iZoneCombo),parsed[i],_(parsed[i])); - } - if (size) yon_char_parsed_free(parsed,size); - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ZoneCombo),0); - } - free(active); -} - -void on_locale_changed(GtkWidget *,main_window *); -void on_locale_changed(GtkWidget *,main_window *){ - -} - -void on_additional_software_toggled(); -void on_additional_software_toggled(){ - -} - -void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_size, GtkComboBox *size_type); -void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_size, GtkComboBox *size_type){ - GtkTreeModel *model; - GtkTreeIter iter; - char *selected_size=NULL; - if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(table),&model,&iter)){ - gtk_tree_model_get(model,&iter,2,&selected_size,-1); - if (yon_char_is_empty(selected_size)) - gtk_tree_model_get(model,&iter,1,&selected_size,-1); - if (!yon_char_is_empty(selected_size)){ - int size = gtk_combo_box_get_active(size_type); - double cur_size = atof(selected_size); - char cur_size_letter = selected_size[strlen(selected_size)-1]; - int cur_size_type=0; - switch (cur_size_letter){ - case 'M': - cur_size_type=0; - break; - case 'G': - cur_size_type=1; - break; - case 'T': - cur_size_type=2; - break; - } - if (size-cur_size_type>0){ - for (int i=0;iInstallationNearSysSectionTree) - yon_set_max_size_from_partition(GTK_TREE_VIEW(widgets->InstallationNearSysSectionTree),GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin)); - -} - -void on_separate_installation_changed(GtkWidget *self, main_window *widgets); -void on_separate_installation_changed(GtkWidget *self, main_window *widgets){ - - gtk_list_store_clear(widgets->PartitionsList); - GtkTreeIter iter; - GtkTreeModel *model; - if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(self)),&model,&iter)){ - gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SeparateUserDevicesTree)),&iter); - char *disk_path=""; - gtk_tree_model_get(model,&iter,0,&disk_path,-1); - int size; - config_str parsed; - parsed = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); - char *string = yon_char_parsed_to_string(parsed,size,""); - struct json_object *root; - struct json_object *blockdevices; - root = json_tokener_parse(string); - json_object_object_get_ex(root, "blockdevices", &blockdevices); - for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { - struct json_object *device = json_object_array_get_idx(blockdevices, i); - struct json_object *type, *path, *size, *model, *fstype, *fsused; - - json_object_object_get_ex(device, "type", &type); - if (strcmp("part",json_object_get_string(type))) - continue; - json_object_object_get_ex(device, "path", &path); - if (!strstr(json_object_get_string(path),disk_path)){ - continue; - } - json_object_object_get_ex(device, "size", &size); - json_object_object_get_ex(device, "model", &model); - json_object_object_get_ex(device, "fstype", &fstype); - json_object_object_get_ex(device, "fsused", &fsused); - - double free_space=0; - char *free_space_string=""; - if (size&&fsused){ - char *fsused_str = (char*)json_object_get_string(fsused); - double fsused_kbytes = atof(fsused_str); - for (int i=0;i1024;sz=sz+1){ - free_space=free_space/1024; - } - if (sz==-1) { - sz=0; - free_space=free_space/1024; - } - free_space_string = yon_char_append(yon_char_from_double(free_space)," "); - free_space_string[strlen(free_space_string)-1]=*(yon_size_get_mod(sz)); - } - gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)),0.0); - gtk_list_store_append(widgets->PartitionsList,&iter); - gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(size),2,free_space_string,3,json_object_get_string(fstype),-1); - } - yon_char_parsed_free(parsed,size); - } -} - -void on_near_installation_device_changed(GtkWidget *self, main_window *widgets){ - gtk_list_store_clear(widgets->PartitionsList); - GtkTreeIter iter; - GtkTreeModel *model; - if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(self)),&model,&iter)){ - char *disk_path=""; - gtk_tree_model_get(model,&iter,0,&disk_path,-1); - int size; - config_str parsed; - parsed = yon_config_load((get_parts_and_devices_command),&size); - char *string = yon_char_parsed_to_string(parsed,size,""); - struct json_object *root; - struct json_object *blockdevices; - root = json_tokener_parse(string); - json_object_object_get_ex(root, "blockdevices", &blockdevices); - for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { - struct json_object *device = json_object_array_get_idx(blockdevices, i); - struct json_object *type, *path, *size, *model, *fstype, *fsused, *label; - - json_object_object_get_ex(device, "type", &type); - if (strcmp("part",json_object_get_string(type))) - continue; - json_object_object_get_ex(device, "path", &path); - if (!strstr(json_object_get_string(path),disk_path)){ - continue; - } - json_object_object_get_ex(device, "size", &size); - json_object_object_get_ex(device, "model", &model); - json_object_object_get_ex(device, "label", &label); - json_object_object_get_ex(device, "fstype", &fstype); - json_object_object_get_ex(device, "fsused", &fsused); - - double free_space=0; - char *free_space_string=""; - if (size&&fsused){ - char *fsused_str = (char*)json_object_get_string(fsused); - double fsused_kbytes = atof(fsused_str); - for (int i=0;iUsersToggle)); + GList *list = gtk_container_get_children(parent); + for (guint i=0;i1024;sz=sz+1){ - free_space=free_space/1024; - } - if (sz==-1) { - sz=0; - free_space=free_space/1024; - } - free_space_string = yon_char_append(yon_char_from_double(free_space)," "); - free_space_string[strlen(free_space_string)-1]=*(yon_size_get_mod(sz)); - } - // gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),0.0); - gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)),0.0); - gtk_list_store_append(widgets->PartitionsList,&iter); - gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(size),2,free_space_string,3,json_object_get_string(fstype),4,json_object_get_string(label),-1); } - yon_char_parsed_free(parsed,size); } + g_list_free(list); } -void on_same_installation_device_changed(GtkWidget *, main_window *widgets); -void on_same_installation_device_changed(GtkWidget *, main_window *widgets){ - gtk_list_store_clear(widgets->PartitionsList); - GtkTreeIter iter; - GtkTreeModel *model; - if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SamePlaceDeviceTree)),&model,&iter)){ - char *disk_path=""; - gtk_tree_model_get(model,&iter,0,&disk_path,-1); - int size; - config_str parsed; - parsed = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); - char *string = yon_char_parsed_to_string(parsed,size,""); - struct json_object *root; - struct json_object *blockdevices; - root = json_tokener_parse(string); - json_object_object_get_ex(root, "blockdevices", &blockdevices); - for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { - struct json_object *device = json_object_array_get_idx(blockdevices, i); - struct json_object *type, *path, *size, *model, *vendor, *serial; - - json_object_object_get_ex(device, "type", &type); - if (strcmp("part",json_object_get_string(type))) - continue; - json_object_object_get_ex(device, "path", &path); - if (!strstr(json_object_get_string(path),disk_path)){ - continue; - } - json_object_object_get_ex(device, "size", &size); - json_object_object_get_ex(device, "model", &model); - json_object_object_get_ex(device, "vendor", &vendor); - json_object_object_get_ex(device, "serial", &serial); - - gtk_list_store_append(widgets->PartitionsList,&iter); - gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(model),2,json_object_get_string(serial),3,json_object_get_string(size),4,json_object_get_string(vendor),-1); - } - yon_char_parsed_free(parsed,size); - } +// gboolean on_image_slide(void *data){ +// main_window *widgets = (main_window*)data; +// int size; +// config_str target = yon_char_parsed_new(&size,slide_repeat_path); +// if (size) +// yon_char_parsed_free(target,size); +// gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->SlidesImage),(GdkPixbuf*)g_list_nth_data(widgets->slides_original,cur_slide)); +// // gtk_widget_queue_draw(widgets->SlidesImage); +// if (cur_slideInstallationLabel), current_copy); +// gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress), fraction / 100); +// gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress), 0); +// gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), ""); +// } else { +// gtk_widget_show(gtk_widget_get_parent(widgets->PackageInstallationProgress)); +// +// config_str parsed = yon_char_parse(current_copy, &size, " "); +// if (size >= 3) { +// double fraction = atof(parsed[2]) / 100; +// gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress), fraction); +// gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), yon_char_parsed_to_string(parsed, size, " ")); +// } +// } +// +// } +// yon_char_parsed_free(text, size); +// } +// +// g_mutex_lock(&main_config.install_mutex); +// if (main_config.install_thread) { +// g_mutex_unlock(&main_config.install_mutex); +// return 1; +// } else { +// g_mutex_unlock(&main_config.install_mutex); +// gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), ""); +// return 0; +// } +// } + +// void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){ +// if (widgets){}; +// switch(page){ +// case YON_PAGE_WELCOME: { +// gtk_widget_hide(widgets->SaveButton); +// gtk_widget_set_sensitive(widgets->CancelInstallButton,0); +// gtk_widget_set_sensitive(widgets->BackButton,0); +// gtk_widget_set_sensitive(widgets->NextButton,1); +// textdomain(LocaleName); +// gtk_button_set_label(GTK_BUTTON(widgets->NextButton),NEXT_LABEL); +// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),CANCEL_LABEL); +// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))),"com.ublinux.ubinstall-gtk.arrow-right-symbolic",GTK_ICON_SIZE_BUTTON); +// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->CancelInstallButton))),"com.ublinux.ubinstall-gtk.circle-exit-symbolic",GTK_ICON_SIZE_BUTTON); +// gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,1); +// yon_switch_page_render(widgets,0); +// } break; +// +// case YON_PAGE_LICENCE:{ +// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); +// gtk_widget_set_sensitive(widgets->BackButton,1); +// yon_switch_page_render(widgets,1); +// } break; +// +// case YON_PAGE_REGION: { +// yon_image_resize_from_container(GTK_IMAGE(widgets->RegionImage), widgets->regions_original); +// yon_switch_page_render(widgets,4); +// } break; +// +// case YON_PAGE_KEYBOARD: { +// +// yon_switch_page_render(widgets,5); +// yon_image_resize_from_container(GTK_IMAGE(widgets->KeyboardImage), widgets->keyboard_original); +// } break; +// +// case YON_PAGE_OS_COMPONENTS: +// case YON_PAGE_SOFTWARE: +// case YON_PAGE_INSTALLATION_BEGIN: +// yon_switch_page_render(widgets,3); +// +// break; +// case YON_PAGE_INSTALLATION:{ +// yon_switch_page_render(widgets,3); +// gtk_widget_set_sensitive(widgets->BackButton,0); +// if ((!main_config.configure_mode)) +// gtk_widget_set_sensitive(widgets->CancelInstallButton,0); +// if (!main_config.progress_thread&&!main_config.configure_mode) +// main_config.progress_thread = gdk_threads_add_timeout(500,(GSourceFunc)yon_installation_progress_update,widgets); +// +// if (!main_config.slider_thread&&!main_config.configure_mode) +// main_config.slider_thread = g_timeout_add(5000,(GSourceFunc)on_image_slide,widgets); +// gtk_widget_show(gtk_widget_get_parent(widgets->InstallationProgress)); +// } break; +// +// case YON_PAGE_USERS: +// yon_switch_page_render(widgets,6); +// gtk_widget_set_sensitive(widgets->NextButton,1); +// gtk_widget_hide(widgets->SaveButton); +// break; +// +// case YON_PAGE_INSTALL_ERROR:{ +// on_summary_log_view((GtkWidget*)NULL,widgets); +// +// yon_switch_page_render(widgets,7); +// gtk_widget_set_sensitive(widgets->BackButton,0); +// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); +// gtk_widget_hide(widgets->InstallationLabel); +// gtk_widget_hide(widgets->PackageInstallationLabel); +// gtk_widget_set_sensitive(widgets->NextButton,1); +// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); +// g_mutex_lock(&main_config.install_mutex); +// main_config.install_complete=0; +// g_mutex_unlock(&main_config.install_mutex); +// main_config.save_done=0; +// textdomain(LocaleName); +// gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL); +// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); +// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), +// "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); +// +// } break; +// case YON_PAGE_COMPLETION:{ +// yon_switch_page_render(widgets,7); +// gtk_widget_set_sensitive(widgets->BackButton,0); +// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); +// gtk_widget_hide(widgets->InstallationLabel); +// gtk_widget_hide(widgets->PackageInstallationLabel); +// gtk_widget_set_sensitive(widgets->NextButton,1); +// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); +// g_mutex_lock(&main_config.install_mutex); +// main_config.install_complete=0; +// g_mutex_unlock(&main_config.install_mutex); +// main_config.save_done=0; +// textdomain(LocaleName); +// gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL); +// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); +// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), +// "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); +// } +// gtk_widget_hide(gtk_widget_get_parent(widgets->InstallationProgress)); +// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); +// break; +// +// case YON_PAGE_COMPLETED:{ +// yon_switch_page_render(widgets,7); +// gtk_widget_set_sensitive(widgets->BackButton,1); +// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); +// gtk_widget_hide(widgets->InstallationLabel); +// gtk_widget_hide(widgets->PackageInstallationLabel); +// gtk_widget_set_sensitive(widgets->NextButton,0); +// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); +// g_mutex_lock(&main_config.install_mutex); +// main_config.install_complete=0; +// g_mutex_unlock(&main_config.install_mutex); +// main_config.save_done=0; +// textdomain(LocaleName); +// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); +// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), +// "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); +// +// }break; +// +// case YON_PAGE_SECTIONS: +// case YON_PAGE_INSTALL_COMMON: +// case YON_PAGE_INSTALL_SEPARATE: +// case YON_PAGE_INSTALL_SAME_PARTITION: +// case YON_PAGE_INSTALL_RECOVERY: +// case YON_PAGE_OPTIONS_GRUB_INSTALL: +// case YON_PAGE_OPTIONS_GRUB_UPDATE: +// case YON_PAGE_OPTIONS_SEPARATE: +// case YON_PAGE_OPTIONS_SEPARATE_USRDATA: +// case YON_PAGE_OPTIONS_OS_ONLY: +// case YON_PAGE_OPTIONS_USRDATA_ONLY: { +// yon_switch_page_render(widgets,2); +// } break; +// case YON_PAGE_CONFIGURE_END: { +// gtk_widget_set_sensitive(widgets->BackButton,1); +// gtk_widget_set_sensitive(widgets->NextButton,0); +// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); +// gtk_widget_show(widgets->SaveButton); +// } +// } +// } + +// gboolean on_install_success(main_window *widgets){ +// gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),""); +// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION); +// +// return 0; +// } + +// gboolean on_install_error(main_window *widgets){ +// gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),""); +// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_ERROR); +// return 0; +// } + +// void *on_setup_system_configuration(void * data){ +// yon_debug_output("%s\n","Entered thread"); +// main_window *widgets = (main_window*)data; +// if (widgets){}; +// int size; +// config_str all_parameters = yon_config_get_selection_by_key(&size, +// user_name_parameter, +// user_gecos_parameter, +// user_password_parameter, +// root_password_parameter, +// autologin_parameter, +// xkbmodel_parameter, +// xkblayout_parameter, +// xkbvariant_parameter, +// xkboptions_parameter, +// hostname_parameter, +// zone_parameter, +// lang_parameter, +// locale_parameter, +// NULL); +// if (all_parameters){ +// char *parameter_string = yon_char_parsed_to_string(all_parameters,size," "); +// char *command = set_user_config_command(parameter_string); +// if (system(yon_debug_output("%s\n",command))){}; +// yon_char_parsed_free(all_parameters,size); +// free(command); +// if (parameter_string) free(parameter_string); +// } +// g_idle_add((GSourceFunc)on_install_success,widgets); +// return NULL; +// } + +// void on_log_closed(GtkWidget *, dictionary *dict){ +// main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); +// log_window *window = yon_dictionary_get_data(dict->first->next,log_window*); +// +// gtk_widget_set_sensitive(widgets->ReadFullLogButton,1); +// gtk_widget_set_sensitive(widgets->ReadShortLogButton,1); +// +// free(window->command); +// window->Window=NULL; +// } + +// log_window *yon_log_window_new(){ +// log_window *window = malloc(sizeof(log_window)); +// GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_log_view); +// window->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); +// window->ScrollWindow = yon_gtk_builder_get_widget(builder,"ScrollWindow"); +// window->HeadLabel = yon_gtk_builder_get_widget(builder,"headerTopic"); +// window->LogLabel = yon_gtk_builder_get_widget(builder,"LogLabel"); +// window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); +// window->ScrollToEndCheck = yon_gtk_builder_get_widget(builder,"ScrollToEndCheck"); +// gtk_widget_show(window->Window); +// return window; +// } + +// gboolean yon_read_log(void *data){ +// log_window *window = (log_window*)data; +// if (window->Window){ +// int size; +// g_mutex_lock(&main_config.progress_mutex); +// config_str parsed = yon_file_open(window->command,&size); +// g_mutex_unlock(&main_config.progress_mutex); +// if (size){ +// char *final = yon_char_parsed_to_string(parsed,size,""); +// gtk_label_set_text(GTK_LABEL(window->LogLabel),final); +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck))){ +// gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)),gtk_adjustment_get_upper(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)))); +// } +// free(final); +// yon_char_parsed_free(parsed,size); +// } +// g_mutex_lock(&main_config.install_mutex); +// if (!main_config.install_complete){ +// g_mutex_unlock(&main_config.install_mutex); +// return 1; +// } else { +// g_mutex_unlock(&main_config.install_mutex); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck),0); +// gtk_widget_set_sensitive(window->ScrollToEndCheck,0); +// } +// } +// return 0; +// } + +// void on_process_log_view(GtkWidget *,main_window *widgets){ +// log_window *window = yon_log_window_new(); +// dictionary *dict=NULL; +// yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); +// yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); +// g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),dict); +// gtk_widget_set_sensitive(widgets->ReadFullLogButton,0); +// gtk_widget_set_sensitive(widgets->ReadShortLogButton,0); +// yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,INSTALL_LOG_LABEL,icon_path,"log_viewer"); +// window->command = yon_char_new(short_log_path); +// gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); +// } + +// void on_summary_log_view(GtkWidget *,main_window *widgets){ +// log_window *window = yon_log_window_new(); +// dictionary *dict=NULL; +// yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); +// yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); +// g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),dict); +// gtk_widget_set_sensitive(widgets->ReadFullLogButton,0); +// gtk_widget_set_sensitive(widgets->ReadShortLogButton,0); +// yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,PROGRESS_LOG_LABEL,icon_path,"log_viewer"); +// window->command = yon_char_new(full_log_path); +// gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); +// +// } + + +// void on_region_changed(GtkComboBox *self, main_window *widgets){ +// char *active = (char*)gtk_combo_box_get_active_id(self); +// active = yon_char_append("/usr/share/zoneinfo/",active); +// int size; +// gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo)); +// if (yon_file_is_directory(active)){ +// config_str parsed = yon_file_ls(active,&size); +// for (int i=0;iZoneCombo),parsed[i],_(parsed[i])); +// } +// if (size) yon_char_parsed_free(parsed,size); +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ZoneCombo),0); +// } +// free(active); +// } + +// void on_locale_changed(GtkWidget *,main_window *){ +// +// } + +// void on_additional_software_toggled(){ +// +// } + +// void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_size, GtkComboBox *size_type){ +// GtkTreeModel *model; +// GtkTreeIter iter; +// char *selected_size=NULL; +// if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(table),&model,&iter)){ +// gtk_tree_model_get(model,&iter,2,&selected_size,-1); +// if (yon_char_is_empty(selected_size)) +// gtk_tree_model_get(model,&iter,1,&selected_size,-1); +// if (!yon_char_is_empty(selected_size)){ +// int size = gtk_combo_box_get_active(size_type); +// double cur_size = atof(selected_size); +// char cur_size_letter = selected_size[strlen(selected_size)-1]; +// int cur_size_type=0; +// switch (cur_size_letter){ +// case 'M': +// cur_size_type=0; +// break; +// case 'G': +// cur_size_type=1; +// break; +// case 'T': +// cur_size_type=2; +// break; +// } +// if (size-cur_size_type>0){ +// for (int i=0;iInstallationNearSysSectionTree) +// yon_set_max_size_from_partition(GTK_TREE_VIEW(widgets->InstallationNearSysSectionTree),GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin)); +// +// } + +// void on_separate_installation_changed(GtkWidget *self, main_window *widgets){ +// +// gtk_list_store_clear(widgets->PartitionsList); +// GtkTreeIter iter; +// GtkTreeModel *model; +// if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(self)),&model,&iter)){ +// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SeparateUserDevicesTree)),&iter); +// char *disk_path=""; +// gtk_tree_model_get(model,&iter,0,&disk_path,-1); +// int size; +// config_str parsed; +// parsed = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); +// char *string = yon_char_parsed_to_string(parsed,size,""); +// struct json_object *root; +// struct json_object *blockdevices; +// root = json_tokener_parse(string); +// json_object_object_get_ex(root, "blockdevices", &blockdevices); +// for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { +// struct json_object *device = json_object_array_get_idx(blockdevices, i); +// struct json_object *type, *path, *size, *model, *fstype, *fsused; +// +// json_object_object_get_ex(device, "type", &type); +// if (strcmp("part",json_object_get_string(type))) +// continue; +// json_object_object_get_ex(device, "path", &path); +// if (!strstr(json_object_get_string(path),disk_path)){ +// continue; +// } +// json_object_object_get_ex(device, "size", &size); +// json_object_object_get_ex(device, "model", &model); +// json_object_object_get_ex(device, "fstype", &fstype); +// json_object_object_get_ex(device, "fsused", &fsused); +// +// double free_space=0; +// char *free_space_string=""; +// if (size&&fsused){ +// char *fsused_str = (char*)json_object_get_string(fsused); +// double fsused_kbytes = atof(fsused_str); +// for (int i=0;i1024;sz=sz+1){ +// free_space=free_space/1024; +// } +// if (sz==-1) { +// sz=0; +// free_space=free_space/1024; +// } +// free_space_string = yon_char_append(yon_char_from_double(free_space)," "); +// free_space_string[strlen(free_space_string)-1]=*(yon_size_get_mod(sz)); +// } +// gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)),0.0); +// gtk_list_store_append(widgets->PartitionsList,&iter); +// gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(size),2,free_space_string,3,json_object_get_string(fstype),-1); +// } +// yon_char_parsed_free(parsed,size); +// } +// } + +// void on_near_installation_device_changed(GtkWidget *self, main_window *widgets){ +// gtk_list_store_clear(widgets->PartitionsList); +// GtkTreeIter iter; +// GtkTreeModel *model; +// if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(self)),&model,&iter)){ +// char *disk_path=""; +// gtk_tree_model_get(model,&iter,0,&disk_path,-1); +// int size; +// config_str parsed; +// parsed = yon_config_load((get_parts_and_devices_command),&size); +// char *string = yon_char_parsed_to_string(parsed,size,""); +// struct json_object *root; +// struct json_object *blockdevices; +// root = json_tokener_parse(string); +// json_object_object_get_ex(root, "blockdevices", &blockdevices); +// for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { +// struct json_object *device = json_object_array_get_idx(blockdevices, i); +// struct json_object *type, *path, *size, *model, *fstype, *fsused, *label; +// +// json_object_object_get_ex(device, "type", &type); +// if (strcmp("part",json_object_get_string(type))) +// continue; +// json_object_object_get_ex(device, "path", &path); +// if (!strstr(json_object_get_string(path),disk_path)){ +// continue; +// } +// json_object_object_get_ex(device, "size", &size); +// json_object_object_get_ex(device, "model", &model); +// json_object_object_get_ex(device, "label", &label); +// json_object_object_get_ex(device, "fstype", &fstype); +// json_object_object_get_ex(device, "fsused", &fsused); +// +// double free_space=0; +// char *free_space_string=""; +// if (size&&fsused){ +// char *fsused_str = (char*)json_object_get_string(fsused); +// double fsused_kbytes = atof(fsused_str); +// for (int i=0;i1024;sz=sz+1){ +// free_space=free_space/1024; +// } +// if (sz==-1) { +// sz=0; +// free_space=free_space/1024; +// } +// free_space_string = yon_char_append(yon_char_from_double(free_space)," "); +// free_space_string[strlen(free_space_string)-1]=*(yon_size_get_mod(sz)); +// } +// // gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),0.0); +// gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)),0.0); +// gtk_list_store_append(widgets->PartitionsList,&iter); +// gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(size),2,free_space_string,3,json_object_get_string(fstype),4,json_object_get_string(label),-1); +// } +// yon_char_parsed_free(parsed,size); +// } +// } + +// void on_same_installation_device_changed(GtkWidget *, main_window *widgets){ +// gtk_list_store_clear(widgets->PartitionsList); +// GtkTreeIter iter; +// GtkTreeModel *model; +// if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SamePlaceDeviceTree)),&model,&iter)){ +// char *disk_path=""; +// gtk_tree_model_get(model,&iter,0,&disk_path,-1); +// int size; +// config_str parsed; +// parsed = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); +// char *string = yon_char_parsed_to_string(parsed,size,""); +// struct json_object *root; +// struct json_object *blockdevices; +// root = json_tokener_parse(string); +// json_object_object_get_ex(root, "blockdevices", &blockdevices); +// for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { +// struct json_object *device = json_object_array_get_idx(blockdevices, i); +// struct json_object *type, *path, *size, *model, *vendor, *serial; +// +// json_object_object_get_ex(device, "type", &type); +// if (strcmp("part",json_object_get_string(type))) +// continue; +// json_object_object_get_ex(device, "path", &path); +// if (!strstr(json_object_get_string(path),disk_path)){ +// continue; +// } +// json_object_object_get_ex(device, "size", &size); +// json_object_object_get_ex(device, "model", &model); +// json_object_object_get_ex(device, "vendor", &vendor); +// json_object_object_get_ex(device, "serial", &serial); +// +// gtk_list_store_append(widgets->PartitionsList,&iter); +// gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(model),2,json_object_get_string(serial),3,json_object_get_string(size),4,json_object_get_string(vendor),-1); +// } +// yon_char_parsed_free(parsed,size); +// } +// } + +void on_page_next_clicked(GtkWidget *, main_window *widgets){ + enum YON_PAGES page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); + page = yon_page_get_next(widgets,page); + if ((int)page!=-1){ + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page); + } + yon_page_update(widgets); +} + +void on_page_prev_clicked(GtkWidget *, main_window *widgets){ + enum YON_PAGES page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); + page = yon_page_get_prev(page); + if ((int)page!=-1){ + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page); + } + yon_page_update(widgets); } -void on_gparted_open(); void on_gparted_open(){ yon_launch_app_with_arguments(open_gparted_command,NULL); } -gboolean on_yon_exit(GtkWidget *,GdkEvent*, main_window *widgets); -void on_reboot_accepted(GtkWidget *,dictionary *dict){ - main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); - confirmation_window *window = yon_dictionary_get_data(dict->first->next,confirmation_window*); +void on_reboot_accepted(main_window *widgets){ g_mutex_lock(&main_config.install_mutex); if (main_config.install_thread){ pthread_cancel((pthread_t)main_config.install_thread); @@ -2278,16 +1435,11 @@ void on_reboot_accepted(GtkWidget *,dictionary *dict){ } main_config.exit_accepted=1; g_signal_emit_by_name(G_OBJECT(widgets->MainWindow),"delete-event"); - free(window); - yon_dictionary_free_all(dict,NULL); - free(dict); + while(gtk_events_pending()) gtk_main_iteration(); if (system("reboot")){}; } -void on_exit_accepted(GtkWidget *,dictionary *dict); -void on_exit_accepted(GtkWidget *,dictionary *dict){ - main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); - confirmation_window *window = yon_dictionary_get_data(dict->first->next,confirmation_window*); +void on_exit_accepted(main_window *widgets){ g_mutex_lock(&main_config.install_mutex); if (main_config.install_thread){ pthread_cancel((pthread_t)main_config.install_thread); @@ -2295,38 +1447,19 @@ void on_exit_accepted(GtkWidget *,dictionary *dict){ } main_config.exit_accepted=1; g_signal_emit_by_name(G_OBJECT(widgets->MainWindow),"delete-event"); - free(window); - yon_dictionary_free_all(dict,NULL); - free(dict); + while(gtk_events_pending()) gtk_main_iteration(); gtk_widget_destroy(widgets->MainWindow); } -confirmation_window *yon_confirmation_window_new(){ - confirmation_window *window = malloc(sizeof(confirmation_window)); - GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_confirmation); - window->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); - window->TitleLabel = yon_gtk_builder_get_widget(builder,"TitleLabel"); - window->TextLabel = yon_gtk_builder_get_widget(builder,"TextLabel"); - window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton"); - window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton"); - g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); - return window; -} - gboolean on_yon_exit(GtkWidget *,GdkEvent*, main_window *widgets){ if (!main_config.exit_accepted||(main_config.save_done&&main_config.install_complete)){ if (widgets){}; - confirmation_window *window = yon_confirmation_window_new(); - dictionary *dict = NULL; - yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); - yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); - g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_exit_accepted),dict); - gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->MainWindow)); - gtk_window_set_title(GTK_WINDOW(window->Window),TITLE_LABEL); - gtk_window_set_icon_name(GTK_WINDOW(window->Window),icon_path); - gtk_label_set_text(GTK_LABEL(window->TextLabel),WARNING_TEXT_LABEL); - gtk_label_set_text(GTK_LABEL(window->TitleLabel),WARNING_TITLE_LABEL); - gtk_widget_show(window->Window); + dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); + data->action_text=WARNING_TEXT_LABEL; + data->title=WARNING_TITLE_LABEL; + if (yon_confirmation_dialog_call(widgets->MainWindow,data)==GTK_RESPONSE_ACCEPT ){ + on_exit_accepted(widgets); + } return 1; @@ -2511,6 +1644,50 @@ main_window *yon_main_window_complete(){ widgets->SameFSTypeSensitiveCheck = yon_gtk_builder_get_widget(builder,"SameFSTypeSensitiveCheck"); widgets->SameLabelSensitiveCheck = yon_gtk_builder_get_widget(builder,"SameLabelSensitiveCheck"); + widgets->KernelsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"KernelsList")); + widgets->KernelsTree = yon_gtk_builder_get_widget(builder,"KernelsTree"); + + widgets->OSSoftwareTree = yon_gtk_builder_get_widget(builder,"OSSoftwareTree"); + widgets->OSSoftwareList = GTK_LIST_STORE(gtk_builder_get_object(builder,"OSSoftwareList")); + + widgets->StartupServicesTree = yon_gtk_builder_get_widget(builder,"StartupServicesTree"); + widgets->StartupList = GTK_LIST_STORE(gtk_builder_get_object(builder,"StartupList")); + + widgets->BootloadTimerSwitch = yon_gtk_builder_get_widget(builder,"BootloadTimerSwitch"); + widgets->BootloadTimerSpin = yon_gtk_builder_get_widget(builder,"BootloadTimerSpin"); + widgets->BootloadDefaultOSEntry = yon_gtk_builder_get_widget(builder,"BootloadDefaultOSEntry"); + widgets->BootloadDefaulOSButton = yon_gtk_builder_get_widget(builder,"BootloadDefaulOSButton"); + widgets->BootloadNoPasswordSwitch = yon_gtk_builder_get_widget(builder,"BootloadNoPasswordSwitch"); + widgets->BootloadUserTree = yon_gtk_builder_get_widget(builder,"BootloadUserTree"); + widgets->BootloadUserAddButton = yon_gtk_builder_get_widget(builder,"BootloadUserAddButton"); + widgets->BootloadUserRemoveButton = yon_gtk_builder_get_widget(builder,"BootloadUserRemoveButton"); + widgets->BootloadUsersList = GTK_LIST_STORE(gtk_builder_get_object(builder,"BootloadUsersList")); + + widgets->NetworkDomainSwitch = yon_gtk_builder_get_widget(builder,"NetworkDomainSwitch"); + widgets->NetworkDomainNameEntry = yon_gtk_builder_get_widget(builder,"NetworkDomainNameEntry"); + widgets->NetworkDomainAdminEntry = yon_gtk_builder_get_widget(builder,"NetworkDomainAdminEntry"); + widgets->DomainPasswordEntry = yon_gtk_builder_get_widget(builder,"DomainPasswordEntry"); + widgets->NetworkNTPServerSwitch = yon_gtk_builder_get_widget(builder,"NetworkNTPServerSwitch"); + widgets->NetworkNTPCombo = yon_gtk_builder_get_widget(builder,"NetworkNTPCombo"); + widgets->NetworkNTPEntry = yon_gtk_builder_get_widget(builder,"NetworkNTPEntry"); + widgets->NetworkConnectionsBox = yon_gtk_builder_get_widget(builder,"NetworkConnectionsBox"); + widgets->NetworkConnectionsAddButton = yon_gtk_builder_get_widget(builder,"NetworkConnectionsAddButton"); + widgets->network_connections = NULL; + + widgets->AdvancedDeviceTree = yon_gtk_builder_get_widget(builder,"AdvancedDeviceTree"); + widgets->AdvancedVirtualDeviceCombo = yon_gtk_builder_get_widget(builder,"AdvancedVirtualDeviceCombo"); + widgets->AdvancedPartitionTree = yon_gtk_builder_get_widget(builder,"AdvancedPartitionTree"); + widgets->AdvancedPartitionAddBox = yon_gtk_builder_get_widget(builder,"AdvancedPartitionAddBox"); + widgets->AdvancedAddButton = yon_gtk_builder_get_widget(builder,"AdvancedAddButton"); + widgets->AdvancedLoadTypeSwitch = yon_gtk_builder_get_widget(builder,"AdvancedLoadTypeSwitch"); + widgets->AdvancedBiosSectorSwitch = yon_gtk_builder_get_widget(builder,"AdvancedBiosSectorSwitch"); + widgets->AdvancedEFISwitch = yon_gtk_builder_get_widget(builder,"AdvancedEFISwitch"); + widgets->AdvancedSwapSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapSwitch"); + widgets->AdvancedSwapAutoSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapAutoSwitch"); + widgets->AdvancedSwapRamSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapRamSwitch"); + widgets->AdvancedSwapFixedSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapFixedSwitch"); + widgets->AdvancedSwapFixedSpin = yon_gtk_builder_get_widget(builder,"AdvancedSwapFixedSpin"); + g_signal_connect(G_OBJECT(widgets->MainWindow),"delete-event",G_CALLBACK(on_yon_exit),widgets); GtkWidget *menu = yon_gtk_builder_get_widget(builder,"menu2"); gtk_style_context_add_class(gtk_widget_get_style_context(widgets->DocumentationMenuItem),"menuitemmiddle"); @@ -2518,66 +1695,66 @@ main_window *yon_main_window_complete(){ gtk_menu_shell_append(GTK_MENU_SHELL(menu),widgets->DocumentationMenuItem); gtk_menu_shell_append(GTK_MENU_SHELL(menu),widgets->AboutMenuItem); - g_signal_connect(G_OBJECT(widgets->LoadGlobalConfigurationMenuItem),"activate",G_CALLBACK(on_config_global_load),widgets); - g_signal_connect(G_OBJECT(widgets->LoadLocalConfigurationMenuItem),"activate",G_CALLBACK(on_config_local_load),widgets); - g_signal_connect(G_OBJECT(widgets->LoadExternalConfigurationMenuItem),"activate",G_CALLBACK(on_config_custom_load),widgets); + // g_signal_connect(G_OBJECT(widgets->LoadGlobalConfigurationMenuItem),"activate",G_CALLBACK(on_config_global_load),widgets); + // g_signal_connect(G_OBJECT(widgets->LoadLocalConfigurationMenuItem),"activate",G_CALLBACK(on_config_local_load),widgets); + // g_signal_connect(G_OBJECT(widgets->LoadExternalConfigurationMenuItem),"activate",G_CALLBACK(on_config_custom_load),widgets); - g_signal_connect(G_OBJECT(widgets->SaveGlobalLocalConfigurationMenuItem),"activate",G_CALLBACK(on_config_global_local_save),widgets); - g_signal_connect(G_OBJECT(widgets->SaveGlobalConfigurationMenuItem),"activate",G_CALLBACK(on_config_global_save),widgets); - g_signal_connect(G_OBJECT(widgets->SaveLocalConfigurationMenuItem),"activate",G_CALLBACK(on_config_local_save),widgets); - g_signal_connect(G_OBJECT(widgets->SaveExternalConfigurationMenuItem),"activate",G_CALLBACK(on_config_custom_save),widgets); + // g_signal_connect(G_OBJECT(widgets->SaveGlobalLocalConfigurationMenuItem),"activate",G_CALLBACK(on_config_global_local_save),widgets); + // g_signal_connect(G_OBJECT(widgets->SaveGlobalConfigurationMenuItem),"activate",G_CALLBACK(on_config_global_save),widgets); + // g_signal_connect(G_OBJECT(widgets->SaveLocalConfigurationMenuItem),"activate",G_CALLBACK(on_config_local_save),widgets); + // g_signal_connect(G_OBJECT(widgets->SaveExternalConfigurationMenuItem),"activate",G_CALLBACK(on_config_custom_save),widgets); - g_signal_connect(G_OBJECT(widgets->ReadFullLogButton),"clicked",G_CALLBACK(on_process_log_view),widgets); - g_signal_connect(G_OBJECT(widgets->ReadShortLogButton),"clicked",G_CALLBACK(on_summary_log_view),widgets); + // g_signal_connect(G_OBJECT(widgets->ReadFullLogButton),"clicked",G_CALLBACK(on_process_log_view),widgets); + // g_signal_connect(G_OBJECT(widgets->ReadShortLogButton),"clicked",G_CALLBACK(on_summary_log_view),widgets); g_signal_connect(G_OBJECT(widgets->GpartedCommonButton),"clicked",G_CALLBACK(on_gparted_open),NULL); g_signal_connect(G_OBJECT(widgets->GpartedSameButton),"clicked",G_CALLBACK(on_gparted_open),NULL); g_signal_connect(G_OBJECT(widgets->GpartedNearButton),"clicked",G_CALLBACK(on_gparted_open),NULL); - g_signal_connect(G_OBJECT(widgets->Notebook),"switch-page",G_CALLBACK(on_page_changed),widgets); - g_signal_connect(G_OBJECT(widgets->MainWindow),"check-resize",G_CALLBACK(on_region_resized),widgets); - g_signal_connect(G_OBJECT(widgets->BackButton),"clicked",G_CALLBACK(on_page_navigation_clicked),widgets); - g_signal_connect(G_OBJECT(widgets->NextButton),"clicked",G_CALLBACK(on_page_navigation_clicked),widgets); - g_signal_connect(G_OBJECT(widgets->CancelInstallButton),"clicked",G_CALLBACK(on_page_navigation_clicked),widgets); - g_signal_connect(G_OBJECT(widgets->AvailableLanguagesButton),"clicked",G_CALLBACK(on_language_clicked),widgets); - g_signal_connect(G_OBJECT(widgets->RegionCombo),"changed",G_CALLBACK(on_region_changed),widgets); - g_signal_connect(G_OBJECT(widgets->LayoutSensitiveCheck),"toggled",G_CALLBACK(on_layout_toggle_button_switch),widgets); - g_signal_connect(G_OBJECT(widgets->AddButton),"clicked",G_CALLBACK(on_keyboard_clicked),widgets); - g_signal_connect(G_OBJECT(widgets->RemoveButton),"clicked",G_CALLBACK(on_keyboard_removed),widgets); - - g_signal_connect(G_OBJECT(widgets->GrubInstallDevicesTree),"cursor-changed",G_CALLBACK(on_separate_installation_changed),widgets); - g_signal_connect(G_OBJECT(widgets->GrubUpdateDevicesTree),"cursor-changed",G_CALLBACK(on_separate_installation_changed),widgets); - g_signal_connect(G_OBJECT(widgets->InstallationNearSysDevicesTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); - g_signal_connect(G_OBJECT(widgets->SamePlaceDeviceTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); - g_signal_connect(G_OBJECT(widgets->UserdataDevicesTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); - g_signal_connect(G_OBJECT(widgets->OSDevicesTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); - g_signal_connect(G_OBJECT(widgets->SeparateDevicesTree),"cursor-changed",G_CALLBACK(on_separate_installation_changed),widgets); - - g_signal_connect(G_OBJECT(widgets->ConfigurationModeMenuItem),"toggled",G_CALLBACK(on_configuration_mode_switch),widgets); - g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),widgets); - g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),widgets); - - g_signal_connect(G_OBJECT(widgets->SamePlacePartTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); - g_signal_connect(G_OBJECT(widgets->InstallationNearSysSectionTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); - gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),3); - - g_signal_connect(G_OBJECT(widgets->LanguageCombo),"changed",G_CALLBACK(on_locale_changed),widgets); - g_signal_connect(G_OBJECT(widgets->AdditionalSoftwareCell),"toggled",G_CALLBACK(on_additional_software_toggled),widgets); - - g_signal_connect(G_OBJECT(widgets->ManualLayoutRadio),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),gtk_widget_get_parent(gtk_widget_get_parent(widgets->AddButton))); + // g_signal_connect(G_OBJECT(widgets->Notebook),"switch-page",G_CALLBACK(on_page_changed),widgets); + // g_signal_connect(G_OBJECT(widgets->MainWindow),"check-resize",G_CALLBACK(on_region_resized),widgets); + g_signal_connect(G_OBJECT(widgets->NextButton),"clicked",G_CALLBACK(on_page_next_clicked),widgets); + g_signal_connect(G_OBJECT(widgets->BackButton),"clicked",G_CALLBACK(on_page_prev_clicked),widgets); + // g_signal_connect(G_OBJECT(widgets->CancelInstallButton),"clicked",G_CALLBACK(on_page_navigation_clicked),widgets); + // g_signal_connect(G_OBJECT(widgets->AvailableLanguagesButton),"clicked",G_CALLBACK(on_language_clicked),widgets); + // g_signal_connect(G_OBJECT(widgets->RegionCombo),"changed",G_CALLBACK(on_region_changed),widgets); + // g_signal_connect(G_OBJECT(widgets->LayoutSensitiveCheck),"toggled",G_CALLBACK(on_layout_toggle_button_switch),widgets); + // g_signal_connect(G_OBJECT(widgets->AddButton),"clicked",G_CALLBACK(on_keyboard_clicked),widgets); + // g_signal_connect(G_OBJECT(widgets->RemoveButton),"clicked",G_CALLBACK(on_keyboard_removed),widgets); + + // g_signal_connect(G_OBJECT(widgets->GrubInstallDevicesTree),"cursor-changed",G_CALLBACK(on_separate_installation_changed),widgets); + // g_signal_connect(G_OBJECT(widgets->GrubUpdateDevicesTree),"cursor-changed",G_CALLBACK(on_separate_installation_changed),widgets); + // g_signal_connect(G_OBJECT(widgets->InstallationNearSysDevicesTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); + // g_signal_connect(G_OBJECT(widgets->SamePlaceDeviceTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); + // g_signal_connect(G_OBJECT(widgets->UserdataDevicesTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); + // g_signal_connect(G_OBJECT(widgets->OSDevicesTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); + // g_signal_connect(G_OBJECT(widgets->SeparateDevicesTree),"cursor-changed",G_CALLBACK(on_separate_installation_changed),widgets); + + // g_signal_connect(G_OBJECT(widgets->ConfigurationModeMenuItem),"toggled",G_CALLBACK(on_configuration_mode_switch),widgets); + // g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),widgets); + // g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),widgets); + + // g_signal_connect(G_OBJECT(widgets->SamePlacePartTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); + // g_signal_connect(G_OBJECT(widgets->InstallationNearSysSectionTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); + // gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),3); + + // g_signal_connect(G_OBJECT(widgets->LanguageCombo),"changed",G_CALLBACK(on_locale_changed),widgets); + // g_signal_connect(G_OBJECT(widgets->AdditionalSoftwareCell),"toggled",G_CALLBACK(on_additional_software_toggled),widgets); + + // g_signal_connect(G_OBJECT(widgets->ManualLayoutRadio),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),gtk_widget_get_parent(gtk_widget_get_parent(widgets->AddButton))); - g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),widgets->HotnameEntry); - - g_signal_connect(G_OBJECT(widgets->NextInstallationFormatCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->NextInstallationFilesystemTypeCombo); - g_signal_connect(G_OBJECT(widgets->SameInstallationFormatCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->SameInstallationFilesystemTypeCombo); - g_signal_connect(G_OBJECT(widgets->HostnameSensitiveCheck),"toggled",G_CALLBACK(on_autohostname_sensitiveness_check),widgets); - g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(on_autohostname_check),widgets); - g_signal_connect(G_OBJECT(widgets->HotnameEntry),"changed",G_CALLBACK(on_hostname_entry_changed),widgets); - - g_signal_connect(G_OBJECT(widgets->PasswordCombo),"changed",G_CALLBACK(yon_password_combo_set_sensitive),widgets); - g_signal_connect(G_OBJECT(widgets->AdminPasswordCombo),"changed",G_CALLBACK(yon_password_combo_set_sensitive),widgets); - g_signal_connect(G_OBJECT(widgets->RootPasswordSensitiveCheck),"toggled",G_CALLBACK(yon_password_set_sensitive_from_toggle),widgets); - g_signal_connect(G_OBJECT(widgets->PasswordSensitiveCheck),"toggled",G_CALLBACK(yon_password_set_sensitive_from_toggle),widgets); + // g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),widgets->HotnameEntry); + + // g_signal_connect(G_OBJECT(widgets->NextInstallationFormatCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->NextInstallationFilesystemTypeCombo); + // g_signal_connect(G_OBJECT(widgets->SameInstallationFormatCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->SameInstallationFilesystemTypeCombo); + // g_signal_connect(G_OBJECT(widgets->HostnameSensitiveCheck),"toggled",G_CALLBACK(on_autohostname_sensitiveness_check),widgets); + // g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(on_autohostname_check),widgets); + // g_signal_connect(G_OBJECT(widgets->HotnameEntry),"changed",G_CALLBACK(on_hostname_entry_changed),widgets); + + // g_signal_connect(G_OBJECT(widgets->PasswordCombo),"changed",G_CALLBACK(yon_password_combo_set_sensitive),widgets); + // g_signal_connect(G_OBJECT(widgets->AdminPasswordCombo),"changed",G_CALLBACK(yon_password_combo_set_sensitive),widgets); + // g_signal_connect(G_OBJECT(widgets->RootPasswordSensitiveCheck),"toggled",G_CALLBACK(yon_password_set_sensitive_from_toggle),widgets); + // g_signal_connect(G_OBJECT(widgets->PasswordSensitiveCheck),"toggled",G_CALLBACK(yon_password_set_sensitive_from_toggle),widgets); yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->PasswordEntry)); yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->AdminPasswordEntry)); @@ -2744,103 +1921,32 @@ main_window *yon_main_window_complete(){ } if (size) yon_char_parsed_free(models,size); gtk_builder_connect_signals(builder,NULL); - yon_load_proceed(YON_CONFIG_DEFAULT); - yon_interface_update(widgets); + // yon_load_proceed(YON_CONFIG_DEFAULT); + // yon_interface_update(widgets); return widgets; } - + int main(int argc, char *argv[]){ - local=setlocale(LC_ALL, ""); - textdomain (LocaleName); - config_init(); - int option_index=0; - int show_help=0; - { - struct option long_options[] = { - {"help", 0, 0, 'h'}, - {"version", 0, 0, 'V'}, - {"lock-help", 0,0, 1}, - {"lock-save", 0,0, 2}, - {"lock-save-local", 0,0, 3}, - {"lock-save-global", 0,0, 4}, - {"lock-load-global", 0,0, 5}, - {"socket-id", 1, 0, 's'}, - {"socket-ext-id", 1,0, 'e'}, - {"socket-trd-id", 1,0, 't'}, - {"clear-config", 0,0, 'c'}, - {"debug", 0,0, 'd'}, - { NULL, 0, NULL, 0 } - }; - for (int i=0;iMainWindow)); - char *window_config_path = config_path; - yon_window_config_load(window_config_path); - free(window_config_path); - GtkCssProvider *css=gtk_css_provider_new(); - gtk_css_provider_load_from_resource(css,CssPath); - gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), - GTK_STYLE_PROVIDER(css), - -1); - gtk_main(); - free(widgets); + widgets = yon_main_window_complete(); + if (widgets){}; + char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL); + yon_window_config_load(path); + main_config.launch_arguments=yon_char_parsed_copy(argv,argc); + main_config.launch_size=argc; + if (getuid()!=0){ + textdomain(template_ui_LocaleName); + yon_ubl_status_box_render(ROOT_WARNING_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + textdomain(LocaleName); + } + gtk_main(); + return 0; } \ No newline at end of file diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index d538577..25442ae 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -11,6 +11,7 @@ #include #include #include +#include #ifdef WEBKIT_FOUND #include #endif @@ -23,10 +24,8 @@ #define glade_path "/com/ublinux/ui/ubinstall-gtk.glade" #define glade_path_ubinstall_keyboard "/com/ublinux/ui/ubinstall-gtk-keyboard.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 ui_glade_path_about "/com/ublinux/ui/ubinstall-gtk-about.glade" -#define ui_glade_path_documentation "/com/ublinux/ui/ubinstall-gtk-documentation.glade" -#define glade_path_confirmation "/com/ublinux/ui/ubinstall-gtk-warning.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) @@ -84,6 +83,12 @@ NULL #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 modules_extra_parameter "AUTOINSTALL[modules_extra]" +#define modules_extra_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[modules_extra]" + #define user_name_parameter "AUTOINSTALL[user_name]" #define user_name_parameter_command "ubconfig --source global --conarg get [autoinstall] AUTOINSTALL[user_name]" #define user_gecos_parameter "AUTOINSTALL[user_gecos]" @@ -118,6 +123,16 @@ NULL #define part_size_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_size]" #define part_type_parameter "AUTOINSTALL[part_fs_type]" #define part_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_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 save_config_command(parameters) yon_char_unite("ubconfig --target system set [autoinstall] AUTOINSTALL[log]=yes ",parameters, "; nice ubinstall2 --debug autoinstall", NULL) @@ -154,57 +169,52 @@ NULL #define default_langs(size) yon_char_parsed_new(size,"en_US.UTF-8","ru_RU.UTF-8",NULL); typedef char* string; +__attribute__((unused)) static \ string version_application; -char *local; - +extern int cur_slide; + enum YON_PAGES { YON_PAGE_WELCOME = 0, YON_PAGE_LICENCE, YON_PAGE_SECTIONS, YON_PAGE_OS_COMPONENTS, - YON_PAGE_SOFTWARE, YON_PAGE_INSTALLATION_BEGIN, - YON_PAGE_INSTALLATION, + YON_PAGE_KERNEL, + YON_PAGE_SOFTWARE, YON_PAGE_REGION, YON_PAGE_KEYBOARD, YON_PAGE_USERS, + YON_PAGE_STARTUP, + YON_PAGE_BOOTLOADER, + YON_PAGE_NETWORK, + YON_PAGE_INSTALLATION, YON_PAGE_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_OPTIONS, - YON_PAGE_OPTIONS_GRUB_INSTALL, - YON_PAGE_OPTIONS_GRUB_UPDATE, - YON_PAGE_OPTIONS_SEPARATE, - YON_PAGE_OPTIONS_SEPARATE_USRDATA, - YON_PAGE_OPTIONS_OS_ONLY, - YON_PAGE_OPTIONS_USRDATA_ONLY, - YON_PAGE_INSTALL_ERROR, - YON_PAGE_CONFIGURE_END + 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 { - int socket_id; - int load_socket_id; - int save_socket_id; - - int lock_help; - int lock_save_local; - int lock_save_global; - int lock_load_global; - - int always_open_documentation; - - int password_min_length; - + template_config_fields + config_str launch_arguments; + int launch_size; int save_done; int save_configured; - int load_mode; int install_complete; - int debug_mode; guint slider_thread; int install_mode; unsigned long install_thread; @@ -221,6 +231,18 @@ typedef struct { int arg_size; config_str arg_target; } config; + +extern config main_config; + +typedef struct { + GtkWidget *CommonInstallationDevicesTree; + GtkWidget *GpartedCommonButton; + GtkWidget *CommonFilesystemSensitiveCheck; + GtkWidget *CommonInstallationFilesystemTypeCombo; + GtkWidget *CommonSectionSensitiveCheck; + GtkWidget *CommonInstallationSectionNameEntry; + GtkListStore *DevicesList; +} install_common_page; typedef struct { GtkBuilder *builder; @@ -392,8 +414,69 @@ typedef struct { GtkWidget *SameFSTypeSensitiveCheck; GtkWidget *SameLabelSensitiveCheck; + GtkWidget *KernelsTree; + GtkListStore *KernelsList; + GtkWidget *OSSoftwareTree; + GtkListStore *OSSoftwareList; + GtkWidget *StartupServicesTree; + GtkListStore *StartupList; + + GtkWidget *BootloadTimerSwitch; + GtkWidget *BootloadTimerSpin; + GtkWidget *BootloadDefaultOSEntry; + GtkWidget *BootloadDefaulOSButton; + GtkWidget *BootloadNoPasswordSwitch; + GtkWidget *BootloadUserAddButton; + GtkWidget *BootloadUserRemoveButton; + GtkWidget *BootloadUserTree; + GtkListStore *BootloadUsersList; + + GtkWidget *NetworkDomainSwitch; + GtkWidget *NetworkDomainNameEntry; + GtkWidget *NetworkDomainAdminEntry; + GtkWidget *DomainPasswordEntry; + GtkWidget *NetworkNTPServerSwitch; + GtkWidget *NetworkNTPCombo; + GtkWidget *NetworkNTPEntry; + GtkWidget *NetworkConnectionsBox; + GtkWidget *NetworkConnectionsAddButton; + dictionary *network_connections; + + 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; + dictionary *advanced_sections; } main_window; +typedef struct { + GtkWidget *MainBox; + GtkWidget *SystemSectionToggle; + GtkWidget *UserDataSectionToggle; + GtkWidget *RemoveButton; + GtkWidget *FormatSwitch; + GtkWidget *FormatExpander; + GtkWidget *SizeSpin; + GtkWidget *SizeCombo; + GtkWidget *SectionMarkEntry; + GtkWidget *FileSystemTypeCombo; + GtkWidget *FileSystemMarkentry; + GtkWidget *EncryptionCombo; + GtkWidget *EncryptionEntry; + GtkWidget *EncryptionButton; + + char *part; +} advanced_section; typedef struct { GtkWidget *Window; @@ -458,6 +541,19 @@ typedef struct { GtkWidget *CancelButton; } confirmation_window; +typedef struct { + GtkWidget *MainBox; + GtkWidget *TypeCombo; + GtkWidget *ConnectionCombo; + GtkWidget *EnabledSwitch; + GtkWidget *RemoveButton; + GtkWidget *AutoGetIPSwitch; + GtkWidget *IpAdressEntry; + GtkWidget *GatewayEntry; + GtkWidget *MaskEntry; + GtkWidget *DNSEntry; +} network_info; + void config_init(); main_window *yon_main_window_complete(); ubinstall_language_window *yon_ubinstall_language_new(); @@ -467,7 +563,6 @@ ubinstall_keyboard_window *yon_ubinstall_keyboard_new(); password_window *yon_password_new(); void on_password_accept(GtkWidget *self, dictionary *dict); -char* yon_debug_output(char *pattern,char*text); void yon_interface_update(main_window *widgets); @@ -484,8 +579,77 @@ gboolean on_install_success(main_window *widgets); gboolean on_install_error(main_window *widgets); -confirmation_window *yon_confirmation_window_new(); - -void on_reboot_accepted(GtkWidget *,dictionary *dict); - -void on_layout_toggle_button_switch(GtkWidget *self, main_window *widgets); \ No newline at end of file +// confirmation_window *yon_confirmation_window_new(); + +void on_reboot_accepted(main_window *widgets); + +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 *); +void on_region_changed(GtkComboBox *self, main_window *widgets); +void on_page_navigation_clicked(GtkWidget *self, 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); +gboolean yon_read_log(void *data); +log_window *yon_log_window_new(); +void on_log_closed(GtkWidget *, dictionary *dict); +void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets); +gboolean yon_installation_progress_update(void *data); +void *on_config_save(void *data); +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); +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(GtkWidget *,main_window *); +void on_config_global_load(GtkWidget *,main_window *); +void on_config_local_load(GtkWidget *,main_window *widgets); +// void yon_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); +void yon_password_combo_set_sensitive(GtkWidget *self, main_window *widgets); +void yon_password_set_sensitive_from_toggle(GtkWidget *self, main_window *widgets); +void on_layout_toggle_button_switch(GtkWidget *self, main_window *widgets); +enum YON_PAGES yon_page_get_next(main_window *widgets,enum YON_PAGES page); +enum YON_PAGES yon_page_get_prev(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); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 11c6e08..114ba74 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -1,5 +1,3 @@ -#define VERSION_LABEL yon_char_unite(_("Version:")," ",!yon_char_is_empty(version_application)?version_application:"","\n",NULL) -#define HELP_LABEL(rest) yon_char_unite(LocaleName,_(" version:")," ", !yon_char_is_empty(version_application)?version_application:"","\n",TITLE_LABEL,"\n",_("Usage:"), " ",LocaleName," ",_("[OPTIONS]"),"\n",_("Options:"),"\n\t--help, -h\t\t\t",_("Show this help"),"\n\t--version, -V\t\t\t",_("Show package version"),"\n\t--lock-help\t\t\t",_("Lock this help menu"),"\n\t--lock-save\t\t\t",_("Lock configuration saving"),"\n\t--lock-save-local\t\t",_("Lock local configration saving"),"\n\t--lock-save-global\t\t",_("Lock global configration saving"),"\n\t--lock-load-global\t\t",_("Lock global configration loading"),"\n\t--clear-config\t\t\t",_("Reset application settings"),"\n",!yon_char_is_empty(rest)?rest:NULL,NULL) #define TITLE_LABEL _("UBLinux installation") @@ -107,7 +105,7 @@ #define SECTION_NAME_LABEL _("Section name:") #define FORMAT_LABEL _("Format") -#define SUCCESS_LABEL _("You have UBLinux installed on your computer.\nYou can reboot and use your new system\nor continue working in the UBLinux Live environment.") +#define INSTALL_SUCCESS_LABEL _("You have UBLinux installed on your computer.\nYou can reboot and use your new system\nor continue working in the UBLinux Live environment.") #define LANGUAGES_TITLE_LABEL _("Available languages in the system") #define LAYOUTS_TITLE_LABEL _("Keyboard layout language") @@ -185,4 +183,6 @@ #define WARNING_TITLE_LABEL _("Warning") #define WARNING_TEXT_LABEL _("Are you sure want to exit and\ninterrupt installation process?") -#define WARNING_REBOOT_TEXT_LABEL _("Are you sure want to reboot system?") \ No newline at end of file +#define WARNING_REBOOT_TEXT_LABEL _("Are you sure want to reboot system?") + +#define DEFAULT_BOOTLOAD_MENU_ITEM_LABEL _("Default (Use last succeeded)") \ No newline at end of file diff --git a/ubinstall-gtk-advanced-box.glade b/ubinstall-gtk-advanced-box.glade new file mode 100644 index 0000000..0a883d0 --- /dev/null +++ b/ubinstall-gtk-advanced-box.glade @@ -0,0 +1,416 @@ + + + + + + + True + False + com.ublinux.libublsettingsui-gtk3.trash-symbolic + + + True + False + gtk-missing-image + + + True + False + gtk-missing-image + + + True + False + com.ublinux.libublsettingsui-gtk3.edit-symbolic + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + vertical + 5 + + + True + False + 5 + + + True + False + New section at + + + False + True + 0 + + + + + True + False + /dev/sdb + + + False + True + 1 + + + + + True + True + True + image1 + + + + False + True + end + 2 + + + + + "/ublinux-data/" user data section + True + True + True + image2 + + + False + True + end + 3 + + + + + "/ublinux/" system section + True + True + True + image3 + + + False + True + end + 5 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + + + False + True + 0 + + + + + True + False + Format + + + False + True + 1 + + + + + False + True + 1 + + + + + True + True + True + + + True + False + vertical + 5 + + + True + False + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Size: + 0 + + + False + True + 0 + + + + + True + True + + + False + True + 1 + + + + + True + False + + Mb + Gb + Tb + + + + False + True + 2 + + + + + True + False + Part label: + 0 + + + False + True + 3 + + + + + True + True + + + False + True + 4 + + + + + True + False + File system type: + + + False + True + 5 + + + + + True + False + + Default + + + + False + True + 6 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + False + File system label: + 0 + + + False + True + 0 + + + + + True + True + + + False + True + 1 + + + + + True + False + Encryption: + 0 + + + False + True + 2 + + + + + True + False + + Off + + + + False + True + 3 + + + + + True + False + Encryption password: + + + False + True + 4 + + + + + True + True + + + False + True + 5 + + + + + True + True + True + image4 + + + False + True + 6 + + + + + False + True + 2 + + + + + + + + + + False + True + 2 + + + + + True + True + 0 + + + + + + + + + + + + + + + + + diff --git a/ubinstall-gtk-network-box.glade b/ubinstall-gtk-network-box.glade new file mode 100644 index 0000000..0f37eda --- /dev/null +++ b/ubinstall-gtk-network-box.glade @@ -0,0 +1,300 @@ + + + + + + + True + False + com.ublinux.libublsettingsui-gtk3.trash-symbolic + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + vertical + 5 + + + True + False + 5 + + + True + False + Connection type: + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + False + Enabled: + + + False + True + 3 + + + + + True + True + + + False + True + 4 + + + + + True + True + True + image1 + + + + False + True + end + 5 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + + + False + True + 0 + + + + + True + False + Automatically get IP adress with DHCP + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + False + 5 + + + True + False + IP adress: + 0 + + + False + True + 0 + + + + + True + True + + + True + True + 1 + + + + + True + False + Gateway: + 0 + + + False + True + 2 + + + + + True + True + + + True + True + 3 + + + + + False + True + 3 + + + + + True + False + 5 + + + True + False + Mask: + 0 + + + False + True + 0 + + + + + True + True + + + True + True + 1 + + + + + True + False + DNS-server: + 0 + + + False + True + 2 + + + + + True + True + + + True + True + 3 + + + + + False + True + 4 + + + + + True + True + 0 + + + + + + + + + + + + + + + + + diff --git a/ubinstall-gtk.css b/ubinstall-gtk.css index 6d28543..9b28bc6 100644 --- a/ubinstall-gtk.css +++ b/ubinstall-gtk.css @@ -217,4 +217,11 @@ treeview row:nth-child(even) { background-color: #ffffff; } } .menubox *{ color:@theme_base_color; +} +.bggrey{ + border-radius:5px; + border-color:@theme_text_color; + border-style:solid; + border-width:0.3px; + box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15); } \ No newline at end of file diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 2ad950d..ac0bfe8 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -15,6 +15,18 @@ + + + + + + + + + + + + @@ -29,6 +41,20 @@ + + + + + + + + + + + + + + @@ -57,6 +83,18 @@ LayoutList + + + + + + + + + + + + @@ -71,6 +109,18 @@ + + + + + + + + + + + + True False @@ -84,12 +134,12 @@ 1 10 - - True - False - com.ublinux.libublsettingsui-gtk3.properties-symbolic + + 60 + 1 + 10 - + True False com.ublinux.libublsettingsui-gtk3.properties-symbolic @@ -124,22 +174,37 @@ False com.ublinux.ubinstall.properties-symbolic + + True + False + com.ublinux.libublsettingsui-gtk3.increase-symbolic + + + True + False + com.ublinux.libublsettingsui-gtk3.trash-symbolic + + + True + False + com.ublinux.libublsettingsui-gtk3.settings-symbolic + True False com.ublinux.libublsettingsui-gtk3.properties-symbolic - + True False com.ublinux.libublsettingsui-gtk3.properties-symbolic - + True False com.ublinux.libublsettingsui-gtk3.properties-symbolic - + True False com.ublinux.libublsettingsui-gtk3.properties-symbolic @@ -352,7 +417,7 @@ False True - 1 + 0 @@ -377,11 +442,11 @@ agreement False True - 2 + 1 - + True False False @@ -390,7 +455,7 @@ agreement True False - Sections + Preparation 0 @@ -401,11 +466,11 @@ agreement False True - 2 + 3 - + True False False @@ -414,7 +479,7 @@ agreement True False - Installation + Location 0 @@ -425,11 +490,11 @@ agreement False True - 3 + 4 - + True False False @@ -438,7 +503,7 @@ agreement True False - Location + Keyboard 0 @@ -449,11 +514,11 @@ agreement False True - 4 + 5 - + True False False @@ -462,7 +527,7 @@ agreement True False - Keyboard + Users 0 @@ -473,11 +538,11 @@ agreement False True - 5 + 6 - + True False False @@ -486,7 +551,7 @@ agreement True False - Users + Additional 0 @@ -497,7 +562,31 @@ agreement False True - 6 + 7 + + + + + True + False + False + True + + + True + False + Installation + 0 + + + + + + False + True + 8 @@ -560,7 +649,6 @@ agreement 5 5 left - False True @@ -1007,6 +1095,7 @@ and help you install UBLinux on your computer + True True False True @@ -1083,6 +1172,7 @@ and help you install UBLinux on your computer + True True False True @@ -1233,17 +1323,16 @@ and help you install UBLinux on your computer True in - + True True - AdditionalSoftwareList + OSSorfwareList 0 - Chosen @@ -1265,7 +1354,7 @@ and help you install UBLinux on your computer - Tag + Type @@ -1331,7 +1420,62 @@ and help you install UBLinux on your computer True False - Installation completion + end + Installation configuration has ended + + + + + + + True + True + 1 + + + + + True + False + start + UBLinux OS installation is about to begin + + + + + + True + True + 2 + + + + + 4 + + + + + True + False + Configuration end + + + 4 + False + + + + + True + False + vertical + 5 + + + True + False + Choose system kernel @@ -1364,17 +1508,16 @@ and help you install UBLinux on your computer True in - + True True - AdditionalSoftwareList + KernelsList 0 - Chosen @@ -1385,18 +1528,20 @@ and help you install UBLinux on your computer - Module name + Load - + + True + - 1 + 1 - Tag + Kernel @@ -1407,7 +1552,7 @@ and help you install UBLinux on your computer - Description + Modules @@ -1416,6 +1561,17 @@ and help you install UBLinux on your computer + + + Description + + + + 4 + + + + @@ -1437,61 +1593,6 @@ and help you install UBLinux on your computer - - 4 - - - - - True - False - Additional software - - - 4 - False - - - - - True - False - vertical - 5 - - - True - False - end - Installation configuration has ended - - - - - - - True - True - 1 - - - - - True - False - start - UBLinux OS installation is about to begin - - - - - - True - True - 2 - - - 5 @@ -1500,7 +1601,7 @@ and help you install UBLinux on your computer True False - page 6 + Kernel 5 @@ -1517,7 +1618,7 @@ and help you install UBLinux on your computer True False - Installation + Choose additional components @@ -1531,26 +1632,106 @@ and help you install UBLinux on your computer - + True False - - - False - True - 1 - - - - - 6 - - - - - True - False - Installation + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 + + + True + True + in + + + True + True + AdditionalSoftwareList + 0 + + + + + + + + + 0 + + + + + + + Module name + + + + 1 + + + + + + + Type + + + + 2 + + + + + + + Description + + + + 3 + + + + + + + + + + + + + True + False + Selecting additional software to install from the repository via the Internet + + + + + True + True + 1 + + + + + 6 + + + + + True + False + Additional components 6 @@ -2714,7 +2895,7 @@ and help you install UBLinux on your computer True False - Installation completion + Startup services @@ -2729,25 +2910,86 @@ and help you install UBLinux on your computer - + + True False + 0 + none + + + True + False + + + + + - True + False True 1 - + True - False - end - Success - - - - + True + in + + + True + True + StartupList + + + + + + Autostart + + + + 0 + + + + + + + Unit + + + + 1 + + + + + + + Service + + + + 2 + + + + + + + Description + + + + 3 + + + + + + True @@ -2755,26 +2997,6 @@ and help you install UBLinux on your computer 2 - - - True - False - start - You have UBLinux installed on your computer. -You can reboot and use your new system -or continue working in the UBLinux Live environment. - center - True - - - - - - True - True - 3 - - 10 @@ -2784,7 +3006,7 @@ or continue working in the UBLinux Live environment. True False - Completion + Startup configuration 10 @@ -2801,7 +3023,7 @@ or continue working in the UBLinux Live environment. True False - Completion + Boot load @@ -2816,173 +3038,250 @@ or continue working in the UBLinux Live environment. - - False - - - True - True - 1 - - - - + True False - end - Configuration has been saved - - - - + 0 + none + + + True + False + + + + + - True + False True - 2 + 1 - + True False - start - You can safely exit configurator or return and create new configuration file. - center - True - - - - - - True - True - 3 - - - - - 11 - - - - - True - False - Completed - - - 11 - False - - - - - True - False - vertical - 5 - - - True - False - Installation parameters - - - - - - - - False - True - 0 - - - - - True - True + vertical + 5 - + True False - 10 - 5 + 5 - + + True + True + + + False + True + 0 + + + + True False - vertical - 5 + Boot selection menu timer: + + + False + True + 1 + + + + + True + True + adjustment2 + + + False + True + 2 + + + + + True + False + seconds + + + False + True + 3 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Default OS: + + + False + True + 0 + + + + + True + True + + + True + True + 1 + + + + + True + True + True + image19 + + + + False + True + 2 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + True + + + False + True + 0 + + + + + True + False + Login without password request + + + False + True + 1 + + + + + False + True + 2 + + + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 True False - vertical 5 - + True - False - 5 - - - True - False - /com/ublinux/images/clear_install_disk.png - - - False - True - 0 - - + True + in + 64 + 256 - + True - False - vertical - 5 + True + BootloadUsersList + + + - - True - False - Installation - 0 - - - + + Administrator + + + + 0 + + - - False - True - 0 - - - True - False - Deleting all data on the selected disk and then installing the UBLinux system - 0 + + Username + + + + 1 + + + + + + + Password + + + + 3 + + - - False - True - 1 - - - True - True - 1 - - False + True True 0 @@ -2991,13 +3290,17 @@ or continue working in the UBLinux Live environment. True False + vertical 5 - + True - False - Select device: - 0 + True + True + image17 + False @@ -3006,12 +3309,11 @@ or continue working in the UBLinux Live environment. - + True True True - Start GParted - image5 + image18 @@ -3019,7 +3321,6 @@ or continue working in the UBLinux Live environment. False True - end 1 @@ -3030,220 +3331,44 @@ or continue working in the UBLinux Live environment. 1 - - - True - True - in - 105 - - - True - True - DevicesList - 0 - - - - - - Device - - - - 0 - - - - - - - Description - - - - 1 - - - - - - - Label - - - - 2 - - - - - - - Size - - - - 3 - - - - - - - Serial - - - - 4 - - - - - - - - - True - True - 2 - - - - - True - True - 0 - - - - - True - False - 5 - - - True - True - False - True - - - - True - False - Choose file system type for the section: - - - - - False - True - 0 - - - - - True - False - True - 1 - - ext3 - ext4 - fat16 - fat32 - exfat - riserfs - udf - xfs - zfs - - - - - True - True - 2 - - - - - False - True - 1 - - - - - True - False - 5 - - - True - True - False - True - - - - True - False - Section name: - - - - - False - True - 0 - - - - - True - False - True - - - - True - True - 2 - - - - False - True - 2 - + + + True + False + Bootloader menu users + + + + False + True + 3 + - True + False True - 1 + 2 - 12 + 11 True False - Common Installation + Bootloader - 12 + 11 False @@ -3257,9 +3382,10 @@ or continue working in the UBLinux Live environment. True False - Installation parameters + Network + @@ -3271,30 +3397,1138 @@ or continue working in the UBLinux Live environment. - + True - True + False + 0 + none - + True False - 10 - 5 + + + + + + + + False + True + 1 + + + + + True + False + vertical + 5 + + + True + False + 5 - + + True + True + + + False + True + 0 + + + + True False - vertical - 5 - - - True - False - vertical - 5 - - - True + Domain name: + + + False + True + 1 + + + + + True + True + 10 + + + False + True + 2 + + + + + True + False + Domain administrator: + + + False + True + 3 + + + + + True + True + 10 + + + False + True + 4 + + + + + True + False + Password: + + + False + True + 5 + + + + + True + True + 10 + + + False + True + 6 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + + + False + True + 0 + + + + + True + False + NTP Server: + + + False + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + True + + + True + True + 3 + + + + + False + True + 1 + + + + + True + False + vertical + 5 + + + + + + + + True + True + True + + + + False + True + end + 1 + + + + + False + True + 2 + + + + + False + True + 2 + + + + + 12 + + + + + True + False + Network + + + 12 + False + + + + + True + False + vertical + 5 + + + True + False + Installation + + + + + + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + 13 + + + + + True + False + Installation process + + + 13 + False + + + + + True + False + vertical + 5 + + + True + False + Installation completion + + + + + + + + + False + True + 0 + + + + + False + + + True + True + 1 + + + + + True + False + end + Success + + + + + + + True + True + 2 + + + + + True + False + start + You have UBLinux installed on your computer. +You can reboot and use your new system +or continue working in the UBLinux Live environment. + center + True + + + + + + True + True + 3 + + + + + 14 + + + + + True + False + Completion + + + 14 + False + + + + + True + False + vertical + 5 + + + True + False + Completion + + + + + + + + + False + True + 0 + + + + + False + + + True + True + 1 + + + + + True + False + end + Configuration has been saved + + + + + + + True + True + 2 + + + + + True + False + start + You can safely exit configurator or return and create new configuration file. + center + True + + + + + + True + True + 3 + + + + + 15 + + + + + True + False + Completed + + + 15 + False + + + + + True + False + vertical + 5 + + + True + False + Installation error + + + + + + + + + False + True + 0 + + + + + False + + + False + True + 1 + + + + + True + False + end + Error + + + + + + + True + True + 2 + + + + + True + False + start + Error has occured while installation process + center + True + + + + + + True + True + 3 + + + + + 16 + + + + + True + False + Configuration error + + + 16 + False + + + + + True + False + vertical + 5 + + + True + False + Configuration + + + + + + + + + False + True + 0 + + + + + False + + + False + True + 1 + + + + + True + False + end + Installer configuration has been finished + + + + + + + True + True + 2 + + + + + True + False + start + Choose a save option on the header bar + center + True + + + + + + True + True + 3 + + + + + 17 + + + + + True + False + Configuration end + + + 17 + False + + + + + True + False + vertical + 5 + + + True + False + Configuration + + + + + + + + + False + True + 0 + + + + + False + + + False + True + 1 + + + + + True + False + end + Configuration has been saved + + + + + + + True + True + 2 + + + + + True + False + start + You can safely exit configurator or return and create new configuration file. + center + True + + + + + + True + True + 3 + + + + + 18 + + + + + True + False + Configuration saved + + + 18 + False + + + + + True + False + vertical + 5 + + + True + False + Installation parameters + + + + + + + + False + True + 0 + + + + + True + True + + + True + False + 10 + 5 + + + True + False + vertical + 5 + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + /com/ublinux/images/clear_install_disk.png + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + Installation + 0 + + + + + + False + True + 0 + + + + + True + False + Deleting all data on the selected disk and then installing the UBLinux system + 0 + + + False + True + 1 + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Select device: + 0 + + + False + True + 0 + + + + + True + True + True + Start GParted + image5 + + + + False + True + end + 1 + + + + + False + True + 1 + + + + + True + True + in + 105 + 350 + + + True + True + DevicesList + 0 + + + + + + Device + + + + 0 + + + + + + + Description + + + + 1 + + + + + + + Label + + + + 2 + + + + + + + Size + + + + 3 + + + + + + + Serial + + + + 4 + + + + + + + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + False + True + + + + True + False + Choose file system type for the section: + + + + + False + True + 0 + + + + + True + False + True + 1 + + ext3 + ext4 + fat16 + fat32 + exfat + riserfs + udf + xfs + zfs + + + + + True + True + 2 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + True + False + True + + + + True + False + Section name: + + + + + False + True + 0 + + + + + True + False + True + + + + True + True + 2 + + + + + False + True + 2 + + + + + + + + + True + True + 1 + + + + + 19 + + + + + True + False + Common Installation + + + 19 + False + + + + + True + False + vertical + 5 + + + True + False + Installation parameters + + + + + + + + False + True + 0 + + + + + True + True + + + True + False + 10 + 5 + + + True + False + vertical + 5 + + + True + False + vertical + 5 + + + True False 5 @@ -3443,6 +4677,7 @@ installed. True in 105 + 350 True @@ -3511,14 +4746,14 @@ installed. - True + False True 1 - True + False True 0 @@ -3547,6 +4782,7 @@ installed. True in 128 + 350 True @@ -3615,14 +4851,14 @@ installed. - True + False True 1 - True + False True 1 @@ -3697,7 +4933,7 @@ installed. - True + False True 1 @@ -3834,7 +5070,7 @@ installed. - 13 + 20 @@ -3844,7 +5080,7 @@ installed. Installation next to system - 13 + 20 False @@ -4367,7 +5603,7 @@ installed. - 14 + 21 @@ -4377,7 +5613,7 @@ installed. Installation on same partition - 14 + 21 False @@ -4391,7 +5627,7 @@ installed. True False - Installation options + Installation parameters @@ -4405,22 +5641,319 @@ installed. - + True - True + False + vertical + 5 + + + True + False + 5 + + + True + False + /com/ublinux/images/manual_install_disk.png + + + False + True + 0 + + + + + True + False + vertical + + + True + False + Advanced installation mode + 0 + + + + + + False + True + 0 + + + + + True + False + Installing OS files, user data on different partitions, creating RAID, etc. + 0 + + + False + True + 1 + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + <b>Attention!</b> The selected OS UBLinux components will be installed +separately into the selected partition. + True + 0 + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + vertical + 5 + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + Select device: + 0 + + + False + True + 0 + + + + + True + True + True + image20 + + + + False + True + end + 1 + + + + + False + True + 0 + + + + + True + True + in + + + True + True + + + + + + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Virtual device type: + 0 + + + False + True + 0 + + + + + True + False + 0 + + No + + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + vertical + 5 + + + True + False + Select partiton: + 0 + + + False + True + 0 + + + + + True + True + in + + + True + True + + + + + + + + False + True + 1 + + + + + False + True + 2 + + + + + True + False + vertical + 5 + + + + + + + + True + True + True + + + + False + True + 2 + + + + + False + True + 3 + + - + True False + 5 - + True False - vertical + start + 0 + none True False + 5 + 5 + 5 + 5 vertical 5 @@ -4429,341 +5962,74 @@ installed. False 5 - + True False - /com/ublinux/images/manual_install_disk.png + Load type False - True - 0 - - - - - True - False - vertical - - - True - False - Advanced installation mode - 0 - - - - - - False - True - 0 - - - - - True - False - Installing OS files, user data on different partitions, creating RAID, etc. - 0 - - - False - True - 1 - - - - - True - True - 1 - - - - - False - True - 0 - - - - - True - False - <b>Attention!</b> The selected OS UBLinux components will be installed -separately into the selected partition. - True - 0 - - - False - True - 1 - - - - - False - True - 1 - - - - - True - False - vertical - 5 - - - True - True - False - True - True - - - True - False - 5 - - - True - False - gtk-missing-image - - - False - True - 0 - - - - - True - False - vertical - 5 - - - True - False - GRUB install - 0 - - - - - - - False - True - 0 - - - - - True - False - Install the GRUB bootloader - 0 - - - False - True - 1 - - - - - True - True - 1 - - - - - - - False - True - 0 - - - - - True - True - False - True - True - GrubInstallRadio - - - True - False - 5 - - - True - False - gtk-missing-image - - - False - True - 0 - - - - - True - False - vertical - 5 - - - True - False - GRUB update - 0 - - - - - - - False - True - 0 - - - - - True - False - Update (reinstall) the GRUB bootloader - 0 - - - False - True - 1 - - - - - True - True - 1 - - - - - - - False - True - 1 - - - - - True - True - False - True - True - GrubInstallRadio + True + 0 + + - + True - False - 5 - - - True - False - gtk-missing-image - - - False - True - 0 - - + True + False + True - - True - False - vertical - 5 - - - True - False - Separate installation - 0 - - - - - - - False - True - 0 - - - - - True - False - Installing OS components and user data on different disk partitions - 0 - - - False - True - 1 - - - - - True - True - 1 - + + + + + False + True + end + 1 + + + + + True + True + + False + True + end + 2 + False True - 2 + 0 - + True - True - False - True - True - GrubInstallRadio + False + none + True True False + vertical 5 - + True False - gtk-missing-image False @@ -4775,18 +6041,12 @@ separately into the selected partition. True False - vertical 5 True False - OS only - 0 - - - - + BIOS Boot sector False @@ -4795,75 +6055,45 @@ separately into the selected partition. - + True - False - Installing only OS components without user data - 0 + True False True - 1 + end + 2 - True + False True 1 - - - - - False - True - 3 - - - - - True - True - False - True - True - GrubInstallRadio - - - True - False - 5 - + True False - gtk-missing-image False True - 0 + 2 True False - vertical 5 True False - User data only - 0 - - - - + EFI section False @@ -4872,23 +6102,22 @@ separately into the selected partition. - + True - False - Installing only user data without OS components - 0 + True False True - 1 + end + 2 - True + False True - 1 + 4 @@ -4897,102 +6126,114 @@ separately into the selected partition. False True - 4 + 1 - - False - True - 2 - + + + + + + True + True + 0 + - - - - - True - True - 3 - - - - - 15 - - - - - True - False - Advanced installation - - - 15 - False - - - - - True - False - vertical - 5 - - - True - False - vertical - 5 - - - True - False - Installation parameters - - - - - - - - False - True - 0 - - - - - True - True - + True False + 0 + none True False + 5 + 5 + 5 + 5 vertical 5 - + + True + False + 5 + + + True + False + Swap file + + + False + True + 0 + + + + + True + True + False + True + + + + + + + False + True + end + 1 + + + + + True + True + + + False + True + end + 2 + + + + + False + True + 0 + + + + True False - vertical - 5 + none + True True False + vertical 5 - + True False - /com/ublinux/images/clear_install_disk.png False @@ -5004,17 +6245,12 @@ separately into the selected partition. True False - vertical 5 True False - GRUB install - 0 - - - + Automatically False @@ -5023,256 +6259,165 @@ separately into the selected partition. - + True - False - Install the GRUB bootloader - 0 + True False True - 1 + end + 2 - True + False True 1 - - - False - True - 0 - - - - - True - False - 5 - + True False - Select device: - 0 False True - 0 + 2 - + True - True - True - image2 - + False + 5 + + + True + False + Corresponds to RAM size + + + False + True + 0 + + + + + True + True + + + False + True + end + 2 + + False True - end - 1 + 3 - - - False - True - 1 - - - - - True - True - in - 128 - + True - True - DevicesList - 0 - - - - - - Device - - - - 0 - - - - - - - Description - - - - 1 - - - - - - - Mark - - - - 2 - - - - - - - Size - - - - 3 - - - - - - - Free - - - - 4 - - - - + False + + False + True + 4 + - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - vertical - - - True - False - Choose a section: - 0 - - - False - True - 0 - - - - - True - True - in - 128 - + True - True - PartitionsList - 0 - - + False + 5 + + + True + False + Fixed size: + + + False + True + 0 + - - Section - - - - 0 - - + + True + True + + False + True + 1 + - - Capacity - - - - 1 - - + + True + True + + False + True + end + 2 + - - Free space - - - - 2 - - + + True + False + Mb + + False + True + 3 + - - File system - - - - 3 - - + + True + True + + False + True + 4 + - - Mark - - - - 4 - - + + True + False + Gb + + False + True + 5 + + + False + True + 5 + - - False - True - 1 - @@ -5283,35 +6428,46 @@ separately into the selected partition. + + + + + + True + True + 1 + - True + False True - 1 + 4 - True + False True - 1 + 2 - 16 + 22 True False - GRUB install + Advanced section - 16 + 22 False @@ -5325,7 +6481,7 @@ separately into the selected partition. True False - Installation parameters + Installation options @@ -5351,7 +6507,6 @@ separately into the selected partition. True False vertical - 5 True @@ -5367,7 +6522,7 @@ separately into the selected partition. True False - /com/ublinux/images/clear_install_disk.png + /com/ublinux/images/manual_install_disk.png False @@ -5380,12 +6535,11 @@ separately into the selected partition. True False vertical - 5 True False - GRUB update + Advanced installation mode 0 @@ -5401,63 +6555,202 @@ separately into the selected partition. True False - Update (reinstall) the GRUB bootloader + Installing OS files, user data on different partitions, creating RAID, etc. 0 - False + False + True + 1 + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + <b>Attention!</b> The selected OS UBLinux components will be installed +separately into the selected partition. + True + 0 + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + vertical + 5 + + + True + True + False + True + True + + + True + False + 5 + + + True + False + gtk-missing-image + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + GRUB install + 0 + + + + + + + False + True + 0 + + + + + True + False + Install the GRUB bootloader + 0 + + + False + True + 1 + + + + + True + True + 1 + + + + + + + False + True + 0 + + + + + True + True + False + True + True + GrubInstallRadio + + + True + False + 5 + + + True + False + gtk-missing-image + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + GRUB update + 0 + + + + + + + False + True + 0 + + + + + True + False + Update (reinstall) the GRUB bootloader + 0 + + + False + True + 1 + + + + + True True 1 - - True - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - False - Select device: - 0 - - - False - True - 0 - - - - - True - True - True - image3 - - - - False - True - end - 1 - @@ -5467,74 +6760,72 @@ separately into the selected partition. - + True True - in - 128 + False + True + True + GrubInstallRadio - + True - True - DevicesList - 0 - - - - - - Device - - - - 0 - - - - - - - Description - - - - 1 - - - - + False + 5 - - Mark - - - - 2 - - + + True + False + gtk-missing-image + + False + True + 0 + - - Size + + True + False + vertical + 5 - - - 3 - + + True + False + OS only + 0 + + + + + + + False + True + 0 + - - - - - Free - - - 4 - + + True + False + Installing only OS components without user data + 0 + + + False + True + 1 + + + True + True + 1 + @@ -5542,103 +6833,76 @@ separately into the selected partition. False True - 2 - - - - - False - True - 0 - - - - - True - False - vertical - - - True - False - Choose a section: - 0 - - - False - True - 0 + 3 - + True True - in - 128 + False + True + True + GrubInstallRadio - + True - True - PartitionsList - 0 - - - - - - Section - - - - 0 - - - - - - - Capacity - - - - 1 - - - - + False + 5 - - Free space - - - - 2 - - + + True + False + gtk-missing-image + + False + True + 0 + - - File system + + True + False + vertical + 5 - - - 3 - + + True + False + User data only + 0 + + + + + + + False + True + 0 + - - - - - Mark - - - 4 - + + True + False + Installing only user data without OS components + 0 + + + False + True + 1 + + + True + True + 1 + @@ -5646,14 +6910,14 @@ separately into the selected partition. False True - 1 + 4 False True - 1 + 2 @@ -5664,22 +6928,22 @@ separately into the selected partition. True True - 1 + 3 - 17 + 23 True False - GRUB update + Recovery section - 17 + 23 False @@ -5690,36 +6954,36 @@ separately into the selected partition. vertical 5 - + True False - Installation parameters - - - - - - - - False - True - 0 - - - - - True - True + vertical + 5 - + True False + Installation parameters + + + + + + + + False + True + 0 + + + + + True + True - + True False - vertical - 5 True @@ -5730,12 +6994,67 @@ separately into the selected partition. True False + vertical 5 - + True False - /com/ublinux/images/clear_install_disk.png + 5 + + + True + False + /com/ublinux/images/clear_install_disk.png + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + GRUB install + 0 + + + + + + False + True + 0 + + + + + True + False + Install the GRUB bootloader + 0 + + + False + True + 1 + + + + + True + True + 1 + + False @@ -5747,17 +7066,13 @@ separately into the selected partition. True False - vertical 5 True False - Separate installation + Select device: 0 - - - False @@ -5766,172 +7081,109 @@ separately into the selected partition. - + True - False - Installing OS components and user data on different disk partitions - 0 + True + True + image2 + False True + end 1 - - True - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - False - Select device: - 0 - - - False - True - 0 - - - - - True - True - True - image4 - - False True - end 1 - - - False - True - 1 - - - - - True - True - in - 128 - + True True - DevicesList - 0 - - - + in + 128 - - Device - - - - 0 - + + True + True + DevicesList + 0 + + + + + + Device + + + + 0 + + + - - - - - Description - - - 1 - + + Description + + + + 1 + + + - - - - - Mark - - - 2 - + + Mark + + + + 2 + + + - - - - - Size - - - 3 - + + Size + + + + 3 + + + - - - - - Free - - - 4 - + + Free + + + + 4 + + + + + False + True + 2 + - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - vertical - - - True - False - Choose a section: - 0 - False True @@ -5939,76 +7191,101 @@ separately into the selected partition. - + True - True - in - 128 + False + vertical + + + True + False + Choose a section: + 0 + + + False + True + 0 + + - + True True - PartitionsList - 0 - - - + in + 128 - - Section + + True + True + PartitionsList + 0 + + + - - - 0 - + + Section + + + + 0 + + + - - - - - Capacity - - - 1 - + + Capacity + + + + 1 + + + - - - - - Free space - - - 2 - + + Free space + + + + 2 + + + - - - - - File system - - - 3 - + + File system + + + + 3 + + + - - - - - Mark - - - 4 - + + Mark + + + + 4 + + + + + False + True + 1 + @@ -6018,15 +7295,15 @@ separately into the selected partition. - - False - True - 1 - + + True + True + 1 + @@ -6037,17 +7314,17 @@ separately into the selected partition. - 18 + 24 True False - Separate installation + GRUB install - 18 + 24 False @@ -6121,7 +7398,7 @@ separately into the selected partition. True False - Separate installation + GRUB update 0 @@ -6137,7 +7414,7 @@ separately into the selected partition. True False - Installing OS components and user data on different disk partitions + Update (reinstall) the GRUB bootloader 0 @@ -6179,11 +7456,11 @@ separately into the selected partition. - + True True True - image10 + image3 @@ -6209,9 +7486,8 @@ separately into the selected partition. in 128 - + True - False True DevicesList 0 @@ -6314,7 +7590,7 @@ separately into the selected partition. in 128 - + True True PartitionsList @@ -6406,17 +7682,17 @@ separately into the selected partition. - 19 + 25 True False - Separate installation - userdata + GRUB update - 19 + 25 False @@ -6774,7 +8050,7 @@ separately into the selected partition. - 20 + 26 @@ -6784,7 +8060,7 @@ separately into the selected partition. OS only - 20 + 26 False @@ -7142,7 +8418,7 @@ separately into the selected partition. - 21 + 27 @@ -7152,262 +8428,7 @@ separately into the selected partition. User data only - 21 - False - - - - - True - False - vertical - 5 - - - True - False - Installation error - - - - - - - - - False - True - 0 - - - - - False - - - False - True - 1 - - - - - True - False - end - Error - - - - - - - True - True - 2 - - - - - True - False - start - Error has occured while installation process - center - True - - - - - - True - True - 3 - - - - - 22 - - - - - True - False - Installation error - - - 22 - False - - - - - True - False - vertical - 5 - - - True - False - Configuration - - - - - - - - - False - True - 0 - - - - - False - - - False - True - 1 - - - - - True - False - end - Installer configuration has been finished - - - - - - - True - True - 2 - - - - - True - False - start - Choose a save option on the header bar - center - True - - - - - - True - True - 3 - - - - - 23 - - - - - True - False - Configuration ended - - - 23 - False - - - - - True - False - vertical - 5 - - - True - False - Configuration - - - - - - - - - False - True - 0 - - - - - False - - - False - True - 1 - - - - - True - False - end - Configuration has been saved - - - - - - - True - True - 2 - - - - - True - False - start - You can safely exit configurator or return and create new configuration file. - center - True - - - - - - True - True - 3 - - - - - 24 - - - - - True - False - Configuration saved - - - 24 + 27 False @@ -7446,7 +8467,6 @@ separately into the selected partition. Back - True False True True -- 2.35.1 From f71848ea9d88c37f9c2a7e6039af9769c61be4a4 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 3 Jul 2025 18:00:11 +0600 Subject: [PATCH 02/18] WIP navigation; WIP network saving; WIP kernel saving --- source/CMakeLists.txt | 1 + source/ubinstall-gtk-components.c | 3 - source/ubinstall-gtk-configuration-mode.c | 25 ++++++ source/ubinstall-gtk-installation.c | 34 +++++--- source/ubinstall-gtk-network.c | 95 +++++++++++++++++++++++ source/ubinstall-gtk-page-switch.c | 24 +++++- source/ubinstall-gtk-region.c | 18 ++++- source/ubinstall-gtk.c | 47 +---------- source/ubinstall-gtk.h | 22 +++++- ubinstall-gtk-network-box.glade | 18 +++++ ubinstall-gtk.glade | 27 ++++++- 11 files changed, 248 insertions(+), 66 deletions(-) create mode 100644 source/ubinstall-gtk-configuration-mode.c diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index c81cf69..9a5fe02 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -115,6 +115,7 @@ set(SOURCE_FILES ubinstall-gtk-network.c ubinstall-gtk-separate.c ubinstall-gtk-users.c + ubinstall-gtk-configuration-mode.c ubinstall-gtk.h ubl-strings.h ) diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index 245bd14..67ca9bc 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -13,9 +13,6 @@ int yon_kernel_save(main_window *widgets){ yon_char_parsed_add_or_create_if_exists(kernels,&size,target); } } - if (!size){ - return 0; - } return 1; } diff --git a/source/ubinstall-gtk-configuration-mode.c b/source/ubinstall-gtk-configuration-mode.c new file mode 100644 index 0000000..d0b0e8f --- /dev/null +++ b/source/ubinstall-gtk-configuration-mode.c @@ -0,0 +1,25 @@ +#include "ubinstall-gtk.h" + +void on_configuration_mode_switch(GtkWidget *self,main_window *widgets){ + if (getuid()) { + if (main_config.configure_mode==1){ + char *argline = LocaleName; + for (int i=1;iMainWindow); + } + } + } + main_config.configure_mode = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(self)); +} diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 6f2c073..6fcdfc4 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -151,23 +151,23 @@ int yon_advanced_sections_save(dictionary *dict){ char *size = yon_char_unite(size_first,size_last?",":NULL,size_last,NULL); yon_config_register(part_size_parameter,part_size_parameter_command,size); - char *device_label_first = gtk_entry_get_text(GTK_ENTRY(first_section->SectionMarkEntry)); - char *device_label_last = last_section&&!strcmp(format_last,"yes")?gtk_entry_get_text(GTK_ENTRY(last_section->SectionMarkEntry)):NULL; + char *device_label_first = (char*)gtk_entry_get_text(GTK_ENTRY(first_section->SectionMarkEntry)); + char *device_label_last = last_section&&!strcmp(format_last,"yes")?(char*)gtk_entry_get_text(GTK_ENTRY(last_section->SectionMarkEntry)):NULL; char *device_label = yon_char_unite(device_label_first,device_label_last?",":NULL,device_label_last,NULL); yon_config_register(device_label_parameter,device_label_parameter_command,device_label); - char *fs_label_first = gtk_entry_get_text(GTK_ENTRY(first_section->FileSystemMarkentry)); - char *fs_label_last = last_section&&!strcmp(format_last,"yes")?gtk_entry_get_text(GTK_ENTRY(last_section->FileSystemMarkentry)):NULL; + char *fs_label_first = (char*)gtk_entry_get_text(GTK_ENTRY(first_section->FileSystemMarkentry)); + char *fs_label_last = last_section&&!strcmp(format_last,"yes")?(char*)gtk_entry_get_text(GTK_ENTRY(last_section->FileSystemMarkentry)):NULL; char *fs_label = yon_char_unite(fs_label_first,fs_label_last?",":NULL,fs_label_last,NULL); yon_config_register(part_fs_label_parameter,part_fs_label_parameter_command,fs_label); - char *fs_type_first = gtk_combo_box_get_active_id(GTK_COMBO_BOX(first_section->FileSystemTypeCombo)); - char *fs_type_last = last_section&&!strcmp(format_last,"yes")?gtk_combo_box_get_active_id(GTK_COMBO_BOX(last_section->FileSystemTypeCombo)):NULL; + char *fs_type_first = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(first_section->FileSystemTypeCombo)); + char *fs_type_last = last_section&&!strcmp(format_last,"yes")?(char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(last_section->FileSystemTypeCombo)):NULL; char *fs_type = yon_char_unite(fs_type_first,fs_type_last?",":NULL,fs_type_last,NULL); yon_config_register(part_type_parameter,part_type_parameter_command,fs_type); - char *part_crypt_first = gtk_combo_box_get_active(first_section->EncryptionCombo)?gtk_entry_get_text(GTK_ENTRY(first_section->EncryptionEntry)):NULL; - char *part_crypt_last = last_section&&!strcmp(format_last,"yes")&>k_combo_box_get_active(last_section->EncryptionCombo)?gtk_entry_get_text(GTK_ENTRY(first_section->EncryptionEntry)):NULL; + char *part_crypt_first = gtk_combo_box_get_active(GTK_COMBO_BOX(first_section->EncryptionCombo))?(char*)gtk_entry_get_text(GTK_ENTRY(first_section->EncryptionEntry)):NULL; + char *part_crypt_last = last_section&&!strcmp(format_last,"yes")&>k_combo_box_get_active(GTK_COMBO_BOX(last_section->EncryptionCombo))?(char*)gtk_entry_get_text(GTK_ENTRY(first_section->EncryptionEntry)):NULL; char *part_crypt = NULL; if (part_crypt_first||part_crypt_last){ part_crypt = yon_char_unite(part_crypt_first,part_crypt_last?",":NULL,part_crypt_last,NULL); @@ -201,7 +201,9 @@ int yon_install_advanced_save(main_window *widgets){ char *part; gtk_tree_model_get(model,&iter,0,&part,-1); - yon_advanced_section_get_string(widgets->advanced_sections); + if (!yon_advanced_sections_save(widgets->advanced_sections)){ + return 0; + } if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapSwitch))){ if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapAutoSwitch))){ @@ -215,6 +217,20 @@ int yon_install_advanced_save(main_window *widgets){ yon_config_register(swap_size_parameter,swap_size_parameter_command,swap); } } + const char *device_typevfs = gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->AdvancedVirtualDeviceCombo)); + if (!yon_char_is_empty(device_typevfs)){ + yon_config_register(device_typevfs_parameter,device_typevfs_parameter_command,(char*)device_typevfs); + } else { + yon_config_remove_by_key(device_typevfs_parameter); + } + if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedLoadTypeSwitch))){ + char *bios = gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedBiosSectorSwitch))?"bios":""; + char *efi = gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedEFISwitch))?"efi":NULL; + char *boot = yon_char_unite(bios,!yon_char_is_empty(bios)&&!yon_char_is_empty(efi)?"+":"",efi,NULL); + yon_config_register(boot_parameter,boot_parameter_command,boot); + } else { + yon_config_register(boot_parameter,boot_parameter_command,"none"); + } return 1; } \ No newline at end of file diff --git a/source/ubinstall-gtk-network.c b/source/ubinstall-gtk-network.c index 6df7f1f..c1d4e4f 100644 --- a/source/ubinstall-gtk-network.c +++ b/source/ubinstall-gtk-network.c @@ -6,6 +6,7 @@ network_info *yon_network_info_new(){ info->MainBox = yon_gtk_builder_get_widget(builder,"MainBox"); info->TypeCombo = yon_gtk_builder_get_widget(builder,"TypeCombo"); info->ConnectionCombo = yon_gtk_builder_get_widget(builder,"ConnectionCombo"); + info->ConnectionEntry = yon_gtk_builder_get_widget(builder,"ConnectionEntry"); info->EnabledSwitch = yon_gtk_builder_get_widget(builder,"EnabledSwitch"); info->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton"); info->AutoGetIPSwitch = yon_gtk_builder_get_widget(builder,"AutoGetIPSwitch"); @@ -17,5 +18,99 @@ network_info *yon_network_info_new(){ g_object_set_data(G_OBJECT(info->RemoveButton),"network_info",info); g_object_set_data(G_OBJECT(info->MainBox),"network_info",info); + gtk_widget_show(info->MainBox); return info; +} + +void on_ntp_sync(GtkWidget *, main_window *widgets){ + int mode = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->NetworkNTPCombo)); + gtk_widget_set_sensitive(widgets->NetworkNTPEntry,0); + switch(mode){ + case 0: + gtk_entry_set_text(GTK_ENTRY(widgets->NetworkNTPEntry),""); + gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->NetworkNTPEntry),""); + break; + case 2:{ + int size; + config_str parsed = yon_config_load(get_ntp_default_command,&size); + if (size&&!yon_char_is_empty(parsed[0])&&strcmp(parsed[0],"(null)\n")){ + free(yon_char_divide_search(parsed[0],"=",-1)); + yon_char_remove_last_symbol(parsed[0],'\n'); + yon_char_remove_brackets(parsed[0]); + gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->NetworkNTPEntry),parsed[0]); + yon_char_parsed_free(parsed,size); + gtk_entry_set_text(GTK_ENTRY(widgets->NetworkNTPEntry),""); + } + } + break; + case 3:{ + int size; + config_str parsed = yon_config_load(get_ntp_ru_command,&size); + if (size&&!yon_char_is_empty(parsed[0])&&strcmp(parsed[0],"(null)\n")){ + free(yon_char_divide_search(parsed[0],"=",-1)); + yon_char_remove_last_symbol(parsed[0],'\n'); + yon_char_remove_brackets(parsed[0]); + gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->NetworkNTPEntry),parsed[0]); + yon_char_parsed_free(parsed,size); + gtk_entry_set_text(GTK_ENTRY(widgets->NetworkNTPEntry),""); + } + } + break; + case 1: + gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->NetworkNTPEntry),"DHCP"); + gtk_entry_set_text(GTK_ENTRY(widgets->NetworkNTPEntry),""); + break; + case 5: + gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->NetworkNTPEntry),""); + gtk_entry_set_text(GTK_ENTRY(widgets->NetworkNTPEntry),""); + break; + case 4: + gtk_widget_set_sensitive(widgets->NetworkNTPEntry,1); + gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->NetworkNTPEntry),""); + gtk_entry_set_text(GTK_ENTRY(widgets->NetworkNTPEntry),""); + break; + } +} + +void on_connection_add(main_window *widgets){ + network_info *info = yon_network_info_new(); + gtk_box_pack_start(GTK_BOX(widgets->NetworkConnectionsBox),info->MainBox,0,0,0); +} + +int yon_network_save(main_window *widgets){ + if (gtk_switch_get_active(GTK_SWITCH(widgets->NetworkDomainSwitch))){ + // const char *domain_name = gtk_entry_get_text(GTK_ENTRY(widgets->NetworkDomainNameEntry)); + // const char *domain_admin = gtk_entry_get_text(GTK_ENTRY(widgets->NetworkDomainAdminEntry)); + // const char *domain_password = gtk_entry_get_text(GTK_ENTRY(widgets->NetworkDomainPasswordEntry)); + } + if (gtk_switch_get_active(GTK_SWITCH(widgets->NetworkNTPServerSwitch))){ + + int mode = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->NetworkNTPCombo)); + switch(mode){ + case 0:yon_config_remove_by_key(NTPSERVERS_parameter); + break; + case 1:yon_config_register(NTPSERVERS_parameter,NTPSERVERS_parameter_command,"dhcp"); + break; + case 2:yon_config_register(NTPSERVERS_parameter,NTPSERVERS_parameter_command,"default"); + break; + case 3:yon_config_register(NTPSERVERS_parameter,NTPSERVERS_parameter_command,"ntp-ru"); + break; + case 5:yon_config_register(NTPSERVERS_parameter,NTPSERVERS_parameter_command,"disable"); + break; + case 6:yon_config_register(NTPSERVERS_parameter,NTPSERVERS_parameter_command,"stop"); + break; + case 4: + char *value = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->NetworkNTPEntry)); + if (yon_char_is_empty(value)) { + yon_ubl_status_box_render(EMPTY_IMPORTANT_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(widgets->NetworkNTPEntry); + return 0; + } + yon_config_register(NTPSERVERS_parameter,NTPSERVERS_parameter_command,value); + break; + } + } else { + yon_config_remove_by_key(NTPSERVERS_parameter); + } + return 1; } \ No newline at end of file diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index 102f13f..da2ac11 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -1,11 +1,14 @@ #include "ubinstall-gtk.h" enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ + if (!yon_page_save(widgets,page)){ + return -1; + } switch (page){ case YON_PAGE_WELCOME: return YON_PAGE_LICENCE; break; case YON_PAGE_LICENCE: return YON_PAGE_SECTIONS; break; case YON_PAGE_SECTIONS: return yon_sections_get_next_page(widgets); break; - case YON_PAGE_OS_COMPONENTS: return YON_PAGE_INSTALLATION_BEGIN; break; + case YON_PAGE_OS_COMPONENTS: return main_config.configure_mode? YON_PAGE_KERNEL : YON_PAGE_INSTALLATION_BEGIN; break; case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_KERNEL; break; case YON_PAGE_KERNEL: return YON_PAGE_SOFTWARE; break; case YON_PAGE_SOFTWARE: return YON_PAGE_REGION; break; @@ -14,7 +17,7 @@ enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_USERS: return YON_PAGE_STARTUP; break; case YON_PAGE_STARTUP: return YON_PAGE_BOOTLOADER; break; case YON_PAGE_BOOTLOADER: return YON_PAGE_NETWORK; break; - case YON_PAGE_NETWORK: return YON_PAGE_INSTALLATION; break; + case YON_PAGE_NETWORK: return main_config.configure_mode? YON_PAGE_CONFIGURE_END : YON_PAGE_INSTALLATION; break; case YON_PAGE_INSTALL_COMMON: return YON_PAGE_KERNEL; break; case YON_PAGE_INSTALL_SEPARATE: return YON_PAGE_KERNEL; break; case YON_PAGE_INSTALL_SAME_PARTITION: return YON_PAGE_KERNEL; break; @@ -129,7 +132,7 @@ int yon_page_save(main_window *widgets, enum YON_PAGES page){ return yon_bootloader_save(widgets); break; case YON_PAGE_NETWORK: - // return yon_network_save(widgets); + return yon_network_save(widgets); break; case YON_PAGE_INSTALL_COMMON: return yon_install_common_save(widgets); @@ -160,9 +163,24 @@ int yon_page_save(main_window *widgets, enum YON_PAGES page){ return 1; } +void yon_configuration_mode_check(main_window *widgets){ + enum YON_PAGES page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); + if (page==YON_PAGE_WELCOME){ + gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,1); + } else { + gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,0); + } + if (page == YON_PAGE_CONFIGURE_END){ + gtk_widget_show(widgets->SaveButton); + } else { + gtk_widget_hide(widgets->SaveButton); + } +} + void yon_page_update(main_window *widgets){ yon_navigation_buttons_set_sensetiveness(widgets); yon_switch_page_render(widgets); + yon_configuration_mode_check(widgets); } enum YON_PAGES yon_sections_get_next_page(main_window *widgets){ diff --git a/source/ubinstall-gtk-region.c b/source/ubinstall-gtk-region.c index 80439cb..27b85da 100644 --- a/source/ubinstall-gtk-region.c +++ b/source/ubinstall-gtk-region.c @@ -40,4 +40,20 @@ int yon_region_save(main_window *widgets){ yon_config_remove_by_key(zone_parameter); } return 1; -} \ No newline at end of file +} + +void on_region_changed(GtkComboBox *self, main_window *widgets){ + char *active = (char*)gtk_combo_box_get_active_id(self); + active = yon_char_append("/usr/share/zoneinfo/",active); + int size; + gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo)); + if (yon_file_is_directory(active)){ + config_str parsed = yon_file_ls(active,&size); + for (int i=0;iZoneCombo),parsed[i],_(parsed[i])); + } + if (size) yon_char_parsed_free(parsed,size); + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ZoneCombo),0); + } + free(active); +} diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 97f7898..2c5022c 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -661,30 +661,6 @@ void on_toggle_button_switch_on(GtkWidget *, GtkToggleButton *toggle){ // yon_launch(argline); // } -// void on_configuration_mode_switch(GtkWidget *self,main_window *widgets){ -// if (getuid()) { -// if (main_config.configure_mode==1){ -// char *argline = LocaleName; -// for (int i=1;iMainWindow); -// } -// } -// } -// main_config.configure_mode = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(self)); -// } - // int yon_image_resize_from_container(GtkImage *target, GdkPixbuf *pixbuf_unscaled){ // int width = gtk_widget_get_allocated_width((gtk_widget_get_parent(GTK_WIDGET(target)))); // int height = gtk_widget_get_allocated_height((gtk_widget_get_parent(GTK_WIDGET(target)))); @@ -1161,23 +1137,6 @@ void yon_switch_page_render(main_window *widgets){ // // } - -// void on_region_changed(GtkComboBox *self, main_window *widgets){ -// char *active = (char*)gtk_combo_box_get_active_id(self); -// active = yon_char_append("/usr/share/zoneinfo/",active); -// int size; -// gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo)); -// if (yon_file_is_directory(active)){ -// config_str parsed = yon_file_ls(active,&size); -// for (int i=0;iZoneCombo),parsed[i],_(parsed[i])); -// } -// if (size) yon_char_parsed_free(parsed,size); -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ZoneCombo),0); -// } -// free(active); -// } - // void on_locale_changed(GtkWidget *,main_window *){ // // } @@ -1666,7 +1625,7 @@ main_window *yon_main_window_complete(){ widgets->NetworkDomainSwitch = yon_gtk_builder_get_widget(builder,"NetworkDomainSwitch"); widgets->NetworkDomainNameEntry = yon_gtk_builder_get_widget(builder,"NetworkDomainNameEntry"); widgets->NetworkDomainAdminEntry = yon_gtk_builder_get_widget(builder,"NetworkDomainAdminEntry"); - widgets->DomainPasswordEntry = yon_gtk_builder_get_widget(builder,"DomainPasswordEntry"); + widgets->NetworkDomainPasswordEntry = yon_gtk_builder_get_widget(builder,"NetworkDomainPasswordEntry"); widgets->NetworkNTPServerSwitch = yon_gtk_builder_get_widget(builder,"NetworkNTPServerSwitch"); widgets->NetworkNTPCombo = yon_gtk_builder_get_widget(builder,"NetworkNTPCombo"); widgets->NetworkNTPEntry = yon_gtk_builder_get_widget(builder,"NetworkNTPEntry"); @@ -1717,7 +1676,7 @@ main_window *yon_main_window_complete(){ g_signal_connect(G_OBJECT(widgets->BackButton),"clicked",G_CALLBACK(on_page_prev_clicked),widgets); // g_signal_connect(G_OBJECT(widgets->CancelInstallButton),"clicked",G_CALLBACK(on_page_navigation_clicked),widgets); // g_signal_connect(G_OBJECT(widgets->AvailableLanguagesButton),"clicked",G_CALLBACK(on_language_clicked),widgets); - // g_signal_connect(G_OBJECT(widgets->RegionCombo),"changed",G_CALLBACK(on_region_changed),widgets); + g_signal_connect(G_OBJECT(widgets->RegionCombo),"changed",G_CALLBACK(on_region_changed),widgets); // g_signal_connect(G_OBJECT(widgets->LayoutSensitiveCheck),"toggled",G_CALLBACK(on_layout_toggle_button_switch),widgets); // g_signal_connect(G_OBJECT(widgets->AddButton),"clicked",G_CALLBACK(on_keyboard_clicked),widgets); // g_signal_connect(G_OBJECT(widgets->RemoveButton),"clicked",G_CALLBACK(on_keyboard_removed),widgets); @@ -1730,7 +1689,7 @@ main_window *yon_main_window_complete(){ // g_signal_connect(G_OBJECT(widgets->OSDevicesTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); // g_signal_connect(G_OBJECT(widgets->SeparateDevicesTree),"cursor-changed",G_CALLBACK(on_separate_installation_changed),widgets); - // g_signal_connect(G_OBJECT(widgets->ConfigurationModeMenuItem),"toggled",G_CALLBACK(on_configuration_mode_switch),widgets); + g_signal_connect(G_OBJECT(widgets->ConfigurationModeMenuItem),"toggled",G_CALLBACK(on_configuration_mode_switch),widgets); // g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),widgets); // g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),widgets); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 25442ae..7aef6a5 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -65,6 +65,9 @@ "/com/ublinux/images/slide-12.png", \ 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}|^ {8,8}'|sed -e 's/ *//g' -e 's,,,g' -e 's/ *//g' -e 's,,,g'" #define check_is_password_hash(password) system(yon_char_unite("/lib/ublinux/functions is_hash_password '", password,"'",NULL)) @@ -133,6 +136,12 @@ NULL #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 device_typevfs_parameter "AUTOINSTALL[device_typevfs]" +#define device_typevfs_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[device_typevfs]" +#define NTPSERVERS_parameter "AOUTINSTALL[ubconfig set [network] NTPSERVERS]" +#define NTPSERVERS_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[ubconfig set [network] NTPSERVERS]" #define save_config_command(parameters) yon_char_unite("ubconfig --target system set [autoinstall] AUTOINSTALL[log]=yes ",parameters, "; nice ubinstall2 --debug autoinstall", NULL) @@ -434,13 +443,13 @@ typedef struct { GtkWidget *NetworkDomainSwitch; GtkWidget *NetworkDomainNameEntry; GtkWidget *NetworkDomainAdminEntry; - GtkWidget *DomainPasswordEntry; + GtkWidget *NetworkDomainPasswordEntry; GtkWidget *NetworkNTPServerSwitch; GtkWidget *NetworkNTPCombo; GtkWidget *NetworkNTPEntry; GtkWidget *NetworkConnectionsBox; GtkWidget *NetworkConnectionsAddButton; - dictionary *network_connections; + GHashTable *network_connections; GtkWidget *AdvancedDeviceTree; GtkWidget *AdvancedVirtualDeviceCombo; @@ -545,6 +554,7 @@ typedef struct { GtkWidget *MainBox; GtkWidget *TypeCombo; GtkWidget *ConnectionCombo; + GtkWidget *ConnectionEntry; GtkWidget *EnabledSwitch; GtkWidget *RemoveButton; GtkWidget *AutoGetIPSwitch; @@ -652,4 +662,10 @@ 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); \ No newline at end of file +int yon_install_advanced_save(main_window *widgets); +int yon_network_save(main_window *widgets); +void on_connection_add(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); \ No newline at end of file diff --git a/ubinstall-gtk-network-box.glade b/ubinstall-gtk-network-box.glade index 0f37eda..0dfad0c 100644 --- a/ubinstall-gtk-network-box.glade +++ b/ubinstall-gtk-network-box.glade @@ -43,6 +43,13 @@ True False + + Wired + Wireless + Tunnel + Bridge + Modem + False @@ -54,6 +61,17 @@ True False + 0 + True + + Deafault + + + + True + Deafault + + False diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index ac0bfe8..821b93c 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -3501,7 +3501,7 @@ and help you install UBLinux on your computer - + True True 10 @@ -3551,6 +3551,14 @@ and help you install UBLinux on your computer True False + + Default + DHCP + NTP (ntp.org) + NTP (vniiftri.ru) + Manual + Do not configure + False @@ -3577,13 +3585,26 @@ and help you install UBLinux on your computer - + True False vertical 5 - + + True + False + vertical + 5 + + + + + + False + True + 0 + -- 2.35.1 From 240baaef1ffbe4e68f3cadd4f08ecec10ac04409 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 16 Jul 2025 18:12:35 +0600 Subject: [PATCH 03/18] WIP installation process beginning --- source/CMakeLists.txt | 6 + source/ubinstall-gtk-decorations.c | 0 source/ubinstall-gtk-grub.c | 2 - source/ubinstall-gtk-install-start.c | 6 + source/ubinstall-gtk-installation.c | 204 +++- source/ubinstall-gtk-log.c | 127 +++ source/ubinstall-gtk-network.c | 61 +- source/ubinstall-gtk-page-switch.c | 182 ++- source/ubinstall-gtk-password.c | 44 + source/ubinstall-gtk-region.c | 6 + source/ubinstall-gtk-saving.c | 544 +++++++++ source/ubinstall-gtk-standard.c | 48 + source/ubinstall-gtk.c | 1567 ++++---------------------- source/ubinstall-gtk.h | 27 +- source/ubl-strings.h | 4 +- ubinstall-gtk.css | 8 + ubinstall-gtk.glade | 1368 ++++++++++++++++++---- 17 files changed, 2590 insertions(+), 1614 deletions(-) create mode 100644 source/ubinstall-gtk-decorations.c create mode 100644 source/ubinstall-gtk-install-start.c create mode 100644 source/ubinstall-gtk-log.c create mode 100644 source/ubinstall-gtk-password.c create mode 100644 source/ubinstall-gtk-saving.c create mode 100644 source/ubinstall-gtk-standard.c diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 9a5fe02..a9b8cd1 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -116,6 +116,12 @@ set(SOURCE_FILES ubinstall-gtk-separate.c ubinstall-gtk-users.c ubinstall-gtk-configuration-mode.c + ubinstall-gtk-decorations.c + ubinstall-gtk-log.c + ubinstall-gtk-password.c + ubinstall-gtk-saving.c + ubinstall-gtk-standard.c + ubinstall-gtk-install-start.c ubinstall-gtk.h ubl-strings.h ) diff --git a/source/ubinstall-gtk-decorations.c b/source/ubinstall-gtk-decorations.c new file mode 100644 index 0000000..e69de29 diff --git a/source/ubinstall-gtk-grub.c b/source/ubinstall-gtk-grub.c index ea8b0fa..8999484 100644 --- a/source/ubinstall-gtk-grub.c +++ b/source/ubinstall-gtk-grub.c @@ -20,7 +20,6 @@ int yon_grub_install_save(main_window *widgets){ yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,cur_device); yon_config_register(part_parameter,part_parameter_command,partition); yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"grub_install"); - yon_config_remove_by_key(part_parameter); return 1; } @@ -44,6 +43,5 @@ int yon_grub_update_save(main_window *widgets){ yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,cur_device); yon_config_register(part_parameter,part_parameter_command,partition); yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"grub_update"); - yon_config_remove_by_key(part_parameter); return 1; } \ No newline at end of file diff --git a/source/ubinstall-gtk-install-start.c b/source/ubinstall-gtk-install-start.c new file mode 100644 index 0000000..e4e97a8 --- /dev/null +++ b/source/ubinstall-gtk-install-start.c @@ -0,0 +1,6 @@ +#include "ubinstall-gtk.h" + +int yon_installation_start(main_window *widgets){ + g_thread_new("install_thread",(GThreadFunc)on_config_save,widgets); + return 1; +} \ No newline at end of file diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 6fcdfc4..0d7f8ea 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -233,4 +233,206 @@ int yon_install_advanced_save(main_window *widgets){ } return 1; -} \ No newline at end of file +} + +void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_button, GtkComboBox *spin_combo){ + GtkTreeModel *model; + GtkTreeIter iter; + long selected_size; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(table),&model,&iter)){ + gtk_tree_model_get(model,&iter,6,&selected_size,-1); + if (!selected_size){ + gtk_tree_model_get(model,&iter,5,&selected_size,-1); + } + if (selected_size){ + GtkAdjustment *adj = gtk_spin_button_get_adjustment(spin_button); + const char *sizemod = gtk_combo_box_get_active_id(spin_combo); + double new_size = yon_size_long_convert_to_mod(selected_size,sizemod[0]); + gtk_adjustment_set_upper(adj,new_size); + gdouble old_value = gtk_adjustment_get_value(adj); + if (old_value>new_size){ + gtk_adjustment_set_value(adj,new_size); + } + } + } +} + +void on_partition_changed(GtkWidget *self, main_window *widgets){ + if (self==widgets->InstallationNearSysSectionTree||self == widgets->InstallationNearSizeTypeSpin){ + yon_set_max_size_from_partition(GTK_TREE_VIEW(widgets->InstallationNearSysSectionTree),GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin)); + } + +} + +// void on_separate_installation_changed(GtkWidget *self, main_window *widgets){ + +// gtk_list_store_clear(widgets->PartitionsList); +// GtkTreeIter iter; +// GtkTreeModel *model; +// if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(self)),&model,&iter)){ +// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SeparateUserDevicesTree)),&iter); +// char *disk_path=""; +// gtk_tree_model_get(model,&iter,0,&disk_path,-1); +// int size; +// config_str partitions; +// partitions = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); +// for (int i=0;i1024;sz=sz+1){ +// free_space=free_space/1024; +// } +// if (sz==-1) { +// sz=0; +// free_space=free_space/1024; +// } +// free_space_string = yon_char_append(yon_char_from_double(free_space)," "); +// free_space_string[strlen(free_space_string)-1]=*(yon_size_get_mod(sz)); +// } +// gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)),0.0); +// gtk_list_store_append(widgets->PartitionsList,&iter); +// gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(size),2,free_space_string,3,json_object_get_string(fstype),-1); +// } +// yon_char_parsed_free(parsed,size); +// } +// } + +void on_device_selection_changed(GtkWidget *self, main_window *widgets){ + gtk_list_store_clear(widgets->PartitionsList); + GtkTreeIter iter; + GtkTreeModel *model; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(self)),&model,&iter)){ + char *disk_path; + gtk_tree_model_get(model,&iter,0,&disk_path,-1); + int size; + config_str partitions; + partitions = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); + for (int i=0;i2){ + char sizemod='\0'; + capacity_long = atol(parsed[2]); + + char *temp = yon_char_from_double(yon_size_long_convert_automatic(capacity_long,&sizemod)); + capacity = yon_char_append_c(temp,sizemod); + free(temp); + } + if (parsed_size>7&&!yon_char_is_empty(parsed[7])){ + char sizemod='\0'; + free_space_long = capacity_long-atol(parsed[7]); + char *temp = yon_char_from_double(yon_size_long_convert_automatic(free_space_long,&sizemod)); + free_space = yon_char_append_c(temp,sizemod); + free(temp); + } + if (parsed_size>3){ + fs_type = parsed[3]; + } + if (parsed_size>4){ + label = parsed[4]; + } + + gtk_list_store_append(widgets->PartitionsList,&iter); + gtk_list_store_set(widgets->PartitionsList,&iter,0,name,1,capacity,2,free_space,3,fs_type,4,label,5,capacity_long,6,free_space_long,-1); + } + yon_char_parsed_free(parsed,parsed_size); + } + } + gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),0.0); + gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)),0.0); + } +} + +// void on_same_installation_device_changed(GtkWidget *, main_window *widgets){ +// gtk_list_store_clear(widgets->PartitionsList); +// GtkTreeIter iter; +// GtkTreeModel *model; +// if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SamePlaceDeviceTree)),&model,&iter)){ +// char *disk_path=""; +// gtk_tree_model_get(model,&iter,0,&disk_path,-1); +// int size; +// config_str parsed; +// parsed = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); +// char *string = yon_char_parsed_to_string(parsed,size,""); +// struct json_object *root; +// struct json_object *blockdevices; +// root = json_tokener_parse(string); +// json_object_object_get_ex(root, "blockdevices", &blockdevices); +// for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { +// struct json_object *device = json_object_array_get_idx(blockdevices, i); +// struct json_object *type, *path, *size, *model, *vendor, *serial; + +// json_object_object_get_ex(device, "type", &type); +// if (strcmp("part",json_object_get_string(type))) +// continue; +// json_object_object_get_ex(device, "path", &path); +// if (!strstr(json_object_get_string(path),disk_path)){ +// continue; +// } +// json_object_object_get_ex(device, "size", &size); +// json_object_object_get_ex(device, "model", &model); +// json_object_object_get_ex(device, "vendor", &vendor); +// json_object_object_get_ex(device, "serial", &serial); + +// gtk_list_store_append(widgets->PartitionsList,&iter); +// gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(model),2,json_object_get_string(serial),3,json_object_get_string(size),4,json_object_get_string(vendor),-1); +// } +// yon_char_parsed_free(parsed,size); +// } +// } diff --git a/source/ubinstall-gtk-log.c b/source/ubinstall-gtk-log.c new file mode 100644 index 0000000..cf51915 --- /dev/null +++ b/source/ubinstall-gtk-log.c @@ -0,0 +1,127 @@ +#include "ubinstall-gtk.h" + + +// void on_log_closed(GtkWidget *, dictionary *dict){ +// main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); +// log_window *window = yon_dictionary_get_data(dict->first->next,log_window*); +// +// gtk_widget_set_sensitive(widgets->ReadFullLogButton,1); +// gtk_widget_set_sensitive(widgets->ReadShortLogButton,1); +// +// free(window->command); +// window->Window=NULL; +// } + +// log_window *yon_log_window_new(){ +// log_window *window = malloc(sizeof(log_window)); +// GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_log_view); +// window->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); +// window->ScrollWindow = yon_gtk_builder_get_widget(builder,"ScrollWindow"); +// window->HeadLabel = yon_gtk_builder_get_widget(builder,"headerTopic"); +// window->LogLabel = yon_gtk_builder_get_widget(builder,"LogLabel"); +// window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); +// window->ScrollToEndCheck = yon_gtk_builder_get_widget(builder,"ScrollToEndCheck"); +// gtk_widget_show(window->Window); +// return window; +// } + +// gboolean yon_read_log(void *data){ +// log_window *window = (log_window*)data; +// if (window->Window){ +// int size; +// g_mutex_lock(&main_config.progress_mutex); +// config_str parsed = yon_file_open(window->command,&size); +// g_mutex_unlock(&main_config.progress_mutex); +// if (size){ +// char *final = yon_char_parsed_to_string(parsed,size,""); +// gtk_label_set_text(GTK_LABEL(window->LogLabel),final); +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck))){ +// gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)),gtk_adjustment_get_upper(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)))); +// } +// free(final); +// yon_char_parsed_free(parsed,size); +// } +// g_mutex_lock(&main_config.install_mutex); +// if (!main_config.install_complete){ +// g_mutex_unlock(&main_config.install_mutex); +// return 1; +// } else { +// g_mutex_unlock(&main_config.install_mutex); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck),0); +// gtk_widget_set_sensitive(window->ScrollToEndCheck,0); +// } +// } +// return 0; +// } + +// void on_process_log_view(GtkWidget *,main_window *widgets){ +// log_window *window = yon_log_window_new(); +// dictionary *dict=NULL; +// yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); +// yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); +// g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),dict); +// gtk_widget_set_sensitive(widgets->ReadFullLogButton,0); +// gtk_widget_set_sensitive(widgets->ReadShortLogButton,0); +// yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,INSTALL_LOG_LABEL,icon_path,"log_viewer"); +// window->command = yon_char_new(short_log_path); +// gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); +// } + +// void on_summary_log_view(GtkWidget *,main_window *widgets){ +// log_window *window = yon_log_window_new(); +// dictionary *dict=NULL; +// yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); +// yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); +// g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),dict); +// gtk_widget_set_sensitive(widgets->ReadFullLogButton,0); +// gtk_widget_set_sensitive(widgets->ReadShortLogButton,0); +// yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,PROGRESS_LOG_LABEL,icon_path,"log_viewer"); +// window->command = yon_char_new(full_log_path); +// gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); +// +// } + +// gboolean yon_installation_progress_update(void *data) { +// main_window *widgets = (main_window*)data; +// int size; +// +// g_mutex_lock(&main_config.progress_mutex); +// config_str text = yon_file_open(progress_path, &size); +// g_mutex_unlock(&main_config.progress_mutex); +// +// if (size) { +// if (!yon_char_is_empty(text[size-1]) && text[size-1][0] == '(') { +// char *current_copy = yon_char_new(text[size-1]); +// char *percentage = yon_char_divide_search(current_copy, ")", -1); +// +// if (!strstr(percentage, "#pb")) { +// double fraction = atof(percentage+1); +// gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel), current_copy); +// gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress), fraction / 100); +// gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress), 0); +// gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), ""); +// } else { +// gtk_widget_show(gtk_widget_get_parent(widgets->PackageInstallationProgress)); +// +// config_str parsed = yon_char_parse(current_copy, &size, " "); +// if (size >= 3) { +// double fraction = atof(parsed[2]) / 100; +// gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress), fraction); +// gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), yon_char_parsed_to_string(parsed, size, " ")); +// } +// } +// +// } +// yon_char_parsed_free(text, size); +// } +// +// g_mutex_lock(&main_config.install_mutex); +// if (main_config.install_thread) { +// g_mutex_unlock(&main_config.install_mutex); +// return 1; +// } else { +// g_mutex_unlock(&main_config.install_mutex); +// gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), ""); +// return 0; +// } +// } diff --git a/source/ubinstall-gtk-network.c b/source/ubinstall-gtk-network.c index c1d4e4f..877a371 100644 --- a/source/ubinstall-gtk-network.c +++ b/source/ubinstall-gtk-network.c @@ -1,5 +1,34 @@ #include "ubinstall-gtk.h" +// void on_autohostname_check(GtkWidget *, main_window *widgets){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ +// gtk_widget_set_sensitive(widgets->HotnameEntry,0); +// gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"auto"); +// }else{ +// gtk_widget_set_sensitive(widgets->HotnameEntry,1); +// gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"ublinux-install"); +// } +// } + +// void on_autohostname_sensitiveness_check(GtkWidget *, main_window *widgets){ +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck))){ +// gtk_widget_set_sensitive(widgets->AutoHostnameCheck,1); +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ +// gtk_widget_set_sensitive(widgets->HotnameEntry,0); +// } else +// gtk_widget_set_sensitive(widgets->HotnameEntry,1); +// } else { +// gtk_widget_set_sensitive(widgets->HotnameEntry,0); +// gtk_widget_set_sensitive(widgets->AutoHostnameCheck,0); +// } +// } + +// void on_hostname_entry_changed (GtkWidget *, main_window *widgets){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0); +// } + network_info *yon_network_info_new(){ network_info *info = new(network_info); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_network_info); @@ -79,9 +108,35 @@ void on_connection_add(main_window *widgets){ int yon_network_save(main_window *widgets){ if (gtk_switch_get_active(GTK_SWITCH(widgets->NetworkDomainSwitch))){ - // const char *domain_name = gtk_entry_get_text(GTK_ENTRY(widgets->NetworkDomainNameEntry)); - // const char *domain_admin = gtk_entry_get_text(GTK_ENTRY(widgets->NetworkDomainAdminEntry)); - // const char *domain_password = gtk_entry_get_text(GTK_ENTRY(widgets->NetworkDomainPasswordEntry)); + const char *domain_name = gtk_entry_get_text(GTK_ENTRY(widgets->NetworkDomainNameEntry)); + if (!yon_char_is_empty(domain_name)){ + yon_ubl_status_box_render(EMPTY_IMPORTANT_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(widgets->NetworkDomainNameEntry); + return 0; + } + const char *domain_admin = gtk_entry_get_text(GTK_ENTRY(widgets->NetworkDomainAdminEntry)); + const char *domain_password = gtk_entry_get_text(GTK_ENTRY(widgets->NetworkDomainPasswordEntry)); + if (!yon_char_is_empty(domain_name)) yon_config_register(DOMAIN_parameter,DOMAIN_parameter_command,(char*)domain_name); + else yon_config_remove_by_key(DOMAIN_parameter); + if ((!yon_char_is_empty(domain_admin)&&yon_char_is_empty(domain_password))||(yon_char_is_empty(domain_admin)&&!yon_char_is_empty(domain_password))){ + yon_ubl_status_box_render(EMPTY_IMPORTANT_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(widgets->NetworkDomainAdminEntry); + yon_ubl_status_highlight_incorrect(widgets->NetworkDomainPasswordEntry); + return 0; + } + if (!yon_char_is_empty(domain_admin)&&!yon_char_is_empty(domain_password)){ + int size; + config_str encrypted_password = yon_config_load(encrypt_domain_password_command(domain_password),&size); + if (!size){ + yon_ubl_status_box_render(ENCRYPT_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(widgets->NetworkDomainPasswordEntry); + return 0; + } + char *admin_string_full = yon_char_unite(domain_admin,":",encrypted_password[0],NULL); + yon_config_register(DOMAIN_admanger_parameter,DOMAIN_parameter_command,admin_string_full); + } else { + yon_config_remove_by_key(DOMAIN_admanger_parameter); + } } if (gtk_switch_get_active(GTK_SWITCH(widgets->NetworkNTPServerSwitch))){ diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index da2ac11..d6504e5 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -18,15 +18,15 @@ enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_STARTUP: return YON_PAGE_BOOTLOADER; break; case YON_PAGE_BOOTLOADER: return YON_PAGE_NETWORK; break; case YON_PAGE_NETWORK: return main_config.configure_mode? YON_PAGE_CONFIGURE_END : YON_PAGE_INSTALLATION; break; - case YON_PAGE_INSTALL_COMMON: return YON_PAGE_KERNEL; break; - case YON_PAGE_INSTALL_SEPARATE: return YON_PAGE_KERNEL; break; - case YON_PAGE_INSTALL_SAME_PARTITION: return YON_PAGE_KERNEL; break; - case YON_PAGE_INSTALL_ADVANCED: return YON_PAGE_KERNEL; break; + case YON_PAGE_INSTALL_COMMON: return main_config.configure_mode?YON_PAGE_KERNEL:YON_PAGE_INSTALLATION_BEGIN; break; + case YON_PAGE_INSTALL_SEPARATE: return main_config.configure_mode?YON_PAGE_KERNEL:YON_PAGE_INSTALLATION_BEGIN; break; + case YON_PAGE_INSTALL_SAME_PARTITION: return main_config.configure_mode?YON_PAGE_KERNEL:YON_PAGE_INSTALLATION_BEGIN; break; + case YON_PAGE_INSTALL_ADVANCED: return main_config.configure_mode?YON_PAGE_KERNEL:YON_PAGE_INSTALLATION_BEGIN; break; case YON_PAGE_INSTALL_RECOVERY: return yon_recovery_get_next(widgets); break; - case YON_PAGE_RECOVERY_GRUB_INSTALL: return YON_PAGE_INSTALLATION; break; - case YON_PAGE_RECOVERY_GRUB_UPDATE: return YON_PAGE_INSTALLATION; break; - case YON_PAGE_RECOVERY_OS_ONLY: return YON_PAGE_INSTALLATION; break; - case YON_PAGE_RECOVERY_USRDATA_ONLY: return YON_PAGE_INSTALLATION; break; + case YON_PAGE_RECOVERY_GRUB_INSTALL: return main_config.configure_mode?YON_PAGE_INSTALLATION:YON_PAGE_INSTALLATION_BEGIN; break; + case YON_PAGE_RECOVERY_GRUB_UPDATE: return main_config.configure_mode?YON_PAGE_INSTALLATION:YON_PAGE_INSTALLATION_BEGIN; break; + case YON_PAGE_RECOVERY_OS_ONLY: return main_config.configure_mode?YON_PAGE_INSTALLATION:YON_PAGE_INSTALLATION_BEGIN; break; + case YON_PAGE_RECOVERY_USRDATA_ONLY: return main_config.configure_mode?YON_PAGE_INSTALLATION:YON_PAGE_INSTALLATION_BEGIN; break; default:return YON_PAGE_WELCOME; } return YON_PAGE_WELCOME; @@ -158,6 +158,9 @@ int yon_page_save(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_RECOVERY_USRDATA_ONLY: return yon_install_options_save(widgets->UserdataDevicesTree,widgets->UserdataSysSectionTree,"data_only",widgets); break; + case YON_PAGE_INSTALLATION_BEGIN: + return yon_installation_start(widgets); + break; default:return 1; } return 1; @@ -207,4 +210,165 @@ enum YON_PAGES yon_recovery_get_next(main_window *widgets){ else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UserDataOnlyRadio))) return YON_PAGE_RECOVERY_USRDATA_ONLY; return YON_PAGE_SECTIONS; -} \ No newline at end of file +} + +void on_page_next_clicked(GtkWidget *, main_window *widgets){ + enum YON_PAGES page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); + page = yon_page_get_next(widgets,page); + if ((int)page!=-1){ + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page); + } + yon_page_update(widgets); +} + +void on_page_prev_clicked(GtkWidget *, main_window *widgets){ + enum YON_PAGES page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); + page = yon_page_get_prev(page); + if ((int)page!=-1){ + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page); + } + yon_page_update(widgets); +} + +// void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){ +// if (widgets){}; +// switch(page){ +// case YON_PAGE_WELCOME: { +// gtk_widget_hide(widgets->SaveButton); +// gtk_widget_set_sensitive(widgets->CancelInstallButton,0); +// gtk_widget_set_sensitive(widgets->BackButton,0); +// gtk_widget_set_sensitive(widgets->NextButton,1); +// textdomain(LocaleName); +// gtk_button_set_label(GTK_BUTTON(widgets->NextButton),NEXT_LABEL); +// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),CANCEL_LABEL); +// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))),"com.ublinux.ubinstall-gtk.arrow-right-symbolic",GTK_ICON_SIZE_BUTTON); +// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->CancelInstallButton))),"com.ublinux.ubinstall-gtk.circle-exit-symbolic",GTK_ICON_SIZE_BUTTON); +// gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,1); +// yon_switch_page_render(widgets,0); +// } break; +// +// case YON_PAGE_LICENCE:{ +// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); +// gtk_widget_set_sensitive(widgets->BackButton,1); +// yon_switch_page_render(widgets,1); +// } break; +// +// case YON_PAGE_REGION: { +// yon_image_resize_from_container(GTK_IMAGE(widgets->RegionImage), widgets->regions_original); +// yon_switch_page_render(widgets,4); +// } break; +// +// case YON_PAGE_KEYBOARD: { +// +// yon_switch_page_render(widgets,5); +// yon_image_resize_from_container(GTK_IMAGE(widgets->KeyboardImage), widgets->keyboard_original); +// } break; +// +// case YON_PAGE_OS_COMPONENTS: +// case YON_PAGE_SOFTWARE: +// case YON_PAGE_INSTALLATION_BEGIN: +// yon_switch_page_render(widgets,3); +// +// break; +// case YON_PAGE_INSTALLATION:{ +// yon_switch_page_render(widgets,3); +// gtk_widget_set_sensitive(widgets->BackButton,0); +// if ((!main_config.configure_mode)) +// gtk_widget_set_sensitive(widgets->CancelInstallButton,0); +// if (!main_config.progress_thread&&!main_config.configure_mode) +// main_config.progress_thread = gdk_threads_add_timeout(500,(GSourceFunc)yon_installation_progress_update,widgets); +// +// if (!main_config.slider_thread&&!main_config.configure_mode) +// main_config.slider_thread = g_timeout_add(5000,(GSourceFunc)on_image_slide,widgets); +// gtk_widget_show(gtk_widget_get_parent(widgets->InstallationProgress)); +// } break; +// +// case YON_PAGE_USERS: +// yon_switch_page_render(widgets,6); +// gtk_widget_set_sensitive(widgets->NextButton,1); +// gtk_widget_hide(widgets->SaveButton); +// break; +// +// case YON_PAGE_INSTALL_ERROR:{ +// on_summary_log_view((GtkWidget*)NULL,widgets); +// +// yon_switch_page_render(widgets,7); +// gtk_widget_set_sensitive(widgets->BackButton,0); +// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); +// gtk_widget_hide(widgets->InstallationLabel); +// gtk_widget_hide(widgets->PackageInstallationLabel); +// gtk_widget_set_sensitive(widgets->NextButton,1); +// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); +// g_mutex_lock(&main_config.install_mutex); +// main_config.install_complete=0; +// g_mutex_unlock(&main_config.install_mutex); +// main_config.save_done=0; +// textdomain(LocaleName); +// gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL); +// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); +// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), +// "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); +// +// } break; +// case YON_PAGE_COMPLETION:{ +// yon_switch_page_render(widgets,7); +// gtk_widget_set_sensitive(widgets->BackButton,0); +// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); +// gtk_widget_hide(widgets->InstallationLabel); +// gtk_widget_hide(widgets->PackageInstallationLabel); +// gtk_widget_set_sensitive(widgets->NextButton,1); +// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); +// g_mutex_lock(&main_config.install_mutex); +// main_config.install_complete=0; +// g_mutex_unlock(&main_config.install_mutex); +// main_config.save_done=0; +// textdomain(LocaleName); +// gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL); +// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); +// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), +// "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); +// } +// gtk_widget_hide(gtk_widget_get_parent(widgets->InstallationProgress)); +// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); +// break; +// +// case YON_PAGE_COMPLETED:{ +// yon_switch_page_render(widgets,7); +// gtk_widget_set_sensitive(widgets->BackButton,1); +// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); +// gtk_widget_hide(widgets->InstallationLabel); +// gtk_widget_hide(widgets->PackageInstallationLabel); +// gtk_widget_set_sensitive(widgets->NextButton,0); +// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); +// g_mutex_lock(&main_config.install_mutex); +// main_config.install_complete=0; +// g_mutex_unlock(&main_config.install_mutex); +// main_config.save_done=0; +// textdomain(LocaleName); +// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); +// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), +// "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); +// +// }break; +// +// case YON_PAGE_SECTIONS: +// case YON_PAGE_INSTALL_COMMON: +// case YON_PAGE_INSTALL_SEPARATE: +// case YON_PAGE_INSTALL_SAME_PARTITION: +// case YON_PAGE_INSTALL_RECOVERY: +// case YON_PAGE_OPTIONS_GRUB_INSTALL: +// case YON_PAGE_OPTIONS_GRUB_UPDATE: +// case YON_PAGE_OPTIONS_SEPARATE: +// case YON_PAGE_OPTIONS_SEPARATE_USRDATA: +// case YON_PAGE_OPTIONS_OS_ONLY: +// case YON_PAGE_OPTIONS_USRDATA_ONLY: { +// yon_switch_page_render(widgets,2); +// } break; +// case YON_PAGE_CONFIGURE_END: { +// gtk_widget_set_sensitive(widgets->BackButton,1); +// gtk_widget_set_sensitive(widgets->NextButton,0); +// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); +// gtk_widget_show(widgets->SaveButton); +// } +// } +// } diff --git a/source/ubinstall-gtk-password.c b/source/ubinstall-gtk-password.c new file mode 100644 index 0000000..a90df7d --- /dev/null +++ b/source/ubinstall-gtk-password.c @@ -0,0 +1,44 @@ +#include "ubinstall-gtk.h" + + +// void yon_password_set_sensitive_from_toggle(GtkWidget *self, main_window *widgets){ +// GtkWidget *combo = NULL; +// GtkWidget *entry = NULL; +// if (self == widgets->PasswordSensitiveCheck){ +// combo = widgets->PasswordCombo; +// entry = widgets->PasswordEntry; +// } else { +// combo = widgets->AdminPasswordCombo; +// entry = widgets->AdminPasswordEntry; +// } +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self))){ +// gtk_widget_set_sensitive(combo,1); +// if (gtk_combo_box_get_active(GTK_COMBO_BOX(combo))){ +// gtk_widget_set_sensitive(entry,1); +// } else { +// gtk_widget_set_sensitive(entry,0); +// } +// } else { +// gtk_widget_set_sensitive(combo,0); +// gtk_widget_set_sensitive(entry,0); +// +// } +// } + +// void yon_password_combo_set_sensitive(GtkWidget *self, main_window *widgets){ +// GtkWidget *entry = NULL; +// GtkWidget *toggle = NULL; +// if (self == widgets->PasswordCombo){ +// entry = widgets->PasswordEntry; +// toggle = widgets->PasswordSensitiveCheck; +// } else if (self == widgets->AdminPasswordCombo){ +// entry = widgets->AdminPasswordEntry; +// toggle = widgets->RootPasswordSensitiveCheck; +// } +// if (gtk_combo_box_get_active(GTK_COMBO_BOX(self))&>k_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle))){ +// gtk_widget_set_sensitive(entry,1); +// } else { +// gtk_widget_set_sensitive(entry,0); +// +// } +// } diff --git a/source/ubinstall-gtk-region.c b/source/ubinstall-gtk-region.c index 27b85da..2c3fce1 100644 --- a/source/ubinstall-gtk-region.c +++ b/source/ubinstall-gtk-region.c @@ -1,5 +1,11 @@ #include "ubinstall-gtk.h" +// void on_region_resized(GtkWidget *,main_window *widgets){ +// yon_image_resize_from_container(GTK_IMAGE(widgets->SlidesImage), (GdkPixbuf*)g_list_nth_data(widgets->slides_original,cur_slide)); +// yon_image_resize_from_container(GTK_IMAGE(widgets->RegionImage), widgets->regions_original); +// yon_image_resize_from_container(GTK_IMAGE(widgets->KeyboardImage), widgets->keyboard_original); +// } + int yon_region_save(main_window *widgets){ if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->RegionCombo))==-1){ yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),REGION_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c new file mode 100644 index 0000000..93685b9 --- /dev/null +++ b/source/ubinstall-gtk-saving.c @@ -0,0 +1,544 @@ +#include "ubinstall-gtk.h" + + + +// void _yon_saving_threaded(char *final_command){ +// FILE *file = popen(final_command,"r"); +// int file_save; +// config_str file_return = yon_config_load_file(file,&file_save); +// pclose(file); +// file_return = yon_char_parsed_append(file_return,&file_save,final_command); +// char *result = yon_char_parsed_to_string(file_return,file_save,""); +// yon_debug_output("%s\n",result); +// yon_char_parsed_free(file_return,file_save); +// free(result); +// } + +// void yon_save_proceed(char *path, YON_CONFIG_TYPE type){ +// yon_debug_output("%s\n",yon_config_save_simple(type,path)); +// } + +// void yon_load_proceed(YON_CONFIG_TYPE type){ +// yon_config_clean(); +// if (!yon_char_is_empty(config_get_default_command)) +// yon_config_load_config(YON_CONFIG_DEFAULT,yon_debug_output("%s\n",config_get_default_command),NULL); +// if (type==YON_CONFIG_GLOBAL){ +// yon_config_load_config(type,yon_debug_output("%s\n",config_get_global_command),NULL); +// } else if (type==YON_CONFIG_LOCAL){ +// yon_config_load_config(type,yon_debug_output("%s\n",config_get_local_command),NULL); +// } else if (type==YON_CONFIG_CUSTOM){ +// char *path=""; +// GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL); +// yon_gtk_window_setup(GTK_WINDOW(dialog),NULL,TITLE_LABEL,icon_path,"FileChooserWindow"); +// textdomain(LocaleName); +// gtk_window_set_icon_name(GTK_WINDOW(dialog),"com.ublinux.ubinstall"); +// gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL); +// GtkFileFilter *filter = gtk_file_filter_new(); +// gtk_file_filter_add_pattern(filter,"*.ini"); +// gtk_file_filter_set_name(filter, "*.ini"); +// gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); +// gtk_widget_show(dialog); +// int response = gtk_dialog_run(GTK_DIALOG(dialog)); +// if (response == GTK_RESPONSE_ACCEPT){ +// char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); +// if (!yon_char_is_empty(file)){ +// path=yon_char_unite("'",file,"'",NULL); +// free(file); +// } +// gtk_widget_destroy(dialog); +// } else { +// gtk_widget_destroy(dialog); +// } +// yon_config_load_config(type,yon_debug_output("%s\n",yon_config_get_custom_command(path)),NULL); +// if (path) free(path); +// } +// } + + +// void on_config_local_load(GtkWidget *,main_window *widgets){ +// yon_load_proceed(YON_CONFIG_LOCAL); +// yon_interface_update(widgets); +// main_config.load_mode=1; +// } + +// void on_config_global_load(GtkWidget *,main_window *widgets){ +// yon_load_proceed(YON_CONFIG_GLOBAL); +// yon_interface_update(widgets); +// main_config.load_mode=0; +// } + +// void on_config_custom_load(GtkWidget *,main_window *widgets){ +// yon_load_proceed(YON_CONFIG_CUSTOM); +// yon_interface_update(widgets); +// main_config.load_mode=3; +// } + +// void on_config_global_local_save(GtkWidget *,main_window *widgets){ +// yon_save_proceed(NULL,YON_CONFIG_BOTH); +// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); +// } + +// void on_config_local_save(GtkWidget *,main_window *widgets){ +// yon_save_proceed("system",YON_CONFIG_LOCAL); +// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); +// +// } + +// void on_config_global_save(GtkWidget *,main_window *widgets){ +// yon_save_proceed("global",YON_CONFIG_GLOBAL); +// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); +// +// } + +// void on_config_custom_save(GtkWidget *, main_window *widgets){ +// char *path = NULL; +// GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,SAVE_LABEL,GTK_RESPONSE_ACCEPT,NULL); +// textdomain(TITLE_LABEL); +// GtkFileFilter *filter = gtk_file_filter_new(); +// gtk_window_set_icon_name(GTK_WINDOW(dialog),yon_char_append("com.ublinux.",LocaleName)); +// gtk_file_filter_add_pattern(filter,"*.ini"); +// gtk_file_filter_set_name(filter, "*.ini"); +// gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); +// int response = gtk_dialog_run(GTK_DIALOG(dialog)); +// if (response == GTK_RESPONSE_ACCEPT){ +// char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); +// if (!yon_char_is_empty(file)){ +// if (!strstr(file,".ini")) file = yon_char_append(file,".ini"); +// if (access(file,0)!=F_OK){ +// char *command_creation = ubconfig_file_create(file); +// int a = system(yon_debug_output("%s\n",command_creation)); +// if (access(file,0)!=F_OK||a){ +// yon_ubl_status_box_render(CUSTOM_CONFIG_CREATION_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); +// return; +// } +// } +// } +// path = yon_char_unite("'",file,"'",NULL); +// free(file); +// gtk_widget_destroy(dialog); +// } else { +// gtk_widget_destroy(dialog); +// return; +// } +// yon_save_proceed(path,YON_CONFIG_CUSTOM); +// if (path) free(path); +// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); +// } +// +// void yon_open_browser(GtkWidget *, char *link); +// void yon_open_browser(GtkWidget *, char *link){ +// GtkWidget *window = yon_ubl_browser_window_open(link,TITLE_LABEL); +// if (window) +// gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",LocaleName)); +// } + +// void yon_interface_update(main_window *widgets){ +// if (widgets){}; +// enum YON_PAGES page=YON_PAGE_COMPLETED; +// char *type = config(AUTOINSTALL_TYPE_INSTALL); +// if (!yon_char_is_empty(type)){ +// if (!strcmp(type,"fast")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationRadio),1); +// page = YON_PAGE_INSTALL_COMMON; +// } else if (!strcmp(type,"next")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationNearRadio),1); +// page = YON_PAGE_INSTALL_SEPARATE; +// } else if (!strcmp(type,"part")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationLinuxRadio),1); +// page = YON_PAGE_INSTALL_SAME_PARTITION; +// } else if (!strcmp(type,"grub_install")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->GrubInstallRadio),1); +// page = YON_PAGE_OPTIONS_GRUB_INSTALL; +// } else if (!strcmp(type,"grub_update")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->GrubUpdateRadio),1); +// page = YON_PAGE_OPTIONS_GRUB_UPDATE; +// } else if (!strcmp(type,"system_only")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->OSRadio),1); +// page = YON_PAGE_OPTIONS_OS_ONLY; +// } else if (!strcmp(type,"data_only")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserDataOnlyRadio),1); +// page = YON_PAGE_OPTIONS_USRDATA_ONLY; +// } else if (!strcmp(type,"custom")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SeparateRadio),1); +// page = YON_PAGE_OPTIONS_SEPARATE; +// } +// } +// char *device = config(AUTOINSTALL_DEVICE); +// char *part = NULL; +// if (page!=YON_PAGE_INSTALL_COMMON) +// part = config(part_parameter); +// char *fs_type = config(part_type_parameter); +// char *device_label = config(device_label_parameter); +// char *format = config(device_format_parameter); +// char *part_size = config(part_size_parameter); +// GtkListStore *device_list = widgets->DevicesList; +// GtkListStore *part_list=widgets->PartitionsList; +// GtkWidget *device_tree=NULL; +// GtkWidget *part_tree=NULL; +// switch (page){ +// case YON_PAGE_INSTALL_COMMON:{ +// device_tree = widgets->CommonInstallationDevicesTree; +// } break; +// +// case YON_PAGE_INSTALL_SEPARATE:{ +// device_tree = widgets->InstallationNearSysDevicesTree; +// part_tree = widgets->InstallationNearSysSectionTree; +// if (!yon_char_is_empty(part_size)){ +// gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),atof(part_size)); +// if (part_size[strlen(part_size)-1]=='M') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),0); +// if (part_size[strlen(part_size)-1]=='G') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),1); +// if (part_size[strlen(part_size)-1]=='T') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),2); +// } +// if (format&&!strcmp(format,"yes")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck),1); +// else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck),main_config.format_default); +// if (!yon_char_is_empty(fs_type)) +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->NextInstallationFilesystemTypeCombo),fs_type); +// if (device_label) +// gtk_entry_set_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry),device_label); +// else +// gtk_entry_set_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry),""); +// +// } break; +// +// case YON_PAGE_INSTALL_SAME_PARTITION:{ +// device_tree = widgets->SamePlaceDeviceTree; +// part_tree = widgets->SamePlacePartTree; +// if (!yon_char_is_empty(fs_type)) +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->SameInstallationFilesystemTypeCombo),fs_type); +// if (format&&!strcmp(format,"yes")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SameInstallationFormatCheck),1); +// else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SameInstallationFormatCheck),main_config.format_default); +// if (device_label) +// gtk_entry_set_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry),device_label); +// else +// gtk_entry_set_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry),""); +// +// } break; +// case YON_PAGE_OPTIONS_GRUB_INSTALL:{ +// device_tree = widgets->GrubInstallDevicesTree; +// } break; +// +// case YON_PAGE_OPTIONS_GRUB_UPDATE:{ +// device_tree = widgets->GrubUpdateDevicesTree; +// } break; +// +// case YON_PAGE_OPTIONS_SEPARATE:{ +// GtkTreeIter iter; +// device_tree = widgets->SeparateDevicesTree; +// part_tree = widgets->SeparateSysSectionTree; +// for_iter(GTK_TREE_MODEL(device_list),&iter){ +// char *cur_device; +// gtk_tree_model_get(GTK_TREE_MODEL(device_list),&iter, 0,&cur_device,-1); +// if (!strcmp(cur_device,device)){ +// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(device_tree)),&iter); +// break; +// } +// } +// on_near_installation_device_changed(device_tree,widgets); +// for_iter(GTK_TREE_MODEL(part_list),&iter){ +// char *cur_part; +// gtk_tree_model_get(GTK_TREE_MODEL(device_list),&iter, 0,&cur_part,-1); +// if (!strcmp(cur_part,part)){ +// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(part_tree)),&iter); +// } +// } +// } break; +// +// case YON_PAGE_OPTIONS_OS_ONLY:{ +// device_tree = widgets->OSDevicesTree; +// part_tree = widgets->OSSysSectionTree; +// } break; +// +// case YON_PAGE_OPTIONS_USRDATA_ONLY:{ +// device_tree = widgets->UserdataDevicesTree; +// part_tree = widgets->UserdataSysSectionTree; +// } break; +// +// default:{}break; +// } +// GtkTreeIter iter; +// char *cur_device=""; +// if (page!=YON_PAGE_OPTIONS_SEPARATE && !yon_char_is_empty(device)){ +// for_iter (widgets->DevicesList,&iter){ +// gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),&iter,0,&cur_device,-1); +// if (!strcmp(device,cur_device)){ +// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(device_tree)),&iter); +// break; +// } +// } +// on_near_installation_device_changed(device_tree,widgets); +// if (!yon_char_is_empty(part)){ +// for_iter (widgets->PartitionsList,&iter){ +// gtk_tree_model_get(GTK_TREE_MODEL(widgets->PartitionsList),&iter,0,&part,-1); +// if (!strcmp(device,cur_device)){ +// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(part_tree)),&iter); +// break; +// } +// } +// } +// } +// char *system_locale = config(locale_parameter); +// if (!yon_char_is_empty(system_locale)){ +// char *chosen_langs = ""; +// for_iter(widgets->LanguagesList,&iter){ +// char *cur=NULL, *render = NULL; +// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,1,&render,2,&cur,-1); +// if (strstr(system_locale,cur)){ +// gtk_list_store_set((widgets->LanguagesList),&iter,0,1,-1); +// chosen_langs = yon_char_unite(chosen_langs,!yon_char_is_empty(chosen_langs)?";":"",render,NULL); +// } else { +// gtk_list_store_set((widgets->LanguagesList),&iter,0,0,-1); +// } +// } +// if (!yon_char_is_empty(chosen_langs)){ +// gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),chosen_langs); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),1); +// free(chosen_langs); +// } else { +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); +// gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); +// } +// } else { +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); +// gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); +// int langsize; +// config_str lang = default_langs(&langsize); +// for_iter(widgets->LanguagesList,&iter){ +// char *cur=NULL; +// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,2,&cur,-1); +// if (lang&&yon_char_parsed_check_exist(lang,langsize,cur)>-1){ +// gtk_list_store_set(widgets->LanguagesList,&iter,0,1,-1); +// } else { +// gtk_list_store_set(widgets->LanguagesList,&iter,0,0,-1); +// } +// if (cur) free(cur); +// } +// if (langsize) yon_char_parsed_free(lang,langsize); +// } +// char *zone = config(zone_parameter); +// char *region = NULL; +// +// if (!yon_char_is_empty(zone)) region = yon_char_divide_search(zone,"/",-1); else {gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck),0);} +// if (!yon_char_is_empty(region)){ +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->RegionCombo),region); +// } else { +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->RegionCombo),"Europe"); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck),0); +// } +// if (!yon_char_is_empty(zone)){ +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->ZoneCombo),zone); +// } else { +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->ZoneCombo),"Moscow"); +// } +// char *language = config(lang_parameter); +// if (!yon_char_is_empty(language)){ +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LanguageCombo),language); +// } else { +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguageCombo),0); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->MainLanguageSensitiveCheck),0); +// } +// char *kbmodel = config (xkbmodel_parameter); +// char *optinos = config(xkboptions_parameter); +// char *layout = config(xkblayout_parameter); +// if (!yon_char_is_empty(kbmodel)){ +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo),kbmodel); +// } else { +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo),0); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->KeyboardModelSensitiveCheck),0); +// +// } +// if (!yon_char_is_empty(optinos)){ +// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LayoutBindingCombo),optinos); +// } else { +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LayoutBindingCombo),0); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->OptionsSensitiveCheck),0); +// } +// if (!yon_char_is_empty(layout)){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio),1); +// for_iter(widgets->LayoutList,&iter){ +// char *cur=NULL; +// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutList),&iter,0,&cur,-1); +// if (strstr(layout,cur)){ +// gtk_tree_store_set(widgets->LayoutList,&iter,3,1,-1); +// } else { +// gtk_tree_store_set(widgets->LayoutList,&iter,3,0,-1); +// } +// } +// } else { +// for_iter(widgets->LayoutList,&iter){ +// char *id; +// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutList),&iter,0,&id,-1); +// if (!strcmp(id,"ru")||!strcmp(id,"us")){ +// gtk_tree_store_set(widgets->LayoutList,&iter,3,1,-1); +// } else { +// gtk_tree_store_set((widgets->LayoutList),&iter,3,0,-1); +// } +// } +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LayoutSensitiveCheck),0); +// } +// char *user_name = config(user_name_parameter); +// char *user_gecos = config(user_gecos_parameter); +// char *user_password = config(user_password_parameter); +// char *root_password = config(root_password_parameter); +// char *autologin = config(autologin_parameter); +// char *hostname = config(hostname_parameter); +// if (!yon_char_is_empty(user_name)){ +// if (!strcmp(user_name,"root")){ +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck),1); +// } else { +// gtk_entry_set_text(GTK_ENTRY(widgets->LoginEntry),user_name); +// } +// } else { +// gtk_entry_set_text(GTK_ENTRY(widgets->LoginEntry),""); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck),0); +// } +// if (!yon_char_is_empty(user_gecos)){ +// gtk_entry_set_text(GTK_ENTRY(widgets->UserNameEntry),_(user_gecos)); +// } else { +// gtk_entry_set_text(GTK_ENTRY(widgets->UserNameEntry),""); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UsernameSensitiveCheck),0); +// } +// int def_size=0; +// config_str default_password = NULL; +// if (!getuid()){ +// default_password = yon_config_load(yon_debug_output("%s\n",get_default_password_command), &def_size); +// if (def_size>0&&default_password){ +// yon_char_remove_last_symbol(default_password[0],'\n'); +// } +// } +// if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->PasswordCombo),0); +// gtk_entry_set_text(GTK_ENTRY(widgets->PasswordEntry),""); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->PasswordSensitiveCheck),0); +// +// } else if (!yon_char_is_empty(user_password)){ +// gtk_entry_set_text(GTK_ENTRY(widgets->PasswordEntry),user_password); +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->PasswordCombo),1); +// } +// if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo),0); +// gtk_entry_set_text(GTK_ENTRY(widgets->AdminPasswordEntry),""); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RootPasswordSensitiveCheck),0); +// +// } else if (!yon_char_is_empty(root_password)){ +// gtk_entry_set_text(GTK_ENTRY(widgets->AdminPasswordEntry),root_password); +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo),1); +// } +// if (!yon_char_is_empty(autologin)){ +// if (!strcmp(autologin,"yes")) +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),1); +// else +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),0); +// } else { +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),main_config.autologin_default); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinSensitiveCheck),0); +// } +// if (!yon_char_is_empty(hostname)){ +// if (strcmp(hostname,"auto")){ +// gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),hostname); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); +// } else{ +// gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),""); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),1); +// } +// } else { +// gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),""); +// g_signal_handlers_block_by_func(G_OBJECT(widgets->AutoHostnameCheck),on_autohostname_check,widgets); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),1); +// g_signal_handlers_unblock_by_func(G_OBJECT(widgets->AutoHostnameCheck),on_autohostname_check,widgets); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),0); +// } +// } + +gboolean on_install_success(main_window *widgets){ + gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),""); + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION); + yon_page_update(widgets); + + return 0; +} + +gboolean on_install_error(main_window *widgets){ + gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),""); + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_ERROR); + yon_page_update(widgets); + + return 0; +} + + +void *on_config_save(void *data){ + main_window *widgets = (main_window*)data; + + int size=0; + config_str parameters = yon_config_get_selection_by_key_no_ignored(&size, + AUTOINSTALL_TYPE_INSTALL, + AUTOINSTALL_DEVICE, + device_format_parameter, + device_label_parameter, + part_parameter, + part_type_parameter, + part_size_parameter, + NULL); + FILE *file = fopen(progress_path,"w"); + if (file) + fclose(file); + char *command = yon_debug_output("%s\n",save_config_command(yon_char_parsed_to_string(parameters,size," "))); + yon_char_parsed_free(parameters,size); + yon_debug_output("%s\n","Entered installation"); + if (system(yon_debug_output("%s\n",command))){ + + gdk_threads_add_idle((GSourceFunc)on_install_error,widgets); + free(command); + g_mutex_lock(&main_config.install_mutex); + main_config.install_complete=1; + g_mutex_unlock(&main_config.install_mutex); + return 0; + }; + free(command); + g_mutex_lock(&main_config.install_mutex); + main_config.install_complete=1; + g_mutex_unlock(&main_config.install_mutex); + if (!main_config.save_done&&main_config.save_configured){ + on_setup_system_configuration(widgets); + } + return 0; +} + +void *on_setup_system_configuration(void * data){ + yon_debug_output("%s\n","Entered thread"); + main_window *widgets = (main_window*)data; + if (widgets){}; + int size; + config_str all_parameters = yon_config_get_selection_by_key(&size, + user_name_parameter, + user_gecos_parameter, + user_password_parameter, + root_password_parameter, + autologin_parameter, + xkbmodel_parameter, + xkblayout_parameter, + xkbvariant_parameter, + xkboptions_parameter, + hostname_parameter, + zone_parameter, + lang_parameter, + locale_parameter, + NULL); + if (all_parameters){ + char *parameter_string = yon_char_parsed_to_string(all_parameters,size," "); + char *command = set_user_config_command(parameter_string); + if (system(yon_debug_output("%s\n",command))){}; + yon_char_parsed_free(all_parameters,size); + free(command); + if (parameter_string) free(parameter_string); + } + g_idle_add((GSourceFunc)on_install_success,widgets); + return NULL; +} diff --git a/source/ubinstall-gtk-standard.c b/source/ubinstall-gtk-standard.c new file mode 100644 index 0000000..e857c0d --- /dev/null +++ b/source/ubinstall-gtk-standard.c @@ -0,0 +1,48 @@ +#include "ubinstall-gtk.h" + + +// void on_open_documentation_confirmation(GtkWidget *self, char *link); +// void on_open_documentation_confirmation(GtkWidget *self, char *link){ +// if (main_config.always_open_documentation==0){ +// GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_documentation); +// documentation_confirmation_window *window = malloc(sizeof(documentation_confirmation_window)); +// window->Window = yon_gtk_builder_get_widget(builder,"helpConfirmationWindow"); +// window->AcceptButton = yon_gtk_builder_get_widget(builder,"ReadHelpButton"); +// window->CloseButton = yon_gtk_builder_get_widget(builder,"CancelHelpButton"); +// window->HeaderLabel = yon_gtk_builder_get_widget(builder,"webHeaderNameLabel"); +// window->AlwaysOpenCheck = yon_gtk_builder_get_widget(builder,"AlwaysOpenDocumentationCheckbox"); +// gtk_label_set_text(GTK_LABEL(window->HeaderLabel),TITLE_LABEL); +// gtk_widget_show_all(window->Window); +// g_signal_connect(G_OBJECT(window->CloseButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); +// g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(yon_open_browser),yon_char_new(link)); +// g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); +// +// +// } else { +// yon_open_browser(self,link); +// } +// } + +// void on_link(GtkWidget *self, char* uri); +// void on_link(GtkWidget *self, char* uri){ +// gtk_widget_destroy(self); +// on_open_documentation_confirmation(self,uri); +// } + +// void on_about(GtkWidget *); +// void on_about(GtkWidget *){ +// GtkBuilder *builder=gtk_builder_new_from_resource(ui_glade_path_about); +// GtkWidget *window=yon_gtk_builder_get_widget(builder,"AboutWindow"); +// GtkWidget *title=yon_gtk_builder_get_widget(builder,"headerAboutTopic"); +// GtkWidget *hideButtonBox=yon_gtk_builder_get_widget(builder,"buttonBoxHide"); +// gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),version_application); +// gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),TITLE_LABEL); +// gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(window),yon_char_append("com.ublinux.",LocaleName)); +// gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",LocaleName)); +// gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(window),LocaleName); +// gtk_label_set_text(GTK_LABEL(title),TITLE_LABEL); +// g_signal_connect(G_OBJECT(window),"activate-link",G_CALLBACK(on_link),WIKI_LINK); +// gtk_widget_set_visible(hideButtonBox,0); +// gtk_widget_destroy(hideButtonBox); +// gtk_widget_show(window); +// } diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 2c5022c..dd35e3a 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -33,598 +33,37 @@ void on_toggle_button_switch_on(GtkWidget *, GtkToggleButton *toggle){ gtk_toggle_button_set_active(toggle,1); } -// void on_autohostname_check(GtkWidget *, main_window *widgets){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); -// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ -// gtk_widget_set_sensitive(widgets->HotnameEntry,0); -// gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"auto"); -// }else{ -// gtk_widget_set_sensitive(widgets->HotnameEntry,1); -// gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"ublinux-install"); -// } -// } - -// void yon_password_set_sensitive_from_toggle(GtkWidget *self, main_window *widgets){ -// GtkWidget *combo = NULL; -// GtkWidget *entry = NULL; -// if (self == widgets->PasswordSensitiveCheck){ -// combo = widgets->PasswordCombo; -// entry = widgets->PasswordEntry; -// } else { -// combo = widgets->AdminPasswordCombo; -// entry = widgets->AdminPasswordEntry; -// } -// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self))){ -// gtk_widget_set_sensitive(combo,1); -// if (gtk_combo_box_get_active(GTK_COMBO_BOX(combo))){ -// gtk_widget_set_sensitive(entry,1); -// } else { -// gtk_widget_set_sensitive(entry,0); -// } -// } else { -// gtk_widget_set_sensitive(combo,0); -// gtk_widget_set_sensitive(entry,0); -// -// } -// } - -// void yon_password_combo_set_sensitive(GtkWidget *self, main_window *widgets){ -// GtkWidget *entry = NULL; -// GtkWidget *toggle = NULL; -// if (self == widgets->PasswordCombo){ -// entry = widgets->PasswordEntry; -// toggle = widgets->PasswordSensitiveCheck; -// } else if (self == widgets->AdminPasswordCombo){ -// entry = widgets->AdminPasswordEntry; -// toggle = widgets->RootPasswordSensitiveCheck; -// } -// if (gtk_combo_box_get_active(GTK_COMBO_BOX(self))&>k_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle))){ -// gtk_widget_set_sensitive(entry,1); -// } else { -// gtk_widget_set_sensitive(entry,0); -// -// } -// } - -// void on_autohostname_sensitiveness_check(GtkWidget *, main_window *widgets){ -// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck))){ -// gtk_widget_set_sensitive(widgets->AutoHostnameCheck,1); -// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ -// gtk_widget_set_sensitive(widgets->HotnameEntry,0); -// } else -// gtk_widget_set_sensitive(widgets->HotnameEntry,1); -// } else { -// gtk_widget_set_sensitive(widgets->HotnameEntry,0); -// gtk_widget_set_sensitive(widgets->AutoHostnameCheck,0); -// } -// } - -// void on_hostname_entry_changed (GtkWidget *, main_window *widgets){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0); -// } - -// void _yon_saving_threaded(char *final_command){ -// FILE *file = popen(final_command,"r"); -// int file_save; -// config_str file_return = yon_config_load_file(file,&file_save); -// pclose(file); -// file_return = yon_char_parsed_append(file_return,&file_save,final_command); -// char *result = yon_char_parsed_to_string(file_return,file_save,""); -// yon_debug_output("%s\n",result); -// yon_char_parsed_free(file_return,file_save); -// free(result); -// } - -// void yon_save_proceed(char *path, YON_CONFIG_TYPE type){ -// yon_debug_output("%s\n",yon_config_save_simple(type,path)); -// } - -// void yon_load_proceed(YON_CONFIG_TYPE type){ -// yon_config_clean(); -// if (!yon_char_is_empty(config_get_default_command)) -// yon_config_load_config(YON_CONFIG_DEFAULT,yon_debug_output("%s\n",config_get_default_command),NULL); -// if (type==YON_CONFIG_GLOBAL){ -// yon_config_load_config(type,yon_debug_output("%s\n",config_get_global_command),NULL); -// } else if (type==YON_CONFIG_LOCAL){ -// yon_config_load_config(type,yon_debug_output("%s\n",config_get_local_command),NULL); -// } else if (type==YON_CONFIG_CUSTOM){ -// char *path=""; -// GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL); -// yon_gtk_window_setup(GTK_WINDOW(dialog),NULL,TITLE_LABEL,icon_path,"FileChooserWindow"); -// textdomain(LocaleName); -// gtk_window_set_icon_name(GTK_WINDOW(dialog),"com.ublinux.ubinstall"); -// gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL); -// GtkFileFilter *filter = gtk_file_filter_new(); -// gtk_file_filter_add_pattern(filter,"*.ini"); -// gtk_file_filter_set_name(filter, "*.ini"); -// gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); -// gtk_widget_show(dialog); -// int response = gtk_dialog_run(GTK_DIALOG(dialog)); -// if (response == GTK_RESPONSE_ACCEPT){ -// char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); -// if (!yon_char_is_empty(file)){ -// path=yon_char_unite("'",file,"'",NULL); -// free(file); -// } -// gtk_widget_destroy(dialog); -// } else { -// gtk_widget_destroy(dialog); -// } -// yon_config_load_config(type,yon_debug_output("%s\n",yon_config_get_custom_command(path)),NULL); -// if (path) free(path); -// } -// } - -// void yon_interface_update(main_window *widgets){ -// if (widgets){}; -// enum YON_PAGES page=YON_PAGE_COMPLETED; -// char *type = config(AUTOINSTALL_TYPE_INSTALL); -// if (!yon_char_is_empty(type)){ -// if (!strcmp(type,"fast")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationRadio),1); -// page = YON_PAGE_INSTALL_COMMON; -// } else if (!strcmp(type,"next")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationNearRadio),1); -// page = YON_PAGE_INSTALL_SEPARATE; -// } else if (!strcmp(type,"part")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationLinuxRadio),1); -// page = YON_PAGE_INSTALL_SAME_PARTITION; -// } else if (!strcmp(type,"grub_install")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->GrubInstallRadio),1); -// page = YON_PAGE_OPTIONS_GRUB_INSTALL; -// } else if (!strcmp(type,"grub_update")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->GrubUpdateRadio),1); -// page = YON_PAGE_OPTIONS_GRUB_UPDATE; -// } else if (!strcmp(type,"system_only")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->OSRadio),1); -// page = YON_PAGE_OPTIONS_OS_ONLY; -// } else if (!strcmp(type,"data_only")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserDataOnlyRadio),1); -// page = YON_PAGE_OPTIONS_USRDATA_ONLY; -// } else if (!strcmp(type,"custom")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SeparateRadio),1); -// page = YON_PAGE_OPTIONS_SEPARATE; -// } -// } -// char *device = config(AUTOINSTALL_DEVICE); -// char *part = NULL; -// if (page!=YON_PAGE_INSTALL_COMMON) -// part = config(part_parameter); -// char *fs_type = config(part_type_parameter); -// char *device_label = config(device_label_parameter); -// char *format = config(device_format_parameter); -// char *part_size = config(part_size_parameter); -// GtkListStore *device_list = widgets->DevicesList; -// GtkListStore *part_list=widgets->PartitionsList; -// GtkWidget *device_tree=NULL; -// GtkWidget *part_tree=NULL; -// switch (page){ -// case YON_PAGE_INSTALL_COMMON:{ -// device_tree = widgets->CommonInstallationDevicesTree; -// } break; -// -// case YON_PAGE_INSTALL_SEPARATE:{ -// device_tree = widgets->InstallationNearSysDevicesTree; -// part_tree = widgets->InstallationNearSysSectionTree; -// if (!yon_char_is_empty(part_size)){ -// gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),atof(part_size)); -// if (part_size[strlen(part_size)-1]=='M') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),0); -// if (part_size[strlen(part_size)-1]=='G') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),1); -// if (part_size[strlen(part_size)-1]=='T') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),2); -// } -// if (format&&!strcmp(format,"yes")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck),1); -// else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck),main_config.format_default); -// if (!yon_char_is_empty(fs_type)) -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->NextInstallationFilesystemTypeCombo),fs_type); -// if (device_label) -// gtk_entry_set_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry),device_label); -// else -// gtk_entry_set_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry),""); -// -// } break; -// -// case YON_PAGE_INSTALL_SAME_PARTITION:{ -// device_tree = widgets->SamePlaceDeviceTree; -// part_tree = widgets->SamePlacePartTree; -// if (!yon_char_is_empty(fs_type)) -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->SameInstallationFilesystemTypeCombo),fs_type); -// if (format&&!strcmp(format,"yes")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SameInstallationFormatCheck),1); -// else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SameInstallationFormatCheck),main_config.format_default); -// if (device_label) -// gtk_entry_set_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry),device_label); -// else -// gtk_entry_set_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry),""); -// -// } break; -// case YON_PAGE_OPTIONS_GRUB_INSTALL:{ -// device_tree = widgets->GrubInstallDevicesTree; -// } break; -// -// case YON_PAGE_OPTIONS_GRUB_UPDATE:{ -// device_tree = widgets->GrubUpdateDevicesTree; -// } break; -// -// case YON_PAGE_OPTIONS_SEPARATE:{ -// GtkTreeIter iter; -// device_tree = widgets->SeparateDevicesTree; -// part_tree = widgets->SeparateSysSectionTree; -// for_iter(GTK_TREE_MODEL(device_list),&iter){ -// char *cur_device; -// gtk_tree_model_get(GTK_TREE_MODEL(device_list),&iter, 0,&cur_device,-1); -// if (!strcmp(cur_device,device)){ -// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(device_tree)),&iter); -// break; -// } -// } -// on_near_installation_device_changed(device_tree,widgets); -// for_iter(GTK_TREE_MODEL(part_list),&iter){ -// char *cur_part; -// gtk_tree_model_get(GTK_TREE_MODEL(device_list),&iter, 0,&cur_part,-1); -// if (!strcmp(cur_part,part)){ -// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(part_tree)),&iter); -// } -// } -// } break; -// -// case YON_PAGE_OPTIONS_OS_ONLY:{ -// device_tree = widgets->OSDevicesTree; -// part_tree = widgets->OSSysSectionTree; -// } break; -// -// case YON_PAGE_OPTIONS_USRDATA_ONLY:{ -// device_tree = widgets->UserdataDevicesTree; -// part_tree = widgets->UserdataSysSectionTree; -// } break; -// -// default:{}break; -// } -// GtkTreeIter iter; -// char *cur_device=""; -// if (page!=YON_PAGE_OPTIONS_SEPARATE && !yon_char_is_empty(device)){ -// for_iter (widgets->DevicesList,&iter){ -// gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),&iter,0,&cur_device,-1); -// if (!strcmp(device,cur_device)){ -// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(device_tree)),&iter); -// break; -// } -// } -// on_near_installation_device_changed(device_tree,widgets); -// if (!yon_char_is_empty(part)){ -// for_iter (widgets->PartitionsList,&iter){ -// gtk_tree_model_get(GTK_TREE_MODEL(widgets->PartitionsList),&iter,0,&part,-1); -// if (!strcmp(device,cur_device)){ -// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(part_tree)),&iter); -// break; -// } -// } -// } -// } -// char *system_locale = config(locale_parameter); -// if (!yon_char_is_empty(system_locale)){ -// char *chosen_langs = ""; -// for_iter(widgets->LanguagesList,&iter){ -// char *cur=NULL, *render = NULL; -// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,1,&render,2,&cur,-1); -// if (strstr(system_locale,cur)){ -// gtk_list_store_set((widgets->LanguagesList),&iter,0,1,-1); -// chosen_langs = yon_char_unite(chosen_langs,!yon_char_is_empty(chosen_langs)?";":"",render,NULL); -// } else { -// gtk_list_store_set((widgets->LanguagesList),&iter,0,0,-1); -// } -// } -// if (!yon_char_is_empty(chosen_langs)){ -// gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),chosen_langs); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),1); -// free(chosen_langs); -// } else { -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); -// gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); -// } -// } else { -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); -// gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); -// int langsize; -// config_str lang = default_langs(&langsize); -// for_iter(widgets->LanguagesList,&iter){ -// char *cur=NULL; -// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,2,&cur,-1); -// if (lang&&yon_char_parsed_check_exist(lang,langsize,cur)>-1){ -// gtk_list_store_set(widgets->LanguagesList,&iter,0,1,-1); -// } else { -// gtk_list_store_set(widgets->LanguagesList,&iter,0,0,-1); -// } -// if (cur) free(cur); -// } -// if (langsize) yon_char_parsed_free(lang,langsize); -// } -// char *zone = config(zone_parameter); -// char *region = NULL; -// -// if (!yon_char_is_empty(zone)) region = yon_char_divide_search(zone,"/",-1); else {gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck),0);} -// if (!yon_char_is_empty(region)){ -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->RegionCombo),region); -// } else { -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->RegionCombo),"Europe"); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck),0); -// } -// if (!yon_char_is_empty(zone)){ -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->ZoneCombo),zone); -// } else { -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->ZoneCombo),"Moscow"); -// } -// char *language = config(lang_parameter); -// if (!yon_char_is_empty(language)){ -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LanguageCombo),language); -// } else { -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguageCombo),0); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->MainLanguageSensitiveCheck),0); -// } -// char *kbmodel = config (xkbmodel_parameter); -// char *optinos = config(xkboptions_parameter); -// char *layout = config(xkblayout_parameter); -// if (!yon_char_is_empty(kbmodel)){ -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo),kbmodel); -// } else { -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo),0); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->KeyboardModelSensitiveCheck),0); -// -// } -// if (!yon_char_is_empty(optinos)){ -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LayoutBindingCombo),optinos); -// } else { -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LayoutBindingCombo),0); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->OptionsSensitiveCheck),0); -// } -// if (!yon_char_is_empty(layout)){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio),1); -// for_iter(widgets->LayoutList,&iter){ -// char *cur=NULL; -// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutList),&iter,0,&cur,-1); -// if (strstr(layout,cur)){ -// gtk_tree_store_set(widgets->LayoutList,&iter,3,1,-1); -// } else { -// gtk_tree_store_set(widgets->LayoutList,&iter,3,0,-1); -// } -// } -// } else { -// for_iter(widgets->LayoutList,&iter){ -// char *id; -// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutList),&iter,0,&id,-1); -// if (!strcmp(id,"ru")||!strcmp(id,"us")){ -// gtk_tree_store_set(widgets->LayoutList,&iter,3,1,-1); -// } else { -// gtk_tree_store_set((widgets->LayoutList),&iter,3,0,-1); -// } -// } -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LayoutSensitiveCheck),0); -// } -// char *user_name = config(user_name_parameter); -// char *user_gecos = config(user_gecos_parameter); -// char *user_password = config(user_password_parameter); -// char *root_password = config(root_password_parameter); -// char *autologin = config(autologin_parameter); -// char *hostname = config(hostname_parameter); -// if (!yon_char_is_empty(user_name)){ -// if (!strcmp(user_name,"root")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck),1); -// } else { -// gtk_entry_set_text(GTK_ENTRY(widgets->LoginEntry),user_name); -// } -// } else { -// gtk_entry_set_text(GTK_ENTRY(widgets->LoginEntry),""); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck),0); -// } -// if (!yon_char_is_empty(user_gecos)){ -// gtk_entry_set_text(GTK_ENTRY(widgets->UserNameEntry),_(user_gecos)); -// } else { -// gtk_entry_set_text(GTK_ENTRY(widgets->UserNameEntry),""); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UsernameSensitiveCheck),0); -// } -// int def_size=0; -// config_str default_password = NULL; -// if (!getuid()){ -// default_password = yon_config_load(yon_debug_output("%s\n",get_default_password_command), &def_size); -// if (def_size>0&&default_password){ -// yon_char_remove_last_symbol(default_password[0],'\n'); -// } -// } -// if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->PasswordCombo),0); -// gtk_entry_set_text(GTK_ENTRY(widgets->PasswordEntry),""); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->PasswordSensitiveCheck),0); -// -// } else if (!yon_char_is_empty(user_password)){ -// gtk_entry_set_text(GTK_ENTRY(widgets->PasswordEntry),user_password); -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->PasswordCombo),1); -// } -// if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo),0); -// gtk_entry_set_text(GTK_ENTRY(widgets->AdminPasswordEntry),""); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RootPasswordSensitiveCheck),0); -// -// } else if (!yon_char_is_empty(root_password)){ -// gtk_entry_set_text(GTK_ENTRY(widgets->AdminPasswordEntry),root_password); -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo),1); -// } -// if (!yon_char_is_empty(autologin)){ -// if (!strcmp(autologin,"yes")) -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),1); -// else -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),0); -// } else { -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),main_config.autologin_default); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinSensitiveCheck),0); -// } -// if (!yon_char_is_empty(hostname)){ -// if (strcmp(hostname,"auto")){ -// gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),hostname); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); -// } else{ -// gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),""); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),1); -// } -// } else { -// gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),""); -// g_signal_handlers_block_by_func(G_OBJECT(widgets->AutoHostnameCheck),on_autohostname_check,widgets); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),1); -// g_signal_handlers_unblock_by_func(G_OBJECT(widgets->AutoHostnameCheck),on_autohostname_check,widgets); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),0); -// } -// } - -// void on_config_local_load(GtkWidget *,main_window *widgets){ -// yon_load_proceed(YON_CONFIG_LOCAL); -// yon_interface_update(widgets); -// main_config.load_mode=1; -// } - -// void on_config_global_load(GtkWidget *,main_window *widgets){ -// yon_load_proceed(YON_CONFIG_GLOBAL); -// yon_interface_update(widgets); -// main_config.load_mode=0; -// } - -// void on_config_custom_load(GtkWidget *,main_window *widgets){ -// yon_load_proceed(YON_CONFIG_CUSTOM); -// yon_interface_update(widgets); -// main_config.load_mode=3; -// } - -// void on_config_global_local_save(GtkWidget *,main_window *widgets){ -// yon_save_proceed(NULL,YON_CONFIG_BOTH); -// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); -// } - -// void on_config_local_save(GtkWidget *,main_window *widgets){ -// yon_save_proceed("system",YON_CONFIG_LOCAL); -// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); -// -// } - -// void on_config_global_save(GtkWidget *,main_window *widgets){ -// yon_save_proceed("global",YON_CONFIG_GLOBAL); -// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); -// -// } - -// void on_config_custom_save(GtkWidget *, main_window *widgets){ -// char *path = NULL; -// GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,SAVE_LABEL,GTK_RESPONSE_ACCEPT,NULL); -// textdomain(TITLE_LABEL); -// GtkFileFilter *filter = gtk_file_filter_new(); -// gtk_window_set_icon_name(GTK_WINDOW(dialog),yon_char_append("com.ublinux.",LocaleName)); -// gtk_file_filter_add_pattern(filter,"*.ini"); -// gtk_file_filter_set_name(filter, "*.ini"); -// gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); -// int response = gtk_dialog_run(GTK_DIALOG(dialog)); -// if (response == GTK_RESPONSE_ACCEPT){ -// char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); -// if (!yon_char_is_empty(file)){ -// if (!strstr(file,".ini")) file = yon_char_append(file,".ini"); -// if (access(file,0)!=F_OK){ -// char *command_creation = ubconfig_file_create(file); -// int a = system(yon_debug_output("%s\n",command_creation)); -// if (access(file,0)!=F_OK||a){ -// yon_ubl_status_box_render(CUSTOM_CONFIG_CREATION_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); -// return; -// } -// } -// } -// path = yon_char_unite("'",file,"'",NULL); -// free(file); -// gtk_widget_destroy(dialog); -// } else { -// gtk_widget_destroy(dialog); -// return; -// } -// yon_save_proceed(path,YON_CONFIG_CUSTOM); -// if (path) free(path); -// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); -// } -// -// void yon_open_browser(GtkWidget *, char *link); -// void yon_open_browser(GtkWidget *, char *link){ -// GtkWidget *window = yon_ubl_browser_window_open(link,TITLE_LABEL); -// if (window) -// gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",LocaleName)); -// } - -// void on_open_documentation_confirmation(GtkWidget *self, char *link); -// void on_open_documentation_confirmation(GtkWidget *self, char *link){ -// if (main_config.always_open_documentation==0){ -// GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_documentation); -// documentation_confirmation_window *window = malloc(sizeof(documentation_confirmation_window)); -// window->Window = yon_gtk_builder_get_widget(builder,"helpConfirmationWindow"); -// window->AcceptButton = yon_gtk_builder_get_widget(builder,"ReadHelpButton"); -// window->CloseButton = yon_gtk_builder_get_widget(builder,"CancelHelpButton"); -// window->HeaderLabel = yon_gtk_builder_get_widget(builder,"webHeaderNameLabel"); -// window->AlwaysOpenCheck = yon_gtk_builder_get_widget(builder,"AlwaysOpenDocumentationCheckbox"); -// gtk_label_set_text(GTK_LABEL(window->HeaderLabel),TITLE_LABEL); -// gtk_widget_show_all(window->Window); -// g_signal_connect(G_OBJECT(window->CloseButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); -// g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(yon_open_browser),yon_char_new(link)); -// g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); -// -// -// } else { -// yon_open_browser(self,link); -// } -// } - -// void on_link(GtkWidget *self, char* uri); -// void on_link(GtkWidget *self, char* uri){ -// gtk_widget_destroy(self); -// on_open_documentation_confirmation(self,uri); -// } - -// void on_about(GtkWidget *); -// void on_about(GtkWidget *){ -// GtkBuilder *builder=gtk_builder_new_from_resource(ui_glade_path_about); -// GtkWidget *window=yon_gtk_builder_get_widget(builder,"AboutWindow"); -// GtkWidget *title=yon_gtk_builder_get_widget(builder,"headerAboutTopic"); -// GtkWidget *hideButtonBox=yon_gtk_builder_get_widget(builder,"buttonBoxHide"); -// gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),version_application); -// gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),TITLE_LABEL); -// gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(window),yon_char_append("com.ublinux.",LocaleName)); -// gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",LocaleName)); -// gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(window),LocaleName); -// gtk_label_set_text(GTK_LABEL(title),TITLE_LABEL); -// g_signal_connect(G_OBJECT(window),"activate-link",G_CALLBACK(on_link),WIKI_LINK); -// gtk_widget_set_visible(hideButtonBox,0); -// gtk_widget_destroy(hideButtonBox); -// gtk_widget_show(window); -// } +double yon_size_long_convert_to_mod(double size, char mod){ + int sizemod = yon_get_size_get_from_letter(mod); + double final_size = size; + for (int i=-1;i1024;repeats++){ -// byte_float=byte_float/1024; -// } -// if (repeats==-1) { -// repeats=0; -// byte_float=byte_float/1024; -// } -// switch(repeats){ -// case 0: (*size)='K'; -// break; -// case 1: (*size)='M'; -// break; -// case 2: (*size)='G'; -// break; -// case 3: (*size)='T'; -// break; -// } -// return byte_float; -// } +double yon_size_long_convert_automatic(unsigned long bytes, char *size){ + int repeats; + double byte_float=bytes; + for (repeats=-1;byte_float>1024;repeats++){ + byte_float=byte_float/1024; + } + if (repeats==-1) { + repeats=0; + byte_float=byte_float/1024; + } + switch(repeats){ + case 0: (*size)='K'; + break; + case 1: (*size)='M'; + break; + case 2: (*size)='G'; + break; + case 3: (*size)='T'; + break; + } + return byte_float; +} // // standard functions // /**config_init() @@ -686,12 +125,6 @@ void on_toggle_button_switch_on(GtkWidget *, GtkToggleButton *toggle){ // return 1; // } -// void on_region_resized(GtkWidget *,main_window *widgets){ -// yon_image_resize_from_container(GTK_IMAGE(widgets->SlidesImage), (GdkPixbuf*)g_list_nth_data(widgets->slides_original,cur_slide)); -// yon_image_resize_from_container(GTK_IMAGE(widgets->RegionImage), widgets->regions_original); -// yon_image_resize_from_container(GTK_IMAGE(widgets->KeyboardImage), widgets->keyboard_original); -// } - void yon_switch_page_render(main_window *widgets){ enum YON_PAGES page = yon_page_get_current(GTK_NOTEBOOK(widgets->Notebook)); @@ -779,364 +212,6 @@ void yon_switch_page_render(main_window *widgets){ // void *on_setup_system_configuration(void *data); -// void *on_config_save(void *data){ -// main_window *widgets = (main_window*)data; -// -// int size=0; -// config_str parameters = yon_config_get_selection_by_key_no_ignored(&size, -// AUTOINSTALL_TYPE_INSTALL, -// AUTOINSTALL_DEVICE, -// device_format_parameter, -// device_label_parameter, -// main_config.install_mode!=1&&main_config.install_mode!=2?NULL:part_parameter, -// part_type_parameter, -// device_format_parameter, -// main_config.install_mode!=1?NULL:part_size_parameter, -// NULL); -// FILE *file = fopen(progress_path,"w"); -// if (file) -// fclose(file); -// char *command = save_config_command(yon_char_parsed_to_string(parameters,size," ")); -// yon_char_parsed_free(parameters,size); -// yon_debug_output("%s\n","Entered installation"); -// if (system(yon_debug_output("%s\n",command))){ -// -// gdk_threads_add_idle((GSourceFunc)on_install_error,widgets); -// free(command); -// g_mutex_lock(&main_config.install_mutex); -// main_config.install_thread=0; -// g_mutex_unlock(&main_config.install_mutex); -// g_mutex_lock(&main_config.install_mutex); -// main_config.install_complete=1; -// g_mutex_unlock(&main_config.install_mutex); -// return 0; -// }; -// free(command); -// g_mutex_lock(&main_config.install_mutex); -// main_config.install_thread=0; -// g_mutex_unlock(&main_config.install_mutex); -// g_mutex_lock(&main_config.install_mutex); -// main_config.install_complete=1; -// g_mutex_unlock(&main_config.install_mutex); -// if (!main_config.save_done&&main_config.save_configured){ -// on_setup_system_configuration(widgets); -// } -// return 0; -// } - -// gboolean yon_installation_progress_update(void *data) { -// main_window *widgets = (main_window*)data; -// int size; -// -// g_mutex_lock(&main_config.progress_mutex); -// config_str text = yon_file_open(progress_path, &size); -// g_mutex_unlock(&main_config.progress_mutex); -// -// if (size) { -// if (!yon_char_is_empty(text[size-1]) && text[size-1][0] == '(') { -// char *current_copy = yon_char_new(text[size-1]); -// char *percentage = yon_char_divide_search(current_copy, ")", -1); -// -// if (!strstr(percentage, "#pb")) { -// double fraction = atof(percentage+1); -// gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel), current_copy); -// gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress), fraction / 100); -// gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress), 0); -// gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), ""); -// } else { -// gtk_widget_show(gtk_widget_get_parent(widgets->PackageInstallationProgress)); -// -// config_str parsed = yon_char_parse(current_copy, &size, " "); -// if (size >= 3) { -// double fraction = atof(parsed[2]) / 100; -// gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress), fraction); -// gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), yon_char_parsed_to_string(parsed, size, " ")); -// } -// } -// -// } -// yon_char_parsed_free(text, size); -// } -// -// g_mutex_lock(&main_config.install_mutex); -// if (main_config.install_thread) { -// g_mutex_unlock(&main_config.install_mutex); -// return 1; -// } else { -// g_mutex_unlock(&main_config.install_mutex); -// gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), ""); -// return 0; -// } -// } - -// void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){ -// if (widgets){}; -// switch(page){ -// case YON_PAGE_WELCOME: { -// gtk_widget_hide(widgets->SaveButton); -// gtk_widget_set_sensitive(widgets->CancelInstallButton,0); -// gtk_widget_set_sensitive(widgets->BackButton,0); -// gtk_widget_set_sensitive(widgets->NextButton,1); -// textdomain(LocaleName); -// gtk_button_set_label(GTK_BUTTON(widgets->NextButton),NEXT_LABEL); -// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),CANCEL_LABEL); -// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))),"com.ublinux.ubinstall-gtk.arrow-right-symbolic",GTK_ICON_SIZE_BUTTON); -// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->CancelInstallButton))),"com.ublinux.ubinstall-gtk.circle-exit-symbolic",GTK_ICON_SIZE_BUTTON); -// gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,1); -// yon_switch_page_render(widgets,0); -// } break; -// -// case YON_PAGE_LICENCE:{ -// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); -// gtk_widget_set_sensitive(widgets->BackButton,1); -// yon_switch_page_render(widgets,1); -// } break; -// -// case YON_PAGE_REGION: { -// yon_image_resize_from_container(GTK_IMAGE(widgets->RegionImage), widgets->regions_original); -// yon_switch_page_render(widgets,4); -// } break; -// -// case YON_PAGE_KEYBOARD: { -// -// yon_switch_page_render(widgets,5); -// yon_image_resize_from_container(GTK_IMAGE(widgets->KeyboardImage), widgets->keyboard_original); -// } break; -// -// case YON_PAGE_OS_COMPONENTS: -// case YON_PAGE_SOFTWARE: -// case YON_PAGE_INSTALLATION_BEGIN: -// yon_switch_page_render(widgets,3); -// -// break; -// case YON_PAGE_INSTALLATION:{ -// yon_switch_page_render(widgets,3); -// gtk_widget_set_sensitive(widgets->BackButton,0); -// if ((!main_config.configure_mode)) -// gtk_widget_set_sensitive(widgets->CancelInstallButton,0); -// if (!main_config.progress_thread&&!main_config.configure_mode) -// main_config.progress_thread = gdk_threads_add_timeout(500,(GSourceFunc)yon_installation_progress_update,widgets); -// -// if (!main_config.slider_thread&&!main_config.configure_mode) -// main_config.slider_thread = g_timeout_add(5000,(GSourceFunc)on_image_slide,widgets); -// gtk_widget_show(gtk_widget_get_parent(widgets->InstallationProgress)); -// } break; -// -// case YON_PAGE_USERS: -// yon_switch_page_render(widgets,6); -// gtk_widget_set_sensitive(widgets->NextButton,1); -// gtk_widget_hide(widgets->SaveButton); -// break; -// -// case YON_PAGE_INSTALL_ERROR:{ -// on_summary_log_view((GtkWidget*)NULL,widgets); -// -// yon_switch_page_render(widgets,7); -// gtk_widget_set_sensitive(widgets->BackButton,0); -// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); -// gtk_widget_hide(widgets->InstallationLabel); -// gtk_widget_hide(widgets->PackageInstallationLabel); -// gtk_widget_set_sensitive(widgets->NextButton,1); -// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); -// g_mutex_lock(&main_config.install_mutex); -// main_config.install_complete=0; -// g_mutex_unlock(&main_config.install_mutex); -// main_config.save_done=0; -// textdomain(LocaleName); -// gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL); -// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); -// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), -// "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); -// -// } break; -// case YON_PAGE_COMPLETION:{ -// yon_switch_page_render(widgets,7); -// gtk_widget_set_sensitive(widgets->BackButton,0); -// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); -// gtk_widget_hide(widgets->InstallationLabel); -// gtk_widget_hide(widgets->PackageInstallationLabel); -// gtk_widget_set_sensitive(widgets->NextButton,1); -// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); -// g_mutex_lock(&main_config.install_mutex); -// main_config.install_complete=0; -// g_mutex_unlock(&main_config.install_mutex); -// main_config.save_done=0; -// textdomain(LocaleName); -// gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL); -// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); -// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), -// "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); -// } -// gtk_widget_hide(gtk_widget_get_parent(widgets->InstallationProgress)); -// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); -// break; -// -// case YON_PAGE_COMPLETED:{ -// yon_switch_page_render(widgets,7); -// gtk_widget_set_sensitive(widgets->BackButton,1); -// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); -// gtk_widget_hide(widgets->InstallationLabel); -// gtk_widget_hide(widgets->PackageInstallationLabel); -// gtk_widget_set_sensitive(widgets->NextButton,0); -// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); -// g_mutex_lock(&main_config.install_mutex); -// main_config.install_complete=0; -// g_mutex_unlock(&main_config.install_mutex); -// main_config.save_done=0; -// textdomain(LocaleName); -// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); -// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), -// "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); -// -// }break; -// -// case YON_PAGE_SECTIONS: -// case YON_PAGE_INSTALL_COMMON: -// case YON_PAGE_INSTALL_SEPARATE: -// case YON_PAGE_INSTALL_SAME_PARTITION: -// case YON_PAGE_INSTALL_RECOVERY: -// case YON_PAGE_OPTIONS_GRUB_INSTALL: -// case YON_PAGE_OPTIONS_GRUB_UPDATE: -// case YON_PAGE_OPTIONS_SEPARATE: -// case YON_PAGE_OPTIONS_SEPARATE_USRDATA: -// case YON_PAGE_OPTIONS_OS_ONLY: -// case YON_PAGE_OPTIONS_USRDATA_ONLY: { -// yon_switch_page_render(widgets,2); -// } break; -// case YON_PAGE_CONFIGURE_END: { -// gtk_widget_set_sensitive(widgets->BackButton,1); -// gtk_widget_set_sensitive(widgets->NextButton,0); -// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); -// gtk_widget_show(widgets->SaveButton); -// } -// } -// } - -// gboolean on_install_success(main_window *widgets){ -// gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),""); -// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION); -// -// return 0; -// } - -// gboolean on_install_error(main_window *widgets){ -// gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),""); -// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_ERROR); -// return 0; -// } - -// void *on_setup_system_configuration(void * data){ -// yon_debug_output("%s\n","Entered thread"); -// main_window *widgets = (main_window*)data; -// if (widgets){}; -// int size; -// config_str all_parameters = yon_config_get_selection_by_key(&size, -// user_name_parameter, -// user_gecos_parameter, -// user_password_parameter, -// root_password_parameter, -// autologin_parameter, -// xkbmodel_parameter, -// xkblayout_parameter, -// xkbvariant_parameter, -// xkboptions_parameter, -// hostname_parameter, -// zone_parameter, -// lang_parameter, -// locale_parameter, -// NULL); -// if (all_parameters){ -// char *parameter_string = yon_char_parsed_to_string(all_parameters,size," "); -// char *command = set_user_config_command(parameter_string); -// if (system(yon_debug_output("%s\n",command))){}; -// yon_char_parsed_free(all_parameters,size); -// free(command); -// if (parameter_string) free(parameter_string); -// } -// g_idle_add((GSourceFunc)on_install_success,widgets); -// return NULL; -// } - -// void on_log_closed(GtkWidget *, dictionary *dict){ -// main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); -// log_window *window = yon_dictionary_get_data(dict->first->next,log_window*); -// -// gtk_widget_set_sensitive(widgets->ReadFullLogButton,1); -// gtk_widget_set_sensitive(widgets->ReadShortLogButton,1); -// -// free(window->command); -// window->Window=NULL; -// } - -// log_window *yon_log_window_new(){ -// log_window *window = malloc(sizeof(log_window)); -// GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_log_view); -// window->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); -// window->ScrollWindow = yon_gtk_builder_get_widget(builder,"ScrollWindow"); -// window->HeadLabel = yon_gtk_builder_get_widget(builder,"headerTopic"); -// window->LogLabel = yon_gtk_builder_get_widget(builder,"LogLabel"); -// window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); -// window->ScrollToEndCheck = yon_gtk_builder_get_widget(builder,"ScrollToEndCheck"); -// gtk_widget_show(window->Window); -// return window; -// } - -// gboolean yon_read_log(void *data){ -// log_window *window = (log_window*)data; -// if (window->Window){ -// int size; -// g_mutex_lock(&main_config.progress_mutex); -// config_str parsed = yon_file_open(window->command,&size); -// g_mutex_unlock(&main_config.progress_mutex); -// if (size){ -// char *final = yon_char_parsed_to_string(parsed,size,""); -// gtk_label_set_text(GTK_LABEL(window->LogLabel),final); -// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck))){ -// gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)),gtk_adjustment_get_upper(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)))); -// } -// free(final); -// yon_char_parsed_free(parsed,size); -// } -// g_mutex_lock(&main_config.install_mutex); -// if (!main_config.install_complete){ -// g_mutex_unlock(&main_config.install_mutex); -// return 1; -// } else { -// g_mutex_unlock(&main_config.install_mutex); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck),0); -// gtk_widget_set_sensitive(window->ScrollToEndCheck,0); -// } -// } -// return 0; -// } - -// void on_process_log_view(GtkWidget *,main_window *widgets){ -// log_window *window = yon_log_window_new(); -// dictionary *dict=NULL; -// yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); -// yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); -// g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),dict); -// gtk_widget_set_sensitive(widgets->ReadFullLogButton,0); -// gtk_widget_set_sensitive(widgets->ReadShortLogButton,0); -// yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,INSTALL_LOG_LABEL,icon_path,"log_viewer"); -// window->command = yon_char_new(short_log_path); -// gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); -// } - -// void on_summary_log_view(GtkWidget *,main_window *widgets){ -// log_window *window = yon_log_window_new(); -// dictionary *dict=NULL; -// yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); -// yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); -// g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),dict); -// gtk_widget_set_sensitive(widgets->ReadFullLogButton,0); -// gtk_widget_set_sensitive(widgets->ReadShortLogButton,0); -// yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,PROGRESS_LOG_LABEL,icon_path,"log_viewer"); -// window->command = yon_char_new(full_log_path); -// gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); -// -// } - // void on_locale_changed(GtkWidget *,main_window *){ // // } @@ -1145,242 +220,6 @@ void yon_switch_page_render(main_window *widgets){ // // } -// void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_size, GtkComboBox *size_type){ -// GtkTreeModel *model; -// GtkTreeIter iter; -// char *selected_size=NULL; -// if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(table),&model,&iter)){ -// gtk_tree_model_get(model,&iter,2,&selected_size,-1); -// if (yon_char_is_empty(selected_size)) -// gtk_tree_model_get(model,&iter,1,&selected_size,-1); -// if (!yon_char_is_empty(selected_size)){ -// int size = gtk_combo_box_get_active(size_type); -// double cur_size = atof(selected_size); -// char cur_size_letter = selected_size[strlen(selected_size)-1]; -// int cur_size_type=0; -// switch (cur_size_letter){ -// case 'M': -// cur_size_type=0; -// break; -// case 'G': -// cur_size_type=1; -// break; -// case 'T': -// cur_size_type=2; -// break; -// } -// if (size-cur_size_type>0){ -// for (int i=0;iInstallationNearSysSectionTree) -// yon_set_max_size_from_partition(GTK_TREE_VIEW(widgets->InstallationNearSysSectionTree),GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin)); -// -// } - -// void on_separate_installation_changed(GtkWidget *self, main_window *widgets){ -// -// gtk_list_store_clear(widgets->PartitionsList); -// GtkTreeIter iter; -// GtkTreeModel *model; -// if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(self)),&model,&iter)){ -// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SeparateUserDevicesTree)),&iter); -// char *disk_path=""; -// gtk_tree_model_get(model,&iter,0,&disk_path,-1); -// int size; -// config_str parsed; -// parsed = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); -// char *string = yon_char_parsed_to_string(parsed,size,""); -// struct json_object *root; -// struct json_object *blockdevices; -// root = json_tokener_parse(string); -// json_object_object_get_ex(root, "blockdevices", &blockdevices); -// for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { -// struct json_object *device = json_object_array_get_idx(blockdevices, i); -// struct json_object *type, *path, *size, *model, *fstype, *fsused; -// -// json_object_object_get_ex(device, "type", &type); -// if (strcmp("part",json_object_get_string(type))) -// continue; -// json_object_object_get_ex(device, "path", &path); -// if (!strstr(json_object_get_string(path),disk_path)){ -// continue; -// } -// json_object_object_get_ex(device, "size", &size); -// json_object_object_get_ex(device, "model", &model); -// json_object_object_get_ex(device, "fstype", &fstype); -// json_object_object_get_ex(device, "fsused", &fsused); -// -// double free_space=0; -// char *free_space_string=""; -// if (size&&fsused){ -// char *fsused_str = (char*)json_object_get_string(fsused); -// double fsused_kbytes = atof(fsused_str); -// for (int i=0;i1024;sz=sz+1){ -// free_space=free_space/1024; -// } -// if (sz==-1) { -// sz=0; -// free_space=free_space/1024; -// } -// free_space_string = yon_char_append(yon_char_from_double(free_space)," "); -// free_space_string[strlen(free_space_string)-1]=*(yon_size_get_mod(sz)); -// } -// gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)),0.0); -// gtk_list_store_append(widgets->PartitionsList,&iter); -// gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(size),2,free_space_string,3,json_object_get_string(fstype),-1); -// } -// yon_char_parsed_free(parsed,size); -// } -// } - -// void on_near_installation_device_changed(GtkWidget *self, main_window *widgets){ -// gtk_list_store_clear(widgets->PartitionsList); -// GtkTreeIter iter; -// GtkTreeModel *model; -// if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(self)),&model,&iter)){ -// char *disk_path=""; -// gtk_tree_model_get(model,&iter,0,&disk_path,-1); -// int size; -// config_str parsed; -// parsed = yon_config_load((get_parts_and_devices_command),&size); -// char *string = yon_char_parsed_to_string(parsed,size,""); -// struct json_object *root; -// struct json_object *blockdevices; -// root = json_tokener_parse(string); -// json_object_object_get_ex(root, "blockdevices", &blockdevices); -// for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { -// struct json_object *device = json_object_array_get_idx(blockdevices, i); -// struct json_object *type, *path, *size, *model, *fstype, *fsused, *label; -// -// json_object_object_get_ex(device, "type", &type); -// if (strcmp("part",json_object_get_string(type))) -// continue; -// json_object_object_get_ex(device, "path", &path); -// if (!strstr(json_object_get_string(path),disk_path)){ -// continue; -// } -// json_object_object_get_ex(device, "size", &size); -// json_object_object_get_ex(device, "model", &model); -// json_object_object_get_ex(device, "label", &label); -// json_object_object_get_ex(device, "fstype", &fstype); -// json_object_object_get_ex(device, "fsused", &fsused); -// -// double free_space=0; -// char *free_space_string=""; -// if (size&&fsused){ -// char *fsused_str = (char*)json_object_get_string(fsused); -// double fsused_kbytes = atof(fsused_str); -// for (int i=0;i1024;sz=sz+1){ -// free_space=free_space/1024; -// } -// if (sz==-1) { -// sz=0; -// free_space=free_space/1024; -// } -// free_space_string = yon_char_append(yon_char_from_double(free_space)," "); -// free_space_string[strlen(free_space_string)-1]=*(yon_size_get_mod(sz)); -// } -// // gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),0.0); -// gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)),0.0); -// gtk_list_store_append(widgets->PartitionsList,&iter); -// gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(size),2,free_space_string,3,json_object_get_string(fstype),4,json_object_get_string(label),-1); -// } -// yon_char_parsed_free(parsed,size); -// } -// } - -// void on_same_installation_device_changed(GtkWidget *, main_window *widgets){ -// gtk_list_store_clear(widgets->PartitionsList); -// GtkTreeIter iter; -// GtkTreeModel *model; -// if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SamePlaceDeviceTree)),&model,&iter)){ -// char *disk_path=""; -// gtk_tree_model_get(model,&iter,0,&disk_path,-1); -// int size; -// config_str parsed; -// parsed = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); -// char *string = yon_char_parsed_to_string(parsed,size,""); -// struct json_object *root; -// struct json_object *blockdevices; -// root = json_tokener_parse(string); -// json_object_object_get_ex(root, "blockdevices", &blockdevices); -// for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { -// struct json_object *device = json_object_array_get_idx(blockdevices, i); -// struct json_object *type, *path, *size, *model, *vendor, *serial; -// -// json_object_object_get_ex(device, "type", &type); -// if (strcmp("part",json_object_get_string(type))) -// continue; -// json_object_object_get_ex(device, "path", &path); -// if (!strstr(json_object_get_string(path),disk_path)){ -// continue; -// } -// json_object_object_get_ex(device, "size", &size); -// json_object_object_get_ex(device, "model", &model); -// json_object_object_get_ex(device, "vendor", &vendor); -// json_object_object_get_ex(device, "serial", &serial); -// -// gtk_list_store_append(widgets->PartitionsList,&iter); -// gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(model),2,json_object_get_string(serial),3,json_object_get_string(size),4,json_object_get_string(vendor),-1); -// } -// yon_char_parsed_free(parsed,size); -// } -// } - -void on_page_next_clicked(GtkWidget *, main_window *widgets){ - enum YON_PAGES page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); - page = yon_page_get_next(widgets,page); - if ((int)page!=-1){ - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page); - } - yon_page_update(widgets); -} - -void on_page_prev_clicked(GtkWidget *, main_window *widgets){ - enum YON_PAGES page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); - page = yon_page_get_prev(page); - if ((int)page!=-1){ - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page); - } - yon_page_update(widgets); -} - void on_gparted_open(){ yon_launch_app_with_arguments(open_gparted_command,NULL); } @@ -1405,7 +244,7 @@ void on_exit_accepted(main_window *widgets){ g_mutex_unlock(&main_config.install_mutex); } main_config.exit_accepted=1; - g_signal_emit_by_name(G_OBJECT(widgets->MainWindow),"delete-event"); + // g_signal_emit_by_name(G_OBJECT(widgets->MainWindow),"delete-event"); while(gtk_events_pending()) gtk_main_iteration(); gtk_widget_destroy(widgets->MainWindow); } @@ -1418,10 +257,11 @@ gboolean on_yon_exit(GtkWidget *,GdkEvent*, main_window *widgets){ data->title=WARNING_TITLE_LABEL; if (yon_confirmation_dialog_call(widgets->MainWindow,data)==GTK_RESPONSE_ACCEPT ){ on_exit_accepted(widgets); + gtk_main_quit(); + return 1; } - return 1; } return 0; @@ -1447,6 +287,9 @@ main_window *yon_main_window_complete(){ widgets->MainWindow=yon_gtk_builder_get_widget(builder,"MainWindow"); widgets->WelcomeToggle=yon_gtk_builder_get_widget(builder,"WelcomeToggle"); widgets->LicenceToggle=yon_gtk_builder_get_widget(builder,"LicenceToggle"); + widgets->StartScenarioButton=yon_gtk_builder_get_widget(builder,"StartScenarioButton"); + widgets->SourceButton=yon_gtk_builder_get_widget(builder,"SourceButton"); + widgets->SkipInstallationButton=yon_gtk_builder_get_widget(builder,"SkipInstallationButton"); widgets->LocationToggle=yon_gtk_builder_get_widget(builder,"LocationToggle"); widgets->KeyboardToggle=yon_gtk_builder_get_widget(builder,"KeyboardToggle"); widgets->SectionsToggle=yon_gtk_builder_get_widget(builder,"SectionsToggle"); @@ -1681,31 +524,32 @@ main_window *yon_main_window_complete(){ // g_signal_connect(G_OBJECT(widgets->AddButton),"clicked",G_CALLBACK(on_keyboard_clicked),widgets); // g_signal_connect(G_OBJECT(widgets->RemoveButton),"clicked",G_CALLBACK(on_keyboard_removed),widgets); - // g_signal_connect(G_OBJECT(widgets->GrubInstallDevicesTree),"cursor-changed",G_CALLBACK(on_separate_installation_changed),widgets); - // g_signal_connect(G_OBJECT(widgets->GrubUpdateDevicesTree),"cursor-changed",G_CALLBACK(on_separate_installation_changed),widgets); - // g_signal_connect(G_OBJECT(widgets->InstallationNearSysDevicesTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); - // g_signal_connect(G_OBJECT(widgets->SamePlaceDeviceTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); - // g_signal_connect(G_OBJECT(widgets->UserdataDevicesTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); - // g_signal_connect(G_OBJECT(widgets->OSDevicesTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); - // g_signal_connect(G_OBJECT(widgets->SeparateDevicesTree),"cursor-changed",G_CALLBACK(on_separate_installation_changed),widgets); + g_signal_connect(G_OBJECT(widgets->GrubInstallDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); + g_signal_connect(G_OBJECT(widgets->GrubUpdateDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); + g_signal_connect(G_OBJECT(widgets->InstallationNearSysDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); + g_signal_connect(G_OBJECT(widgets->SamePlaceDeviceTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); + g_signal_connect(G_OBJECT(widgets->UserdataDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); + g_signal_connect(G_OBJECT(widgets->OSDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); + g_signal_connect(G_OBJECT(widgets->SeparateDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->ConfigurationModeMenuItem),"toggled",G_CALLBACK(on_configuration_mode_switch),widgets); // g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),widgets); // g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),widgets); - // g_signal_connect(G_OBJECT(widgets->SamePlacePartTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); - // g_signal_connect(G_OBJECT(widgets->InstallationNearSysSectionTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); + g_signal_connect(G_OBJECT(widgets->SamePlacePartTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); + g_signal_connect(G_OBJECT(widgets->InstallationNearSysSectionTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); + g_signal_connect(G_OBJECT(widgets->InstallationNearSizeTypeSpin),"changed",G_CALLBACK(on_partition_changed),widgets); // gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),3); // g_signal_connect(G_OBJECT(widgets->LanguageCombo),"changed",G_CALLBACK(on_locale_changed),widgets); // g_signal_connect(G_OBJECT(widgets->AdditionalSoftwareCell),"toggled",G_CALLBACK(on_additional_software_toggled),widgets); - // g_signal_connect(G_OBJECT(widgets->ManualLayoutRadio),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),gtk_widget_get_parent(gtk_widget_get_parent(widgets->AddButton))); + g_signal_connect(G_OBJECT(widgets->ManualLayoutRadio),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),gtk_widget_get_parent(gtk_widget_get_parent(widgets->AddButton))); - // g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),widgets->HotnameEntry); + g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),widgets->HotnameEntry); - // g_signal_connect(G_OBJECT(widgets->NextInstallationFormatCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->NextInstallationFilesystemTypeCombo); - // g_signal_connect(G_OBJECT(widgets->SameInstallationFormatCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->SameInstallationFilesystemTypeCombo); + g_signal_connect(G_OBJECT(widgets->NextInstallationFormatCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->NextInstallationFilesystemTypeCombo); + g_signal_connect(G_OBJECT(widgets->SameInstallationFormatCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->SameInstallationFilesystemTypeCombo); // g_signal_connect(G_OBJECT(widgets->HostnameSensitiveCheck),"toggled",G_CALLBACK(on_autohostname_sensitiveness_check),widgets); // g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(on_autohostname_check),widgets); // g_signal_connect(G_OBJECT(widgets->HotnameEntry),"changed",G_CALLBACK(on_hostname_entry_changed),widgets); @@ -1714,174 +558,176 @@ main_window *yon_main_window_complete(){ // g_signal_connect(G_OBJECT(widgets->AdminPasswordCombo),"changed",G_CALLBACK(yon_password_combo_set_sensitive),widgets); // g_signal_connect(G_OBJECT(widgets->RootPasswordSensitiveCheck),"toggled",G_CALLBACK(yon_password_set_sensitive_from_toggle),widgets); // g_signal_connect(G_OBJECT(widgets->PasswordSensitiveCheck),"toggled",G_CALLBACK(yon_password_set_sensitive_from_toggle),widgets); - yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->PasswordEntry)); - yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->AdminPasswordEntry)); + { + yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->PasswordEntry)); + yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->AdminPasswordEntry)); - if (main_config.lock_load_global == 1){ - gtk_widget_set_sensitive(widgets->LoadGlobalConfigurationMenuItem,0); - } - if (main_config.lock_save_global == 1){ - gtk_widget_set_sensitive(widgets->SaveGlobalConfigurationMenuItem,0); - gtk_widget_set_sensitive(widgets->SaveGlobalLocalConfigurationMenuItem,0); - } - if (main_config.lock_save_local == 1){ - gtk_widget_set_sensitive(widgets->SaveLocalConfigurationMenuItem,0); - gtk_widget_set_sensitive(widgets->SaveGlobalLocalConfigurationMenuItem,0); - } - if (getuid()){ - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widgets->ConfigurationModeMenuItem),1); - } + if (main_config.lock_load_global == 1){ + gtk_widget_set_sensitive(widgets->LoadGlobalConfigurationMenuItem,0); + } + if (main_config.lock_save_global == 1){ + gtk_widget_set_sensitive(widgets->SaveGlobalConfigurationMenuItem,0); + gtk_widget_set_sensitive(widgets->SaveGlobalLocalConfigurationMenuItem,0); + } + if (main_config.lock_save_local == 1){ + gtk_widget_set_sensitive(widgets->SaveLocalConfigurationMenuItem,0); + gtk_widget_set_sensitive(widgets->SaveGlobalLocalConfigurationMenuItem,0); + } + if (getuid()){ + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widgets->ConfigurationModeMenuItem),1); + } - gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter),0); - gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); + gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter),0); + gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); - gtk_window_set_title(GTK_WINDOW(widgets->MainWindow),TITLE_LABEL); - gtk_window_set_icon_name(GTK_WINDOW(widgets->MainWindow),icon_path); + gtk_window_set_title(GTK_WINDOW(widgets->MainWindow),TITLE_LABEL); + gtk_window_set_icon_name(GTK_WINDOW(widgets->MainWindow),icon_path); - int size; - config_str parsed = NULL; - parsed = yon_file_open(licence_path,&size); - if (size){ - char *licence = yon_char_parsed_to_string(parsed,size,""); - gtk_label_set_text(GTK_LABEL(widgets->LicenceLabel),licence); - free(licence); - yon_char_parsed_free(parsed,size); - } + int size; + config_str parsed = NULL; + parsed = yon_file_open(licence_path,&size); + if (size){ + char *licence = yon_char_parsed_to_string(parsed,size,""); + gtk_label_set_text(GTK_LABEL(widgets->LicenceLabel),licence); + free(licence); + yon_char_parsed_free(parsed,size); + } - config_str slides = yon_char_parsed_new(&size,slide_repeat_path); - widgets->regions_original = gdk_pixbuf_new_from_resource(regions_path,NULL); - widgets->keyboard_original = gdk_pixbuf_new_from_resource(keyboard_path,NULL); - widgets->slides_original = NULL; - widgets->slides_original = g_list_prepend(widgets->slides_original,gdk_pixbuf_new_from_resource(slide_0_path,NULL)); - for (int i=1;islides_original = g_list_prepend(widgets->slides_original,gdk_pixbuf_new_from_resource(slides[i-1],NULL)); - } - widgets->slides_original = g_list_reverse(widgets->slides_original); - yon_char_parsed_free(slides,size); - int width = gdk_pixbuf_get_width(widgets->regions_original); - int height = gdk_pixbuf_get_height(widgets->regions_original); - widgets->region_height_mult = (float)height/width; - GdkPixbuf *pix = gdk_pixbuf_scale_simple(widgets->regions_original,600,400,GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->RegionImage),pix); - g_object_unref(pix); - pix = gdk_pixbuf_scale_simple(widgets->keyboard_original,600,400,GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->KeyboardImage),pix); - g_object_unref(pix); - pix = gdk_pixbuf_scale_simple((GdkPixbuf*)g_list_nth_data(widgets->slides_original,0),600,400,GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->SlidesImage),pix); - g_object_unref(pix); - - int langsize; - config_str lang = default_langs(&langsize); - - GtkTreeIter iter; - gtk_list_store_clear(widgets->LanguagesList); - parsed = yon_file_open(languages_path,&size); - for (int i=0;iLanguagesList,&iter); - gtk_list_store_set(widgets->LanguagesList,&iter,0,0,1,_(cur[1]),2,cur[0],-1); + config_str slides = yon_char_parsed_new(&size,slide_repeat_path); + widgets->regions_original = gdk_pixbuf_new_from_resource(regions_path,NULL); + widgets->keyboard_original = gdk_pixbuf_new_from_resource(keyboard_path,NULL); + widgets->slides_original = NULL; + widgets->slides_original = g_list_prepend(widgets->slides_original,gdk_pixbuf_new_from_resource(slide_0_path,NULL)); + for (int i=1;islides_original = g_list_prepend(widgets->slides_original,gdk_pixbuf_new_from_resource(slides[i-1],NULL)); } - yon_char_parsed_free(cur,cur_size); - } - yon_char_parsed_free(parsed,size); - if (lang) - yon_char_parsed_free(lang,langsize); - - parsed = yon_dir_get_contents(zone_path,&size); - for (int i=0;iRegionCombo),parsed[i],_(parsed[i])); + widgets->slides_original = g_list_reverse(widgets->slides_original); + yon_char_parsed_free(slides,size); + int width = gdk_pixbuf_get_width(widgets->regions_original); + int height = gdk_pixbuf_get_height(widgets->regions_original); + widgets->region_height_mult = (float)height/width; + GdkPixbuf *pix = gdk_pixbuf_scale_simple(widgets->regions_original,600,400,GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->RegionImage),pix); + g_object_unref(pix); + pix = gdk_pixbuf_scale_simple(widgets->keyboard_original,600,400,GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->KeyboardImage),pix); + g_object_unref(pix); + pix = gdk_pixbuf_scale_simple((GdkPixbuf*)g_list_nth_data(widgets->slides_original,0),600,400,GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->SlidesImage),pix); + g_object_unref(pix); + + int langsize; + config_str lang = default_langs(&langsize); + + GtkTreeIter iter; + gtk_list_store_clear(widgets->LanguagesList); + parsed = yon_file_open(languages_path,&size); + for (int i=0;iLanguagesList,&iter); + gtk_list_store_set(widgets->LanguagesList,&iter,0,0,1,_(cur[1]),2,cur[0],-1); } - free(path); + yon_char_parsed_free(cur,cur_size); } - } - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->RegionCombo),0); - yon_char_parsed_free(parsed,size); - parsed = yon_config_load(yon_debug_output("%s\n",get_layouts_command),&size); - GtkTreeIter itar; - for (int i=0;iLayoutList,&iter,NULL); - gtk_tree_store_set(widgets->LayoutList,&iter,0,layout[0],1,_(layout[1]),2,1,-1); - yon_char_parsed_free(layout,layout_size); - char *command = get_layouts_local_command(layout_id); - config_str layout_local = yon_config_load(yon_debug_output("%s\n",command),&layout_size); - free(command); - free(layout_id); - for (int j=0;jLayoutList,&itar,&iter); - gtk_tree_store_set(widgets->LayoutList,&itar,0,layouts_parsed[0],1,_(layouts_parsed[1]),2,1,3,0,-1); - yon_char_parsed_free(layouts_parsed,parsed_size); + yon_char_parsed_free(parsed,size); + if (lang) + yon_char_parsed_free(lang,langsize); + + parsed = yon_dir_get_contents(zone_path,&size); + for (int i=0;iRegionCombo),parsed[i],_(parsed[i])); } + free(path); } - if (layout_size==-1) { - gtk_tree_store_set(widgets->LayoutList,&iter,2,1,-1); - } - yon_char_parsed_free(layout_local,layout_size); } - } - yon_char_parsed_free(parsed,size); - { - parsed = yon_config_load(yon_debug_output("%s\n",get_devices_command),&size); - char *string = yon_char_parsed_to_string(parsed,size,""); - struct json_object *root; - struct json_object *blockdevices; - root = json_tokener_parse(string); - free(string); - json_object_object_get_ex(root, "blockdevices", &blockdevices); - for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { - struct json_object *device = json_object_array_get_idx(blockdevices, i); - struct json_object *path, *size, *model, *vendor, *serial; - - json_object_object_get_ex(device, "path", &path); - json_object_object_get_ex(device, "size", &size); - json_object_object_get_ex(device, "model", &model); - json_object_object_get_ex(device, "vendor", &vendor); - json_object_object_get_ex(device, "serial", &serial); - - gtk_list_store_append(widgets->DevicesList,&iter); - gtk_list_store_set(widgets->DevicesList,&iter,0,json_object_get_string(path),1,json_object_get_string(model),2,json_object_get_string(serial),3,json_object_get_string(size),4,json_object_get_string(vendor),-1); - + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->RegionCombo),0); + yon_char_parsed_free(parsed,size); + parsed = yon_config_load(yon_debug_output("%s\n",get_layouts_command),&size); + GtkTreeIter itar; + for (int i=0;iLayoutList,&iter,NULL); + gtk_tree_store_set(widgets->LayoutList,&iter,0,layout[0],1,_(layout[1]),2,1,-1); + yon_char_parsed_free(layout,layout_size); + char *command = get_layouts_local_command(layout_id); + config_str layout_local = yon_config_load(yon_debug_output("%s\n",command),&layout_size); + free(command); + free(layout_id); + for (int j=0;jLayoutList,&itar,&iter); + gtk_tree_store_set(widgets->LayoutList,&itar,0,layouts_parsed[0],1,_(layouts_parsed[1]),2,1,3,0,-1); + yon_char_parsed_free(layouts_parsed,parsed_size); + } + } + if (layout_size==-1) { + gtk_tree_store_set(widgets->LayoutList,&iter,2,1,-1); + } + yon_char_parsed_free(layout_local,layout_size); + } } yon_char_parsed_free(parsed,size); - } - - parsed = yon_resource_open_file(additional_software_path,&size); - for (int i=1;iAdditionalSoftwareList,&iter); - gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,1,1,module_parsed[0],3,module_parsed[1],-1); //2,module_parsed[2] - yon_char_parsed_free(module_parsed,module_size); + { + parsed = yon_config_load(yon_debug_output("%s\n",get_devices_command),&size); + char *string = yon_char_parsed_to_string(parsed,size,""); + struct json_object *root; + struct json_object *blockdevices; + root = json_tokener_parse(string); + free(string); + json_object_object_get_ex(root, "blockdevices", &blockdevices); + for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { + struct json_object *device = json_object_array_get_idx(blockdevices, i); + struct json_object *path, *size, *model, *vendor, *serial; + + json_object_object_get_ex(device, "path", &path); + json_object_object_get_ex(device, "size", &size); + json_object_object_get_ex(device, "model", &model); + json_object_object_get_ex(device, "vendor", &vendor); + json_object_object_get_ex(device, "serial", &serial); + + gtk_list_store_append(widgets->DevicesList,&iter); + gtk_list_store_set(widgets->DevicesList,&iter,0,json_object_get_string(path),1,json_object_get_string(model),2,json_object_get_string(serial),3,json_object_get_string(size),4,json_object_get_string(vendor),-1); + + } + yon_char_parsed_free(parsed,size); } - } - if (size) yon_char_parsed_free(parsed,size); + + parsed = yon_resource_open_file(additional_software_path,&size); + for (int i=1;iAdditionalSoftwareList,&iter); + gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,1,1,module_parsed[0],3,module_parsed[1],-1); //2,module_parsed[2] + yon_char_parsed_free(module_parsed,module_size); + } + } + if (size) yon_char_parsed_free(parsed,size); - config_str models = yon_config_load(yon_debug_output("%s\n",get_models_command),&size); - for (int i=0;iKeyboardModelCombo),models[i],_(models[i+1])); + config_str models = yon_config_load(yon_debug_output("%s\n",get_models_command),&size); + for (int i=0;iKeyboardModelCombo),models[i],_(models[i+1])); + } + if (size) yon_char_parsed_free(models,size); + gtk_builder_connect_signals(builder,NULL); + // yon_load_proceed(YON_CONFIG_DEFAULT); + // yon_interface_update(widgets); } - if (size) yon_char_parsed_free(models,size); - gtk_builder_connect_signals(builder,NULL); - // yon_load_proceed(YON_CONFIG_DEFAULT); - // yon_interface_update(widgets); return widgets; } @@ -1901,6 +747,11 @@ int main(int argc, char *argv[]){ yon_window_config_load(path); main_config.launch_arguments=yon_char_parsed_copy(argv,argc); main_config.launch_size=argc; + GtkCssProvider *css=gtk_css_provider_new(); + gtk_css_provider_load_from_resource(css,CssPath); + gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), + GTK_STYLE_PROVIDER(css), + -1); if (getuid()!=0){ textdomain(template_ui_LocaleName); yon_ubl_status_box_render(ROOT_WARNING_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 7aef6a5..c781494 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -65,6 +65,8 @@ "/com/ublinux/images/slide-12.png", \ NULL +#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" @@ -75,7 +77,7 @@ NULL #define get_layouts_command "xkbcli list --load-exotic | awk \"layout && /description:/ {match(\\$0,/: *(.*)/,matches);description=matches[1];printf \\\"%s|%s\\n\\\",layout,description;layout=\\\"\\\"} /layout:/ {match(\\$0, /: *'([^']+)'/,matches);l=matches[1];if (layouts[l]) next;layout=layouts[l]=l}\" | sort -u" #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,253" -#define get_parts_and_devices_command "lsblk --noheadings -Jo TYPE,PATH,SIZE,FSTYPE,LABEL,PARTLABEL,MOUNTPOINT,FSUSED,FSUSE% --exclude 7,253" +#define get_parts_and_devices_command "lsblk --noheadings --bytes -o TYPE,PATH,SIZE,FSTYPE,LABEL,PARTLABEL,MOUNTPOINT,FSUSED,FSUSE% --exclude 7,253 |awk '{print ($1\";\"$2\";\"$3\";\"$4\";\"$5\";\"$6\";\"$7\";\"$8\";\"$9)}'" #define AUTOINSTALL_TYPE_INSTALL "AUTOINSTALL[install_type]" #define AUTOINSTALL_TYPE_INSTALL_command "ubconfig --source global get [autoinstall] AUTOINSTALL[install_type]" @@ -142,6 +144,10 @@ NULL #define device_typevfs_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[device_typevfs]" #define NTPSERVERS_parameter "AOUTINSTALL[ubconfig set [network] NTPSERVERS]" #define NTPSERVERS_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[ubconfig set [network] NTPSERVERS]" +#define DOMAIN_parameter "AOUTINSTALL[ubconfig set [network] DOMAIN]" +#define DOMAIN_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[ubconfig set [network] DOMAIN]" +#define DOMAIN_admanger_parameter "AOUTINSTALL[ubconfig set [network] DOMAIN[admanger]]" +#define DOMAIN_admanger_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[ubconfig set [network] DOMAIN[admanger]]" #define save_config_command(parameters) yon_char_unite("ubconfig --target system set [autoinstall] AUTOINSTALL[log]=yes ",parameters, "; nice ubinstall2 --debug autoinstall", NULL) @@ -274,6 +280,10 @@ typedef struct { GtkWidget *MainWindow; + GtkWidget *StartScenarioButton; + GtkWidget *SourceButton; + GtkWidget *SkipInstallationButton; + GtkWidget *StatusBox; GtkWidget *WelcomeToggle; GtkWidget *LicenceToggle; @@ -466,6 +476,11 @@ typedef struct { GtkWidget *AdvancedSwapFixedSwitch; GtkWidget *AdvancedSwapFixedSizeSwitch; dictionary *advanced_sections; + + GFile *install_progress_file; + GFileMonitor *install_progress_monitor; + GFile *install_info_file; + GFileMonitor *install_info_monitor; } main_window; typedef struct { @@ -577,7 +592,7 @@ 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_near_installation_device_changed(GtkWidget *self, main_window *widgets); +void on_device_selection_changed(GtkWidget *self, main_window *widgets); void on_toggle_button_switch_on(GtkWidget *, GtkToggleButton *toggle); @@ -602,7 +617,7 @@ 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_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); @@ -618,11 +633,13 @@ void on_log_closed(GtkWidget *, dictionary *dict); void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets); gboolean yon_installation_progress_update(void *data); void *on_config_save(void *data); +void *on_setup_system_configuration(void * data); 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); @@ -668,4 +685,6 @@ void on_connection_add(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); \ No newline at end of file +void on_configuration_mode_switch(GtkWidget *self,main_window *widgets); +void *_yon_installation_start(main_window *widgets); +int yon_installation_start(main_window *widgets); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 114ba74..e0930c3 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -100,7 +100,6 @@ #define PASSWORD_SHORT_LABEL(min_size_char) yon_char_unite(_("Password must be at least")," ", min_size_char," ",_("characters")) #define RESTART_LABEL _("Restart PC") -#define EXIT_LABEL _("Exit") #define CHOOSE_LABEL _("Choose file system type for the section:") #define SECTION_NAME_LABEL _("Section name:") #define FORMAT_LABEL _("Format") @@ -185,4 +184,5 @@ #define WARNING_TEXT_LABEL _("Are you sure want to exit and\ninterrupt installation process?") #define WARNING_REBOOT_TEXT_LABEL _("Are you sure want to reboot system?") -#define DEFAULT_BOOTLOAD_MENU_ITEM_LABEL _("Default (Use last succeeded)") \ No newline at end of file +#define DEFAULT_BOOTLOAD_MENU_ITEM_LABEL _("Default (Use last succeeded)") +#define ENCRYPT_ERROR_LABEL _("Password encryption error") \ No newline at end of file diff --git a/ubinstall-gtk.css b/ubinstall-gtk.css index 9b28bc6..0dba73b 100644 --- a/ubinstall-gtk.css +++ b/ubinstall-gtk.css @@ -16,6 +16,14 @@ background:transparent; color: @theme_text_color; } +.bggrey{ + border-radius:5px; + border-color:@theme_text_color; + border-style:solid; + border-width:0.3px; + box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15); +} + .inherited>* { border:none; background:inherit; diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 821b93c..ed605d0 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -27,6 +27,11 @@ + + 60 + 1 + 10 + @@ -95,18 +100,28 @@ + + 999999 + 16 + 1 + 10 + - + - + - + - + - + + + + + @@ -121,28 +136,15 @@ - + True False - - - - - - 999999 - 16 - 1 - 10 - - - 60 - 1 - 10 + com.ublinux.libublsettingsui-gtk3.properties-symbolic - + True False - com.ublinux.libublsettingsui-gtk3.properties-symbolic + com.ublinux.libublsettingsui-gtk3.edit-symbolic True @@ -209,6 +211,11 @@ False com.ublinux.libublsettingsui-gtk3.properties-symbolic + + True + False + com.ublinux.libublsettingsui-gtk3.edit-symbolic + True False @@ -2801,67 +2808,6 @@ and help you install UBLinux on your computer 5 - - - True - False - 5 - - - True - True - False - True - - - True - False - Host name: - 0 - - - - - False - True - 0 - - - - - True - False - True - auto - - - True - True - 2 - - - - - Automatically - True - False - True - False - True - - - False - True - 3 - - - - - False - True - 6 - - False @@ -3097,7 +3043,7 @@ and help you install UBLinux on your computer True True - adjustment2 + BootloaderTimer False @@ -3584,6 +3530,67 @@ and help you install UBLinux on your computer 1 + + + True + False + 5 + + + True + True + False + True + + + True + False + Host name: + 0 + + + + + False + True + 0 + + + + + True + False + True + auto + + + True + True + 2 + + + + + Automatically + True + False + True + False + True + + + False + True + 3 + + + + + False + True + 2 + + True @@ -3627,7 +3634,7 @@ and help you install UBLinux on your computer False True - 2 + 3 @@ -4917,7 +4924,7 @@ installed. False True 0,0 - adjustment1 + PartitionSize 1 @@ -5148,6 +5155,10 @@ installed. True False + center + center + 20 + 20 vertical 5 @@ -5495,120 +5506,226 @@ installed. True False - 5 + vertical - + True - True - False - True - + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + 5 - + True False - Choose file system type for the section: + 5 + + + True + False + Partition: + 0 + + + False + True + 0 + + + + + True + False + label + 0 + + + False + True + 1 + + + + False + True + 0 + - - - False - True - 0 - - - - - True - False - True - 1 - - ext3 - ext4 - fat16 - fat32 - exfat - riserfs - udf - xfs - zfs - - - - - True - True - 2 - - - - - Format - True - False - True - False - True - - - - False - True - 3 - - - - - False - True - 2 - - - - - True - False - 5 - - - True - True - False - True - - + True False - Section name: + 5 + + + True + True + + + False + True + 0 + + + + + True + False + Format + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + vertical + 5 + + + True + False + + + False + True + 0 + + + + + True + False + none + True + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + Partition label: + + + False + True + 3 + + + + + True + False + True + + + + True + True + 4 + + + + + True + False + File system type: + + + False + True + 5 + + + + + True + False + False + 1 + + ext3 + ext4 + fat16 + fat32 + exfat + riserfs + udf + xfs + zfs + + + + + True + True + 6 + + + + + False + True + 0 + + + + + + + False + True + 1 + + + + False + True + 2 + False True - 0 - - - - - True - False - True - - - - True - True 2 + False True - 3 + 4 @@ -5860,7 +5977,14 @@ separately into the selected partition. False 0 - No + No + RAID0 + RAID1 + DAID4 + RAID5 + RAID6 + LVM + LVM_DYNAMIC @@ -8058,6 +8182,365 @@ separately into the selected partition. 1 + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + vertical + 5 + + + True + False + 5 + + + True + False + Partition: + 0 + + + False + True + 0 + + + + + True + False + label + 0 + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + + + False + True + 0 + + + + + True + False + Format + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + vertical + 5 + + + True + False + + + False + True + 0 + + + + + True + False + none + True + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + Size: + + + False + True + 0 + + + + + True + True + PartitionSize + + + False + True + 1 + + + + + True + False + 1 + + Mb + Gb + Tb + + + + False + True + 2 + + + + + True + False + Partition mark: + + + False + True + 3 + + + + + True + True + + + False + True + 4 + + + + + True + False + File system type: + + + False + True + 5 + + + + + True + False + False + 1 + + ext3 + ext4 + fat16 + fat32 + exfat + riserfs + udf + xfs + zfs + + + + True + True + 6 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + File system mark: + + + False + True + 0 + + + + + True + True + + + False + True + 1 + + + + + True + False + Encryption: + + + False + True + 2 + + + + + True + False + + + False + True + 3 + + + + + True + False + Encryption password: + + + False + True + 4 + + + + + True + True + + + False + True + 5 + + + + + True + True + True + image4 + + + + False + True + 6 + + + + + False + True + 1 + + + + + + + False + True + 1 + + + + + False + True + 2 + + + + + False + True + 2 + + + + + + False + True + 2 + + @@ -8426,6 +8909,369 @@ separately into the selected partition. 1 + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + 5 + + + True + False + 5 + + + True + False + Partition: + 0 + + + False + True + 0 + + + + + True + False + label + 0 + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + + + False + True + 0 + + + + + True + False + Format + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + vertical + 5 + + + True + False + + + False + True + 0 + + + + + True + False + none + True + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + Size: + + + False + True + 0 + + + + + True + True + 16 + PartitionSize + 16 + + + False + True + 1 + + + + + True + False + 1 + + Mb + Gb + Tb + + + + False + True + 2 + + + + + True + False + Partition mark: + + + False + True + 3 + + + + + True + True + + + False + True + 4 + + + + + True + False + File system type: + + + False + True + 5 + + + + + True + False + False + 1 + + ext3 + ext4 + fat16 + fat32 + exfat + riserfs + udf + xfs + zfs + + + + True + True + 6 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + File system mark: + + + False + True + 0 + + + + + True + True + + + False + True + 1 + + + + + True + False + Encryption: + + + False + True + 2 + + + + + True + False + + + False + True + 3 + + + + + True + False + Encryption password: + + + False + True + 4 + + + + + True + True + + + False + True + 5 + + + + + True + True + True + image10 + + + + False + True + 6 + + + + + False + True + 1 + + + + + + + False + True + 1 + + + + + False + True + 2 + + + + + False + True + 2 + + + + + + False + True + 2 + + @@ -8464,63 +9310,6 @@ separately into the selected partition. 0 - - - True - False - center - 5 - - - Cancel - True - False - True - True - image7 - - - False - True - 0 - - - - - Back - False - True - True - image8 - - - False - True - 1 - - - - - Next - True - True - True - image9 - - - False - True - 2 - - - - - False - True - end - 1 - - True @@ -8656,6 +9445,115 @@ separately into the selected partition. + + False + True + 1 + + + + + True + False + 5 + + + True + False + center + 5 + + + Cancel + True + False + True + True + image7 + + + False + True + 0 + + + + + Back + False + True + True + image8 + + + False + True + 1 + + + + + Next + True + True + True + image9 + + + False + True + 2 + + + + + False + True + end + 3 + + + + + Start installation scenario + True + True + True + + + False + True + 0 + + + + + Source + True + True + True + + + False + True + 1 + + + + + Skip installation + True + True + True + + + False + True + end + 2 + + + False True -- 2.35.1 From a95c0dbfbfeb1496546f6fd87a64aa53c4da0834 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 17 Jul 2025 18:04:28 +0600 Subject: [PATCH 04/18] WIP format widgets changes, user window changes --- source/ubinstall-gtk-installation.c | 122 +-- source/ubinstall-gtk-keyboard.c | 23 + source/ubinstall-gtk-password.c | 42 - source/ubinstall-gtk-saving.c | 106 ++- source/ubinstall-gtk-users.c | 23 +- source/ubinstall-gtk.c | 302 ++++--- source/ubinstall-gtk.h | 138 ++-- ubinstall-gtk.glade | 1160 ++++++++++++++++----------- 8 files changed, 1099 insertions(+), 817 deletions(-) diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 0d7f8ea..1066501 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -8,20 +8,22 @@ int yon_install_common_save(main_window *widgets){ yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->CommonInstallationDevicesTree)); return 0; } - char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->CommonInstallationFilesystemTypeCombo)); - char *device_name = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->CommonInstallationSectionNameEntry)); char *device; yon_config_remove_by_key(part_size_parameter); yon_config_remove_by_key(part_parameter); gtk_tree_model_get(model,&iter,0,&device,-1); yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"fast"); yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,device); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->CommonSectionSensitiveCheck))){ - yon_config_register(device_label_parameter,device_label_parameter_command,device_name); + + char *device_name = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->CommonInstallationSectionNameEntry)); + if (!yon_char_is_empty(device_name)){ + yon_config_register(part_label_parameter,part_label_parameter_command,device_name); } else { - yon_config_remove_by_key(device_label_parameter); + yon_config_remove_by_key(part_label_parameter); } - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->CommonFilesystemSensitiveCheck))){ + + char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->CommonInstallationFilesystemTypeCombo)); + if (!yon_char_is_empty(file_system_type)){ yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type); } else { yon_config_remove_by_key(part_type_parameter); @@ -32,52 +34,59 @@ int yon_install_common_save(main_window *widgets){ int yon_install_separate_save(main_window *widgets){ GtkTreeModel *model; GtkTreeIter iter; - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->InstallationNearSysDevicesTree)),&model,&iter)){ + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->NextInstallationSysDevicesTree)),&model,&iter)){ yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->CommonInstallationDevicesTree)); return 0; } char *device; gtk_tree_model_get(model,&iter,0,&device,-1); - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->InstallationNearSysSectionTree)),&model,&iter)){ + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->NextInstallationSysSectionTree)),&model,&iter)){ yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->CommonInstallationDevicesTree)); return 0; } - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextSizeSensitiveCheck))){ - double part_size = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)); + if (gtk_switch_get_active(GTK_SWITCH(widgets->NextInstallationFormatSwitch))){ + yon_config_register(part_format_parameter,part_format_parameter_command,"yes"); + double part_size = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin)); if (part_size){ - char *size_letter = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin)); + char *size_letter = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->NextInstallationSizeTypeSpin)); char *size_final = yon_char_append(yon_char_from_long((long)part_size),size_letter); yon_config_register(part_size_parameter,part_size_parameter_command,size_final); - } else yon_config_remove_by_key(part_size_parameter); - } else yon_config_remove_by_key(part_size_parameter); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextLabelSensitiveCheck))){ - char *device_name = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry)); - yon_config_register(device_label_parameter,device_label_parameter_command,device_name); + } else { + yon_config_remove_by_key(part_size_parameter); + } + + char *device_name = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry)); + if (!yon_char_is_empty(device_name)){ + yon_config_register(part_label_parameter,part_label_parameter_command,device_name); + } else { + yon_config_remove_by_key(part_label_parameter); + + } + + char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->NextInstallationFilesystemTypeCombo)); + if (!yon_char_is_empty(file_system_type)){ + yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type); + + } else { + yon_config_remove_by_key(part_type_parameter); + + } } else { - yon_config_remove_by_key(device_label_parameter); + yon_config_register(part_format_parameter,part_format_parameter_command,"no"); + yon_config_remove_by_key(part_label_parameter); + yon_config_remove_by_key(part_type_parameter); + yon_config_remove_by_key(part_format_parameter); + yon_config_remove_by_key(part_type_parameter); + yon_config_remove_by_key(part_format_parameter); } + char *part; gtk_tree_model_get(model,&iter,0,&part,-1); yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"next"); yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,device); yon_config_register(part_parameter,part_parameter_command,part); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextFSTypeSensitiveCheck))){ - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck))){ - yon_config_register(device_format_parameter,device_format_parameter_command,"no"); - yon_config_remove_by_key(part_type_parameter); - } else { - char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->NextInstallationFilesystemTypeCombo)); - yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type); - yon_config_remove_by_key(device_format_parameter); - } - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck))) - yon_config_register(device_format_parameter,device_format_parameter_command,"no"); - } else { - yon_config_remove_by_key(part_type_parameter); - yon_config_remove_by_key(device_format_parameter); - } return 1; } @@ -103,26 +112,27 @@ int yon_install_same_partition_save(main_window *widgets){ yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,device); yon_config_register(part_parameter,part_parameter_command,part); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->SameLabelSensitiveCheck))){ + if (gtk_switch_get_active(GTK_SWITCH(widgets->SameInstallationFormatSwitch))){ + yon_config_register(part_format_parameter,part_format_parameter_command,"yes"); char *device_name = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry)); - yon_config_register(device_label_parameter,device_label_parameter_command,device_name); - } else { - yon_config_remove_by_key(device_label_parameter); - } + if (!yon_char_is_empty(device_name)){ + yon_config_register(part_label_parameter,part_label_parameter_command,device_name); + } else { + yon_config_remove_by_key(part_label_parameter); + } - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->SameFSTypeSensitiveCheck))){ - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->SameInstallationFormatCheck))){ - yon_config_register(device_format_parameter,device_format_parameter_command,"no"); - yon_config_remove_by_key(part_type_parameter); - } else { - char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->SameInstallationFilesystemTypeCombo)); + char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->SameInstallationFilesystemTypeCombo)); + if (!yon_char_is_empty(file_system_type)){ yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type); - yon_config_remove_by_key(device_format_parameter); - } - } else { - yon_config_remove_by_key(device_format_parameter); + } else { yon_config_remove_by_key(part_type_parameter); + } + } else { + yon_config_register(part_format_parameter,part_format_parameter_command,"no"); + yon_config_remove_by_key(part_label_parameter); + yon_config_remove_by_key(part_format_parameter); + yon_config_remove_by_key(part_type_parameter); } return 1; } @@ -151,10 +161,10 @@ int yon_advanced_sections_save(dictionary *dict){ char *size = yon_char_unite(size_first,size_last?",":NULL,size_last,NULL); yon_config_register(part_size_parameter,part_size_parameter_command,size); - char *device_label_first = (char*)gtk_entry_get_text(GTK_ENTRY(first_section->SectionMarkEntry)); - char *device_label_last = last_section&&!strcmp(format_last,"yes")?(char*)gtk_entry_get_text(GTK_ENTRY(last_section->SectionMarkEntry)):NULL; - char *device_label = yon_char_unite(device_label_first,device_label_last?",":NULL,device_label_last,NULL); - yon_config_register(device_label_parameter,device_label_parameter_command,device_label); + char *part_label_first = (char*)gtk_entry_get_text(GTK_ENTRY(first_section->SectionMarkEntry)); + char *part_label_last = last_section&&!strcmp(format_last,"yes")?(char*)gtk_entry_get_text(GTK_ENTRY(last_section->SectionMarkEntry)):NULL; + char *part_label = yon_char_unite(part_label_first,part_label_last?",":NULL,part_label_last,NULL); + yon_config_register(part_label_parameter,part_label_parameter_command,part_label); char *fs_label_first = (char*)gtk_entry_get_text(GTK_ENTRY(first_section->FileSystemMarkentry)); char *fs_label_last = last_section&&!strcmp(format_last,"yes")?(char*)gtk_entry_get_text(GTK_ENTRY(last_section->FileSystemMarkentry)):NULL; @@ -258,8 +268,8 @@ void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_but } void on_partition_changed(GtkWidget *self, main_window *widgets){ - if (self==widgets->InstallationNearSysSectionTree||self == widgets->InstallationNearSizeTypeSpin){ - yon_set_max_size_from_partition(GTK_TREE_VIEW(widgets->InstallationNearSysSectionTree),GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin)); + if (self==widgets->NextInstallationSysSectionTree||self == widgets->NextInstallationSizeTypeSpin){ + yon_set_max_size_from_partition(GTK_TREE_VIEW(widgets->NextInstallationSysSectionTree),GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin),GTK_COMBO_BOX(widgets->NextInstallationSizeTypeSpin)); } } @@ -334,7 +344,7 @@ void on_partition_changed(GtkWidget *self, main_window *widgets){ // free_space_string = yon_char_append(yon_char_from_double(free_space)," "); // free_space_string[strlen(free_space_string)-1]=*(yon_size_get_mod(sz)); // } -// gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)),0.0); +// gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin)),0.0); // gtk_list_store_append(widgets->PartitionsList,&iter); // gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(size),2,free_space_string,3,json_object_get_string(fstype),-1); // } @@ -394,8 +404,8 @@ void on_device_selection_changed(GtkWidget *self, main_window *widgets){ yon_char_parsed_free(parsed,parsed_size); } } - gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),0.0); - gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)),0.0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin),0.0); + gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin)),0.0); } } diff --git a/source/ubinstall-gtk-keyboard.c b/source/ubinstall-gtk-keyboard.c index b83ea1e..0d4c290 100644 --- a/source/ubinstall-gtk-keyboard.c +++ b/source/ubinstall-gtk-keyboard.c @@ -1,5 +1,28 @@ #include "ubinstall-gtk.h" +void on_layout_toggle_button_switch(GtkWidget *self, main_window *widgets){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self))){ + gtk_widget_set_sensitive(widgets->DefaultLayoutRadio,1); + gtk_widget_set_sensitive(widgets->ManualLayoutRadio,1); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio))){ + gtk_widget_set_sensitive(widgets->LayoutTree,1); + gtk_widget_set_sensitive(widgets->AddButton,1); + gtk_widget_set_sensitive(widgets->RemoveButton,1); + } else { + gtk_widget_set_sensitive(widgets->LayoutTree,0); + gtk_widget_set_sensitive(widgets->AddButton,0); + gtk_widget_set_sensitive(widgets->RemoveButton,0); + } + } else { + gtk_widget_set_sensitive(widgets->DefaultLayoutRadio,0); + gtk_widget_set_sensitive(widgets->ManualLayoutRadio,0); + gtk_widget_set_sensitive(widgets->LayoutTree,0); + gtk_widget_set_sensitive(widgets->AddButton,0); + gtk_widget_set_sensitive(widgets->RemoveButton,0); + + } +} + int yon_keyboard_save(main_window *widgets){ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio))){ GtkTreeIter iter; diff --git a/source/ubinstall-gtk-password.c b/source/ubinstall-gtk-password.c index a90df7d..f52114a 100644 --- a/source/ubinstall-gtk-password.c +++ b/source/ubinstall-gtk-password.c @@ -1,44 +1,2 @@ #include "ubinstall-gtk.h" - -// void yon_password_set_sensitive_from_toggle(GtkWidget *self, main_window *widgets){ -// GtkWidget *combo = NULL; -// GtkWidget *entry = NULL; -// if (self == widgets->PasswordSensitiveCheck){ -// combo = widgets->PasswordCombo; -// entry = widgets->PasswordEntry; -// } else { -// combo = widgets->AdminPasswordCombo; -// entry = widgets->AdminPasswordEntry; -// } -// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self))){ -// gtk_widget_set_sensitive(combo,1); -// if (gtk_combo_box_get_active(GTK_COMBO_BOX(combo))){ -// gtk_widget_set_sensitive(entry,1); -// } else { -// gtk_widget_set_sensitive(entry,0); -// } -// } else { -// gtk_widget_set_sensitive(combo,0); -// gtk_widget_set_sensitive(entry,0); -// -// } -// } - -// void yon_password_combo_set_sensitive(GtkWidget *self, main_window *widgets){ -// GtkWidget *entry = NULL; -// GtkWidget *toggle = NULL; -// if (self == widgets->PasswordCombo){ -// entry = widgets->PasswordEntry; -// toggle = widgets->PasswordSensitiveCheck; -// } else if (self == widgets->AdminPasswordCombo){ -// entry = widgets->AdminPasswordEntry; -// toggle = widgets->RootPasswordSensitiveCheck; -// } -// if (gtk_combo_box_get_active(GTK_COMBO_BOX(self))&>k_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle))){ -// gtk_widget_set_sensitive(entry,1); -// } else { -// gtk_widget_set_sensitive(entry,0); -// -// } -// } diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c index 93685b9..a825145 100644 --- a/source/ubinstall-gtk-saving.c +++ b/source/ubinstall-gtk-saving.c @@ -174,7 +174,7 @@ // part = config(part_parameter); // char *fs_type = config(part_type_parameter); // char *device_label = config(device_label_parameter); -// char *format = config(device_format_parameter); +// char *format = config(part_format_parameter); // char *part_size = config(part_size_parameter); // GtkListStore *device_list = widgets->DevicesList; // GtkListStore *part_list=widgets->PartitionsList; @@ -186,13 +186,13 @@ // } break; // // case YON_PAGE_INSTALL_SEPARATE:{ -// device_tree = widgets->InstallationNearSysDevicesTree; -// part_tree = widgets->InstallationNearSysSectionTree; +// device_tree = widgets->NextInstallationSysDevicesTree; +// part_tree = widgets->NextInstallationSysSectionTree; // if (!yon_char_is_empty(part_size)){ -// gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),atof(part_size)); -// if (part_size[strlen(part_size)-1]=='M') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),0); -// if (part_size[strlen(part_size)-1]=='G') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),1); -// if (part_size[strlen(part_size)-1]=='T') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin),2); +// gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin),atof(part_size)); +// if (part_size[strlen(part_size)-1]=='M') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NextInstallationSizeTypeSpin),0); +// if (part_size[strlen(part_size)-1]=='G') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NextInstallationSizeTypeSpin),1); +// if (part_size[strlen(part_size)-1]=='T') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NextInstallationSizeTypeSpin),2); // } // if (format&&!strcmp(format,"yes")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck),1); // else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck),main_config.format_default); @@ -391,10 +391,10 @@ // if (!strcmp(user_name,"root")){ // gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck),1); // } else { -// gtk_entry_set_text(GTK_ENTRY(widgets->LoginEntry),user_name); +// gtk_entry_set_text(GTK_ENTRY(widgets->UserLoginEntry),user_name); // } // } else { -// gtk_entry_set_text(GTK_ENTRY(widgets->LoginEntry),""); +// gtk_entry_set_text(GTK_ENTRY(widgets->UserLoginEntry),""); // gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck),0); // } // if (!yon_char_is_empty(user_gecos)){ @@ -412,13 +412,13 @@ // } // } // if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->PasswordCombo),0); -// gtk_entry_set_text(GTK_ENTRY(widgets->PasswordEntry),""); +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserPasswordCombo),0); +// gtk_entry_set_text(GTK_ENTRY(widgets->UserPasswordEntry),""); // gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->PasswordSensitiveCheck),0); // // } else if (!yon_char_is_empty(user_password)){ -// gtk_entry_set_text(GTK_ENTRY(widgets->PasswordEntry),user_password); -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->PasswordCombo),1); +// gtk_entry_set_text(GTK_ENTRY(widgets->UserPasswordEntry),user_password); +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserPasswordCombo),1); // } // if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ // gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo),0); @@ -431,11 +431,11 @@ // } // if (!yon_char_is_empty(autologin)){ // if (!strcmp(autologin,"yes")) -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),1); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserAutologinSwitch),1); // else -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),0); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserAutologinSwitch),0); // } else { -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck),main_config.autologin_default); +// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserAutologinSwitch),main_config.autologin_default); // gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinSensitiveCheck),0); // } // if (!yon_char_is_empty(hostname)){ @@ -472,20 +472,76 @@ gboolean on_install_error(main_window *widgets){ return 0; } +enum INSTALL_TYPE{ + INSTALL_COMMON, + INSTALL_PART, + INSTALL_NEXT, + INSTALL_ADVANCED, + INSTALL_GRUB_INSTALL, + INSTALL_GRUB_UPDATE, + INSTALL_SYSTEM_ONLY, + INSTALL_USER_ONLY, + INSTALL_ERROR +}; + +/**Функция получения текущего режима установки + * + */ +enum INSTALL_TYPE yon_ubl_get_install_mode(){ + char *value = config(AUTOINSTALL_TYPE_INSTALL); + if (!strcmp(value,"common")){ + return INSTALL_COMMON; + } else if (!strcmp(value,"part")){ + return INSTALL_PART; + } else if (!strcmp(value,"next")){ + return INSTALL_NEXT; + } else if (!strcmp(value,"advanced")){ + return INSTALL_ADVANCED; + } else if (!strcmp(value,"grub_install")){ + return INSTALL_GRUB_INSTALL; + } else if (!strcmp(value,"grub_update")){ + return INSTALL_GRUB_UPDATE; + } else if (!strcmp(value,"system_only")){ + return INSTALL_SYSTEM_ONLY; + } else if (!strcmp(value,"data_only")){ + return INSTALL_USER_ONLY; + } + return INSTALL_ERROR; +} void *on_config_save(void *data){ main_window *widgets = (main_window*)data; int size=0; - config_str parameters = yon_config_get_selection_by_key_no_ignored(&size, - AUTOINSTALL_TYPE_INSTALL, - AUTOINSTALL_DEVICE, - device_format_parameter, - device_label_parameter, - part_parameter, - part_type_parameter, - part_size_parameter, - NULL); + config_str parameters = NULL; + enum INSTALL_TYPE install_mode = yon_ubl_get_install_mode(); + switch(install_mode){ + case INSTALL_COMMON: + parameters = yon_config_get_selection_by_key_no_ignored(&size,install_common_parameters,NULL); + break; + case INSTALL_PART: + parameters = yon_config_get_selection_by_key_no_ignored(&size,install_part_parameters,NULL); + break; + case INSTALL_NEXT: + parameters = yon_config_get_selection_by_key_no_ignored(&size,install_next_parameters,NULL); + break; + case INSTALL_ADVANCED: + parameters = yon_config_get_selection_by_key_no_ignored(&size,install_advanced_parameters,NULL); + break; + case INSTALL_GRUB_INSTALL: + case INSTALL_GRUB_UPDATE: + parameters = yon_config_get_selection_by_key_no_ignored(&size,install_grub_install_update_parameters,NULL); + break; + case INSTALL_SYSTEM_ONLY: + parameters = yon_config_get_selection_by_key_no_ignored(&size,install_system_only_parameters,NULL); + break; + case INSTALL_USER_ONLY: + parameters = yon_config_get_selection_by_key_no_ignored(&size,install_userdata_only_parameters,NULL); + break; + default: + yon_ubl_status_box_render(ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + return 0; + } FILE *file = fopen(progress_path,"w"); if (file) fclose(file); diff --git a/source/ubinstall-gtk-users.c b/source/ubinstall-gtk-users.c index 14d4d3a..9695f84 100644 --- a/source/ubinstall-gtk-users.c +++ b/source/ubinstall-gtk-users.c @@ -9,26 +9,25 @@ int yon_users_save(main_window *widgets){ yon_config_register(user_gecos_parameter,user_gecos_parameter_command,username); } - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck))){ + if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->UserLoginEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck))){ yon_config_remove_by_key(user_name_parameter); } else { if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck))){ yon_config_register(user_name_parameter,user_name_parameter_command,"root"); } else { - char *login = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)); + char *login = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserLoginEntry)); if (login){}; yon_config_register(user_name_parameter,user_name_parameter_command,login); } } - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->PasswordSensitiveCheck))){ - if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->PasswordCombo))==1){ - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->PasswordEntry)))){ + if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->UserPasswordCombo))==1){ + if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->UserPasswordEntry)))){ yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(widgets->PasswordEntry); + yon_ubl_status_highlight_incorrect(widgets->UserPasswordEntry); return 0; } else { - char *password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->PasswordEntry)); + char *password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserPasswordEntry)); if (password){}; yon_config_register(user_password_parameter,user_password_parameter_command,password); @@ -37,12 +36,7 @@ int yon_users_save(main_window *widgets){ } else { yon_config_remove_by_key(user_password_parameter); } - }else { - yon_config_remove_by_key(user_password_parameter); - } - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->RootPasswordSensitiveCheck))){ if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo))==1){ if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->AdminPasswordEntry)))){ yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); @@ -57,9 +51,6 @@ int yon_users_save(main_window *widgets){ } else { yon_config_remove_by_key(root_password_parameter); } - } else { - yon_config_remove_by_key(root_password_parameter); - } if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck))){ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ @@ -80,7 +71,7 @@ int yon_users_save(main_window *widgets){ } if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutologinSensitiveCheck))){ - char *autologin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck))?"yes":"no"; + char *autologin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UserAutologinSwitch))?"yes":"no"; yon_config_register(autologin_parameter,autologin_parameter_command,autologin); } else { yon_config_remove_by_key(autologin_parameter); diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index dd35e3a..da34acb 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -6,29 +6,6 @@ int cur_slide=0; // //functions -// void on_layout_toggle_button_switch(GtkWidget *self, main_window *widgets){ -// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self))){ -// gtk_widget_set_sensitive(widgets->DefaultLayoutRadio,1); -// gtk_widget_set_sensitive(widgets->ManualLayoutRadio,1); -// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio))){ -// gtk_widget_set_sensitive(widgets->LayoutTree,1); -// gtk_widget_set_sensitive(widgets->AddButton,1); -// gtk_widget_set_sensitive(widgets->RemoveButton,1); -// } else { -// gtk_widget_set_sensitive(widgets->LayoutTree,0); -// gtk_widget_set_sensitive(widgets->AddButton,0); -// gtk_widget_set_sensitive(widgets->RemoveButton,0); -// } -// } else { -// gtk_widget_set_sensitive(widgets->DefaultLayoutRadio,0); -// gtk_widget_set_sensitive(widgets->ManualLayoutRadio,0); -// gtk_widget_set_sensitive(widgets->LayoutTree,0); -// gtk_widget_set_sensitive(widgets->AddButton,0); -// gtk_widget_set_sensitive(widgets->RemoveButton,0); -// -// } -// } - void on_toggle_button_switch_on(GtkWidget *, GtkToggleButton *toggle){ gtk_toggle_button_set_active(toggle,1); } @@ -281,170 +258,180 @@ main_window *yon_main_window_complete(){ gtk_builder_add_callback_symbol(builder,"on_toggle_button_switch_on",G_CALLBACK(on_toggle_button_switch_on)); // Custom widgets configuration widgets->builder = builder; + gtk_builder_set_translation_domain(builder,template_ui_LocaleName); + { widgets->DevicesList=GTK_LIST_STORE(gtk_builder_get_object(builder,"DevicesList")); widgets->LanguagesList=GTK_LIST_STORE(gtk_builder_get_object(builder,"LanguagesList")); + + widgets->PartitionsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"PartitionsList")); + widgets->MainWindow=yon_gtk_builder_get_widget(builder,"MainWindow"); + widgets->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + widgets->Notebook = yon_gtk_builder_get_widget(builder,"Notebook"); + + widgets->DocumentationMenuItem = yon_ubl_menu_item_documentation_new(DOCUMENTATION_LABEL); + widgets->AboutMenuItem = yon_ubl_menu_item_about_new(ABOUT_LABEL); + + widgets->SaveButton = yon_gtk_builder_get_widget(builder,"SaveButton"); + + widgets->LoadGlobalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"LoadGlobalConfigurationMenuItem"); + widgets->LoadLocalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"LoadLocalConfigurationMenuItem"); + widgets->LoadExternalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"LoadExternalConfigurationMenuItem"); + + widgets->SaveGlobalLocalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"SaveGlobalLocalConfigurationMenuItem"); + widgets->SaveGlobalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"SaveGlobalConfigurationMenuItem"); + widgets->SaveLocalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"SaveLocalConfigurationMenuItem"); + widgets->SaveExternalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"SaveExternalConfigurationMenuItem"); + + widgets->SlidesImage = yon_gtk_builder_get_widget(builder,"SlidesImage"); + + widgets->LicenceLabel = yon_gtk_builder_get_widget(builder,"LicenceLabel"); + + widgets->menu1=yon_gtk_builder_get_widget(builder,"menu1"); + widgets->menu2=yon_gtk_builder_get_widget(builder,"menu2"); + widgets->ConfigurationModeMenuItem = yon_gtk_builder_get_widget(builder,"ConfigurationModeMenuItem"); + + widgets->CancelInstallButton=yon_gtk_builder_get_widget(builder,"CancelInstallButton"); + widgets->BackButton=yon_gtk_builder_get_widget(builder,"BackButton"); + widgets->NextButton=yon_gtk_builder_get_widget(builder,"NextButton"); + widgets->WelcomeToggle=yon_gtk_builder_get_widget(builder,"WelcomeToggle"); widgets->LicenceToggle=yon_gtk_builder_get_widget(builder,"LicenceToggle"); - widgets->StartScenarioButton=yon_gtk_builder_get_widget(builder,"StartScenarioButton"); - widgets->SourceButton=yon_gtk_builder_get_widget(builder,"SourceButton"); - widgets->SkipInstallationButton=yon_gtk_builder_get_widget(builder,"SkipInstallationButton"); widgets->LocationToggle=yon_gtk_builder_get_widget(builder,"LocationToggle"); widgets->KeyboardToggle=yon_gtk_builder_get_widget(builder,"KeyboardToggle"); widgets->SectionsToggle=yon_gtk_builder_get_widget(builder,"SectionsToggle"); - widgets->UsersToggle=yon_gtk_builder_get_widget(builder,"USersToggle"); + widgets->UsersToggle=yon_gtk_builder_get_widget(builder,"UsersToggle"); widgets->SummaryToggle=yon_gtk_builder_get_widget(builder,"SummaryToggle"); widgets->CompletionToggle=yon_gtk_builder_get_widget(builder,"CompletionToggle"); widgets->InstallationToggle=yon_gtk_builder_get_widget(builder,"InstallationToggle"); - widgets->LanguageCombo=yon_gtk_builder_get_widget(builder,"LanguageCombo"); - widgets->RegionCombo=yon_gtk_builder_get_widget(builder,"RegionCombo"); - widgets->ZoneCombo=yon_gtk_builder_get_widget(builder,"ZoneCombo"); - widgets->AvailableLanguagesEntry=yon_gtk_builder_get_widget(builder,"AvailableLanguagesEntry"); - widgets->AvailableLanguagesButton=yon_gtk_builder_get_widget(builder,"AvailableLanguagesButton"); - widgets->LanguagesCombo=yon_gtk_builder_get_widget(builder,"LanguagesCombo"); - widgets->KeyboardModelCombo=yon_gtk_builder_get_widget(builder,"KeyboardModelCombo"); - widgets->LayoutBindingCombo=yon_gtk_builder_get_widget(builder,"LayoutBindingCombo"); - widgets->DefaultLayoutRadio=yon_gtk_builder_get_widget(builder,"DefaultLayoutRadio"); - widgets->ManualLayoutRadio=yon_gtk_builder_get_widget(builder,"ManualLayoutRadio"); - widgets->LayoutTree=yon_gtk_builder_get_widget(builder,"LayoutTree"); - widgets->AddButton=yon_gtk_builder_get_widget(builder,"AddButton"); - widgets->RemoveButton=yon_gtk_builder_get_widget(builder,"RemoveButton"); + + widgets->StartScenarioButton=yon_gtk_builder_get_widget(builder,"StartScenarioButton"); + + widgets->SourceButton=yon_gtk_builder_get_widget(builder,"SourceButton"); + widgets->SkipInstallationButton=yon_gtk_builder_get_widget(builder,"SkipInstallationButton"); + widgets->InstallationRadio=yon_gtk_builder_get_widget(builder,"InstallationRadio"); widgets->InstallationNearRadio=yon_gtk_builder_get_widget(builder,"InstallationNearRadio"); widgets->InstallationLinuxRadio=yon_gtk_builder_get_widget(builder,"InstallationLinuxRadio"); widgets->InstallationWindowsRadio=yon_gtk_builder_get_widget(builder,"InstallationWindowsRadio"); widgets->InstallationOptionsRadio=yon_gtk_builder_get_widget(builder,"InstallationOptionsRadio"); - widgets->UserNameEntry=yon_gtk_builder_get_widget(builder,"UserNameEntry"); - widgets->LoginEntry=yon_gtk_builder_get_widget(builder,"LoginEntry"); - widgets->PasswordCombo=yon_gtk_builder_get_widget(builder,"PasswordCombo"); - widgets->PasswordEntry=yon_gtk_builder_get_widget(builder,"PasswordEntry"); - widgets->PasswordButton=yon_gtk_builder_get_widget(builder,"PasswordButton"); - widgets->AutologinCheck=yon_gtk_builder_get_widget(builder,"AutologinCheck"); - widgets->AdminPasswordCombo=yon_gtk_builder_get_widget(builder,"AdminPasswordCombo"); - widgets->AdminPasswordEntry=yon_gtk_builder_get_widget(builder,"AdminPasswordEntry"); - widgets->AdminPasswordButton=yon_gtk_builder_get_widget(builder,"AdminPasswordButton"); - widgets->HotnameEntry=yon_gtk_builder_get_widget(builder,"HotnameEntry"); - widgets->AutoHostnameCheck=yon_gtk_builder_get_widget(builder,"AutoHostnameCheck"); - widgets->CancelInstallButton=yon_gtk_builder_get_widget(builder,"CancelInstallButton"); - widgets->BackButton=yon_gtk_builder_get_widget(builder,"BackButton"); - widgets->NextButton=yon_gtk_builder_get_widget(builder,"NextButton"); - widgets->mainSettingsButton=yon_gtk_builder_get_widget(builder,"mainSettingsButton"); - widgets->menu1=yon_gtk_builder_get_widget(builder,"menu1"); - widgets->menu2=yon_gtk_builder_get_widget(builder,"menu2"); - widgets->RegionImage = yon_gtk_builder_get_widget(builder,"RegionImage"); - widgets->RegionBox = yon_gtk_builder_get_widget(builder,"RegionBox"); - widgets->RegionAspect = yon_gtk_builder_get_widget(builder,"RegionAspect"); - widgets->KeyboardImage = yon_gtk_builder_get_widget(builder,"KeyboardImage"); - widgets->KeyboardBox = yon_gtk_builder_get_widget(builder,"KeyboardBox"); - widgets->Notebook = yon_gtk_builder_get_widget(builder,"Notebook"); - widgets->LicenceLabel = yon_gtk_builder_get_widget(builder,"LicenceLabel"); - widgets->SlidesImage = yon_gtk_builder_get_widget(builder,"SlidesImage"); + widgets->GrubInstallRadio = yon_gtk_builder_get_widget(builder,"GrubInstallRadio"); + widgets->GrubUpdateRadio = yon_gtk_builder_get_widget(builder,"GrubUpdateRadio"); + widgets->SeparateRadio = yon_gtk_builder_get_widget(builder,"SeparateRadio"); + widgets->OSRadio = yon_gtk_builder_get_widget(builder,"OSRadio"); + widgets->UserDataOnlyRadio = yon_gtk_builder_get_widget(builder,"UserDataOnlyRadio"); + widgets->CommonInstallationDevicesTree = yon_gtk_builder_get_widget(builder,"CommonInstallationDevicesTree"); - widgets->AdditionalSoftwareTree = yon_gtk_builder_get_widget(builder,"AdditionalSoftwareTree"); + widgets->CommonInstallationFilesystemTypeCombo = yon_gtk_builder_get_widget(builder,"CommonInstallationFilesystemTypeCombo"); + widgets->CommonInstallationSectionNameEntry = yon_gtk_builder_get_widget(builder,"CommonInstallationSectionNameEntry"); + widgets->GpartedCommonButton = yon_gtk_builder_get_widget(builder,"GpartedCommonButton"); widgets->SamePlaceDeviceTree = yon_gtk_builder_get_widget(builder,"SamePlaceDeviceTree"); widgets->SamePlacePartTree = yon_gtk_builder_get_widget(builder,"SamePlacePartTree"); - - widgets->InstallationNearSysDevicesTree = yon_gtk_builder_get_widget(builder,"InstallationNearSysDevicesTree"); - widgets->InstallationNearSysSectionTree = yon_gtk_builder_get_widget(builder,"InstallationNearSysSectionTree"); - widgets->InstallationNearSizeSpin = yon_gtk_builder_get_widget(builder,"InstallationNearSizeSpin"); - widgets->InstallationNearSizeTypeSpin = yon_gtk_builder_get_widget(builder,"InstallationNearSizeTypeSpin"); - - widgets->InstallationProgress = yon_gtk_builder_get_widget(builder,"InstallationProgress"); - widgets->InstallationLabel = yon_gtk_builder_get_widget(builder,"InstallationLabel"); - widgets->ReadShortLogButton = yon_gtk_builder_get_widget(builder,"ReadShortLogButton"); - widgets->PackageInstallationProgress = yon_gtk_builder_get_widget(builder,"PackageInstallationProgress"); - widgets->PackageInstallationLabel = yon_gtk_builder_get_widget(builder,"PackageInstallationLabel"); - widgets->ReadFullLogButton = yon_gtk_builder_get_widget(builder,"ReadFullLogButton"); - + widgets->SameInstallationFormatSwitch = yon_gtk_builder_get_widget(builder,"SameInstallationFormatSwitch"); + widgets->SameInstallationFormatRevealer = yon_gtk_builder_get_widget(builder,"SameInstallationFormatRevealer"); widgets->SameInstallationFilesystemTypeCombo = yon_gtk_builder_get_widget(builder,"SameInstallationFilesystemTypeCombo"); - widgets->SameInstallationFormatCheck = yon_gtk_builder_get_widget(builder,"SameInstallationFormatCheck"); widgets->SameInstallationSectionNameEntry = yon_gtk_builder_get_widget(builder,"SameInstallationSectionNameEntry"); - widgets->NextInstallationFilesystemTypeCombo = yon_gtk_builder_get_widget(builder,"NextInstallationFilesystemTypeCombo"); - widgets->NextInstallationFormatCheck = yon_gtk_builder_get_widget(builder,"NextInstallationFormatCheck"); - widgets->NextInstallationSectionNameEntry = yon_gtk_builder_get_widget(builder,"NextInstallationSectionNameEntry"); - widgets->CommonInstallationFilesystemTypeCombo = yon_gtk_builder_get_widget(builder,"CommonInstallationFilesystemTypeCombo"); - widgets->CommonInstallationSectionNameEntry = yon_gtk_builder_get_widget(builder,"CommonInstallationSectionNameEntry"); - - widgets->GpartedCommonButton = yon_gtk_builder_get_widget(builder,"GpartedCommonButton"); - widgets->GpartedNearButton = yon_gtk_builder_get_widget(builder,"GpartedNearButton"); widgets->GpartedSameButton = yon_gtk_builder_get_widget(builder,"GpartedSameButton"); - widgets->ConfigurationModeMenuItem = yon_gtk_builder_get_widget(builder,"ConfigurationModeMenuItem"); - widgets->DocumentationMenuItem = yon_ubl_menu_item_documentation_new(DOCUMENTATION_LABEL); - widgets->AboutMenuItem = yon_ubl_menu_item_about_new(ABOUT_LABEL); - - widgets->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); - widgets->AdditionalSoftwareCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"AdditionalSoftwareCell")); - - widgets->GrubInstallRadio = yon_gtk_builder_get_widget(builder,"GrubInstallRadio"); - widgets->GrubUpdateRadio = yon_gtk_builder_get_widget(builder,"GrubUpdateRadio"); - widgets->SeparateRadio = yon_gtk_builder_get_widget(builder,"SeparateRadio"); - widgets->OSRadio = yon_gtk_builder_get_widget(builder,"OSRadio"); - widgets->UserDataOnlyRadio = yon_gtk_builder_get_widget(builder,"UserDataOnlyRadio"); + widgets->NextInstallationFilesystemTypeCombo = yon_gtk_builder_get_widget(builder,"NextInstallationFilesystemTypeCombo"); + widgets->NextInstallationFormatSwitch = yon_gtk_builder_get_widget(builder,"NextInstallationFormatSwitch"); + widgets->NextInstallationFormatRevealer = yon_gtk_builder_get_widget(builder,"NextInstallationFormatRevealer"); + widgets->NextInstallationSectionNameEntry = yon_gtk_builder_get_widget(builder,"NextInstallationSectionNameEntry"); + widgets->NextInstallationSizeSpin = yon_gtk_builder_get_widget(builder,"NextInstallationFormatSizeSpin"); + widgets->NextInstallationSizeTypeSpin = yon_gtk_builder_get_widget(builder,"NextInstallationFormatSizeCombo"); + widgets->NextInstallationSysDevicesTree = yon_gtk_builder_get_widget(builder,"NextInstallationSysDevicesTree"); + widgets->NextInstallationSysSectionTree = yon_gtk_builder_get_widget(builder,"NextInstallationSysSectionTree"); + widgets->GpartedNextInstallationButton = yon_gtk_builder_get_widget(builder,"GpartedNextInstallationButton"); + + widgets->AdvancedDeviceTree = yon_gtk_builder_get_widget(builder,"AdvancedDeviceTree"); + widgets->AdvancedVirtualDeviceCombo = yon_gtk_builder_get_widget(builder,"AdvancedVirtualDeviceCombo"); + widgets->AdvancedPartitionTree = yon_gtk_builder_get_widget(builder,"AdvancedPartitionTree"); + widgets->AdvancedPartitionAddBox = yon_gtk_builder_get_widget(builder,"AdvancedPartitionAddBox"); + widgets->AdvancedAddButton = yon_gtk_builder_get_widget(builder,"AdvancedAddButton"); + widgets->AdvancedLoadTypeSwitch = yon_gtk_builder_get_widget(builder,"AdvancedLoadTypeSwitch"); + widgets->AdvancedBiosSectorSwitch = yon_gtk_builder_get_widget(builder,"AdvancedBiosSectorSwitch"); + widgets->AdvancedEFISwitch = yon_gtk_builder_get_widget(builder,"AdvancedEFISwitch"); + widgets->AdvancedSwapSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapSwitch"); + widgets->AdvancedSwapAutoSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapAutoSwitch"); + widgets->AdvancedSwapRamSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapRamSwitch"); + widgets->AdvancedSwapFixedSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapFixedSwitch"); + widgets->AdvancedSwapFixedSpin = yon_gtk_builder_get_widget(builder,"AdvancedSwapFixedSpin"); - widgets->GpartedGrubInstallButton = yon_gtk_builder_get_widget(builder,"GpartedGrubInstallButton"); widgets->GrubInstallDevicesTree = yon_gtk_builder_get_widget(builder,"GrubInstallDevicesTree"); widgets->GrubInstallPartitionTree = yon_gtk_builder_get_widget(builder,"GrubInstallPartitionTree"); + widgets->GpartedGrubInstallButton = yon_gtk_builder_get_widget(builder,"GpartedGrubInstallButton"); - widgets->GpartedGrubUpdateButton = yon_gtk_builder_get_widget(builder,"GpartedGrubUpdateButton"); widgets->GrubUpdateDevicesTree = yon_gtk_builder_get_widget(builder,"GrubUpdateDevicesTree"); widgets->GrubUpdatePartitionTree = yon_gtk_builder_get_widget(builder,"GrubUpdatePartitionTree"); + widgets->GpartedGrubUpdateButton = yon_gtk_builder_get_widget(builder,"GpartedGrubUpdateButton"); - widgets->GpartedSeparateButton = yon_gtk_builder_get_widget(builder,"GpartedSeparateButton"); - widgets->SeparateDevicesTree = yon_gtk_builder_get_widget(builder,"SeparateDevicesTree"); - widgets->SeparateSysSectionTree = yon_gtk_builder_get_widget(builder,"SeparateSysSectionTree"); - widgets->GpartedSeparateUserButton = yon_gtk_builder_get_widget(builder,"GpartedSeparateUserButton"); - widgets->SeparateUserDevicesTree = yon_gtk_builder_get_widget(builder,"SeparateUserDevicesTree"); - widgets->SeparateUserSysSectionTree = yon_gtk_builder_get_widget(builder,"SeparateUserSysSectionTree"); - - widgets->GpartedOSButton = yon_gtk_builder_get_widget(builder,"GpartedOSButton"); widgets->OSDevicesTree = yon_gtk_builder_get_widget(builder,"OSDevicesTree"); widgets->OSSysSectionTree = yon_gtk_builder_get_widget(builder,"OSSysSectionTree"); + widgets->GpartedOSButton = yon_gtk_builder_get_widget(builder,"GpartedOSButton"); - widgets->GpartedUserdataButton = yon_gtk_builder_get_widget(builder,"GpartedUserdataButton"); widgets->UserdataDevicesTree = yon_gtk_builder_get_widget(builder,"UserdataDevicesTree"); widgets->UserdataSysSectionTree = yon_gtk_builder_get_widget(builder,"UserdataSysSectionTree"); + widgets->GpartedUserdataButton = yon_gtk_builder_get_widget(builder,"UserdataGpartedButton"); - widgets->SaveButton = yon_gtk_builder_get_widget(builder,"SaveButton"); - - widgets->LoadGlobalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"LoadGlobalConfigurationMenuItem"); - widgets->LoadLocalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"LoadLocalConfigurationMenuItem"); - widgets->LoadExternalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"LoadExternalConfigurationMenuItem"); - - widgets->SaveGlobalLocalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"SaveGlobalLocalConfigurationMenuItem"); - widgets->SaveGlobalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"SaveGlobalConfigurationMenuItem"); - widgets->SaveLocalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"SaveLocalConfigurationMenuItem"); - widgets->SaveExternalConfigurationMenuItem = yon_gtk_builder_get_widget(builder,"SaveExternalConfigurationMenuItem"); - - widgets->LanguagesList = GTK_LIST_STORE(gtk_builder_get_object(builder,"LanguagesList")); widgets->LanguagesFilter = GTK_TREE_MODEL(gtk_builder_get_object(builder,"LanguagesFilter")); widgets->LayoutsFilter = GTK_TREE_MODEL(gtk_builder_get_object(builder,"LayoutsFilter")); widgets->LayoutList = GTK_TREE_STORE(gtk_builder_get_object(builder,"LayoutList")); - widgets->AdditionalSoftwareList = GTK_LIST_STORE(gtk_builder_get_object(builder,"AdditionalSoftwareList")); - widgets->PartitionsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"PartitionsList")); - + widgets->LanguageCombo=yon_gtk_builder_get_widget(builder,"LanguageCombo"); + widgets->RegionCombo=yon_gtk_builder_get_widget(builder,"RegionCombo"); + widgets->ZoneCombo=yon_gtk_builder_get_widget(builder,"ZoneCombo"); + widgets->AvailableLanguagesEntry=yon_gtk_builder_get_widget(builder,"AvailableLanguagesEntry"); + widgets->AvailableLanguagesButton=yon_gtk_builder_get_widget(builder,"AvailableLanguagesButton"); + widgets->LanguagesCombo=yon_gtk_builder_get_widget(builder,"LanguagesCombo"); + widgets->KeyboardModelCombo=yon_gtk_builder_get_widget(builder,"KeyboardModelCombo"); + widgets->LayoutBindingCombo=yon_gtk_builder_get_widget(builder,"LayoutBindingCombo"); + widgets->DefaultLayoutRadio=yon_gtk_builder_get_widget(builder,"DefaultLayoutRadio"); + widgets->ManualLayoutRadio=yon_gtk_builder_get_widget(builder,"ManualLayoutRadio"); + widgets->LayoutTree=yon_gtk_builder_get_widget(builder,"LayoutTree"); + widgets->AddButton=yon_gtk_builder_get_widget(builder,"AddButton"); + widgets->RemoveButton=yon_gtk_builder_get_widget(builder,"RemoveButton"); widgets->RegionSensitiveCheck = yon_gtk_builder_get_widget(builder,"RegionSensitiveCheck"); widgets->LanguagesSensitiveCheck = yon_gtk_builder_get_widget(builder,"LanguagesSensitiveCheck"); widgets->MainLanguageSensitiveCheck = yon_gtk_builder_get_widget(builder,"MainLanguageSensitiveCheck"); widgets->KeyboardModelSensitiveCheck = yon_gtk_builder_get_widget(builder,"KeyboardModelSensitiveCheck"); widgets->OptionsSensitiveCheck = yon_gtk_builder_get_widget(builder,"OptionsSensitiveCheck"); widgets->LayoutSensitiveCheck = yon_gtk_builder_get_widget(builder,"LayoutSensitiveCheck"); + + widgets->UserNameEntry=yon_gtk_builder_get_widget(builder,"UserNameEntry"); + widgets->UserLoginEntry=yon_gtk_builder_get_widget(builder,"UserLoginEntry"); + widgets->UserPasswordCombo=yon_gtk_builder_get_widget(builder,"UserPasswordCombo"); + widgets->UserPasswordEntry=yon_gtk_builder_get_widget(builder,"UserPasswordEntry"); + widgets->UserPasswordButton=yon_gtk_builder_get_widget(builder,"UserPasswordButton"); + widgets->UserAutologinSwitch=yon_gtk_builder_get_widget(builder,"UserAutologinSwitch"); + widgets->AdminPasswordCombo=yon_gtk_builder_get_widget(builder,"AdminPasswordCombo"); + widgets->AdminPasswordEntry=yon_gtk_builder_get_widget(builder,"AdminPasswordEntry"); + widgets->AdminPasswordButton=yon_gtk_builder_get_widget(builder,"AdminPasswordButton"); widgets->UsernameSensitiveCheck = yon_gtk_builder_get_widget(builder,"UsernameSensitiveCheck"); widgets->LoginSensitiveCheck = yon_gtk_builder_get_widget(builder,"LoginSensitiveCheck"); widgets->UserRootOnlyCheck = yon_gtk_builder_get_widget(builder,"UserRootOnlyCheck"); - widgets->PasswordSensitiveCheck = yon_gtk_builder_get_widget(builder,"PasswordSensitiveCheck"); widgets->AutologinSensitiveCheck = yon_gtk_builder_get_widget(builder,"AutologinSensitiveCheck"); - widgets->RootPasswordSensitiveCheck = yon_gtk_builder_get_widget(builder,"RootPasswordSensitiveCheck"); - widgets->HostnameSensitiveCheck = yon_gtk_builder_get_widget(builder,"HostnameSensitiveCheck"); - widgets->CommonFilesystemSensitiveCheck = yon_gtk_builder_get_widget(builder,"CommonFilesystemSensitiveCheck"); - widgets->CommonSectionSensitiveCheck = yon_gtk_builder_get_widget(builder,"CommonSectionSensitiveCheck"); - widgets->NextSizeSensitiveCheck = yon_gtk_builder_get_widget(builder,"NextSizeSensitiveCheck"); - widgets->NextFSTypeSensitiveCheck = yon_gtk_builder_get_widget(builder,"NextFSTypeSensitiveCheck"); - widgets->NextLabelSensitiveCheck = yon_gtk_builder_get_widget(builder,"NextLabelSensitiveCheck"); - widgets->SameFSTypeSensitiveCheck = yon_gtk_builder_get_widget(builder,"SameFSTypeSensitiveCheck"); - widgets->SameLabelSensitiveCheck = yon_gtk_builder_get_widget(builder,"SameLabelSensitiveCheck"); + + widgets->HotnameEntry=yon_gtk_builder_get_widget(builder,"HotnameEntry"); + widgets->mainSettingsButton=yon_gtk_builder_get_widget(builder,"mainSettingsButton"); + widgets->RegionImage = yon_gtk_builder_get_widget(builder,"RegionImage"); + widgets->RegionBox = yon_gtk_builder_get_widget(builder,"RegionBox"); + widgets->RegionAspect = yon_gtk_builder_get_widget(builder,"RegionAspect"); + widgets->KeyboardImage = yon_gtk_builder_get_widget(builder,"KeyboardImage"); + widgets->KeyboardBox = yon_gtk_builder_get_widget(builder,"KeyboardBox"); + + widgets->AdditionalSoftwareList = GTK_LIST_STORE(gtk_builder_get_object(builder,"AdditionalSoftwareList")); + widgets->AdditionalSoftwareTree = yon_gtk_builder_get_widget(builder,"AdditionalSoftwareTree"); + widgets->AdditionalSoftwareCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"AdditionalSoftwareCell")); + + + widgets->InstallationProgress = yon_gtk_builder_get_widget(builder,"InstallationProgress"); + widgets->InstallationLabel = yon_gtk_builder_get_widget(builder,"InstallationLabel"); + widgets->ReadShortLogButton = yon_gtk_builder_get_widget(builder,"ReadShortLogButton"); + widgets->PackageInstallationProgress = yon_gtk_builder_get_widget(builder,"PackageInstallationProgress"); + widgets->PackageInstallationLabel = yon_gtk_builder_get_widget(builder,"PackageInstallationLabel"); + widgets->ReadFullLogButton = yon_gtk_builder_get_widget(builder,"ReadFullLogButton"); + widgets->KernelsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"KernelsList")); widgets->KernelsTree = yon_gtk_builder_get_widget(builder,"KernelsTree"); @@ -474,22 +461,10 @@ main_window *yon_main_window_complete(){ widgets->NetworkNTPEntry = yon_gtk_builder_get_widget(builder,"NetworkNTPEntry"); widgets->NetworkConnectionsBox = yon_gtk_builder_get_widget(builder,"NetworkConnectionsBox"); widgets->NetworkConnectionsAddButton = yon_gtk_builder_get_widget(builder,"NetworkConnectionsAddButton"); + widgets->HostnameSensitiveCheck = yon_gtk_builder_get_widget(builder,"HostnameSensitiveCheck"); + widgets->AutoHostnameCheck=yon_gtk_builder_get_widget(builder,"AutoHostnameCheck"); widgets->network_connections = NULL; - - widgets->AdvancedDeviceTree = yon_gtk_builder_get_widget(builder,"AdvancedDeviceTree"); - widgets->AdvancedVirtualDeviceCombo = yon_gtk_builder_get_widget(builder,"AdvancedVirtualDeviceCombo"); - widgets->AdvancedPartitionTree = yon_gtk_builder_get_widget(builder,"AdvancedPartitionTree"); - widgets->AdvancedPartitionAddBox = yon_gtk_builder_get_widget(builder,"AdvancedPartitionAddBox"); - widgets->AdvancedAddButton = yon_gtk_builder_get_widget(builder,"AdvancedAddButton"); - widgets->AdvancedLoadTypeSwitch = yon_gtk_builder_get_widget(builder,"AdvancedLoadTypeSwitch"); - widgets->AdvancedBiosSectorSwitch = yon_gtk_builder_get_widget(builder,"AdvancedBiosSectorSwitch"); - widgets->AdvancedEFISwitch = yon_gtk_builder_get_widget(builder,"AdvancedEFISwitch"); - widgets->AdvancedSwapSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapSwitch"); - widgets->AdvancedSwapAutoSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapAutoSwitch"); - widgets->AdvancedSwapRamSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapRamSwitch"); - widgets->AdvancedSwapFixedSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapFixedSwitch"); - widgets->AdvancedSwapFixedSpin = yon_gtk_builder_get_widget(builder,"AdvancedSwapFixedSpin"); - + } g_signal_connect(G_OBJECT(widgets->MainWindow),"delete-event",G_CALLBACK(on_yon_exit),widgets); GtkWidget *menu = yon_gtk_builder_get_widget(builder,"menu2"); gtk_style_context_add_class(gtk_widget_get_style_context(widgets->DocumentationMenuItem),"menuitemmiddle"); @@ -511,34 +486,33 @@ main_window *yon_main_window_complete(){ g_signal_connect(G_OBJECT(widgets->GpartedCommonButton),"clicked",G_CALLBACK(on_gparted_open),NULL); g_signal_connect(G_OBJECT(widgets->GpartedSameButton),"clicked",G_CALLBACK(on_gparted_open),NULL); - g_signal_connect(G_OBJECT(widgets->GpartedNearButton),"clicked",G_CALLBACK(on_gparted_open),NULL); + g_signal_connect(G_OBJECT(widgets->GpartedNextInstallationButton),"clicked",G_CALLBACK(on_gparted_open),NULL); // g_signal_connect(G_OBJECT(widgets->Notebook),"switch-page",G_CALLBACK(on_page_changed),widgets); // g_signal_connect(G_OBJECT(widgets->MainWindow),"check-resize",G_CALLBACK(on_region_resized),widgets); g_signal_connect(G_OBJECT(widgets->NextButton),"clicked",G_CALLBACK(on_page_next_clicked),widgets); g_signal_connect(G_OBJECT(widgets->BackButton),"clicked",G_CALLBACK(on_page_prev_clicked),widgets); // g_signal_connect(G_OBJECT(widgets->CancelInstallButton),"clicked",G_CALLBACK(on_page_navigation_clicked),widgets); - // g_signal_connect(G_OBJECT(widgets->AvailableLanguagesButton),"clicked",G_CALLBACK(on_language_clicked),widgets); + g_signal_connect(G_OBJECT(widgets->AvailableLanguagesButton),"clicked",G_CALLBACK(on_language_clicked),widgets); g_signal_connect(G_OBJECT(widgets->RegionCombo),"changed",G_CALLBACK(on_region_changed),widgets); - // g_signal_connect(G_OBJECT(widgets->LayoutSensitiveCheck),"toggled",G_CALLBACK(on_layout_toggle_button_switch),widgets); + g_signal_connect(G_OBJECT(widgets->LayoutSensitiveCheck),"toggled",G_CALLBACK(on_layout_toggle_button_switch),widgets); // g_signal_connect(G_OBJECT(widgets->AddButton),"clicked",G_CALLBACK(on_keyboard_clicked),widgets); // g_signal_connect(G_OBJECT(widgets->RemoveButton),"clicked",G_CALLBACK(on_keyboard_removed),widgets); g_signal_connect(G_OBJECT(widgets->GrubInstallDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->GrubUpdateDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); - g_signal_connect(G_OBJECT(widgets->InstallationNearSysDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); + g_signal_connect(G_OBJECT(widgets->NextInstallationSysDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->SamePlaceDeviceTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->UserdataDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->OSDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); - g_signal_connect(G_OBJECT(widgets->SeparateDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->ConfigurationModeMenuItem),"toggled",G_CALLBACK(on_configuration_mode_switch),widgets); // g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),widgets); // g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),widgets); g_signal_connect(G_OBJECT(widgets->SamePlacePartTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); - g_signal_connect(G_OBJECT(widgets->InstallationNearSysSectionTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); - g_signal_connect(G_OBJECT(widgets->InstallationNearSizeTypeSpin),"changed",G_CALLBACK(on_partition_changed),widgets); + g_signal_connect(G_OBJECT(widgets->NextInstallationSysSectionTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); + g_signal_connect(G_OBJECT(widgets->NextInstallationSizeTypeSpin),"changed",G_CALLBACK(on_partition_changed),widgets); // gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),3); // g_signal_connect(G_OBJECT(widgets->LanguageCombo),"changed",G_CALLBACK(on_locale_changed),widgets); @@ -548,18 +522,15 @@ main_window *yon_main_window_complete(){ g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),widgets->HotnameEntry); - g_signal_connect(G_OBJECT(widgets->NextInstallationFormatCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->NextInstallationFilesystemTypeCombo); - g_signal_connect(G_OBJECT(widgets->SameInstallationFormatCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->SameInstallationFilesystemTypeCombo); + yon_gtk_revealer_set_from_switch(GTK_REVEALER(widgets->NextInstallationFormatRevealer),GTK_SWITCH(widgets->NextInstallationFormatSwitch)); + yon_gtk_revealer_set_from_switch(GTK_REVEALER(widgets->SameInstallationFormatRevealer),GTK_SWITCH(widgets->SameInstallationFormatSwitch)); + // g_signal_connect(G_OBJECT(widgets->HostnameSensitiveCheck),"toggled",G_CALLBACK(on_autohostname_sensitiveness_check),widgets); // g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(on_autohostname_check),widgets); // g_signal_connect(G_OBJECT(widgets->HotnameEntry),"changed",G_CALLBACK(on_hostname_entry_changed),widgets); - // g_signal_connect(G_OBJECT(widgets->PasswordCombo),"changed",G_CALLBACK(yon_password_combo_set_sensitive),widgets); - // g_signal_connect(G_OBJECT(widgets->AdminPasswordCombo),"changed",G_CALLBACK(yon_password_combo_set_sensitive),widgets); - // g_signal_connect(G_OBJECT(widgets->RootPasswordSensitiveCheck),"toggled",G_CALLBACK(yon_password_set_sensitive_from_toggle),widgets); - // g_signal_connect(G_OBJECT(widgets->PasswordSensitiveCheck),"toggled",G_CALLBACK(yon_password_set_sensitive_from_toggle),widgets); { - yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->PasswordEntry)); + yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->UserPasswordEntry)); yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->AdminPasswordEntry)); if (main_config.lock_load_global == 1){ @@ -744,6 +715,7 @@ int main(int argc, char *argv[]){ widgets = yon_main_window_complete(); if (widgets){}; char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL); + yon_window_config_setup(GTK_WINDOW(widgets->MainWindow)); yon_window_config_load(path); main_config.launch_arguments=yon_char_parsed_copy(argv,argc); main_config.launch_size=argc; diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index c781494..3344940 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -120,16 +120,14 @@ NULL #define lang_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[lang]" #define locale_parameter "AUTOINSTALL[locale]" #define locale_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[locale]" -#define device_format_parameter "AUTOINSTALL[device_format]" -#define device_format_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[device_format]" -#define device_label_parameter "AUTOINSTALL[part_label]" -#define device_label_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_label]" #define part_size_parameter "AUTOINSTALL[part_size]" #define part_size_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_size]" #define part_type_parameter "AUTOINSTALL[part_fs_type]" #define part_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]" @@ -171,10 +169,10 @@ NULL #define full_log_path "/var/log/ubinstall.log" -#define yon_config_get_custom_command(target) yon_char_unite("ubconfig --source ",target," --conarg get [autoinstall] AUTOINSTALL[installer_lang] AUTOINSTALL[install_type] AUTOINSTALL[device] AUTOINSTALL[part] AUTOINSTALL[part_size] AUTOINSTALL[part_label] AUTOINSTALL[part_fs_type] AUTOINSTALL[part_format] UTOINSTALL[locale] AUTOINSTALL[lang] AUTOINSTALL[zone] AUTOINSTALL[user_name] AUTOINSTALL[user_gecos] AUTOINSTALL[user_password] AUTOINSTALL[root_password] AUTOINSTALL[autologin] AUTOINSTALL[xkbmodel] AUTOINSTALL[xkblayout] AUTOINSTALL[xkbvariant] AUTOINSTALL[xkboptions] AUTOINSTALL[hostname] AUTOINSTALL[modules] AUTOINSTALL[modules_extra] AUTOINSTALL[device_label] AUTOINSTALL[locale]",NULL) -#define config_get_local_command "ubconfig --source system --conarg get [autoinstall] AUTOINSTALL[installer_lang] AUTOINSTALL[install_type] AUTOINSTALL[device] AUTOINSTALL[part] AUTOINSTALL[part_size] AUTOINSTALL[part_label] AUTOINSTALL[part_fs_type] AUTOINSTALL[part_format] UTOINSTALL[locale] AUTOINSTALL[lang] AUTOINSTALL[zone] AUTOINSTALL[user_name] AUTOINSTALL[user_gecos] AUTOINSTALL[user_password] AUTOINSTALL[root_password] AUTOINSTALL[autologin] AUTOINSTALL[xkbmodel] AUTOINSTALL[xkblayout] AUTOINSTALL[xkbvariant] AUTOINSTALL[xkboptions] AUTOINSTALL[hostname] AUTOINSTALL[modules] AUTOINSTALL[modules_extra] AUTOINSTALL[device_label] AUTOINSTALL[locale]" -#define config_get_global_command yon_char_new("ubconfig --source global --conarg get [autoinstall] AUTOINSTALL[installer_lang] AUTOINSTALL[install_type] AUTOINSTALL[device] AUTOINSTALL[part] AUTOINSTALL[part_size] AUTOINSTALL[part_label] AUTOINSTALL[part_fs_type] AUTOINSTALL[part_format] UTOINSTALL[locale] AUTOINSTALL[lang] AUTOINSTALL[zone] AUTOINSTALL[user_name] AUTOINSTALL[user_gecos] AUTOINSTALL[user_password] AUTOINSTALL[root_password] AUTOINSTALL[autologin] AUTOINSTALL[xkbmodel] AUTOINSTALL[xkblayout] AUTOINSTALL[xkbvariant] AUTOINSTALL[xkboptions] AUTOINSTALL[hostname] AUTOINSTALL[modules] AUTOINSTALL[modules_extra] AUTOINSTALL[device_label] AUTOINSTALL[locale]") -#define config_get_default_command "ubconfig --source default --conarg get [autoinstall] AUTOINSTALL[installer_lang] AUTOINSTALL[install_type] AUTOINSTALL[device] AUTOINSTALL[part] AUTOINSTALL[part_size] AUTOINSTALL[part_label] AUTOINSTALL[part_fs_type] AUTOINSTALL[part_format] UTOINSTALL[locale] AUTOINSTALL[lang] AUTOINSTALL[zone] AUTOINSTALL[user_name] AUTOINSTALL[user_gecos] AUTOINSTALL[user_password] AUTOINSTALL[root_password] AUTOINSTALL[autologin] AUTOINSTALL[xkbmodel] AUTOINSTALL[xkblayout] AUTOINSTALL[xkbvariant] AUTOINSTALL[xkboptions] AUTOINSTALL[hostname] AUTOINSTALL[modules] AUTOINSTALL[modules_extra] AUTOINSTALL[device_label] AUTOINSTALL[locale]" +#define yon_config_get_custom_command(target) yon_char_unite("ubconfig --source ",target," --conarg get [autoinstall] AUTOINSTALL[installer_lang] AUTOINSTALL[install_type] AUTOINSTALL[device] AUTOINSTALL[part] AUTOINSTALL[part_size] AUTOINSTALL[part_label] AUTOINSTALL[part_fs_type] AUTOINSTALL[part_format] UTOINSTALL[locale] AUTOINSTALL[lang] AUTOINSTALL[zone] AUTOINSTALL[user_name] AUTOINSTALL[user_gecos] AUTOINSTALL[user_password] AUTOINSTALL[root_password] AUTOINSTALL[autologin] AUTOINSTALL[xkbmodel] AUTOINSTALL[xkblayout] AUTOINSTALL[xkbvariant] AUTOINSTALL[xkboptions] AUTOINSTALL[hostname] AUTOINSTALL[modules] AUTOINSTALL[modules_extra] AUTOINSTALL[part_label] AUTOINSTALL[locale]",NULL) +#define config_get_local_command "ubconfig --source system --conarg get [autoinstall] AUTOINSTALL[installer_lang] AUTOINSTALL[install_type] AUTOINSTALL[device] AUTOINSTALL[part] AUTOINSTALL[part_size] AUTOINSTALL[part_label] AUTOINSTALL[part_fs_type] AUTOINSTALL[part_format] UTOINSTALL[locale] AUTOINSTALL[lang] AUTOINSTALL[zone] AUTOINSTALL[user_name] AUTOINSTALL[user_gecos] AUTOINSTALL[user_password] AUTOINSTALL[root_password] AUTOINSTALL[autologin] AUTOINSTALL[xkbmodel] AUTOINSTALL[xkblayout] AUTOINSTALL[xkbvariant] AUTOINSTALL[xkboptions] AUTOINSTALL[hostname] AUTOINSTALL[modules] AUTOINSTALL[modules_extra] AUTOINSTALL[part_label] AUTOINSTALL[locale]" +#define config_get_global_command yon_char_new("ubconfig --source global --conarg get [autoinstall] AUTOINSTALL[installer_lang] AUTOINSTALL[install_type] AUTOINSTALL[device] AUTOINSTALL[part] AUTOINSTALL[part_size] AUTOINSTALL[part_label] AUTOINSTALL[part_fs_type] AUTOINSTALL[part_format] UTOINSTALL[locale] AUTOINSTALL[lang] AUTOINSTALL[zone] AUTOINSTALL[user_name] AUTOINSTALL[user_gecos] AUTOINSTALL[user_password] AUTOINSTALL[root_password] AUTOINSTALL[autologin] AUTOINSTALL[xkbmodel] AUTOINSTALL[xkblayout] AUTOINSTALL[xkbvariant] AUTOINSTALL[xkboptions] AUTOINSTALL[hostname] AUTOINSTALL[modules] AUTOINSTALL[modules_extra] AUTOINSTALL[part_label] AUTOINSTALL[locale]") +#define config_get_default_command "ubconfig --source default --conarg get [autoinstall] AUTOINSTALL[installer_lang] AUTOINSTALL[install_type] AUTOINSTALL[device] AUTOINSTALL[part] AUTOINSTALL[part_size] AUTOINSTALL[part_label] AUTOINSTALL[part_fs_type] AUTOINSTALL[part_format] UTOINSTALL[locale] AUTOINSTALL[lang] AUTOINSTALL[zone] AUTOINSTALL[user_name] AUTOINSTALL[user_gecos] AUTOINSTALL[user_password] AUTOINSTALL[root_password] AUTOINSTALL[autologin] AUTOINSTALL[xkbmodel] AUTOINSTALL[xkblayout] AUTOINSTALL[xkbvariant] AUTOINSTALL[xkboptions] AUTOINSTALL[hostname] AUTOINSTALL[modules] AUTOINSTALL[modules_extra] AUTOINSTALL[part_label] AUTOINSTALL[locale]" #define config_get_global_only_parameters "" #define config_get_local_only_parameters "" @@ -183,6 +181,65 @@ NULL #define default_langs(size) yon_char_parsed_new(size,"en_US.UTF-8","ru_RU.UTF-8",NULL); +#define install_common_parameters \ + AUTOINSTALL_TYPE_INSTALL,\ + AUTOINSTALL_DEVICE,\ + part_format_parameter,\ + part_label_parameter,\ + part_type_parameter + +#define install_part_parameters \ + AUTOINSTALL_TYPE_INSTALL,\ + AUTOINSTALL_DEVICE,\ + part_format_parameter,\ + part_fs_label_parameter,\ + part_parameter,\ + part_type_parameter,\ + part_fs_label_parameter + +#define install_next_parameters \ + AUTOINSTALL_TYPE_INSTALL,\ + AUTOINSTALL_DEVICE,\ + part_format_parameter,\ + part_fs_label_parameter,\ + part_parameter,\ + part_type_parameter,\ + part_size_parameter + +#define install_advanced_parameters \ + AUTOINSTALL_TYPE_INSTALL,\ + AUTOINSTALL_DEVICE,\ + part_format_parameter,\ + part_label_parameter,\ + part_parameter,\ + part_type_parameter,\ + part_size_parameter + +#define install_grub_install_update_parameters \ + AUTOINSTALL_TYPE_INSTALL,\ + AUTOINSTALL_DEVICE,\ + part_parameter + +#define install_system_only_parameters \ + AUTOINSTALL_TYPE_INSTALL,\ + AUTOINSTALL_DEVICE,\ + part_format_parameter,\ + part_label_parameter,\ + part_parameter,\ + part_type_parameter,\ + part_size_parameter,\ + part_crypt_parameter + +#define install_userdata_only_parameters \ + AUTOINSTALL_TYPE_INSTALL,\ + AUTOINSTALL_DEVICE,\ + part_format_parameter,\ + part_label_parameter,\ + part_parameter,\ + part_type_parameter,\ + part_size_parameter,\ + part_crypt_parameter + typedef char* string; __attribute__((unused)) static \ string version_application; @@ -307,17 +364,19 @@ typedef struct { GtkWidget *LayoutTree; GtkWidget *AddButton; GtkWidget *RemoveButton; + GtkWidget *InstallationRadio; GtkWidget *InstallationNearRadio; GtkWidget *InstallationLinuxRadio; GtkWidget *InstallationWindowsRadio; GtkWidget *InstallationOptionsRadio; + GtkWidget *UserNameEntry; - GtkWidget *LoginEntry; - GtkWidget *PasswordCombo; - GtkWidget *PasswordEntry; - GtkWidget *PasswordButton; - GtkWidget *AutologinCheck; + GtkWidget *UserLoginEntry; + GtkWidget *UserPasswordCombo; + GtkWidget *UserPasswordEntry; + GtkWidget *UserPasswordButton; + GtkWidget *UserAutologinSwitch; GtkWidget *AdminPasswordCombo; GtkWidget *AdminPasswordEntry; GtkWidget *AdminPasswordButton; @@ -338,22 +397,28 @@ typedef struct { GtkWidget *LicenceLabel; GtkWidget *SlidesImage; - GtkWidget *SameInstallationFilesystemTypeCombo; - GtkWidget *SameInstallationFormatCheck; - GtkWidget *SameInstallationSectionNameEntry; - GtkWidget *NextInstallationFilesystemTypeCombo; - GtkWidget *NextInstallationFormatCheck; - GtkWidget *NextInstallationSectionNameEntry; + GtkWidget *CommonInstallationDevicesTree; GtkWidget *CommonInstallationFilesystemTypeCombo; GtkWidget *CommonInstallationSectionNameEntry; + GtkWidget *GpartedCommonButton; - GtkWidget *InstallationNearSysDevicesTree; - GtkWidget *InstallationNearSysSectionTree; - GtkWidget *InstallationNearSizeSpin; - GtkWidget *InstallationNearSizeTypeSpin; + GtkWidget *NextInstallationSysDevicesTree; + GtkWidget *NextInstallationSysSectionTree; + GtkWidget *NextInstallationFormatSwitch; + GtkWidget *NextInstallationFormatRevealer; + GtkWidget *NextInstallationSizeSpin; + GtkWidget *NextInstallationSizeTypeSpin; + GtkWidget *NextInstallationFilesystemTypeCombo; + GtkWidget *NextInstallationSectionNameEntry; + GtkWidget *GpartedNextInstallationButton; GtkWidget *SamePlaceDeviceTree; GtkWidget *SamePlacePartTree; + GtkWidget *SameInstallationFormatSwitch; + GtkWidget *SameInstallationFormatRevealer; + GtkWidget *SameInstallationFilesystemTypeCombo; + GtkWidget *SameInstallationSectionNameEntry; + GtkWidget *GpartedSameButton; GtkWidget *InstallationProgress; GtkWidget *InstallationLabel; @@ -362,9 +427,6 @@ typedef struct { GtkWidget *PackageInstallationLabel; GtkWidget *ReadFullLogButton; - GtkWidget *GpartedCommonButton; - GtkWidget *GpartedNearButton; - GtkWidget *GpartedSameButton; GtkWidget *ConfigurationModeMenuItem; GtkWidget *AboutMenuItem; @@ -372,7 +434,6 @@ typedef struct { GtkCellRenderer *AdditionalSoftwareCell; - GtkWidget *CommonInstallationDevicesTree; GtkWidget *AdditionalSoftwareTree; GtkWidget *GrubInstallRadio; @@ -389,13 +450,6 @@ typedef struct { GtkWidget *GrubUpdateDevicesTree; GtkWidget *GrubUpdatePartitionTree; - GtkWidget *GpartedSeparateButton; - GtkWidget *SeparateDevicesTree; - GtkWidget *SeparateSysSectionTree; - GtkWidget *GpartedSeparateUserButton; - GtkWidget *SeparateUserDevicesTree; - GtkWidget *SeparateUserSysSectionTree; - GtkWidget *GpartedOSButton; GtkWidget *OSDevicesTree; GtkWidget *OSSysSectionTree; @@ -421,17 +475,8 @@ typedef struct { GtkWidget *UsernameSensitiveCheck; GtkWidget *LoginSensitiveCheck; GtkWidget *UserRootOnlyCheck; - GtkWidget *PasswordSensitiveCheck; GtkWidget *AutologinSensitiveCheck; - GtkWidget *RootPasswordSensitiveCheck; GtkWidget *HostnameSensitiveCheck; - GtkWidget *CommonFilesystemSensitiveCheck; - GtkWidget *CommonSectionSensitiveCheck; - GtkWidget *NextSizeSensitiveCheck; - GtkWidget *NextFSTypeSensitiveCheck; - GtkWidget *NextLabelSensitiveCheck; - GtkWidget *SameFSTypeSensitiveCheck; - GtkWidget *SameLabelSensitiveCheck; GtkWidget *KernelsTree; GtkListStore *KernelsList; @@ -539,7 +584,7 @@ typedef struct{ GtkWidget *StatusBox; GtkWidget *UserCancelButton; GtkWidget *UserOkButton; - GtkWidget *PasswordEntry; + GtkWidget *UserPasswordEntry; GtkWidget *RepeatPasswordEntry; GtkWidget *PasswordHashEntry; GtkWidget *HashBox; @@ -653,8 +698,6 @@ 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); -void yon_password_combo_set_sensitive(GtkWidget *self, main_window *widgets); -void yon_password_set_sensitive_from_toggle(GtkWidget *self, main_window *widgets); void on_layout_toggle_button_switch(GtkWidget *self, main_window *widgets); enum YON_PAGES yon_page_get_next(main_window *widgets,enum YON_PAGES page); enum YON_PAGES yon_page_get_prev(enum YON_PAGES page); @@ -687,4 +730,5 @@ 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); \ No newline at end of file +int yon_installation_start(main_window *widgets); +enum INSTALL_TYPE yon_ubl_get_install_mode(); \ No newline at end of file diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index ed605d0..a667648 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -1,5 +1,5 @@ - + @@ -201,6 +201,16 @@ False com.ublinux.libublsettingsui-gtk3.properties-symbolic + + True + False + com.ublinux.libublsettingsui-gtk3.edit-symbolic + + + True + False + com.ublinux.libublsettingsui-gtk3.edit-symbolic + True False @@ -525,7 +535,7 @@ agreement - + True False False @@ -2330,6 +2340,7 @@ and help you install UBLinux on your computer True True in + 128 True @@ -2508,107 +2519,248 @@ and help you install UBLinux on your computer True False vertical - 5 True False + 5 + 5 + 5 + 5 + 5 + 5 + vertical 5 - + True - True - False - True - + False + 5 + + + True + True + + + False + True + end + 0 + + True False - Account name: - 0 + Root only + + False + True + 1 + False True - 0 - - - - - True - False - True - Administrator - - - - True - True - 2 + 1 - - - False - True - 0 - - - - - True - False - 5 - + True - True - False - True - + False + vertical + 5 - + True False - Login: - 0 + + False + True + 0 + + + + + True + False + slide-up + True + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + True + Administrator + + + + True + True + 1 + + + + + True + False + Account name: + + + False + True + 3 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Login: + 0 + + + False + True + 0 + + + + + True + False + True + superadmin + + + + True + True + 1 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + False + Password: + 0 + + + False + True + 0 + + + + + True + False + True + 0 + + Default + Set a password + + + + + False + True + 1 + + + + + True + False + True + False + + ublinux + password + + + True + True + 2 + + + + + True + True + True + image22 + + + + False + True + 3 + + + + + False + True + 2 + + + + + + + False + True + 1 + False True - 0 - - - - - Root only - True - True - False - True - - - False - True - 1 - - - - - True - False - True - superadmin - - - - True - True 2 @@ -2616,203 +2768,127 @@ and help you install UBLinux on your computer False True - 1 + 2 - - - True - False - 5 - - - True - True - False - True - - - True - False - Password: - 0 - - - - - False - True - 0 - - - - - True - False - True - 0 - - Default - Set a password - - - - - False - True - 2 - - - - - True - False - True - False - - ublinux - password - - - True - True - 3 - - + + + + False + True + 3 + + + + + True + False + 5 + + + True + True False True - 2 + 0 - + True False - 5 - - - True - True - False - True - - - - - - - False - True - 0 - - - - - Automatic login without password prompt - True - False - True - False - True - - - False - True - 1 - - + Automatic login without password prompt False True - 3 + 1 + + + False + True + 4 + + + + + True + False + 5 - + True False - 5 - - - True - True - False - True - - - True - False - Administrator password (root): - 0 - - - - - False - True - 0 - - - - - True - False - True - 0 - - Default - Set a password - - - - - False - True - 2 - - - - - True - False - True - False - - ublinux - password - - - True - True - 3 - - + Administrator password (root): + 0 False True - 4 + 0 - + True + False False + 0 + + Default + Set a password + + False True - 5 + 1 + + + + + True + False + True + False + + ublinux + password + + + True + True + 2 + + + + + True + True + True + image21 + + + + False + True + 3 False True - 2 + 5 @@ -4382,104 +4458,186 @@ or continue working in the UBLinux Live environment. True False - 5 + vertical - + True - True - False - True - + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + 5 - + True False - Choose file system type for the section: + 5 + + + True + False + True + True + + + False + True + 0 + + + + + True + False + Format + + + False + True + 1 + + + + False + True + 1 + - - - False - True - 0 - - - - - True - False - True - 1 - - ext3 - ext4 - fat16 - fat32 - exfat - riserfs - udf - xfs - zfs - - - - - True - True - 2 - - - - - False - True - 1 - - - - - True - False - 5 - - - True - True - False - True - - + True False - Section name: + vertical + 5 + + + True + False + + + False + True + 0 + + + + + True + False + none + True + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + Device label: + + + False + True + 3 + + + + + True + True + + + True + True + 4 + + + + + True + False + File system type: + + + False + True + 5 + + + + + True + False + 1 + + ext3 + ext4 + fat16 + fat32 + exfat + riserfs + udf + xfs + zfs + + + + True + True + 6 + + + + + False + True + 0 + + + + + + + False + True + 1 + + + + False + True + 2 + False True - 0 - - - - - True - False - True - - - - True - True 2 + False True - 2 + 3 @@ -4675,7 +4833,7 @@ installed. - + True True True @@ -4707,7 +4865,7 @@ installed. 105 350 - + True True DevicesList @@ -4812,7 +4970,7 @@ installed. 128 350 - + True True PartitionsList @@ -4891,25 +5049,60 @@ installed. 1 + + + False + True + 1 + + + + + True + False + vertical True False + 5 + 5 + 5 + 5 + 5 + 5 + vertical 5 - + True - True - False - True - - + False + 5 True False - Specify the size of the new partition for UBLinux OS: + Partition: + 0 + + + False + True + 0 + + + + + True + False + label + 0 + + False + True + 1 + @@ -4919,37 +5112,194 @@ installed. - + True - False - True - 0,0 - PartitionSize - 1 + False + 5 + + + True + True + + + False + True + 0 + + + + + True + False + Format + + + False + True + 1 + + False True - 2 + 1 - + True - False - True - 1 - - Mb - Gb - Tb - - + False + vertical + 5 + + + True + False + + + False + True + 0 + + + + + True + False + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + Size: + + + False + True + 0 + + + + + True + True + 16 + PartitionSize + 16 + + + False + True + 1 + + + + + True + False + 1 + + Mb + Gb + Tb + + + + False + True + 2 + + + + + True + False + Partition mark: + + + False + True + 3 + + + + + True + True + + + False + True + 4 + + + + + True + False + File system type: + + + False + True + 5 + + + + + True + False + 1 + + ext3 + ext4 + fat16 + fat32 + exfat + riserfs + udf + xfs + zfs + + + + True + True + 6 + + + + + False + True + 1 + + + + + + + False + True + 1 + + False True - 3 + 2 @@ -4959,130 +5309,14 @@ installed. 2 + False True - 1 - - - - - True - False - 5 - - - True - True - False - True - - - - True - True - Choose file system type for the section: - - - - - False - True - 0 - - - - - True - False - True - 1 - - ext3 - ext4 - fat16 - fat32 - exfat - riserfs - udf - xfs - zfs - - - - - True - True - 2 - - - - - Format - True - False - True - False - True - - - False - True - 3 - - - - - False - True - 2 - - - - - True - False - 5 - - - True - True - False - True - - - - True - False - Section name: - - - - - False - True - 0 - - - - - True - False - True - - - - True - True - 2 - - - - - False - True - 3 + 4 @@ -5497,7 +5731,7 @@ installed. - True + False True 1 @@ -5538,7 +5772,7 @@ installed. - + True False label @@ -5563,7 +5797,7 @@ installed. False 5 - + True True @@ -5610,11 +5844,9 @@ installed. - + True False - none - True True @@ -5641,9 +5873,7 @@ installed. True - False True - True @@ -5666,7 +5896,6 @@ installed. True - False False 1 @@ -5680,7 +5909,6 @@ installed. xfs zfs - True @@ -8696,7 +8924,7 @@ separately into the selected partition. - + True True True @@ -9080,7 +9308,7 @@ separately into the selected partition. True False - Partition mark: + Partition label: False -- 2.35.1 From 8c3f67676b3f5911de8c2debb01cb46fb200de11 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 18 Jul 2025 17:59:13 +0600 Subject: [PATCH 05/18] User slide remake --- source/CMakeLists.txt | 3 + source/ubinstall-gtk-password.c | 1 - source/ubinstall-gtk-saving.c | 16 +- source/ubinstall-gtk-users.c | 146 +++++---- source/ubinstall-gtk.c | 38 ++- source/ubinstall-gtk.h | 88 +++++- source/ubl-strings.h | 4 +- ubinstall-gtk-user.glade | 219 ++++++++++++++ ubinstall-gtk.glade | 509 +++++++++++++------------------- 9 files changed, 628 insertions(+), 396 deletions(-) create mode 100644 ubinstall-gtk-user.glade diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index a9b8cd1..701dc7f 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -65,6 +65,9 @@ set(DEPENDFILES ../ubinstall-gtk-documentation.glade ../ubinstall-gtk-log-view.glade ../ubinstall-gtk-warning.glade + ../ubinstall-gtk-user.glade + ../ubinstall-gtk-menu.glade + ../ubinstall-gtk-menu-item.glade ../gresource.xml ../ubinstall-gtk.css ../modules.csv diff --git a/source/ubinstall-gtk-password.c b/source/ubinstall-gtk-password.c index f52114a..dfdd045 100644 --- a/source/ubinstall-gtk-password.c +++ b/source/ubinstall-gtk-password.c @@ -1,2 +1 @@ #include "ubinstall-gtk.h" - diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c index a825145..a62e573 100644 --- a/source/ubinstall-gtk-saving.c +++ b/source/ubinstall-gtk-saving.c @@ -391,16 +391,16 @@ // if (!strcmp(user_name,"root")){ // gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck),1); // } else { -// gtk_entry_set_text(GTK_ENTRY(widgets->UserLoginEntry),user_name); +// gtk_entry_set_text(GTK_ENTRY(widgets->UserRootLoginEntry),user_name); // } // } else { -// gtk_entry_set_text(GTK_ENTRY(widgets->UserLoginEntry),""); +// gtk_entry_set_text(GTK_ENTRY(widgets->UserRootLoginEntry),""); // gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck),0); // } // if (!yon_char_is_empty(user_gecos)){ -// gtk_entry_set_text(GTK_ENTRY(widgets->UserNameEntry),_(user_gecos)); +// gtk_entry_set_text(GTK_ENTRY(widgets->UserRootNameEntry),_(user_gecos)); // } else { -// gtk_entry_set_text(GTK_ENTRY(widgets->UserNameEntry),""); +// gtk_entry_set_text(GTK_ENTRY(widgets->UserRootNameEntry),""); // gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UsernameSensitiveCheck),0); // } // int def_size=0; @@ -412,13 +412,13 @@ // } // } // if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserPasswordCombo),0); -// gtk_entry_set_text(GTK_ENTRY(widgets->UserPasswordEntry),""); +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),0); +// gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),""); // gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->PasswordSensitiveCheck),0); // // } else if (!yon_char_is_empty(user_password)){ -// gtk_entry_set_text(GTK_ENTRY(widgets->UserPasswordEntry),user_password); -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserPasswordCombo),1); +// gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),user_password); +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),1); // } // if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ // gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo),0); diff --git a/source/ubinstall-gtk-users.c b/source/ubinstall-gtk-users.c index 9695f84..53b045c 100644 --- a/source/ubinstall-gtk-users.c +++ b/source/ubinstall-gtk-users.c @@ -1,80 +1,104 @@ #include "ubinstall-gtk.h" int yon_users_save(main_window *widgets){ - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UsernameSensitiveCheck))){ - yon_config_remove_by_key(user_gecos_parameter); + if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo))){ + const char *root_password = gtk_entry_get_text(GTK_ENTRY(widgets->UserRootPasswordEntry)); + if (yon_char_is_empty(root_password)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(main_config.status_box),_EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(widgets->UserRootPasswordEntry); + return 0; + } + yon_config_register(root_password_parameter,root_password_parameter_command,(char*)root_password); } else { - char *username = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry)); - if (username){}; - yon_config_register(user_gecos_parameter,user_gecos_parameter_command,username); + yon_config_remove_by_key(root_password_parameter); } - - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->UserLoginEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck))){ - yon_config_remove_by_key(user_name_parameter); + int autologin = gtk_switch_get_active(GTK_SWITCH(widgets->UserAutologinSwitch)); + if (autologin){ + yon_config_register(autologin_parameter,autologin_parameter_command,"yes"); } else { - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck))){ - yon_config_register(user_name_parameter,user_name_parameter_command,"root"); - } else { - char *login = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserLoginEntry)); - if (login){}; - yon_config_register(user_name_parameter,user_name_parameter_command,login); - } + yon_config_register(autologin_parameter,autologin_parameter_command,"no"); } - if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->UserPasswordCombo))==1){ - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->UserPasswordEntry)))){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(widgets->UserPasswordEntry); - return 0; - } else { - char *password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserPasswordEntry)); - if (password){}; - - yon_config_register(user_password_parameter,user_password_parameter_command,password); + GList *users = gtk_container_get_children(GTK_CONTAINER(widgets->UserAddBox)); + GList *iter; + for (iter=users;iter;iter=iter->next){ + yon_user_struct *user = g_object_get_data(G_OBJECT(iter->data),"yon_user_struct"); + if (user){ + if (!yon_user_save(user)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(main_config.status_box),_EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return 0; } - } else { - yon_config_remove_by_key(user_password_parameter); } + } - if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo))==1){ - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->AdminPasswordEntry)))){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(widgets->AdminPasswordEntry); - return 0; - } else { - char *root_password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->AdminPasswordEntry)); - if (root_password){}; - yon_config_register(root_password_parameter,root_password_parameter_command,root_password); + yon_debug_output("%s\n",yon_config_get_all_info()); + return 1; +} - } - } else { - yon_config_remove_by_key(root_password_parameter); +int yon_user_save(yon_user_struct *user){ + char *name = (char *)gtk_entry_get_text(GTK_ENTRY(user->UsernameEntry)); + char *login = (char *)gtk_entry_get_text(GTK_ENTRY(user->LoginEntry)); + char *password = NULL; + if (yon_char_is_empty(login)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(main_config.status_box),_EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(user->LoginEntry); + return 0; + } + if (gtk_combo_box_get_active(GTK_COMBO_BOX(user->PasswordCombo))){ + password = (char *)gtk_entry_get_text(GTK_ENTRY(user->PasswordEntry)); + if (yon_char_is_empty(password)){ + yon_ubl_status_highlight_incorrect(user->PasswordEntry); + return 0; } + } + char *parameter = yon_char_unite(yon_char_return_if_exist(name,""),":::::",yon_char_return_if_exist(password,""),NULL); + yon_config_register(USERADD_parameter(login),USERADD_parameter_command(login),parameter); + free(parameter); + return 1; +} - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck))){ - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ - yon_config_register(hostname_parameter,hostname_parameter_command,"auto"); - } else { - if (!yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->HotnameEntry)))){ - char *hostname = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->HotnameEntry)); - if (hostname){}; - yon_config_register(hostname_parameter,hostname_parameter_command,hostname); +void on_user_add(GtkWidget *,main_window *widgets){ + yon_user_struct *user = yon_user_struct_new(); + gtk_box_pack_start(GTK_BOX(widgets->UserAddBox),user->MainBox,0,0,0); +} - } else { - yon_config_remove_by_key(hostname_parameter); +void on_user_remove_clicked(GtkWidget *,yon_user_struct *user){ + gtk_widget_destroy(user->MainBox); + free(user); +} - } - } - } else { - yon_config_remove_by_key(hostname_parameter); - } +void yon_password_root_new(GtkWidget *, main_window *widgets){ + yon_password_window *window = yon_password_open(GTK_ENTRY(widgets->UserRootPasswordEntry)); + gtk_widget_hide(gtk_widget_get_parent(window->EncryptionCombo)); + gtk_widget_show(window->Window); +} - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutologinSensitiveCheck))){ - char *autologin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UserAutologinSwitch))?"yes":"no"; - yon_config_register(autologin_parameter,autologin_parameter_command,autologin); - } else { - yon_config_remove_by_key(autologin_parameter); - } - return 1; +void yon_password_new(GtkWidget *, yon_user_struct *user){ + yon_password_window *window = yon_password_open(GTK_ENTRY(user->PasswordEntry)); + gtk_widget_hide(gtk_widget_get_parent(window->EncryptionCombo)); + gtk_widget_show(window->Window); +} + +yon_user_struct *yon_user_struct_new(){ + yon_user_struct *user = new(yon_user_struct); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_user); + + user->MainBox = yon_gtk_builder_get_widget(builder,"MainBox"); + user->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton"); + user->UsernameEntry = yon_gtk_builder_get_widget(builder,"UsernameEntry"); + user->LoginEntry = yon_gtk_builder_get_widget(builder,"LoginEntry"); + user->PasswordCombo = yon_gtk_builder_get_widget(builder,"PasswordCombo"); + user->PasswordEntry = yon_gtk_builder_get_widget(builder,"PasswordEntry"); + user->PasswordButton = yon_gtk_builder_get_widget(builder,"PasswordButton"); + + g_object_set_data(G_OBJECT(user->MainBox),"yon_user_struct",user); + + yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(user->PasswordEntry)); + + g_signal_connect(G_OBJECT(user->PasswordCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),user->PasswordEntry); + g_signal_connect(G_OBJECT(user->PasswordCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),user->PasswordButton); + g_signal_connect(G_OBJECT(user->PasswordButton),"clicked",G_CALLBACK(yon_password_new),user); + g_signal_connect(G_OBJECT(user->RemoveButton),"clicked",G_CALLBACK(on_user_remove_clicked),user); + return user; } \ No newline at end of file diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index da34acb..ed6bf10 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -398,19 +398,14 @@ main_window *yon_main_window_complete(){ widgets->OptionsSensitiveCheck = yon_gtk_builder_get_widget(builder,"OptionsSensitiveCheck"); widgets->LayoutSensitiveCheck = yon_gtk_builder_get_widget(builder,"LayoutSensitiveCheck"); - widgets->UserNameEntry=yon_gtk_builder_get_widget(builder,"UserNameEntry"); - widgets->UserLoginEntry=yon_gtk_builder_get_widget(builder,"UserLoginEntry"); - widgets->UserPasswordCombo=yon_gtk_builder_get_widget(builder,"UserPasswordCombo"); - widgets->UserPasswordEntry=yon_gtk_builder_get_widget(builder,"UserPasswordEntry"); - widgets->UserPasswordButton=yon_gtk_builder_get_widget(builder,"UserPasswordButton"); + widgets->UserRootNameEntry=yon_gtk_builder_get_widget(builder,"UserRootNameEntry"); + widgets->UserRootLoginEntry=yon_gtk_builder_get_widget(builder,"UserRootLoginEntry"); + widgets->UserRootPasswordCombo=yon_gtk_builder_get_widget(builder,"UserRootPasswordCombo"); + widgets->UserRootPasswordEntry=yon_gtk_builder_get_widget(builder,"UserRootPasswordEntry"); + widgets->UserRootPasswordButton=yon_gtk_builder_get_widget(builder,"UserRootPasswordButton"); widgets->UserAutologinSwitch=yon_gtk_builder_get_widget(builder,"UserAutologinSwitch"); - widgets->AdminPasswordCombo=yon_gtk_builder_get_widget(builder,"AdminPasswordCombo"); - widgets->AdminPasswordEntry=yon_gtk_builder_get_widget(builder,"AdminPasswordEntry"); - widgets->AdminPasswordButton=yon_gtk_builder_get_widget(builder,"AdminPasswordButton"); - widgets->UsernameSensitiveCheck = yon_gtk_builder_get_widget(builder,"UsernameSensitiveCheck"); - widgets->LoginSensitiveCheck = yon_gtk_builder_get_widget(builder,"LoginSensitiveCheck"); - widgets->UserRootOnlyCheck = yon_gtk_builder_get_widget(builder,"UserRootOnlyCheck"); - widgets->AutologinSensitiveCheck = yon_gtk_builder_get_widget(builder,"AutologinSensitiveCheck"); + widgets->UserAddBox=yon_gtk_builder_get_widget(builder,"UserAddBox"); + widgets->UserAddButton=yon_gtk_builder_get_widget(builder,"UserAddButton"); widgets->HotnameEntry=yon_gtk_builder_get_widget(builder,"HotnameEntry"); widgets->mainSettingsButton=yon_gtk_builder_get_widget(builder,"mainSettingsButton"); @@ -464,6 +459,8 @@ main_window *yon_main_window_complete(){ widgets->HostnameSensitiveCheck = yon_gtk_builder_get_widget(builder,"HostnameSensitiveCheck"); widgets->AutoHostnameCheck=yon_gtk_builder_get_widget(builder,"AutoHostnameCheck"); widgets->network_connections = NULL; + + main_config.status_box = widgets->StatusBox; } g_signal_connect(G_OBJECT(widgets->MainWindow),"delete-event",G_CALLBACK(on_yon_exit),widgets); GtkWidget *menu = yon_gtk_builder_get_widget(builder,"menu2"); @@ -513,6 +510,12 @@ main_window *yon_main_window_complete(){ g_signal_connect(G_OBJECT(widgets->SamePlacePartTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); g_signal_connect(G_OBJECT(widgets->NextInstallationSysSectionTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); g_signal_connect(G_OBJECT(widgets->NextInstallationSizeTypeSpin),"changed",G_CALLBACK(on_partition_changed),widgets); + + g_signal_connect(G_OBJECT(widgets->UserRootPasswordCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),widgets->UserRootPasswordEntry); + g_signal_connect(G_OBJECT(widgets->UserRootPasswordCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),widgets->UserRootPasswordButton); + g_signal_connect(G_OBJECT(widgets->UserAddButton),"clicked",G_CALLBACK(on_user_add),widgets); + g_signal_connect(G_OBJECT(widgets->UserRootPasswordButton),"clicked",G_CALLBACK(yon_password_root_new),widgets); + g_signal_connect(G_OBJECT(widgets->BootloadDefaulOSButton),"clicked",G_CALLBACK(yon_menu_window_open),widgets); // gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),3); // g_signal_connect(G_OBJECT(widgets->LanguageCombo),"changed",G_CALLBACK(on_locale_changed),widgets); @@ -529,9 +532,16 @@ main_window *yon_main_window_complete(){ // g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(on_autohostname_check),widgets); // g_signal_connect(G_OBJECT(widgets->HotnameEntry),"changed",G_CALLBACK(on_hostname_entry_changed),widgets); + + { + yon_user_struct *user = yon_user_struct_new(); + gtk_box_pack_start(GTK_BOX(widgets->UserAddBox),user->MainBox,0,0,0); + gtk_entry_set_text(GTK_ENTRY(user->UsernameEntry),ADMINISTRATOR_LABEL); + gtk_entry_set_text(GTK_ENTRY(user->LoginEntry),"superadmin"); + } + { - yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->UserPasswordEntry)); - yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->AdminPasswordEntry)); + yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->UserRootPasswordEntry)); if (main_config.lock_load_global == 1){ gtk_widget_set_sensitive(widgets->LoadGlobalConfigurationMenuItem,0); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 3344940..e133abb 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -26,6 +26,9 @@ #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 CssPath "/com/ublinux/css/ubinstall-gtk.css" #define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) @@ -65,6 +68,8 @@ "/com/ublinux/images/slide-12.png", \ NULL +#define get_menus_entry_command "/usr/lib/ublinux/scripts/grub-functions exec_get_all_menuentry" + #define encrypt_domain_password_command(target) yon_char_unite("echo '",target,"' | base64",NULL) #define get_ntp_default_command "ubconfig --default get [network] NTPSERVERS_DEFAULT" @@ -146,6 +151,9 @@ NULL #define DOMAIN_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[ubconfig set [network] DOMAIN]" #define DOMAIN_admanger_parameter "AOUTINSTALL[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(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 save_config_command(parameters) yon_char_unite("ubconfig --target system set [autoinstall] AUTOINSTALL[log]=yes ",parameters, "; nice ubinstall2 --debug autoinstall", NULL) @@ -302,6 +310,7 @@ typedef struct { int arg_size; config_str arg_target; + GtkWidget *status_box; } config; extern config main_config; @@ -371,15 +380,15 @@ typedef struct { GtkWidget *InstallationWindowsRadio; GtkWidget *InstallationOptionsRadio; - GtkWidget *UserNameEntry; - GtkWidget *UserLoginEntry; - GtkWidget *UserPasswordCombo; - GtkWidget *UserPasswordEntry; - GtkWidget *UserPasswordButton; + GtkWidget *UserRootNameEntry; + GtkWidget *UserRootLoginEntry; + GtkWidget *UserRootPasswordCombo; + GtkWidget *UserRootPasswordEntry; + GtkWidget *UserRootPasswordButton; GtkWidget *UserAutologinSwitch; - GtkWidget *AdminPasswordCombo; - GtkWidget *AdminPasswordEntry; - GtkWidget *AdminPasswordButton; + GtkWidget *UserAddBox; + GtkWidget *UserAddButton; + GtkWidget *HotnameEntry; GtkWidget *AutoHostnameCheck; GtkWidget *CancelInstallButton; @@ -388,11 +397,13 @@ typedef struct { GtkWidget *mainSettingsButton; GtkWidget *menu1; GtkWidget *menu2; + GtkWidget *RegionImage; GtkWidget *RegionBox; GtkWidget *RegionAspect; GtkWidget *KeyboardImage; GtkWidget *KeyboardBox; + GtkWidget *Notebook; GtkWidget *LicenceLabel; GtkWidget *SlidesImage; @@ -584,7 +595,7 @@ typedef struct{ GtkWidget *StatusBox; GtkWidget *UserCancelButton; GtkWidget *UserOkButton; - GtkWidget *UserPasswordEntry; + GtkWidget *UserRootPasswordEntry; GtkWidget *RepeatPasswordEntry; GtkWidget *PasswordHashEntry; GtkWidget *HashBox; @@ -624,13 +635,53 @@ typedef struct { GtkWidget *DNSEntry; } network_info; +typedef struct { + GtkWidget *MainBox; + GtkWidget *RemoveButton; + GtkWidget *UsernameEntry; + GtkWidget *LoginEntry; + GtkWidget *PasswordCombo; + GtkWidget *PasswordEntry; + GtkWidget *PasswordButton; +} yon_user_struct; + + +typedef struct { + GtkWidget *MenuWindow; + GtkWidget *BackButton; + GtkWidget *ItemsRevealer; + GtkWidget *ItemsListBox; + GtkWidget *ChildrenRevealer; + GtkWidget *ChildrenListBox; + + int seat_grab; + dictionary *menu_items; + char *cur_selection; + int button_pos_x; + int button_pos_y; +} yon_menu_window; + +typedef struct { + GtkWidget *MenuItemBox; + GtkWidget *MenuButton; + GtkWidget *MenuTextLabel; + GtkWidget *NextIconButton; + + char *target; + + main_window *widgets; + yon_menu_window *window; + + dictionary *children; + +} yon_menu_item; + 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(); -password_window *yon_password_new(); void on_password_accept(GtkWidget *self, dictionary *dict); @@ -731,4 +782,19 @@ 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(); \ No newline at end of file +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 on_menu_chosen(GtkWidget *, yon_menu_item *item); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index e0930c3..03e63b6 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -185,4 +185,6 @@ #define WARNING_REBOOT_TEXT_LABEL _("Are you sure want to reboot system?") #define DEFAULT_BOOTLOAD_MENU_ITEM_LABEL _("Default (Use last succeeded)") -#define ENCRYPT_ERROR_LABEL _("Password encryption error") \ No newline at end of file +#define ENCRYPT_ERROR_LABEL _("Password encryption error") + +#define DEFAULT_MENU_ITEM_LABEL _("Default (Use last succeeded)") \ No newline at end of file diff --git a/ubinstall-gtk-user.glade b/ubinstall-gtk-user.glade new file mode 100644 index 0000000..a8ddf45 --- /dev/null +++ b/ubinstall-gtk-user.glade @@ -0,0 +1,219 @@ + + + + + + + True + False + com.ublinux.libublsettingsui-gtk3.trash-symbolic + + + True + False + com.ublinux.libublsettingsui-gtk3.edit-symbolic + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + 5 + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + Account name: + + + False + True + 0 + + + + + True + True + Administrator + + + True + True + 1 + + + + + True + True + True + image1 + + + + False + True + 3 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Login: + 0 + + + False + True + 0 + + + + + True + True + superadmin + + + True + True + 1 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + False + Password: + 0 + + + False + True + 0 + + + + + True + False + 0 + + Default + Set a password + + + + False + True + 1 + + + + + True + False + False + False + + ublinux + password + + + True + True + 2 + + + + + True + False + True + True + image22 + + + + False + True + 3 + + + + + False + True + 2 + + + + + False + True + 0 + + + + + False + True + 2 + + + + + diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index a667648..5320c08 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -206,11 +206,6 @@ False com.ublinux.libublsettingsui-gtk3.edit-symbolic - - True - False - com.ublinux.libublsettingsui-gtk3.edit-symbolic - True False @@ -2518,55 +2513,48 @@ and help you install UBLinux on your computer True False - vertical + 5 - + + True + True + + + False + True + 0 + + + + True False - 5 - 5 - 5 - 5 + Automatic login without password prompt + + + False + True + 1 + + + + + False + True + 2 + + + + + True + True + + + True + False + 10 5 5 - vertical - 5 - - - True - False - 5 - - - True - True - - - False - True - end - 0 - - - - - True - False - Root only - - - False - True - 1 - - - - - False - True - 1 - - True @@ -2574,181 +2562,212 @@ and help you install UBLinux on your computer vertical 5 - - True - False - - - False - True - 0 - - - - + True False - slide-up - True + vertical True False + 5 + 5 + 5 + 5 + 5 + 5 vertical 5 True False + vertical 5 - - True - False - True - Administrator - - - - True - True - 1 - - - - + True False - Account name: + 5 + + + True + False + Account name: + + + False + True + 0 + + + + + True + False + True + root + Administrator + + + True + True + 3 + + False True - 3 + 0 - - - False - True - 0 - - - - - True - False - 5 - + True False - Login: - 0 + 5 + + + True + False + Login: + 0 + + + False + True + 0 + + + + + True + False + True + root + superadmin + + + True + True + 1 + + False True - 0 - - - - - True - False - True - superadmin - - - - True - True 1 - - - False - True - 1 - - - - - True - False - 5 - + True False - Password: - 0 - - - False - True - 0 - - - - - True - False - True - 0 - - Default - Set a password - - + 5 + + + True + False + Administrator password (root): + 0 + + + False + True + 0 + + + + + True + False + 0 + + Default + Set a password + + + + False + True + 1 + + + + + True + False + False + False + + ublinux + password + + + True + True + 2 + + + + + True + False + True + True + image21 + + + + False + True + 3 + + False True - 1 - - - - - True - False - True - False - - ublinux - password - - - True - True + end 2 - - - True - True - True - image22 - - - - False - True - 3 - - False True - 2 + 0 + + False + True + 2 + + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + @@ -2757,138 +2776,28 @@ and help you install UBLinux on your computer 1 + + + + + True + True + True + + + False + True + 2 + + - - False - True - 2 - - - False - True - 2 - - - False - True - 3 - - - - - True - False - 5 - - - True - True - - - False - True - 0 - - - - - True - False - Automatic login without password prompt - - - False - True - 1 - - - - - False - True - 4 - - - - - True - False - 5 - - - True - False - Administrator password (root): - 0 - - - False - True - 0 - - - - - True - False - False - 0 - - Default - Set a password - - - - - False - True - 1 - - - - - True - False - True - False - - ublinux - password - - - True - True - 2 - - - - - True - True - True - image21 - - - - False - True - 3 - - - - - False + True True - 5 + 6 -- 2.35.1 From 1bd32feb76aabef2720e14a88942bf3af817d079 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 18 Jul 2025 17:59:44 +0600 Subject: [PATCH 06/18] Added bootload slide menu --- gresource.xml | 3 + source/ubinstall-gtk-bootloader.c | 208 ++++++++++++++++++++++++++++++ ubinstall-gtk-menu-item.glade | 73 +++++++++++ ubinstall-gtk-menu.glade | 203 +++++++++++++++++++++++++++++ 4 files changed, 487 insertions(+) create mode 100644 ubinstall-gtk-menu-item.glade create mode 100644 ubinstall-gtk-menu.glade diff --git a/gresource.xml b/gresource.xml index 7c8474c..73c5f37 100644 --- a/gresource.xml +++ b/gresource.xml @@ -8,6 +8,9 @@ ubinstall-gtk-documentation.glade ubinstall-gtk-log-view.glade ubinstall-gtk-warning.glade + ubinstall-gtk-user.glade + ubinstall-gtk-menu.glade + ubinstall-gtk-menu-item.glade ubinstall-gtk.css diff --git a/source/ubinstall-gtk-bootloader.c b/source/ubinstall-gtk-bootloader.c index 367d126..c412aad 100644 --- a/source/ubinstall-gtk-bootloader.c +++ b/source/ubinstall-gtk-bootloader.c @@ -24,4 +24,212 @@ int yon_bootloader_save(main_window *widgets){ // yon_config_remove_by_key(); } return 1; +} +void on_menu_chosen(GtkWidget *, yon_menu_item *item){ + if (strcmp(item->target,DEFAULT_MENU_ITEM_LABEL)){ + gtk_entry_set_text(GTK_ENTRY(item->widgets->BootloadDefaultOSEntry),item->target); + } else { + gtk_entry_set_text(GTK_ENTRY(item->widgets->BootloadDefaultOSEntry),DEFAULT_MENU_ITEM_LABEL); + } + GdkDisplay *display = gdk_display_get_default(); + GdkSeat *seat = gdk_display_get_default_seat(display); + if (item->window->seat_grab) + gdk_seat_ungrab(seat); + else + gtk_grab_remove(item->window->MenuWindow); + gtk_widget_destroy(item->window->MenuWindow); + +} + +void on_submenu_open(GtkWidget *,yon_menu_item *item){ + yon_menu_window *window = item->window; + + dictionary *dact = NULL; + for_dictionaries(dact,item->children){ + yon_menu_item *child = yon_dictionary_get_data(dact,yon_menu_item*); + gtk_widget_hide(child->NextIconButton); + gtk_list_box_insert(GTK_LIST_BOX(window->ChildrenListBox),child->MenuItemBox,-1); + g_signal_connect(G_OBJECT(child->MenuButton),"clicked",G_CALLBACK(on_menu_chosen),dact->data); + + } + gtk_revealer_set_reveal_child(GTK_REVEALER(item->window->ItemsRevealer),0); + gtk_revealer_set_reveal_child(GTK_REVEALER(item->window->ChildrenRevealer),1); + gtk_box_set_child_packing(GTK_BOX(gtk_widget_get_parent(window->ChildrenRevealer)),window->ChildrenRevealer,1,1,0,GTK_PACK_START); + gtk_box_set_child_packing(GTK_BOX(gtk_widget_get_parent(window->ItemsRevealer)),window->ItemsRevealer,0,0,0,GTK_PACK_START); + yon_on_revealer_switched(window); + g_signal_connect(G_OBJECT(window->MenuWindow),"size-allocate",G_CALLBACK(on_menu_window_size_reallocated),window); + +} + +yon_menu_window *yon_menu_window_open(GtkWidget *, main_window *widgets){ + yon_menu_window *window = yon_menu_window_new(); + gtk_window_set_transient_for(GTK_WINDOW(window->MenuWindow),GTK_WINDOW(widgets->MainWindow)); + { + yon_menu_item *item = yon_menu_item_new(); + item->widgets=widgets; + item->window=window; + item->children=NULL; + gtk_label_set_text(GTK_LABEL(item->MenuTextLabel),DEFAULT_MENU_ITEM_LABEL); + item->target=yon_char_new(DEFAULT_MENU_ITEM_LABEL); + gtk_list_box_insert(GTK_LIST_BOX(window->ItemsListBox),item->MenuItemBox,-1); + yon_dictionary_add_or_create_if_exists_with_data(window->menu_items,DEFAULT_MENU_ITEM_LABEL,item); + gtk_widget_show(item->MenuItemBox); + gtk_widget_hide(item->NextIconButton); + g_signal_connect(G_OBJECT(item->MenuButton),"clicked",G_CALLBACK(on_menu_chosen),item); + } + int size; + config_str parsed = yon_config_load(get_menus_entry_command,&size); + for (int i=0;i"); + dictionary * cur_item = NULL; + if (param_size==2&&(cur_item=yon_dictionary_get(&window->menu_items,parameter[0]))){ + yon_menu_item *item = (yon_menu_item*)cur_item->data; + yon_menu_item *item_child = yon_menu_item_new(); + gtk_widget_hide(item_child->NextIconButton); + gtk_label_set_text(GTK_LABEL(item_child->MenuTextLabel),parameter[1]); + item_child->target=yon_char_new(parsed[i]); + gtk_widget_show(item_child->MenuItemBox); + yon_dictionary_add_or_create_if_exists_with_data(item->children,parameter[1],item_child); + item_child->widgets=widgets; + item_child->window=window; + + } else { + yon_menu_item *item = yon_menu_item_new(); + item->widgets=widgets; + item->window=window; + gtk_label_set_text(GTK_LABEL(item->MenuTextLabel),parameter[0]); + item->target=yon_char_new(parsed[i]); + gtk_list_box_insert(GTK_LIST_BOX(window->ItemsListBox),item->MenuItemBox,-1); + yon_dictionary_add_or_create_if_exists_with_data(window->menu_items,parameter[0],item); + gtk_widget_show(item->MenuItemBox); + if (param_size==2){ + yon_menu_item *item_child = yon_menu_item_new(); + gtk_widget_show(item->NextIconButton); + gtk_widget_hide(item_child->NextIconButton); + gtk_label_set_text(GTK_LABEL(item_child->MenuTextLabel),parameter[1]); + item_child->target=yon_char_new(parsed[i]); + gtk_widget_show(item_child->MenuItemBox); + item_child->widgets=widgets; + item_child->window=window; + g_signal_connect(G_OBJECT(item->MenuButton),"clicked",G_CALLBACK(on_submenu_open),item); + yon_dictionary_add_or_create_if_exists_with_data(item->children,parameter[1],item_child); + } else { + gtk_widget_hide(item->NextIconButton); + g_signal_connect(G_OBJECT(item->MenuButton),"clicked",G_CALLBACK(on_menu_chosen),item); + } + } + + } + gtk_window_set_transient_for(GTK_WINDOW(window->MenuWindow), GTK_WINDOW(widgets->MainWindow)); + + int x,y,width; + gtk_widget_realize(window->MenuWindow); + gdk_window_get_position(gtk_widget_get_window(widgets->BootloadDefaulOSButton),&x,&y); + gtk_widget_translate_coordinates(widgets->BootloadDefaulOSButton,widgets->MainWindow,x,y,&window->button_pos_x,&window->button_pos_y); + gtk_window_get_size(GTK_WINDOW(window->MenuWindow),&width,NULL); + GtkAllocation alloc; + gtk_widget_get_allocation(widgets->BootloadDefaulOSButton, &alloc); + gtk_window_get_position(GTK_WINDOW(widgets->MainWindow),&x,&y); + gtk_window_move(GTK_WINDOW(window->MenuWindow),window->button_pos_x-width,window->button_pos_y); + gtk_widget_show(window->MenuWindow); + GdkGrabStatus status = gdk_seat_grab(gdk_display_get_default_seat(gdk_display_get_default()),gtk_widget_get_window(window->MenuWindow),GDK_SEAT_CAPABILITY_POINTER,TRUE,NULL,NULL,NULL,NULL); + if (status != GDK_GRAB_SUCCESS) { + window->seat_grab=0; + gtk_grab_add(window->MenuWindow); + } else { + window->seat_grab=1; + } + return window; +} + +gboolean on_menu_clicked(GtkWidget *, GdkEventButton *event, yon_menu_window *window){ + int x,y,width,height; + gtk_window_get_size(GTK_WINDOW(window->MenuWindow),&width,&height); + gtk_window_get_position(GTK_WINDOW(window->MenuWindow),&x,&y); + if (event->x_rooty_rootx_root>x+width||event->y_root>y+height){ + + GdkDisplay *display = gdk_display_get_default(); + GdkSeat *seat = gdk_display_get_default_seat(display); + if (window->seat_grab) + gdk_seat_ungrab(seat); + else + gtk_grab_remove(window->MenuWindow); + gtk_widget_destroy(window->MenuWindow); + } + return 1; + +} + +gboolean yon_on_revealer_switched (yon_menu_window *window){ + if (gtk_revealer_get_reveal_child(GTK_REVEALER(window->ItemsRevealer))){ + gtk_widget_hide(window->ChildrenRevealer); + gtk_widget_show(window->ItemsRevealer); + } else { + gtk_widget_hide(window->ItemsRevealer); + gtk_widget_show(window->ChildrenRevealer); + + } + return G_SOURCE_REMOVE; +} + +void on_children_clean(GtkWidget*, yon_menu_window *window){ + GList *list = gtk_container_get_children(GTK_CONTAINER(window->ChildrenListBox)); + list = g_list_last(list); + for (guint i=0;idata)); + g_object_ref(G_OBJECT(item->data)); + gtk_container_remove(GTK_CONTAINER(list->data),GTK_WIDGET(item->data)); + gtk_widget_destroy(GTK_WIDGET(list->data)); + g_list_free(item); + list=list->prev; + } + + gtk_revealer_set_reveal_child(GTK_REVEALER(window->ItemsRevealer),1); + gtk_revealer_set_reveal_child(GTK_REVEALER(window->ChildrenRevealer),0); + gtk_box_set_child_packing(GTK_BOX(gtk_widget_get_parent(window->ItemsRevealer)),window->ItemsRevealer,1,1,0,GTK_PACK_START); + yon_on_revealer_switched(window); + g_signal_connect(G_OBJECT(window->MenuWindow),"size-allocate",G_CALLBACK(on_menu_window_size_reallocated),window); + gtk_box_set_child_packing(GTK_BOX(gtk_widget_get_parent(window->ChildrenRevealer)),window->ChildrenRevealer,0,0,0,GTK_PACK_START); + +} + +void on_menu_window_size_reallocated(GtkWidget *self,GtkAllocation *,yon_menu_window *window){ + + + int x,y,width; + gtk_window_get_size(GTK_WINDOW(window->MenuWindow),&width,NULL); + gtk_window_get_position(GTK_WINDOW(gtk_window_get_transient_for(GTK_WINDOW(window->MenuWindow))),&x,&y); + gtk_window_move(GTK_WINDOW(window->MenuWindow),window->button_pos_x-width,window->button_pos_y); + g_signal_handlers_disconnect_by_func(self,on_menu_window_size_reallocated,window); +} + + yon_menu_window *yon_menu_window_new(){ + yon_menu_window *window = new(yon_menu_window); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_menu_window); + window->MenuWindow = yon_gtk_builder_get_widget(builder,"MainWindow"); + window->ItemsRevealer = yon_gtk_builder_get_widget(builder,"ItemsRevealer"); + window->BackButton = yon_gtk_builder_get_widget(builder,"BackButton"); + window->ItemsListBox = yon_gtk_builder_get_widget(builder,"ItemsListBox"); + window->ChildrenRevealer = yon_gtk_builder_get_widget(builder,"ChildrenRevealer"); + window->ChildrenListBox = yon_gtk_builder_get_widget(builder,"ChildrenListBox"); + + window->menu_items=NULL; + + g_signal_connect(G_OBJECT(window->BackButton),"clicked",G_CALLBACK(on_children_clean),window); + g_signal_connect(G_OBJECT(window->MenuWindow),"button-press-event",G_CALLBACK(on_menu_clicked),window); + return window; +} + +yon_menu_item *yon_menu_item_new(){ + yon_menu_item *item = new(yon_menu_item); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_menu_item); + item->MenuItemBox = yon_gtk_builder_get_widget(builder,"MenuItemBox"); + item->MenuButton = yon_gtk_builder_get_widget(builder,"MenuButton"); + item->MenuTextLabel = yon_gtk_builder_get_widget(builder,"MenuTextLabel"); + item->NextIconButton = yon_gtk_builder_get_widget(builder,"NextIconButton"); + item->children=NULL; + + return item; } \ No newline at end of file diff --git a/ubinstall-gtk-menu-item.glade b/ubinstall-gtk-menu-item.glade new file mode 100644 index 0000000..c9d988a --- /dev/null +++ b/ubinstall-gtk-menu-item.glade @@ -0,0 +1,73 @@ + + + + + + + True + False + + + True + True + True + + + True + False + 5 + + + True + False + label + + + False + True + 0 + + + + + True + True + False + True + menu1 + right + + + + + + + False + True + end + 1 + + + + + + + + True + True + 0 + + + + + True + False + + diff --git a/ubinstall-gtk-menu.glade b/ubinstall-gtk-menu.glade new file mode 100644 index 0000000..a4205a7 --- /dev/null +++ b/ubinstall-gtk-menu.glade @@ -0,0 +1,203 @@ + + + + + + + 450 + 250 + False + False + True + 450 + com.ublinux.ubl-settings-bootloader + True + True + False + + + True + False + 0 + in + + + True + False + 5 + 5 + 5 + 5 + + + True + False + none + True + + + True + True + never + 50 + 200 + + + True + False + + + True + False + none + + + True + False + OS options were not found + + + + + + + + + + + + + True + True + 0 + + + + + False + none + + + True + False + vertical + 5 + + + True + True + True + + + True + False + 5 + + + True + True + False + True + left + + + + + + + False + True + 0 + + + + + True + False + Back + + + False + True + 1 + + + + + + + + False + True + 0 + + + + + True + True + never + 50 + 175 + + + True + False + + + True + False + none + + + True + False + Children options were not found + + + + + + + + + True + True + 1 + + + + + + + False + True + 1 + + + + + + + + + + + + + -- 2.35.1 From 1361ae18dde9a41a87b8fcd0966c8b7a4ba7ba3e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 21 Jul 2025 15:46:13 +0600 Subject: [PATCH 07/18] WIP kernel window --- gresource.xml | 2 + kernel-list.csv | 5 + source/CMakeLists.txt | 3 + source/ubinstall-gtk-bootloader.c | 2 - source/ubinstall-gtk-components.c | 25 +++-- source/ubinstall-gtk-kernel.c | 180 ++++++++++++++++++++++++++++++ source/ubinstall-gtk.c | 4 +- source/ubinstall-gtk.h | 31 ++++- source/ubl-strings.h | 10 +- ubinstall-gtk-kernel-row.glade | 145 ++++++++++++++++++++++++ ubinstall-gtk.css | 70 ++++++++++++ ubinstall-gtk.glade | 72 ++---------- 12 files changed, 470 insertions(+), 79 deletions(-) create mode 100644 kernel-list.csv create mode 100644 source/ubinstall-gtk-kernel.c create mode 100644 ubinstall-gtk-kernel-row.glade diff --git a/gresource.xml b/gresource.xml index 73c5f37..3873c32 100644 --- a/gresource.xml +++ b/gresource.xml @@ -11,6 +11,7 @@ ubinstall-gtk-user.glade ubinstall-gtk-menu.glade ubinstall-gtk-menu-item.glade + ubinstall-gtk-kernel-row.glade ubinstall-gtk.css @@ -40,5 +41,6 @@ modules.csv + kernel-list.csv \ No newline at end of file diff --git a/kernel-list.csv b/kernel-list.csv new file mode 100644 index 0000000..e97af1f --- /dev/null +++ b/kernel-list.csv @@ -0,0 +1,5 @@ +NAME;PAСKAGE_UBM;PAСKAGE;PAСKAGE_UBM_REQUIRED;PAСKAGE_REQUIRED;TAG;DESCRIPTION +Linux 5.15;ubm-001-linux515-test;linux515-test;ubm-002-linux515-test-headers;linux515-test-headers;LTS, Stable, RealTime, Hardened, Recomended;The Linux kernel v5.15 and modules, headers. Additional kernel modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs +Linux 5.15;ubm-001-linux515;linux515;ubm-002-linux515-headers;linux515-headers;LTS, Stable;The Linux kernel v5.15 and modules, headers. Additional kernel modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs +Linux 6.1;ubm-001-linux61;linux61;ubm-002-linux61-headers;linux61-headers;LTS, Stable, Recomended;The Linux kernel v6.1 and modules, headers. Additional kernel modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs +Linux 6.6;ubm-001-linux66;linux66;ubm-002-linux66-headers;linux66-headers;LTS, Stable;The Linux kernel v6.6 and modules, headers. Additional kernel modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 701dc7f..15bc804 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -68,9 +68,11 @@ set(DEPENDFILES ../ubinstall-gtk-user.glade ../ubinstall-gtk-menu.glade ../ubinstall-gtk-menu-item.glade + ../ubinstall-gtk-kernel-row.glade ../gresource.xml ../ubinstall-gtk.css ../modules.csv + ../kernel-list.csv ) file(COPY ${DEPENDFILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) @@ -125,6 +127,7 @@ set(SOURCE_FILES ubinstall-gtk-saving.c ubinstall-gtk-standard.c ubinstall-gtk-install-start.c + ubinstall-gtk-kernel.c ubinstall-gtk.h ubl-strings.h ) diff --git a/source/ubinstall-gtk-bootloader.c b/source/ubinstall-gtk-bootloader.c index c412aad..0d19168 100644 --- a/source/ubinstall-gtk-bootloader.c +++ b/source/ubinstall-gtk-bootloader.c @@ -196,8 +196,6 @@ void on_children_clean(GtkWidget*, yon_menu_window *window){ } void on_menu_window_size_reallocated(GtkWidget *self,GtkAllocation *,yon_menu_window *window){ - - int x,y,width; gtk_window_get_size(GTK_WINDOW(window->MenuWindow),&width,NULL); gtk_window_get_position(GTK_WINDOW(gtk_window_get_transient_for(GTK_WINDOW(window->MenuWindow))),&x,&y); diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index 67ca9bc..24fe7ee 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -1,18 +1,23 @@ #include "ubinstall-gtk.h" int yon_kernel_save(main_window *widgets){ - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->KernelsList); - int size = 0; - config_str kernels = NULL; - for_iter(model,&iter){ - char *target; - int status,loaded; - gtk_tree_model_get(model,&iter,0,&status,1,&loaded,2,&target,-1); - if (status){ - yon_char_parsed_add_or_create_if_exists(kernels,&size,target); + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelListBox)); + char *install_modules = ""; + char *enabled_module = NULL; + for(GList *iter = list;iter;iter = iter->next){ + kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->InstallCheck))){ + char *temp = yon_char_unite(install_modules,!yon_char_is_empty(install_modules)?" ":"",row->modules,NULL); + if (!yon_char_is_empty(install_modules)) free(install_modules); + install_modules = temp; + } + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->EnableRadio))){ + enabled_module = row->package; } + } + + yon_config_register(KERNEL_BOOT_parameter,KERNEL_BOOT_parameter_command,enabled_module); return 1; } diff --git a/source/ubinstall-gtk-kernel.c b/source/ubinstall-gtk-kernel.c new file mode 100644 index 0000000..dd1ed55 --- /dev/null +++ b/source/ubinstall-gtk-kernel.c @@ -0,0 +1,180 @@ +#include "ubinstall-gtk.h" + + +kernel_row *yon_kernel_row_new(){ + kernel_row *row = new(kernel_row); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_kernel_row); + + row->RowBox = yon_gtk_builder_get_widget(builder,"TableRow"); + row->InstallCheck = yon_gtk_builder_get_widget(builder,"InstallCheck"); + row->EnableRadio = yon_gtk_builder_get_widget(builder,"EnableRadio"); + row->NameLabel = yon_gtk_builder_get_widget(builder,"NameLabel"); + row->TagsBox = yon_gtk_builder_get_widget(builder,"TagsBox"); + row->ModulesLabel = yon_gtk_builder_get_widget(builder,"ModulesLabel"); + row->DescriptionLabel = yon_gtk_builder_get_widget(builder,"DescriptionLabel"); + row->name=NULL; + row->modules=NULL; + row->package=NULL; + + row->row = gtk_list_box_row_new(); + gtk_container_add(GTK_CONTAINER(row->row),row->RowBox); + gtk_widget_show(row->row); + + g_object_set_data(G_OBJECT(row->InstallCheck),"kernel_row",row); + g_object_set_data(G_OBJECT(row->EnableRadio),"kernel_row",row); + g_object_set_data(G_OBJECT(row->row),"kernel_row",row); + + return row; +} + +int yon_tag_add(GtkBox *target,char *tag_label, char *tag_style, char *icon_name){ + if (GTK_IS_BOX(target)&&!yon_char_is_empty(tag_label)&&!yon_char_is_empty(tag_style)){ + GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2); + GtkWidget *label = gtk_label_new(tag_label); + PangoAttrList *attr = pango_attr_list_new(); + PangoAttribute *scale_attr = pango_attr_size_new_absolute(12 * PANGO_SCALE); + gtk_label_set_attributes(GTK_LABEL(label),attr); + + g_object_set_data(G_OBJECT(box),"label",label); + + pango_attr_list_insert(attr,scale_attr); + gtk_widget_set_hexpand(box, TRUE); + gtk_widget_set_halign(box, GTK_ALIGN_FILL); + + gtk_style_context_add_class(gtk_widget_get_style_context(label),tag_style); + GtkWidget *icon = NULL; + if (icon_name){ + icon = gtk_image_new_from_icon_name(icon_name,GTK_ICON_SIZE_BUTTON); + gtk_box_pack_start(GTK_BOX(box),icon,0,0,0); + } + gtk_box_pack_start(GTK_BOX(box),label,1,1,0); + gtk_widget_show(label); + gtk_widget_show(box); + gtk_box_pack_start(target,box,0,0,0); + return 1; + } + return 0; +} + +void yon_kernel_row_setup_tags(kernel_row *row, char *tags){ + int size; + config_str parsed = yon_char_parse(tags,&size,", "); + for (int i=0;iTagsBox),tag_name,tag_type,NULL); + } +} + +void yon_kernel_row_setup(kernel_row *row, char *name, char *modules,char *package, char *tags, char *description){ + row->name = yon_char_new(name); + row->modules = yon_char_new(modules); + row->package = yon_char_new(package); + + guint size; + config_str description_wrapped = yon_char_wrap_to_lines(description,3,&size); + char *description_full = yon_char_parsed_to_string(description_wrapped,size,"\n"); + gtk_label_set_label(GTK_LABEL(row->NameLabel),name); + gtk_label_set_label(GTK_LABEL(row->ModulesLabel),modules); + gtk_label_set_label(GTK_LABEL(row->DescriptionLabel),description_full); + + yon_kernel_row_setup_tags(row,tags); + yon_char_parsed_free(description_wrapped,size); + free(description_full); +} + +void yon_kernel_resize(main_window *widgets){ + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelListBox)); + GList *iter = list; + + int name_size=0; + int tags_size=0; + int modules_size=0; + for (;iter;iter=iter->next){ + kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); + int cur_name_size; + int cur_tags_size; + int cur_modules_size; + gtk_widget_realize(row->NameLabel); + gtk_widget_realize(row->TagsBox); + gtk_widget_realize(row->ModulesLabel); + while (g_main_context_iteration(NULL, FALSE)); + gtk_widget_get_preferred_width(row->NameLabel,&cur_name_size,NULL); + gtk_widget_get_preferred_width(row->TagsBox,NULL,&cur_tags_size); + gtk_widget_get_preferred_width(row->ModulesLabel,&cur_modules_size,NULL); + if (name_sizenext){ + kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); + gtk_widget_set_size_request(row->NameLabel,name_size,-1); + // gtk_widget_set_size_request(row->TagsBox,tags_size,-1); + GList *list = gtk_container_get_children(GTK_CONTAINER(row->TagsBox)); + for (GList *iter = list;iter;iter=iter->next){ + gtk_widget_set_size_request(GTK_WIDGET(g_object_get_data(G_OBJECT(iter->data),"label")),tags_size,-1); + + } + gtk_widget_set_size_request(row->ModulesLabel,modules_size,-1); + } +} + +void yon_kernel_setup(main_window *widgets){ + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelListBox)); + GList *iter; + for (iter = list; iter; iter = iter->next){ + kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); + if (row){ + if (row->name) free(row->name); + if (!yon_char_is_empty(row->modules)) free(row->modules); + free(row); + gtk_widget_destroy(GTK_WIDGET(iter->data)); + } + } + g_list_free(list); + + int size; + config_str kernels = yon_resource_open_file(kernel_list_path,&size); + + GtkWidget *radio_group = NULL; + for (int i=1;iKernelListBox),row->row,-1); + + if (!radio_group) { + radio_group = row->EnableRadio; + } + gtk_radio_button_join_group(GTK_RADIO_BUTTON(row->EnableRadio),GTK_RADIO_BUTTON(radio_group)); + + yon_kernel_row_setup(row,name,modules,package,tags,description); + yon_char_parsed_free(parsed,parsed_size); + } + yon_kernel_resize(widgets); + + yon_char_parsed_free(kernels,size); + + +} \ No newline at end of file diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index ed6bf10..6e4ac95 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -428,8 +428,7 @@ main_window *yon_main_window_complete(){ widgets->ReadFullLogButton = yon_gtk_builder_get_widget(builder,"ReadFullLogButton"); - widgets->KernelsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"KernelsList")); - widgets->KernelsTree = yon_gtk_builder_get_widget(builder,"KernelsTree"); + widgets->KernelListBox = yon_gtk_builder_get_widget(builder,"KernelListBox"); widgets->OSSoftwareTree = yon_gtk_builder_get_widget(builder,"OSSoftwareTree"); widgets->OSSoftwareList = GTK_LIST_STORE(gtk_builder_get_object(builder,"OSSoftwareList")); @@ -708,6 +707,7 @@ main_window *yon_main_window_complete(){ gtk_builder_connect_signals(builder,NULL); // yon_load_proceed(YON_CONFIG_DEFAULT); // yon_interface_update(widgets); + yon_kernel_setup(widgets); } return widgets; } diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index e133abb..9681dfa 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -29,6 +29,7 @@ #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 CssPath "/com/ublinux/css/ubinstall-gtk.css" #define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) @@ -51,6 +52,7 @@ #define zone_path "/usr/share/zoneinfo/" #define additional_software_path "resource:///com/ublinux/csv/modules.csv" +#define kernel_list_path "resource:///com/ublinux/csv/kernel-list.csv" #define slide_0_path "/com/ublinux/images/slide-0.png" @@ -154,6 +156,8 @@ NULL #define USERADD_parameter_all "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 geet autoinstall AUTOINSTALL[ubconfig set [boot] KERNEL_BOOT]" #define save_config_command(parameters) yon_char_unite("ubconfig --target system set [autoinstall] AUTOINSTALL[log]=yes ",parameters, "; nice ubinstall2 --debug autoinstall", NULL) @@ -489,8 +493,8 @@ typedef struct { GtkWidget *AutologinSensitiveCheck; GtkWidget *HostnameSensitiveCheck; - GtkWidget *KernelsTree; - GtkListStore *KernelsList; + GtkWidget *KernelListBox; + GtkWidget *OSSoftwareTree; GtkListStore *OSSoftwareList; GtkWidget *StartupServicesTree; @@ -676,6 +680,21 @@ typedef struct { } yon_menu_item; +typedef struct { + GtkWidget *row; + GtkWidget *RowBox; + GtkWidget *InstallCheck; + GtkWidget *EnableRadio; + GtkWidget *TagsBox; + GtkWidget *NameLabel; + GtkWidget *DescriptionLabel; + GtkWidget *ModulesLabel; + + char *name; + char *modules; + char *package; +} kernel_row; + void config_init(); main_window *yon_main_window_complete(); ubinstall_language_window *yon_ubinstall_language_new(); @@ -797,4 +816,10 @@ 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 on_menu_chosen(GtkWidget *, yon_menu_item *item); \ No newline at end of file +void on_menu_chosen(GtkWidget *, yon_menu_item *item); +void yon_kernel_setup(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); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 03e63b6..f44e209 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -187,4 +187,12 @@ #define DEFAULT_BOOTLOAD_MENU_ITEM_LABEL _("Default (Use last succeeded)") #define ENCRYPT_ERROR_LABEL _("Password encryption error") -#define DEFAULT_MENU_ITEM_LABEL _("Default (Use last succeeded)") \ No newline at end of file +#define DEFAULT_MENU_ITEM_LABEL _("Default (Use last succeeded)") + +#define LAUNCH_LABEL _("Launch") +#define LTS_TAG _("LTS") +#define REACTIVE_TAG _("Reactive") +#define RECOMENDED_TAG _("Recomended") +#define HARDENED_TAG _("Hardened") +#define REALTIME_TAG _("RealTime") +#define STABLE_TAG _("Stable") \ No newline at end of file diff --git a/ubinstall-gtk-kernel-row.glade b/ubinstall-gtk-kernel-row.glade new file mode 100644 index 0000000..74540e0 --- /dev/null +++ b/ubinstall-gtk-kernel-row.glade @@ -0,0 +1,145 @@ + + + + + + + True + False + 1 + vertical + + + True + False + 5 + 15 + + + True + True + False + 5 + True + + + + + + False + True + 0 + + + + + True + True + False + 5 + True + True + + + + + + False + True + 1 + + + + + True + False + center + 5 + 5 + vertical + 1 + + + True + False + Name + True + False + 0 + + + False + True + 0 + + + + + False + True + 2 + + + + + True + False + start + 5 + 5 + vertical + 2 + True + + + + + + False + True + 3 + + + + + True + False + 5 + label + 0 + + + False + True + 4 + + + + + True + False + 5 + 0 + + + True + True + end + 6 + + + + + + False + True + 0 + + + + + diff --git a/ubinstall-gtk.css b/ubinstall-gtk.css index 0dba73b..1e2e569 100644 --- a/ubinstall-gtk.css +++ b/ubinstall-gtk.css @@ -232,4 +232,74 @@ treeview row:nth-child(even) { background-color: #ffffff; } border-style:solid; border-width:0.3px; box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15); +} + +.tag_red{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#660000; + border-color: #cf2a27; + + background-color:#ea9999 +} +.tag_blue{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#073763; + border-color: #2b78e4; + + background-color:#9fc5f8 +} +.tag_purple{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#073763; + border-color: #9900ff; + + background-color:#b4a7d6 +} +.tag_orange{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#783f04; + border-color: #ff9900; + + background-color:#f9cb9c +} +.tag_yellow{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#7f6000; + border-color: #bf9000; + + background-color:#ffe599 +} +.tag_green{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + border-color: #009e0f; + background-color:#b6d7a8; + color:#274e13; +} +.tag_grey{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#5f5f5f; + border-color: #777777; + + background-color:#999999 } \ No newline at end of file diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 5320c08..e2c0aec 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -1,5 +1,5 @@ - + @@ -1520,68 +1520,18 @@ and help you install UBLinux on your computer True in - + True - True - KernelsList - 0 - - - - - - - - - 0 - - - - - - - Load - - - True - - - 1 - - - - - - - Kernel - - - - 2 - - - - - - - Modules - - - - 3 - - - - + False - - Description - - - - 4 - - + + True + False + 5 + 5 + 5 + 5 + none -- 2.35.1 From 8f6936eb08da75f46ae69df47d13538ad1a2226e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 22 Jul 2025 17:50:39 +0600 Subject: [PATCH 08/18] WIP Table slides --- gresource.xml | 3 + kernel-list-addon.csv | 13 + services-list.csv | 11 + source/CMakeLists.txt | 4 + source/ubinstall-gtk-installation.c | 116 ----- source/ubinstall-gtk-kernel.c | 126 ++++- source/ubinstall-gtk-page-switch.c | 6 +- source/ubinstall-gtk-startup-services.c | 135 ++++++ source/ubinstall-gtk.c | 43 +- source/ubinstall-gtk.h | 49 +- source/ubl-strings.h | 7 +- ubinstall-gtk-kernel-row.glade | 94 ++-- ubinstall-gtk-service-window.glade | 219 +++++++++ ubinstall-gtk.css | 12 + ubinstall-gtk.glade | 581 +++++++++++++++++++++--- 15 files changed, 1189 insertions(+), 230 deletions(-) create mode 100644 kernel-list-addon.csv create mode 100644 services-list.csv create mode 100644 source/ubinstall-gtk-startup-services.c create mode 100644 ubinstall-gtk-service-window.glade diff --git a/gresource.xml b/gresource.xml index 3873c32..fb7213e 100644 --- a/gresource.xml +++ b/gresource.xml @@ -12,6 +12,7 @@ ubinstall-gtk-menu.glade ubinstall-gtk-menu-item.glade ubinstall-gtk-kernel-row.glade + ubinstall-gtk-service-window.glade ubinstall-gtk.css @@ -42,5 +43,7 @@ modules.csv kernel-list.csv + kernel-list-addon.csv + services-list.csv \ No newline at end of file diff --git a/kernel-list-addon.csv b/kernel-list-addon.csv new file mode 100644 index 0000000..d7f1808 --- /dev/null +++ b/kernel-list-addon.csv @@ -0,0 +1,13 @@ +NAME;PAСKAGE_UBM;PAСKAGE;DESCRIPTION +Linux 5.15 headers;ubm-002-linux515-headers;linux515-headers;The Linux kernel headers v5.15 +Linux 5.15 Docs;ubm-003-linux515-docs;linux515-docs;The Linux kernel docs v5.15 +Linux 5.15 DKMS modules;ubm-linux515-dkms;;The Linux kernel DKMS modules v5.15 : v4l2loopback, rtl88x2bu, r8125, rtl8192eu +Linux 5.15 DKMS modules;ubm-linux515-r8168-8136;;The Linux kernel DKMS modules v5.15 : r8168-8136 +Linux 6.1 headers;ubm-002-linux61-headers;linux61-headers;The Linux kernel headers v6.1 +Linux 6.1 Docs;ubm-003-linux61-docs;linux61-docs;The Linux kernel docs v6.1 +Linux 6.1 DKMS modules;ubm-linux61-dkms;;The Linux kernel DKMS modules v6.1 : v4l2loopback, rtl88x2bu, r8125, rtl8192eu +Linux 6.1 DKMS modules;ubm-linux61-r8168-8136;;The Linux kernel DKMS modules v6.1 : r8168-8136 +Linux 6.6 headers;ubm-002-linux66-headers;linux66-headers;The Linux kernel headers v6.6 +Linux 6.6 Docs;ubm-003-linux66-docs;linux66-docs;The Linux kernel docs v6.6 +Linux 6.6 DKMS modules;ubm-linux66-dkms;;The Linux kernel DKMS modules v6.6 : v4l2loopback, rtl88x2bu, r8125, rtl8192eu +Linux 6.6 DKMS modules;ubm-linux66-dkms-r8168-8136;;The Linux kernel DKMS modules v6.6 : r8168-8136 \ No newline at end of file diff --git a/services-list.csv b/services-list.csv new file mode 100644 index 0000000..fbb62e4 --- /dev/null +++ b/services-list.csv @@ -0,0 +1,11 @@ +NAME;NAME_SERVICES;DESCRIPTION +UBManager WebPanel;cockpit.socket;Operating system monitoring and management manager service +Network Manager;NetworkManager;Is a program for providing detection and configuration for systems to automatically connect to networks +SSH;sshd;The daemon that listens for connections from clients on port 22 +NTP Client;systemd-timesyncd;Is a system service that may be used to synchronize the local system clock with a remote Network Time Protocol (NTP) server +Avahi;avahi-daemon,avahi-dnsconfd;Is a free zero-configuration networking (zeroconf) implementation, including a system for multicast DNS and DNS Service Discovery +CUPS;cups;Is a modular printing system for Unix-like computer operating systems which allows a computer to act as a print server +Samba;smb,nmb;Provides network shares for folders and printers using the SMB/CIFS protocol commonly used on Windows. SMB and NMB Daemon +Samba winbind;winbind;Provides network shares for folders and printers using the SMB/CIFS protocol commonly used on Windows. Winbind Daemon +SwapSpace;swapspace;Operating system dynamic swap file management service +Bluetouth;bluetooth;A Service is a container for logically related Bluetooth data items \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 15bc804..cbb8ef1 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -69,10 +69,13 @@ set(DEPENDFILES ../ubinstall-gtk-menu.glade ../ubinstall-gtk-menu-item.glade ../ubinstall-gtk-kernel-row.glade + ../ubinstall-gtk-service-window.glade ../gresource.xml ../ubinstall-gtk.css ../modules.csv ../kernel-list.csv + ../kernel-list-addon.csv + ../services-list.csv ) file(COPY ${DEPENDFILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) @@ -127,6 +130,7 @@ set(SOURCE_FILES ubinstall-gtk-saving.c ubinstall-gtk-standard.c ubinstall-gtk-install-start.c + ubinstall-gtk-startup-services.c ubinstall-gtk-kernel.c ubinstall-gtk.h ubl-strings.h diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 1066501..f95e88d 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -274,84 +274,6 @@ void on_partition_changed(GtkWidget *self, main_window *widgets){ } -// void on_separate_installation_changed(GtkWidget *self, main_window *widgets){ - -// gtk_list_store_clear(widgets->PartitionsList); -// GtkTreeIter iter; -// GtkTreeModel *model; -// if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(self)),&model,&iter)){ -// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SeparateUserDevicesTree)),&iter); -// char *disk_path=""; -// gtk_tree_model_get(model,&iter,0,&disk_path,-1); -// int size; -// config_str partitions; -// partitions = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); -// for (int i=0;i1024;sz=sz+1){ -// free_space=free_space/1024; -// } -// if (sz==-1) { -// sz=0; -// free_space=free_space/1024; -// } -// free_space_string = yon_char_append(yon_char_from_double(free_space)," "); -// free_space_string[strlen(free_space_string)-1]=*(yon_size_get_mod(sz)); -// } -// gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin)),0.0); -// gtk_list_store_append(widgets->PartitionsList,&iter); -// gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(size),2,free_space_string,3,json_object_get_string(fstype),-1); -// } -// yon_char_parsed_free(parsed,size); -// } -// } - void on_device_selection_changed(GtkWidget *self, main_window *widgets){ gtk_list_store_clear(widgets->PartitionsList); GtkTreeIter iter; @@ -408,41 +330,3 @@ void on_device_selection_changed(GtkWidget *self, main_window *widgets){ gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin)),0.0); } } - -// void on_same_installation_device_changed(GtkWidget *, main_window *widgets){ -// gtk_list_store_clear(widgets->PartitionsList); -// GtkTreeIter iter; -// GtkTreeModel *model; -// if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SamePlaceDeviceTree)),&model,&iter)){ -// char *disk_path=""; -// gtk_tree_model_get(model,&iter,0,&disk_path,-1); -// int size; -// config_str parsed; -// parsed = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); -// char *string = yon_char_parsed_to_string(parsed,size,""); -// struct json_object *root; -// struct json_object *blockdevices; -// root = json_tokener_parse(string); -// json_object_object_get_ex(root, "blockdevices", &blockdevices); -// for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { -// struct json_object *device = json_object_array_get_idx(blockdevices, i); -// struct json_object *type, *path, *size, *model, *vendor, *serial; - -// json_object_object_get_ex(device, "type", &type); -// if (strcmp("part",json_object_get_string(type))) -// continue; -// json_object_object_get_ex(device, "path", &path); -// if (!strstr(json_object_get_string(path),disk_path)){ -// continue; -// } -// json_object_object_get_ex(device, "size", &size); -// json_object_object_get_ex(device, "model", &model); -// json_object_object_get_ex(device, "vendor", &vendor); -// json_object_object_get_ex(device, "serial", &serial); - -// gtk_list_store_append(widgets->PartitionsList,&iter); -// gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(model),2,json_object_get_string(serial),3,json_object_get_string(size),4,json_object_get_string(vendor),-1); -// } -// yon_char_parsed_free(parsed,size); -// } -// } diff --git a/source/ubinstall-gtk-kernel.c b/source/ubinstall-gtk-kernel.c index dd1ed55..db1756c 100644 --- a/source/ubinstall-gtk-kernel.c +++ b/source/ubinstall-gtk-kernel.c @@ -8,8 +8,10 @@ kernel_row *yon_kernel_row_new(){ row->RowBox = yon_gtk_builder_get_widget(builder,"TableRow"); row->InstallCheck = yon_gtk_builder_get_widget(builder,"InstallCheck"); row->EnableRadio = yon_gtk_builder_get_widget(builder,"EnableRadio"); + row->EnableSeparator = yon_gtk_builder_get_widget(builder,"EnableSeparator"); row->NameLabel = yon_gtk_builder_get_widget(builder,"NameLabel"); row->TagsBox = yon_gtk_builder_get_widget(builder,"TagsBox"); + row->TagsSeparator = yon_gtk_builder_get_widget(builder,"TagsSeparator"); row->ModulesLabel = yon_gtk_builder_get_widget(builder,"ModulesLabel"); row->DescriptionLabel = yon_gtk_builder_get_widget(builder,"DescriptionLabel"); row->name=NULL; @@ -38,8 +40,6 @@ int yon_tag_add(GtkBox *target,char *tag_label, char *tag_style, char *icon_name g_object_set_data(G_OBJECT(box),"label",label); pango_attr_list_insert(attr,scale_attr); - gtk_widget_set_hexpand(box, TRUE); - gtk_widget_set_halign(box, GTK_ALIGN_FILL); gtk_style_context_add_class(gtk_widget_get_style_context(label),tag_style); GtkWidget *icon = NULL; @@ -86,52 +86,86 @@ void yon_kernel_row_setup(kernel_row *row, char *name, char *modules,char *packa row->modules = yon_char_new(modules); row->package = yon_char_new(package); - guint size; - config_str description_wrapped = yon_char_wrap_to_lines(description,3,&size); - char *description_full = yon_char_parsed_to_string(description_wrapped,size,"\n"); + char *description_full = yon_char_new(description); + if (strlen(description)>100){ + guint size; + config_str description_wrapped = yon_char_wrap_to_lines(description,3,&size); + description_full = yon_char_parsed_to_string(description_wrapped,size,"\n"); + yon_char_parsed_free(description_wrapped,size); + } gtk_label_set_label(GTK_LABEL(row->NameLabel),name); gtk_label_set_label(GTK_LABEL(row->ModulesLabel),modules); gtk_label_set_label(GTK_LABEL(row->DescriptionLabel),description_full); yon_kernel_row_setup_tags(row,tags); - yon_char_parsed_free(description_wrapped,size); free(description_full); } void yon_kernel_resize(main_window *widgets){ GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelListBox)); GList *iter = list; + // gtk_widget_realize(widgets->KernelListBox); + int install_size=0; + int enable_size=0; + int name_size=0; + int modules_size=0; + gtk_widget_get_preferred_width(widgets->KernelInstallLabel,&install_size,NULL); + gtk_widget_get_preferred_width(widgets->KernelEnableLabel,&enable_size,NULL); + gtk_widget_get_preferred_width(widgets->KernelNameLabel,&name_size,NULL); + gtk_widget_get_preferred_width(widgets->KernelModulesLabel,&modules_size,NULL); + + for (;iter;iter=iter->next){ + kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); + int cur_name_size; + int cur_modules_size; + gtk_widget_get_preferred_width(row->NameLabel,&cur_name_size,NULL); + gtk_widget_get_preferred_width(row->ModulesLabel,&cur_modules_size,NULL); + if (name_sizeKernelNameLabel),name_size,-1); + gtk_widget_set_size_request(GTK_WIDGET(widgets->KernelModulesLabel),modules_size,-1); + for (iter = list;iter;iter = iter->next){ + kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); + gtk_widget_set_size_request(GTK_WIDGET(row->InstallCheck),install_size,-1); + gtk_widget_set_size_request(GTK_WIDGET(row->EnableRadio),enable_size,-1); + gtk_widget_set_size_request(row->NameLabel,name_size,-1); + gtk_widget_set_size_request(row->ModulesLabel,modules_size,-1); + } + g_list_free(list); +} + +void yon_kernel_addon_resize(main_window *widgets){ + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelAddonListBox)); + GList *iter = list; + // gtk_widget_realize(widgets->KernelListBox); + int install_size=0; int name_size=0; - int tags_size=0; int modules_size=0; + gtk_widget_get_preferred_width(widgets->KernelAddonInstallLabel,&install_size,NULL); + gtk_widget_get_preferred_width(widgets->KernelAddonNameLabel,&name_size,NULL); + gtk_widget_get_preferred_width(widgets->KernelAddonModulesLabel,&modules_size,NULL); + for (;iter;iter=iter->next){ kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); int cur_name_size; - int cur_tags_size; int cur_modules_size; - gtk_widget_realize(row->NameLabel); - gtk_widget_realize(row->TagsBox); - gtk_widget_realize(row->ModulesLabel); - while (g_main_context_iteration(NULL, FALSE)); + gtk_widget_get_preferred_width(row->NameLabel,&cur_name_size,NULL); - gtk_widget_get_preferred_width(row->TagsBox,NULL,&cur_tags_size); gtk_widget_get_preferred_width(row->ModulesLabel,&cur_modules_size,NULL); if (name_sizeKernelAddonNameLabel),name_size,-1); + gtk_widget_set_size_request(GTK_WIDGET(widgets->KernelAddonModulesLabel),modules_size,-1); for (iter = list;iter;iter = iter->next){ kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); + gtk_widget_set_size_request(GTK_WIDGET(row->InstallCheck),install_size,-1); gtk_widget_set_size_request(row->NameLabel,name_size,-1); - // gtk_widget_set_size_request(row->TagsBox,tags_size,-1); - GList *list = gtk_container_get_children(GTK_CONTAINER(row->TagsBox)); - for (GList *iter = list;iter;iter=iter->next){ - gtk_widget_set_size_request(GTK_WIDGET(g_object_get_data(G_OBJECT(iter->data),"label")),tags_size,-1); - - } gtk_widget_set_size_request(row->ModulesLabel,modules_size,-1); } + g_list_free(list); } void yon_kernel_setup(main_window *widgets){ @@ -150,6 +184,7 @@ void yon_kernel_setup(main_window *widgets){ int size; config_str kernels = yon_resource_open_file(kernel_list_path,&size); + gtk_size_group_add_widget(widgets->KernelSizeGroup,widgets->KernelTagsLabel); GtkWidget *radio_group = NULL; for (int i=1;iKernelListBox),row->row,-1); + gtk_size_group_add_widget(widgets->KernelSizeGroup,row->TagsBox); if (!radio_group) { radio_group = row->EnableRadio; @@ -177,4 +213,54 @@ void yon_kernel_setup(main_window *widgets){ yon_char_parsed_free(kernels,size); +} + +void yon_kernel_addon_setup(main_window *widgets){ + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelAddonListBox)); + GList *iter; + for (iter = list; iter; iter = iter->next){ + kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); + if (row){ + if (row->name) free(row->name); + if (!yon_char_is_empty(row->modules)) free(row->modules); + free(row); + gtk_widget_destroy(GTK_WIDGET(iter->data)); + } + } + g_list_free(list); + + int size; + config_str kernels = yon_resource_open_file(kernel_list_addon_path,&size); + + GtkWidget *radio_group = NULL; + for (int i=1;iKernelAddonListBox),row->row,-1); + gtk_size_group_add_widget(widgets->KernelSizeGroup,row->TagsBox); + gtk_widget_destroy(row->TagsBox); + gtk_widget_destroy(row->TagsSeparator); + gtk_widget_destroy(row->EnableRadio); + gtk_widget_destroy(row->EnableSeparator); + + if (!radio_group) { + radio_group = row->EnableRadio; + } + gtk_radio_button_join_group(GTK_RADIO_BUTTON(row->EnableRadio),GTK_RADIO_BUTTON(radio_group)); + + yon_kernel_row_setup(row,name,modules,package,tags,description); + yon_char_parsed_free(parsed,parsed_size); + } + yon_kernel_addon_resize(widgets); + + yon_char_parsed_free(kernels,size); + + } \ No newline at end of file diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index d6504e5..7d6a366 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -10,7 +10,8 @@ enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_SECTIONS: return yon_sections_get_next_page(widgets); break; case YON_PAGE_OS_COMPONENTS: return main_config.configure_mode? YON_PAGE_KERNEL : YON_PAGE_INSTALLATION_BEGIN; break; case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_KERNEL; break; - case YON_PAGE_KERNEL: return YON_PAGE_SOFTWARE; break; + case YON_PAGE_KERNEL: return YON_PAGE_KERNEL_ADDON; break; + case YON_PAGE_KERNEL_ADDON: return YON_PAGE_SOFTWARE; break; case YON_PAGE_SOFTWARE: return YON_PAGE_REGION; break; case YON_PAGE_REGION: return YON_PAGE_KEYBOARD; break; case YON_PAGE_KEYBOARD: return YON_PAGE_USERS; break; @@ -40,7 +41,8 @@ enum YON_PAGES yon_page_get_prev(enum YON_PAGES page){ case YON_PAGE_OS_COMPONENTS: return YON_PAGE_SECTIONS; break; case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_SECTIONS; break; case YON_PAGE_KERNEL: return YON_PAGE_SECTIONS; break; - case YON_PAGE_SOFTWARE: return YON_PAGE_KERNEL; break; + case YON_PAGE_KERNEL_ADDON: return YON_PAGE_KERNEL; break; + case YON_PAGE_SOFTWARE: return YON_PAGE_KERNEL_ADDON; break; case YON_PAGE_REGION: return YON_PAGE_SOFTWARE; break; case YON_PAGE_KEYBOARD: return YON_PAGE_REGION; break; case YON_PAGE_USERS: return YON_PAGE_KEYBOARD; break; diff --git a/source/ubinstall-gtk-startup-services.c b/source/ubinstall-gtk-startup-services.c new file mode 100644 index 0000000..e904e6d --- /dev/null +++ b/source/ubinstall-gtk-startup-services.c @@ -0,0 +1,135 @@ +#include "ubinstall-gtk.h" + + +void on_srartup_services_toggled(GtkWidget *, char *path, main_window *widgets){ + GtkTreeIter iter; + int status; + gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(widgets->StartupList),&iter,path); + gtk_tree_model_get(GTK_TREE_MODEL(widgets->StartupList),&iter,0,&status,-1); + gtk_list_store_set(widgets->StartupList,&iter,0,!status,-1); +} + +void on_startup_services_selection_changed(GtkWidget *,main_window *widgets){ + GtkTreeIter iter; + GtkTreeModel *model; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->StartupServicesTree)),&model,&iter)){ + int status; + gtk_tree_model_get(model,&iter,4,&status,-1); + if (status){ + gtk_widget_set_sensitive(widgets->StartupServicesEditButton,1); + gtk_widget_set_sensitive(widgets->StartupServicesRemoveButton,1); + return; + } + } + gtk_widget_set_sensitive(widgets->StartupServicesEditButton,0); + gtk_widget_set_sensitive(widgets->StartupServicesRemoveButton,0); +} + +void on_startup_services_remove(GtkWidget *self,main_window *widgets){ + GtkTreeIter iter; + GtkTreeModel *model; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->StartupServicesTree)),&model,&iter)){ + char *unit; + int deletable; + gtk_tree_model_get(model,&iter,2,&unit,4,&deletable,-1); + if (!deletable) return; + dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); + data->action_text = SERVICE_REMOVE_CONFIRMATION_LABEL(unit); + data->title = SERVICE_REMOVE_TITLE_LABEL; + if (yon_confirmation_dialog_call(self,data) == GTK_RESPONSE_ACCEPT){ + gtk_list_store_remove(widgets->StartupList,&iter); + } + } +} + +void yon_startup_services_setup(main_window *widgets){ + int size; + config_str services = yon_resource_open_file(services_list_path,&size); + for (int i=1;iStartupList,&iter); + gtk_list_store_set(widgets->StartupList,&iter,0,1,1,parsed[0],2,yon_char_return_if_exist(parsed[1],""),3,yon_char_return_if_exist(parsed[2],""),-1); + } + } +} + +void on_startup_add_accept(GtkWidget *self, main_window *widgets){ + startup_service_window *window = g_object_get_data(G_OBJECT(self),"startup_service_window"); + const char *unit = gtk_entry_get_text(GTK_ENTRY(window->UnitEntry)); + const char *service = gtk_entry_get_text(GTK_ENTRY(window->ServiceEntry)); + const char *description = gtk_entry_get_text(GTK_ENTRY(window->DescriptionEntry)); + if (yon_char_is_empty(service)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->ServiceEntry); + return; + } + GtkTreeIter iter; + gtk_list_store_append(widgets->StartupList,&iter); + gtk_list_store_set(widgets->StartupList,&iter,1,unit,2,service,3,description,4,1,-1); + on_subwindow_close(self); +} + +void on_startup_edit_accept(GtkWidget *self, main_window *widgets){ + GtkTreeIter iter; + GtkTreeModel *model; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->StartupServicesTree)),&model,&iter)){ + startup_service_window *window = g_object_get_data(G_OBJECT(self),"startup_service_window"); + const char *unit = gtk_entry_get_text(GTK_ENTRY(window->UnitEntry)); + const char *service = gtk_entry_get_text(GTK_ENTRY(window->ServiceEntry)); + const char *description = gtk_entry_get_text(GTK_ENTRY(window->DescriptionEntry)); + if (yon_char_is_empty(service)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->ServiceEntry); + return; + } + gtk_list_store_set(widgets->StartupList,&iter,1,unit,2,service,3,description,4,1,-1); + } + on_subwindow_close(self); +} + +startup_service_window *yon_startup_service_window_new(){ + startup_service_window *window = new(startup_service_window); + + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_service); + + window->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); + window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton"); + window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton"); + window->UnitEntry = yon_gtk_builder_get_widget(builder,"UnitEntry"); + window->ServiceEntry = yon_gtk_builder_get_widget(builder,"ServiceEntry"); + window->DescriptionEntry = yon_gtk_builder_get_widget(builder,"DescriptionEntry"); + + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + g_object_set_data(G_OBJECT(window->AcceptButton),"startup_service_window",window); + + return window; +} + +void on_startup_service_add(GtkWidget *, main_window *widgets){ + startup_service_window *window = yon_startup_service_window_new(); + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->MainWindow),SERVICE_ADD_TITLE_LABEL,icon_path,"service_add_window"); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_startup_add_accept),widgets); + gtk_widget_show(window->Window); +} + +void on_startup_service_edit(GtkWidget *, main_window *widgets){ + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->StartupServicesTree)),NULL,&iter)){ + char *service, *unit, *description; + int status; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->StartupList),&iter,1,&unit,2,&service,3,&description,4,&status,-1); + if (status){ + startup_service_window *window = yon_startup_service_window_new(); + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->MainWindow),SERVICE_EDIT_TITLE_LABEL,icon_path,"service_add_window"); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_startup_edit_accept),widgets); + gtk_entry_set_text(GTK_ENTRY(window->UnitEntry),unit); + gtk_entry_set_text(GTK_ENTRY(window->ServiceEntry),service); + gtk_entry_set_text(GTK_ENTRY(window->DescriptionEntry),description); + gtk_widget_show(window->Window); + } + } +} \ No newline at end of file diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 6e4ac95..8c7a951 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -121,6 +121,7 @@ void yon_switch_page_render(main_window *widgets){ case YON_PAGE_INSTALL_RECOVERY: case YON_PAGE_INSTALLATION_BEGIN: case YON_PAGE_KERNEL: + case YON_PAGE_KERNEL_ADDON: case YON_PAGE_SOFTWARE: case YON_PAGE_RECOVERY_GRUB_INSTALL: case YON_PAGE_RECOVERY_GRUB_UPDATE: @@ -193,9 +194,13 @@ void yon_switch_page_render(main_window *widgets){ // // } -// void on_additional_software_toggled(){ -// -// } +void on_additional_software_toggled(GtkWidget *, char *path, main_window *widgets){ + GtkTreeIter iter; + int status; + gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(widgets->AdditionalSoftwareList),&iter,path); + gtk_tree_model_get(GTK_TREE_MODEL(widgets->AdditionalSoftwareList),&iter,0,&status,-1); + gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,!status,-1); +} void on_gparted_open(){ yon_launch_app_with_arguments(open_gparted_command,NULL); @@ -241,7 +246,7 @@ gboolean on_yon_exit(GtkWidget *,GdkEvent*, main_window *widgets){ } - return 0; + return 1; } /**yon_main_window_complete(main_window *widgets) @@ -427,13 +432,29 @@ main_window *yon_main_window_complete(){ widgets->PackageInstallationLabel = yon_gtk_builder_get_widget(builder,"PackageInstallationLabel"); widgets->ReadFullLogButton = yon_gtk_builder_get_widget(builder,"ReadFullLogButton"); - widgets->KernelListBox = yon_gtk_builder_get_widget(builder,"KernelListBox"); + widgets->KernelInstallLabel = yon_gtk_builder_get_widget(builder,"KernelInstallLabel"); + widgets->KernelEnableLabel = yon_gtk_builder_get_widget(builder,"KernelEnableLabel"); + widgets->KernelNameLabel = yon_gtk_builder_get_widget(builder,"KernelNameLabel"); + widgets->KernelTagsLabel = yon_gtk_builder_get_widget(builder,"KernelTagsLabel"); + widgets->KernelModulesLabel = yon_gtk_builder_get_widget(builder,"KernelModulesLabel"); + widgets->KernelDescriptionLabel = yon_gtk_builder_get_widget(builder,"KernelDescriptionLabel"); + widgets->KernelSizeGroup = GTK_SIZE_GROUP(gtk_builder_get_object(builder,"TagsSizeGroup")); + + widgets->KernelAddonListBox = yon_gtk_builder_get_widget(builder,"KernelAddonListBox"); + widgets->KernelAddonInstallLabel = yon_gtk_builder_get_widget(builder,"KernelAddonInstallLabel"); + widgets->KernelAddonNameLabel = yon_gtk_builder_get_widget(builder,"KernelAddonNameLabel"); + widgets->KernelAddonModulesLabel = yon_gtk_builder_get_widget(builder,"KernelAddonModulesLabel"); + widgets->KernelAddonDescriptionLabel = yon_gtk_builder_get_widget(builder,"KernelAddonDescriptionLabel"); widgets->OSSoftwareTree = yon_gtk_builder_get_widget(builder,"OSSoftwareTree"); widgets->OSSoftwareList = GTK_LIST_STORE(gtk_builder_get_object(builder,"OSSoftwareList")); widgets->StartupServicesTree = yon_gtk_builder_get_widget(builder,"StartupServicesTree"); + widgets->StartupServicesAddButton = yon_gtk_builder_get_widget(builder,"StartupServicesAddButton"); + widgets->StartupServicesEditButton = yon_gtk_builder_get_widget(builder,"StartupServicesEditButton"); + widgets->StartupServicesRemoveButton = yon_gtk_builder_get_widget(builder,"StartupServicesRemoveButton"); + widgets->StartupChosenCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"StartupChosenCell")); widgets->StartupList = GTK_LIST_STORE(gtk_builder_get_object(builder,"StartupList")); widgets->BootloadTimerSwitch = yon_gtk_builder_get_widget(builder,"BootloadTimerSwitch"); @@ -518,7 +539,13 @@ main_window *yon_main_window_complete(){ // gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),3); // g_signal_connect(G_OBJECT(widgets->LanguageCombo),"changed",G_CALLBACK(on_locale_changed),widgets); - // g_signal_connect(G_OBJECT(widgets->AdditionalSoftwareCell),"toggled",G_CALLBACK(on_additional_software_toggled),widgets); + g_signal_connect(G_OBJECT(widgets->AdditionalSoftwareCell),"toggled",G_CALLBACK(on_additional_software_toggled),widgets); + g_signal_connect(G_OBJECT(widgets->StartupChosenCell),"toggled",G_CALLBACK(on_srartup_services_toggled),widgets); + + g_signal_connect(G_OBJECT(widgets->StartupServicesTree),"cursor-changed",G_CALLBACK(on_startup_services_selection_changed),widgets); + g_signal_connect(G_OBJECT(widgets->StartupServicesAddButton),"clicked",G_CALLBACK(on_startup_service_add),widgets); + g_signal_connect(G_OBJECT(widgets->StartupServicesEditButton),"clicked",G_CALLBACK(on_startup_service_edit),widgets); + g_signal_connect(G_OBJECT(widgets->StartupServicesRemoveButton),"clicked",G_CALLBACK(on_startup_services_remove),widgets); g_signal_connect(G_OBJECT(widgets->ManualLayoutRadio),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),gtk_widget_get_parent(gtk_widget_get_parent(widgets->AddButton))); @@ -691,7 +718,7 @@ main_window *yon_main_window_complete(){ config_str module_parsed = yon_char_parse(parsed[i],&module_size,"|"); if (module_size){ gtk_list_store_append(widgets->AdditionalSoftwareList,&iter); - gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,1,1,module_parsed[0],3,module_parsed[1],-1); //2,module_parsed[2] + gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,1,1,module_parsed[0],2,module_parsed[1],3,module_parsed[2],-1); //2,module_parsed[2] yon_char_parsed_free(module_parsed,module_size); } } @@ -708,6 +735,8 @@ main_window *yon_main_window_complete(){ // yon_load_proceed(YON_CONFIG_DEFAULT); // yon_interface_update(widgets); yon_kernel_setup(widgets); + yon_kernel_addon_setup(widgets); + yon_startup_services_setup(widgets); } return widgets; } diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 9681dfa..516c7cc 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -30,6 +30,7 @@ #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_service "/com/ublinux/ui/ubinstall-gtk-service-window.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) @@ -53,6 +54,8 @@ #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 slide_0_path "/com/ublinux/images/slide-0.png" @@ -265,6 +268,7 @@ enum YON_PAGES { YON_PAGE_OS_COMPONENTS, YON_PAGE_INSTALLATION_BEGIN, YON_PAGE_KERNEL, + YON_PAGE_KERNEL_ADDON, YON_PAGE_SOFTWARE, YON_PAGE_REGION, YON_PAGE_KEYBOARD, @@ -494,10 +498,28 @@ typedef struct { GtkWidget *HostnameSensitiveCheck; GtkWidget *KernelListBox; + GtkWidget *KernelInstallLabel; + GtkWidget *KernelEnableLabel; + GtkWidget *KernelNameLabel; + GtkWidget *KernelTagsLabel; + GtkWidget *KernelModulesLabel; + GtkWidget *KernelDescriptionLabel; + GtkSizeGroup *KernelSizeGroup; + + GtkWidget *KernelAddonListBox; + GtkWidget *KernelAddonInstallLabel; + GtkWidget *KernelAddonNameLabel; + GtkWidget *KernelAddonModulesLabel; + GtkWidget *KernelAddonDescriptionLabel; GtkWidget *OSSoftwareTree; GtkListStore *OSSoftwareList; + GtkWidget *StartupServicesTree; + GtkWidget *StartupServicesAddButton; + GtkWidget *StartupServicesEditButton; + GtkWidget *StartupServicesRemoveButton; + GtkCellRenderer *StartupChosenCell; GtkListStore *StartupList; GtkWidget *BootloadTimerSwitch; @@ -685,7 +707,9 @@ typedef struct { GtkWidget *RowBox; GtkWidget *InstallCheck; GtkWidget *EnableRadio; + GtkWidget *EnableSeparator; GtkWidget *TagsBox; + GtkWidget *TagsSeparator; GtkWidget *NameLabel; GtkWidget *DescriptionLabel; GtkWidget *ModulesLabel; @@ -695,6 +719,16 @@ typedef struct { char *package; } kernel_row; +typedef struct { + GtkWidget *Window; + GtkWidget *StatusBox; + GtkWidget *UnitEntry; + GtkWidget *ServiceEntry; + GtkWidget *DescriptionEntry; + GtkWidget *CancelButton; + GtkWidget *AcceptButton; +} startup_service_window; + void config_init(); main_window *yon_main_window_complete(); ubinstall_language_window *yon_ubinstall_language_new(); @@ -822,4 +856,17 @@ void yon_kernel_row_setup(kernel_row *row, char *name, char *modules,char *packa 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); \ No newline at end of file +void yon_kernel_resize(main_window *widgets); +void on_additional_software_toggled(GtkWidget *, char *path, main_window *widgets); +void yon_kernel_addon_setup(main_window *widgets); +void yon_kernel_addon_resize(main_window *widgets); +void yon_startup_services_setup(main_window *widgets); +void on_srartup_services_toggled(GtkWidget *, 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_setup(main_window *widgets); +void on_startup_services_remove(GtkWidget *self,main_window *widgets); +void on_startup_services_selection_changed(GtkWidget *,main_window *widgets); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index f44e209..07601ba 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -195,4 +195,9 @@ #define RECOMENDED_TAG _("Recomended") #define HARDENED_TAG _("Hardened") #define REALTIME_TAG _("RealTime") -#define STABLE_TAG _("Stable") \ No newline at end of file +#define STABLE_TAG _("Stable") + +#define SERVICE_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to remove service")," ",target," ",_("from the list"),"?",NULL) +#define SERVICE_ADD_TITLE_LABEL _("Add service") +#define SERVICE_EDIT_TITLE_LABEL _("Edit service") +#define SERVICE_REMOVE_TITLE_LABEL _("Remove service") \ No newline at end of file diff --git a/ubinstall-gtk-kernel-row.glade b/ubinstall-gtk-kernel-row.glade index 74540e0..8ca911b 100644 --- a/ubinstall-gtk-kernel-row.glade +++ b/ubinstall-gtk-kernel-row.glade @@ -13,7 +13,7 @@ True False 5 - 15 + 7 True @@ -31,11 +31,23 @@ 0 + + + True + False + + + False + True + 1 + + True True False + center 5 True True @@ -46,38 +58,44 @@ False True - 1 + 2 - + True False - center - 5 - 5 - vertical - 1 - - - True - False - Name - True - False - 0 - - - False - True - 0 - - False True - 2 + 3 + + + + + True + False + Name + True + False + 0 + + + False + True + 4 + + + + + True + False + + + False + True + 5 @@ -97,7 +115,18 @@ False True - 3 + 6 + + + + + True + False + + + False + True + 7 @@ -111,7 +140,7 @@ False True - 4 + 8 @@ -125,7 +154,18 @@ True True end - 6 + 9 + + + + + True + False + + + False + True + 10 + + + False + True + end + 2 + + + + + True + False + Accessed + + + False + True + end + 3 + + + + + True + False + + + + False + True + end + 4 + + + + + True + False + Repository status: + + + False + True + end + 5 + + + + + False + True + 0 + + + + + True + False + + + True + True + in + + + True + True + PacmanSoftwareAllList + 0 + + + + + + + + + 0 + + + + + + + Module name + + + + 1 + + + + + + + Type + + + + 2 + + + + + + + Description + + + + 3 + + + + + + + + + -1 + + + + + True + True + 1 + + + + + + + + + True + False + Selecting additional software to install from the repository via the Internet + + + + + True + True + 1 + + + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 + + + True + True + in + + + True + True + PacmanSoftwareChosenList + 0 + + + + + + + + + 0 + + + + + + + Module name + + + + 1 + + + + + + + Type + + + + 2 + + + + + + + Description + + + + 3 + + + + + + + + + + + + + True + False + Selecting additional software to install from the repository via the Internet + + + + + True + True + 2 + + + + + 8 + + + + + True + False + Pacman software + + + 8 + False + + True @@ -2407,7 +2776,7 @@ and help you install UBLinux on your computer - 8 + 9 @@ -2417,7 +2786,7 @@ and help you install UBLinux on your computer Region - 8 + 9 False @@ -2805,7 +3174,7 @@ and help you install UBLinux on your computer - 9 + 10 @@ -2815,7 +3184,7 @@ and help you install UBLinux on your computer Keyboard - 9 + 10 False @@ -3158,7 +3527,7 @@ and help you install UBLinux on your computer - 10 + 11 @@ -3168,7 +3537,7 @@ and help you install UBLinux on your computer Users - 10 + 11 False @@ -3349,7 +3718,7 @@ and help you install UBLinux on your computer - 11 + 12 @@ -3359,7 +3728,7 @@ and help you install UBLinux on your computer Startup configuration - 11 + 12 False @@ -3708,7 +4077,7 @@ and help you install UBLinux on your computer - 12 + 13 @@ -3718,7 +4087,7 @@ and help you install UBLinux on your computer Bootloader - 12 + 13 False @@ -4050,7 +4419,7 @@ and help you install UBLinux on your computer - 13 + 14 @@ -4060,7 +4429,7 @@ and help you install UBLinux on your computer Network - 13 + 14 False @@ -4100,7 +4469,7 @@ and help you install UBLinux on your computer - 14 + 15 @@ -4110,7 +4479,7 @@ and help you install UBLinux on your computer Installation process - 14 + 15 False @@ -4187,7 +4556,7 @@ or continue working in the UBLinux Live environment. - 15 + 16 @@ -4197,7 +4566,7 @@ or continue working in the UBLinux Live environment. Completion - 15 + 16 False @@ -4272,7 +4641,7 @@ or continue working in the UBLinux Live environment. - 16 + 17 @@ -4282,7 +4651,7 @@ or continue working in the UBLinux Live environment. Completed - 16 + 17 False @@ -4357,7 +4726,7 @@ or continue working in the UBLinux Live environment. - 17 + 18 @@ -4367,7 +4736,7 @@ or continue working in the UBLinux Live environment. Configuration error - 17 + 18 False @@ -4442,7 +4811,7 @@ or continue working in the UBLinux Live environment. - 18 + 19 @@ -4452,7 +4821,7 @@ or continue working in the UBLinux Live environment. Configuration end - 18 + 19 False @@ -4527,7 +4896,7 @@ or continue working in the UBLinux Live environment. - 19 + 20 @@ -4537,7 +4906,7 @@ or continue working in the UBLinux Live environment. Configuration saved - 19 + 20 False @@ -4981,7 +5350,7 @@ or continue working in the UBLinux Live environment. - 20 + 21 @@ -4991,7 +5360,7 @@ or continue working in the UBLinux Live environment. Common Installation - 20 + 21 False @@ -5660,7 +6029,7 @@ installed. - 21 + 22 @@ -5670,7 +6039,7 @@ installed. Installation next to system - 21 + 22 False @@ -6297,7 +6666,7 @@ installed. - 22 + 23 @@ -6307,7 +6676,7 @@ installed. Installation on same partition - 22 + 23 False @@ -7158,7 +7527,7 @@ separately into the selected partition. - 23 + 24 @@ -7168,7 +7537,7 @@ separately into the selected partition. Advanced section - 23 + 24 False @@ -7634,7 +8003,7 @@ separately into the selected partition. - 24 + 25 @@ -7644,7 +8013,7 @@ separately into the selected partition. Recovery section - 24 + 25 False @@ -8015,7 +8384,7 @@ separately into the selected partition. - 25 + 26 @@ -8025,7 +8394,7 @@ separately into the selected partition. GRUB install - 25 + 26 False @@ -8383,7 +8752,7 @@ separately into the selected partition. - 26 + 27 @@ -8393,7 +8762,7 @@ separately into the selected partition. GRUB update - 26 + 27 False @@ -9110,7 +9479,7 @@ separately into the selected partition. - 27 + 28 @@ -9120,7 +9489,7 @@ separately into the selected partition. OS only - 27 + 28 False @@ -9841,7 +10210,7 @@ separately into the selected partition. - 28 + 29 @@ -9851,7 +10220,7 @@ separately into the selected partition. User data only - 28 + 29 False -- 2.35.1 From f03b2967fe99365ddf11513cff662817468de479 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 24 Jul 2025 18:10:55 +0600 Subject: [PATCH 10/18] Pacman slide changes --- source/ubinstall-gtk-components.c | 30 +++++++++++++++++++++++++----- source/ubinstall-gtk-page-switch.c | 4 ++-- source/ubinstall-gtk.c | 29 ++++++++++++++++++----------- source/ubinstall-gtk.h | 6 +++++- 4 files changed, 50 insertions(+), 19 deletions(-) diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index f3aa8ff..5014639 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -10,13 +10,18 @@ int yon_kernel_save(main_window *widgets){ char *temp = yon_char_unite(install_modules,!yon_char_is_empty(install_modules)?" ":"",row->modules,NULL); if (!yon_char_is_empty(install_modules)) free(install_modules); install_modules = temp; - } - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->EnableRadio))){ - enabled_module = row->package; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->EnableRadio))){ + enabled_module = row->package; + } } } + if (!yon_char_is_empty(install_modules)){ + yon_config_register(modules_extra_parameter,modules_extra_parameter_command,install_modules); + } else { + yon_config_remove_by_key(modules_extra_parameter); + } yon_config_register(KERNEL_BOOT_parameter,KERNEL_BOOT_parameter_command,enabled_module); return 1; @@ -68,7 +73,22 @@ int yon_software_save(main_window *widgets){ return 1; } -int yon_pacman_software_save(main_window *){ - +int yon_pacman_software_save(main_window *widgets){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->PacmanSoftwareChosenList); + int size; + config_str parameters = NULL; + for_iter(model,&iter){ + char *target; + gtk_tree_model_get(model,&iter,1,&target,-1); + yon_char_parsed_add_or_create_if_exists(parameters,&size,target); + } + char *final = yon_char_parsed_to_string(parameters,size,","); + yon_char_parsed_free(parameters,size); + if (!yon_char_is_empty(final)){ + yon_config_register(packages_parameter,packages_parameter_command,final); + } else { + yon_config_remove_by_key(packages_parameter); + } return 1; } \ No newline at end of file diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index 6df3698..780750e 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -12,8 +12,8 @@ enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_KERNEL; break; case YON_PAGE_KERNEL: return YON_PAGE_KERNEL_ADDON; break; case YON_PAGE_KERNEL_ADDON: return YON_PAGE_PACMAN_SOFTWARE; break; - case YON_PAGE_PACMAN_SOFTWARE: return YON_PAGE_SOFTWARE; - case YON_PAGE_SOFTWARE: return YON_PAGE_REGION; break; + case YON_PAGE_PACMAN_SOFTWARE: return YON_PAGE_REGION; + case YON_PAGE_SOFTWARE: return YON_PAGE_PACMAN_SOFTWARE; break; case YON_PAGE_REGION: return YON_PAGE_KEYBOARD; break; case YON_PAGE_KEYBOARD: return YON_PAGE_USERS; break; case YON_PAGE_USERS: return YON_PAGE_STARTUP; break; diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 6d3b1a4..89efdb4 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -22,6 +22,7 @@ void on_pacman_software_all_toggled(GtkWidget *, char *path, main_window *widget gtk_list_store_remove(widgets->PacmanSoftwareAllList,&iter); gtk_list_store_append(widgets->PacmanSoftwareChosenList,&iter); gtk_list_store_set(widgets->PacmanSoftwareChosenList,&iter,0,1,1,name,2,type,3,description,-1); + g_hash_table_add(widgets->pacmanchosen,yon_char_new(name)); } @@ -33,7 +34,7 @@ void on_pacman_software_chosen_toggled(GtkWidget *, char *path, main_window *wid gtk_list_store_remove(widgets->PacmanSoftwareChosenList,&iter); gtk_list_store_append(widgets->PacmanSoftwareAllList,&iter); gtk_list_store_set(widgets->PacmanSoftwareAllList,&iter,0,0,1,name,2,type,3,description,-1); - + g_hash_table_remove(widgets->pacmanchosen,name); } gboolean yon_pacman_fill(struct pacman_struct *pacman){ @@ -43,14 +44,14 @@ gboolean yon_pacman_fill(struct pacman_struct *pacman){ for (int i=0;ipacmanchosen,loaded[i])) continue; + char *version = yon_packages_get_version(YON_PACKAGES_SYNC,loaded[i]); + char *description = yon_packages_get_description(YON_PACKAGES_SYNC,loaded[i]); GtkTreeIter iter; gtk_list_store_append(widgets->PacmanSoftwareAllList,&iter); - gtk_list_store_set(widgets->PacmanSoftwareAllList,&iter,0,0,1,parsed[0],2,parsed[1],3,parsed[2],-1); - yon_char_parsed_free(parsed,parsed_size); + gtk_list_store_set(widgets->PacmanSoftwareAllList,&iter,0,0,1,loaded[i],2,version,3,description,-1); + if (!yon_char_is_empty(version))free(version); + if (!yon_char_is_empty(description)) free(description); } yon_char_parsed_free(loaded,size); gtk_widget_set_sensitive(widgets->PacmanSoftwareSearchEntry,1); @@ -63,8 +64,8 @@ gboolean yon_pacman_fill(struct pacman_struct *pacman){ void *yon_pacman_load(struct pacman_struct *pacman){ const char *find_package = pacman->find_package; - char *command = get_local_module_info_command(find_package); - pacman->packages = yon_config_load(yon_debug_output("%s\n",command),&pacman->packages_size); + // char *command = get_local_module_info_command(find_package); + pacman->packages = yon_packages_find(YON_PACKAGES_SYNC,find_package,&pacman->packages_size); g_idle_add((GSourceFunc)yon_pacman_fill,pacman); return NULL; } @@ -150,6 +151,7 @@ void config_init(){ main_config.log_progress_buzy=0; main_config.log_end=0; main_config.exit_accepted=0; + yon_packages_init(); } // void on_root_get_root(char *argline){ @@ -507,6 +509,7 @@ main_window *yon_main_window_complete(){ widgets->HostnameSensitiveCheck = yon_gtk_builder_get_widget(builder,"HostnameSensitiveCheck"); widgets->AutoHostnameCheck=yon_gtk_builder_get_widget(builder,"AutoHostnameCheck"); widgets->network_connections = NULL; + widgets->pacmanchosen = g_hash_table_new_full(g_str_hash,g_str_equal,free,NULL); main_config.status_box = widgets->StatusBox; } @@ -747,16 +750,20 @@ main_window *yon_main_window_complete(){ int base_size; config_str base = yon_file_ls(system_base_modules_path,&base_size); for (int i=0;iOSSoftwareList,&iter); - gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,base[i],-1); + gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,base[i],2,version,3,description,-1); } int modules_size; config_str modules = yon_file_ls(system_modules_path,&modules_size); for (int i=0;iOSSoftwareList,&iter); - gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,modules[i],-1); + char *version = yon_packages_get_version(YON_PACKAGES_SYNC,base[i]); + char *description = yon_packages_get_description(YON_PACKAGES_SYNC,base[i]); + gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,modules[i],2,version,3,description,-1); } } diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 738c472..267bf9c 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -152,6 +152,8 @@ NULL #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 "AOUTINSTALL[ubconfig set [network] NTPSERVERS]" @@ -533,6 +535,7 @@ typedef struct { GtkWidget *PacmanSoftwareAllPackagesTree; GtkListStore *PacmanSoftwareAllList; GtkCellRenderer *PacmanSoftwareAllCell; + GHashTable *pacmanchosen; GtkWidget *PacmanSoftwareChosenPackagesTree; GtkListStore *PacmanSoftwareChosenList; @@ -586,6 +589,7 @@ typedef struct { GFileMonitor *install_progress_monitor; GFile *install_info_file; GFileMonitor *install_info_monitor; + } main_window; typedef struct { @@ -755,7 +759,7 @@ typedef struct { struct pacman_struct{ main_window *widgets; const char *find_package; - int packages_size; + gsize packages_size; config_str packages; }; -- 2.35.1 From f5e9c95c603d8195af469b3279a429bb24e01e4e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 25 Jul 2025 18:02:14 +0600 Subject: [PATCH 11/18] Bootloader saving; Bootloader loading; WIP Network saving --- gresource.xml | 2 + source/CMakeLists.txt | 2 + source/ubinstall-gtk-bootloader.c | 186 ++++++++++++++++++++++- source/ubinstall-gtk-components.c | 37 ++++- source/ubinstall-gtk-network.c | 113 ++++++++++---- source/ubinstall-gtk-page-switch.c | 3 + source/ubinstall-gtk.c | 25 +++- source/ubinstall-gtk.h | 68 +++++++-- source/ubl-strings.h | 6 +- ubinstall-gtk-bootloader-user.glade | 222 ++++++++++++++++++++++++++++ ubinstall-gtk-network-box.glade | 9 +- ubinstall-gtk.glade | 39 +++-- 12 files changed, 637 insertions(+), 75 deletions(-) create mode 100644 ubinstall-gtk-bootloader-user.glade diff --git a/gresource.xml b/gresource.xml index fb7213e..11c7f36 100644 --- a/gresource.xml +++ b/gresource.xml @@ -13,6 +13,8 @@ ubinstall-gtk-menu-item.glade ubinstall-gtk-kernel-row.glade ubinstall-gtk-service-window.glade + ubinstall-gtk-bootloader-user.glade + ubinstall-gtk-network-box.glade ubinstall-gtk.css diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index cbb8ef1..f7b276d 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -70,6 +70,8 @@ set(DEPENDFILES ../ubinstall-gtk-menu-item.glade ../ubinstall-gtk-kernel-row.glade ../ubinstall-gtk-service-window.glade + ../ubinstall-gtk-bootloader-user.glade + ../ubinstall-gtk-network-box.glade ../gresource.xml ../ubinstall-gtk.css ../modules.csv diff --git a/source/ubinstall-gtk-bootloader.c b/source/ubinstall-gtk-bootloader.c index 0d19168..dc5bdc4 100644 --- a/source/ubinstall-gtk-bootloader.c +++ b/source/ubinstall-gtk-bootloader.c @@ -2,29 +2,163 @@ int yon_bootloader_save(main_window *widgets){ if (gtk_switch_get_active(GTK_SWITCH(widgets->BootloadTimerSwitch))){ - // long time = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->BootloadTimerSpin)); - // yon_config_register(,,yon_char_from_long(time)); + long time = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->BootloadTimerSpin)); + yon_config_register(GRUB_TIMEOUT_parameter,GRUB_TIMEOUT_parameter_command,yon_char_from_long(time)); + } else { + yon_config_remove_by_key(GRUB_TIMEOUT_parameter); } char *OS = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->BootloadDefaultOSEntry)); if (strcmp(OS,DEFAULT_BOOTLOAD_MENU_ITEM_LABEL)){ - // yon_config_register(,,OS); + yon_config_register(GRUB_DEFAULT_parameter,GRUB_DEFAULT_parameter_command,OS); } else { - // yon_config_remove_by_key(); + yon_config_remove_by_key(GRUB_DEFAULT_parameter); } if (gtk_switch_get_active(GTK_SWITCH(widgets->BootloadNoPasswordSwitch))){ GtkTreeIter iter; + yon_config_register(AUTOLOGINUSER_parameter,AUTOLOGINUSER_parameter_command,"yes"); GtkTreeModel *model = GTK_TREE_MODEL(widgets->BootloadUsersList); + int admin_size=0; + config_str admin_list = NULL; for_iter(model,&iter){ int is_admin; char *username, *password; gtk_tree_model_get(model,&iter,0,&is_admin,1,&username,2,&password,-1); - // yon_config_register(,,); + if (is_admin){ + yon_char_parsed_add_or_create_if_exists(admin_list,&admin_size,username); + } + char *admin_string = yon_char_parsed_to_string(admin_list,admin_size,","); + yon_config_register(GRUB_PASSWORD_parameter(username),GRUB_PASSWORD_parameter_command(username),password); + yon_config_register(GRUB_SUPERUSERS_parameter,GRUB_SUPERUSERS_parameter_command,admin_string); + free(admin_string); } } else { - // yon_config_remove_by_key(); + int size; + config_str users = yon_config_get_all_by_key(GRUB_PASSWORD_parameter_search,&size); + for (int i=0;iPasswordEntry); + yon_password_window *dialog = yon_password_open(output_target); + yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(window->Window),NULL,icon_path,"password_window"); + gtk_widget_show(window->Window); + +} + +void on_bootloader_user_accept(GtkWidget *, bootloader_user_window *window){ + main_window *widgets = g_object_get_data(G_OBJECT(window->AcceptButton),"widgets"); + const char *username = gtk_entry_get_text(GTK_ENTRY(window->UsernameEntry)); + + if (yon_char_is_empty(window->prev_name)){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->BootloadUsersList); + for_iter(model,&iter){ + char *name; + gtk_tree_model_get(model,&iter,1,&name,-1); + if (!strcmp(name,username)){ + dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); + data->action_text = BOOTLOADER_USER_EXIST_LABEL(username); + if (yon_confirmation_dialog_call(window->Window,data)!=GTK_RESPONSE_ACCEPT){ + return; + } + } + } + } + const char *password = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); + if (yon_char_is_empty(username)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->UsernameEntry); + return; + } + if (yon_char_is_empty(password)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->PasswordEntry); + return; + } + if (!yon_char_is_empty(window->prev_name)&&strcmp(username,window->prev_name)){ + yon_config_remove_by_key(GRUB_PASSWORD(window->prev_name)); + int size; + char *superusers = config(GRUB_SUPERUSERS_parameter); + config_str parsed = yon_char_parse(superusers,&size,","); + int pos = yon_char_parsed_check_exist(parsed,size,(char*)username); + if (pos>-1){ + parsed = yon_char_parsed_rip(parsed,&size,pos); + char *superusers = yon_char_parsed_to_string(parsed,size,","); + if (!yon_char_is_empty(superusers)){ + yon_config_register(GRUB_SUPERUSERS_parameter,GRUB_SUPERUSERS_parameter_command,superusers); + } else { + yon_config_remove_by_key(GRUB_SUPERUSERS_parameter); + } + } + } + yon_config_register(GRUB_PASSWORD(username),GRUB_SUPERUSERS_parameter_command,(char*)password); + GtkTreeIter iter; + gtk_list_store_append(widgets->BootloadUsersList,&iter); + gtk_list_store_set(widgets->BootloadUsersList,&iter,0,gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->AdminCheck)),1,username,2,"******",-1); + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->AdminCheck))){ + int size; + char *superusers = config(GRUB_SUPERUSERS_parameter); + config_str parsed = yon_char_parse(superusers,&size,","); + if (yon_char_parsed_check_exist(parsed,size,(char*)username)==-1){ + yon_char_parsed_add_or_create_if_exists(parsed,&size,(char*)username); + char *superusers = yon_char_parsed_to_string(parsed,size,","); + yon_config_register(GRUB_SUPERUSERS_parameter,GRUB_SUPERUSERS_parameter_command,superusers); + } + } else { + int size; + char *superusers = config(GRUB_SUPERUSERS_parameter); + config_str parsed = yon_char_parse(superusers,&size,","); + int pos = yon_char_parsed_check_exist(parsed,size,(char*)username); + if (pos!=-1){ + parsed = yon_char_parsed_rip(parsed,&size,pos); + + char *superusers = yon_char_parsed_to_string(parsed,size,","); + yon_config_register(GRUB_SUPERUSERS_parameter,GRUB_SUPERUSERS_parameter_command,superusers); + } + } + on_subwindow_close(window->Window); +} + +bootloader_user_window *yon_bootloader_user_window_new(){ + bootloader_user_window *window = new(bootloader_user_window); + + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_bootloader_user); + + window->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); + window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + window->TitleLabel = yon_gtk_builder_get_widget(builder,"TitleLabel"); + window->AdminCheck = yon_gtk_builder_get_widget(builder,"AdminCheck"); + window->UsernameEntry = yon_gtk_builder_get_widget(builder,"UsernameEntry"); + window->PasswordEntry = yon_gtk_builder_get_widget(builder,"PasswordEntry"); + window->PasswordButton = yon_gtk_builder_get_widget(builder,"PasswordButton"); + window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton"); + window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton"); + window->prev_name = NULL; + + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + g_signal_connect(G_OBJECT(window->PasswordButton),"clicked",G_CALLBACK(yon_password_change),window); + yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(window->PasswordEntry)); + yon_gtk_entry_block_restricted_symbols(GTK_ENTRY(window->UsernameEntry)); + return window; +} + +void on_bootloader_user_add(GtkWidget *, main_window *widgets){ + bootloader_user_window *window = yon_bootloader_user_window_new(); + g_object_set_data(G_OBJECT(window->AcceptButton),"widgets",widgets); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_bootloader_user_accept),window); + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->MainWindow),NULL,icon_path,"bootloader_window"); + gtk_widget_show(window->Window); +} + void on_menu_chosen(GtkWidget *, yon_menu_item *item){ if (strcmp(item->target,DEFAULT_MENU_ITEM_LABEL)){ gtk_entry_set_text(GTK_ENTRY(item->widgets->BootloadDefaultOSEntry),item->target); @@ -230,4 +364,42 @@ yon_menu_item *yon_menu_item_new(){ item->children=NULL; return item; -} \ No newline at end of file +} + +void yon_bootloader_interface_update(main_window *widgets){ + char *timeout = config(GRUB_TIMEOUT_parameter); + char *admins = config(GRUB_SUPERUSERS_parameter); + char *autologin = config(AUTOLOGINUSER_parameter); + char *os = config(GRUB_DEFAULT_parameter); + int size; + config_str users = yon_config_get_all_by_key(GRUB_PASSWORD_parameter_search,&size); + if (!yon_char_is_empty(timeout)){ + long timeout_l = atol(timeout); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->BootloadTimerSpin),timeout_l); + } + if (!yon_char_is_empty(os)){ + gtk_entry_set_text(GTK_ENTRY(widgets->BootloadDefaultOSEntry),os); + } else { + gtk_entry_set_text(GTK_ENTRY(widgets->BootloadDefaultOSEntry),DEFAULT_MENU_ITEM_LABEL); + } + if (!yon_char_is_empty(autologin)&&(!strcmp(autologin,"yes")||!strcmp(autologin,"enable"))){ + gtk_switch_set_active(GTK_SWITCH(widgets->BootloadNoPasswordSwitch),1); + } else { + int admins_size; + config_str admins_parsed = yon_char_parse(admins,&admins_size,","); + for (int i=0;iBootloadUsersList,&iter); + gtk_list_store_set(widgets->BootloadUsersList,&iter,0,yon_char_parsed_check_exist(admins_parsed,admins_size,key),1,key,2,value,-1); + } + } + +} + +// void yon_bootloader_setup(main_window *widgets){ + +// } \ No newline at end of file diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index 5014639..fed11dd 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -14,7 +14,6 @@ int yon_kernel_save(main_window *widgets){ enabled_module = row->package; } } - } if (!yon_char_is_empty(install_modules)){ @@ -24,7 +23,27 @@ int yon_kernel_save(main_window *widgets){ } yon_config_register(KERNEL_BOOT_parameter,KERNEL_BOOT_parameter_command,enabled_module); return 1; - +} + +int yon_kernel_addon_save(main_window *widgets){ + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelAddonListBox)); + char *install_modules = ""; + for(GList *iter = list;iter;iter = iter->next){ + kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->InstallCheck))){ + char *temp = yon_char_unite(install_modules,!yon_char_is_empty(install_modules)?" ":"",row->modules,NULL); + if (!yon_char_is_empty(install_modules)) free(install_modules); + install_modules = temp; + } + } + + if (!yon_char_is_empty(install_modules)){ + char *parameter = config(modules_extra_parameter); + char *parameter_new = yon_char_unite(!yon_char_is_empty(parameter)?parameter:"",!yon_char_is_empty(parameter)?",":"",install_modules,NULL); + yon_config_register(modules_extra_parameter,modules_extra_parameter_command,parameter_new); + free(parameter_new); + } + return 1; } int yon_os_components_save(main_window *widgets){ @@ -66,9 +85,10 @@ int yon_software_save(main_window *widgets){ } if (size){ char *final = yon_char_parsed_to_string(modules,size,","); - yon_config_register(modules_extra_parameter,modules_extra_parameter_command,final); - } else { - yon_config_remove_by_key(modules_extra_parameter); + char *parameter = config(modules_extra_parameter); + char *parameter_new = yon_char_unite(!yon_char_is_empty(parameter)?parameter:"",!yon_char_is_empty(parameter)?",":"",final,NULL); + yon_config_register(modules_extra_parameter,modules_extra_parameter_command,parameter_new); + free(parameter_new); } return 1; } @@ -86,9 +106,10 @@ int yon_pacman_software_save(main_window *widgets){ char *final = yon_char_parsed_to_string(parameters,size,","); yon_char_parsed_free(parameters,size); if (!yon_char_is_empty(final)){ - yon_config_register(packages_parameter,packages_parameter_command,final); - } else { - yon_config_remove_by_key(packages_parameter); + char *parameter = config(modules_extra_parameter); + char *parameter_new = yon_char_unite(!yon_char_is_empty(parameter)?parameter:"",!yon_char_is_empty(parameter)?",":"",final,NULL); + yon_config_register(modules_extra_parameter,modules_extra_parameter_command,parameter_new); + free(parameter_new); } return 1; } \ No newline at end of file diff --git a/source/ubinstall-gtk-network.c b/source/ubinstall-gtk-network.c index 877a371..3fcc610 100644 --- a/source/ubinstall-gtk-network.c +++ b/source/ubinstall-gtk-network.c @@ -1,33 +1,33 @@ #include "ubinstall-gtk.h" -// void on_autohostname_check(GtkWidget *, main_window *widgets){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); -// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ -// gtk_widget_set_sensitive(widgets->HotnameEntry,0); -// gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"auto"); -// }else{ -// gtk_widget_set_sensitive(widgets->HotnameEntry,1); -// gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"ublinux-install"); -// } -// } +void on_autohostname_check(GtkWidget *, main_window *widgets){ + gtk_switch_set_active(GTK_SWITCH(widgets->HostnameSensitiveSwitch),1); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ + gtk_widget_set_sensitive(widgets->HotnameEntry,0); + gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"auto"); + }else{ + gtk_widget_set_sensitive(widgets->HotnameEntry,1); + gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"ublinux-install"); + } +} -// void on_autohostname_sensitiveness_check(GtkWidget *, main_window *widgets){ -// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck))){ -// gtk_widget_set_sensitive(widgets->AutoHostnameCheck,1); -// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ -// gtk_widget_set_sensitive(widgets->HotnameEntry,0); -// } else -// gtk_widget_set_sensitive(widgets->HotnameEntry,1); -// } else { -// gtk_widget_set_sensitive(widgets->HotnameEntry,0); -// gtk_widget_set_sensitive(widgets->AutoHostnameCheck,0); -// } -// } +void on_autohostname_sensitiveness_check(GtkWidget *, main_window *widgets){ + if (gtk_switch_get_active(GTK_SWITCH(widgets->HostnameSensitiveSwitch))){ + gtk_widget_set_sensitive(widgets->AutoHostnameCheck,1); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ + gtk_widget_set_sensitive(widgets->HotnameEntry,0); + } else + gtk_widget_set_sensitive(widgets->HotnameEntry,1); + } else { + gtk_widget_set_sensitive(widgets->HotnameEntry,0); + gtk_widget_set_sensitive(widgets->AutoHostnameCheck,0); + } +} -// void on_hostname_entry_changed (GtkWidget *, main_window *widgets){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0); -// } +void on_hostname_entry_changed (GtkWidget *, main_window *widgets){ + gtk_switch_set_active(GTK_SWITCH(widgets->HostnameSensitiveSwitch),1); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0); +} network_info *yon_network_info_new(){ network_info *info = new(network_info); @@ -47,6 +47,22 @@ network_info *yon_network_info_new(){ g_object_set_data(G_OBJECT(info->RemoveButton),"network_info",info); g_object_set_data(G_OBJECT(info->MainBox),"network_info",info); + yon_on_entry_set_allowed_symbols(GTK_ENTRY(info->IpAdressEntry),"01234567890."); + yon_on_entry_set_allowed_symbols(GTK_ENTRY(info->MaskEntry),"01234567890."); + yon_on_entry_set_allowed_symbols(GTK_ENTRY(info->GatewayEntry),"01234567890."); + yon_on_entry_set_allowed_symbols(GTK_ENTRY(info->DNSEntry),"01234567890."); + + yon_entry_set_pattern(GTK_ENTRY(info->IpAdressEntry),"^(\\d{0,3})(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?$"); + yon_entry_set_pattern(GTK_ENTRY(info->MaskEntry),"^(\\d{0,3})(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?$"); + yon_entry_set_pattern(GTK_ENTRY(info->GatewayEntry),"^(\\d{0,3})(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?$"); + yon_entry_set_pattern(GTK_ENTRY(info->DNSEntry),"^(\\d{0,3})(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?$"); + + g_signal_connect(G_OBJECT(info->AutoGetIPSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),info->IpAdressEntry); + g_signal_connect(G_OBJECT(info->AutoGetIPSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),info->GatewayEntry); + g_signal_connect(G_OBJECT(info->AutoGetIPSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),info->MaskEntry); + g_signal_connect(G_OBJECT(info->AutoGetIPSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),info->DNSEntry); + + gtk_widget_show(info->MainBox); return info; } @@ -101,9 +117,10 @@ void on_ntp_sync(GtkWidget *, main_window *widgets){ } } -void on_connection_add(main_window *widgets){ +void on_connection_add(GtkWidget *,main_window *widgets){ network_info *info = yon_network_info_new(); gtk_box_pack_start(GTK_BOX(widgets->NetworkConnectionsBox),info->MainBox,0,0,0); + gtk_widget_show(info->MainBox); } int yon_network_save(main_window *widgets){ @@ -167,5 +184,47 @@ int yon_network_save(main_window *widgets){ } else { yon_config_remove_by_key(NTPSERVERS_parameter); } + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->NetworkConnectionsBox)); + GList *iter; + for (iter=list;iter;iter=iter->next){ + network_info *info = g_object_get_data(G_OBJECT(iter->data),"network_info"); + // char *type = gtk_combo_box_get_active_id(GTK_COMBO_BOX(info->TypeCombo)); + char *connection = (char*)gtk_entry_get_text(GTK_ENTRY(info->ConnectionEntry)); + // int active = gtk_switch_get_active(GTK_SWITCH(info->EnabledSwitch)); + if (!gtk_switch_get_active(GTK_SWITCH(info->AutoGetIPSwitch))){ + char *ip = (char*)gtk_entry_get_text(GTK_ENTRY(info->IpAdressEntry)); + char *mask = (char*)gtk_entry_get_text(GTK_ENTRY(info->MaskEntry)); + char *gateway = (char*)gtk_entry_get_text(GTK_ENTRY(info->GatewayEntry)); + char *dns = (char*)gtk_entry_get_text(GTK_ENTRY(info->DNSEntry)); + if (!yon_ip_check(ip)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),WRONG_IP_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(info->IpAdressEntry); + return 0; + } + if (!yon_ip_check(mask)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),WRONG_IP_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(info->MaskEntry); + return 0; + } + if (!yon_ip_check(gateway)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),WRONG_IP_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(info->GatewayEntry); + return 0; + } + if (!yon_ip_check(dns)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),WRONG_IP_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(info->DNSEntry); + return 0; + } + + int bitmask = yon_ip_mask_get_bits(mask); + mask = yon_char_from_int(bitmask); + char *value = network_value(ip,mask,gateway,dns); + yon_config_register(NETWORK_parameter(connection),NETWORK_parameter_command(connection),value); + } else { + yon_config_register(NETWORK_parameter(connection),NETWORK_parameter_command(connection),network_value_auto); + + } + } return 1; } \ No newline at end of file diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index 780750e..24fb3be 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -117,6 +117,9 @@ int yon_page_save(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_KERNEL: return yon_kernel_save(widgets); break; + case YON_PAGE_KERNEL_ADDON: + return yon_kernel_addon_save(widgets); + break; case YON_PAGE_SOFTWARE: return yon_software_save(widgets); break; diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 89efdb4..f89197d 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -506,7 +506,7 @@ main_window *yon_main_window_complete(){ widgets->NetworkNTPEntry = yon_gtk_builder_get_widget(builder,"NetworkNTPEntry"); widgets->NetworkConnectionsBox = yon_gtk_builder_get_widget(builder,"NetworkConnectionsBox"); widgets->NetworkConnectionsAddButton = yon_gtk_builder_get_widget(builder,"NetworkConnectionsAddButton"); - widgets->HostnameSensitiveCheck = yon_gtk_builder_get_widget(builder,"HostnameSensitiveCheck"); + widgets->HostnameSensitiveSwitch = yon_gtk_builder_get_widget(builder,"HostnameSensitiveSwitch"); widgets->AutoHostnameCheck=yon_gtk_builder_get_widget(builder,"AutoHostnameCheck"); widgets->network_connections = NULL; widgets->pacmanchosen = g_hash_table_new_full(g_str_hash,g_str_equal,free,NULL); @@ -585,14 +585,29 @@ main_window *yon_main_window_complete(){ yon_gtk_revealer_set_from_switch(GTK_REVEALER(widgets->NextInstallationFormatRevealer),GTK_SWITCH(widgets->NextInstallationFormatSwitch)); yon_gtk_revealer_set_from_switch(GTK_REVEALER(widgets->SameInstallationFormatRevealer),GTK_SWITCH(widgets->SameInstallationFormatSwitch)); - // g_signal_connect(G_OBJECT(widgets->HostnameSensitiveCheck),"toggled",G_CALLBACK(on_autohostname_sensitiveness_check),widgets); - // g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(on_autohostname_check),widgets); - // g_signal_connect(G_OBJECT(widgets->HotnameEntry),"changed",G_CALLBACK(on_hostname_entry_changed),widgets); g_signal_connect(G_OBJECT(widgets->OSSoftwareCell),"toggled",G_CALLBACK(on_os_components_toggled),widgets); g_signal_connect(G_OBJECT(widgets->PacmanSoftwareAllCell),"toggled",G_CALLBACK(on_pacman_software_all_toggled),widgets); g_signal_connect(G_OBJECT(widgets->PacmanSoftwareChosenCell),"toggled",G_CALLBACK(on_pacman_software_chosen_toggled),widgets); g_signal_connect(G_OBJECT(widgets->PacmanSoftwareSearchEntry),"icon-press",G_CALLBACK(on_pacman_icon_press),widgets); - + g_signal_connect(G_OBJECT(widgets->BootloadUserAddButton),"clicked",G_CALLBACK(on_bootloader_user_add),widgets); + + g_signal_connect(G_OBJECT(widgets->BootloadTimerSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->BootloadTimerSpin); + g_signal_connect(G_OBJECT(widgets->BootloadNoPasswordSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->BootloadUserRemoveButton); + g_signal_connect(G_OBJECT(widgets->BootloadNoPasswordSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->BootloadUserAddButton); + g_signal_connect(G_OBJECT(widgets->BootloadNoPasswordSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->BootloadUserTree); + + g_signal_connect(G_OBJECT(widgets->NetworkDomainSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->NetworkDomainNameEntry); + g_signal_connect(G_OBJECT(widgets->NetworkDomainSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->NetworkDomainAdminEntry); + g_signal_connect(G_OBJECT(widgets->NetworkDomainSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->NetworkDomainPasswordEntry); + g_signal_connect(G_OBJECT(widgets->NetworkNTPServerSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->NetworkNTPCombo); + g_signal_connect(G_OBJECT(widgets->NetworkNTPServerSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->NetworkNTPEntry); + g_signal_connect(G_OBJECT(widgets->HostnameSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->HotnameEntry); + g_signal_connect(G_OBJECT(widgets->HostnameSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->AutoHostnameCheck); + g_signal_connect(G_OBJECT(widgets->HostnameSensitiveSwitch),"toggled",G_CALLBACK(on_autohostname_sensitiveness_check),widgets); + g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(on_autohostname_check),widgets); + g_signal_connect(G_OBJECT(widgets->HotnameEntry),"changed",G_CALLBACK(on_hostname_entry_changed),widgets); + g_signal_connect(G_OBJECT(widgets->NetworkConnectionsAddButton),"clicked",G_CALLBACK(on_connection_add),widgets); + g_signal_connect(G_OBJECT(widgets->NetworkNTPCombo),"changed",G_CALLBACK(on_ntp_sync),widgets); { yon_user_struct *user = yon_user_struct_new(); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 267bf9c..82f4d52 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -31,6 +31,7 @@ #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_service "/com/ublinux/ui/ubinstall-gtk-service-window.glade" +#define glade_path_bootloader_user "/com/ublinux/ui/ubinstall-gtk-bootloader-user.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) @@ -88,6 +89,9 @@ NULL #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 get_layouts_command "xkbcli list --load-exotic | awk \"layout && /description:/ {match(\\$0,/: *(.*)/,matches);description=matches[1];printf \\\"%s|%s\\n\\\",layout,description;layout=\\\"\\\"} /layout:/ {match(\\$0, /: *'([^']+)'/,matches);l=matches[1];if (layouts[l]) next;layout=layouts[l]=l}\" | sort -u" #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,253" @@ -156,19 +160,37 @@ NULL #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 "AOUTINSTALL[ubconfig set [network] NTPSERVERS]" -#define NTPSERVERS_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[ubconfig set [network] NTPSERVERS]" -#define DOMAIN_parameter "AOUTINSTALL[ubconfig set [network] DOMAIN]" -#define DOMAIN_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[ubconfig set [network] DOMAIN]" -#define DOMAIN_admanger_parameter "AOUTINSTALL[ubconfig set [network] DOMAIN[admanger]]" -#define DOMAIN_admanger_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[ubconfig set [network] DOMAIN[admanger]]" +#define NTPSERVERS_parameter "AOUTINSTALL['ubconfig set [network] NTPSERVERS']" +#define NTPSERVERS_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [network] NTPSERVERS']" +#define DOMAIN_parameter "AOUTINSTALL['ubconfig set [network] DOMAIN']" +#define DOMAIN_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [network] DOMAIN']" +#define DOMAIN_admanger_parameter "AOUTINSTALL['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(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 [boot] SERVICES_ENABLE]" -#define SERVICES_ENABLE_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] SERVICES_ENABLE]" +#define KERNEL_BOOT_parameter_command "ubconfig --source global get autoinstall AUTOINSTALL['ubconfig set [boot] KERNEL_BOOT']" +#define SERVICES_ENABLE_parameter "AUTOINSTALL['ubconfig set [boot] SERVICES_ENABLE']" +#define SERVICES_ENABLE_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] SERVICES_ENABLE']" +#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_SUPERUSERS_parameter "AUTOINSTALL['ubconfig set [boot] GRUB_SUPERUSERS']" +#define GRUB_SUPERUSERS_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] GRUB_SUPERUSERS']" +#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(target) yon_char_unite("AUTOINSTALL['ubconfig set [network] NETWORK[",target,"@connmod]']",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 save_config_command(parameters) yon_char_unite("ubconfig --target system set [autoinstall] AUTOINSTALL[log]=yes ",parameters, "; nice ubinstall2 --debug autoinstall", NULL) @@ -505,7 +527,7 @@ typedef struct { GtkWidget *LoginSensitiveCheck; GtkWidget *UserRootOnlyCheck; GtkWidget *AutologinSensitiveCheck; - GtkWidget *HostnameSensitiveCheck; + GtkWidget *HostnameSensitiveSwitch; GtkWidget *KernelListBox; GtkWidget *KernelInstallLabel; @@ -763,6 +785,22 @@ struct pacman_struct{ 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; + void config_init(); main_window *yon_main_window_complete(); ubinstall_language_window *yon_ubinstall_language_new(); @@ -862,7 +900,7 @@ 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(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); @@ -910,4 +948,10 @@ void on_pacman_software_chosen_toggled(GtkWidget *, char *path, main_window *wid 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); \ No newline at end of file +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); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 07601ba..24df689 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -200,4 +200,8 @@ #define SERVICE_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to remove service")," ",target," ",_("from the list"),"?",NULL) #define SERVICE_ADD_TITLE_LABEL _("Add service") #define SERVICE_EDIT_TITLE_LABEL _("Edit service") -#define SERVICE_REMOVE_TITLE_LABEL _("Remove service") \ No newline at end of file +#define SERVICE_REMOVE_TITLE_LABEL _("Remove service") +#define BOOTLOADER_USER_EXIST_LABEL(target) yon_char_unite(_("User")," ", target," ", _("is already exists. Do you really want to save user")," ",target,"?",NULL) +#define GRUB_PASSWORD(target) yon_char_unite("GRUB_PASSWORD[",target,"]",NULL) + +#define WRONG_IP_LABEL _("Ip adress is incorrect") \ No newline at end of file diff --git a/ubinstall-gtk-bootloader-user.glade b/ubinstall-gtk-bootloader-user.glade new file mode 100644 index 0000000..44e507a --- /dev/null +++ b/ubinstall-gtk-bootloader-user.glade @@ -0,0 +1,222 @@ + + + + + + + True + False + com.ublinux.libublsettingsui-gtk3.edit-symbolic + + + True + False + com.ublinux.libublsettingsui-gtk3.cancel-symbolic + + + True + False + com.ublinux.libublsettingsui-gtk3.accept-symbolic + + + 450 + 250 + False + False + True + 450 + com.ublinux.ubl-settings-usergroups + + + True + False + 5 + vertical + 5 + + + True + False + vertical + + + + + + False + True + 0 + + + + + True + False + 5 + 5 + vertical + 5 + + + Administrator + True + True + False + True + + + False + True + 0 + + + + + True + False + 5 + + + True + False + User name: + 0 + + + False + True + 0 + + + + + True + True + + + True + True + 1 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + False + User password: + 0 + + + False + True + 0 + + + + + True + False + False + * + + + True + True + 1 + + + + + True + True + True + image1 + + + False + True + 2 + + + + + False + True + 2 + + + + + False + True + 1 + + + + + + + True + False + + + True + False + Add user + + + + + + + + Cancel + True + True + True + image4 + + + + + + Accept + True + True + True + image5 + + + + end + 1 + + + + + + + + + + + + diff --git a/ubinstall-gtk-network-box.glade b/ubinstall-gtk-network-box.glade index 0dfad0c..318193b 100644 --- a/ubinstall-gtk-network-box.glade +++ b/ubinstall-gtk-network-box.glade @@ -1,5 +1,5 @@ - + @@ -8,7 +8,7 @@ False com.ublinux.libublsettingsui-gtk3.trash-symbolic - + True False vertical @@ -43,6 +43,7 @@ True False + 0 Wired Wireless @@ -194,6 +195,7 @@ True True + 123.123.123.123 True @@ -218,6 +220,7 @@ True True + 123.123.123.123 True @@ -254,6 +257,7 @@ True True + 123.123.123.123 True @@ -278,6 +282,7 @@ True True + 123.123.123.123 True diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 057cc55..0d64f40 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -1,5 +1,5 @@ - + @@ -2059,6 +2059,9 @@ and help you install UBLinux on your computer True AdditionalSoftwareList 0 + + + @@ -3815,6 +3818,7 @@ and help you install UBLinux on your computer True + False True BootloaderTimer @@ -3953,7 +3957,7 @@ and help you install UBLinux on your computer True True in - 64 + 128 256 @@ -4174,6 +4178,7 @@ and help you install UBLinux on your computer True + False True 10 @@ -4198,6 +4203,7 @@ and help you install UBLinux on your computer True + False True 10 @@ -4222,6 +4228,7 @@ and help you install UBLinux on your computer True + False True 10 @@ -4269,7 +4276,9 @@ and help you install UBLinux on your computer True + False False + 0 Default DHCP @@ -4288,6 +4297,7 @@ and help you install UBLinux on your computer True + False True @@ -4309,19 +4319,9 @@ and help you install UBLinux on your computer False 5 - + True True - False - True - - - True - False - Host name: - 0 - - False @@ -4329,6 +4329,19 @@ and help you install UBLinux on your computer 0 + + + True + False + Host name: + 0 + + + False + True + 1 + + True -- 2.35.1 From ae97363e5b2e111f36b5036e0681d5f00b867f9e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 28 Jul 2025 18:18:30 +0600 Subject: [PATCH 12/18] Network loading; Bootloader loading; Kernel enabled improved logic --- gresource.xml | 1 + network-list.csv | 45 +++++ source/CMakeLists.txt | 1 + source/ubinstall-gtk-bootloader.c | 40 ++++- source/ubinstall-gtk-kernel.c | 21 ++- source/ubinstall-gtk-network.c | 133 +++++++++++++-- source/ubinstall-gtk-page-switch.c | 32 ++++ source/ubinstall-gtk.c | 5 +- source/ubinstall-gtk.h | 18 +- ubinstall-gtk-kernel-row.glade | 4 +- ubinstall-gtk-network-box.glade | 260 ++++++++++++++++------------- ubinstall-gtk.glade | 89 +++++++--- 12 files changed, 469 insertions(+), 180 deletions(-) create mode 100644 network-list.csv diff --git a/gresource.xml b/gresource.xml index 11c7f36..5535760 100644 --- a/gresource.xml +++ b/gresource.xml @@ -47,5 +47,6 @@ kernel-list.csv kernel-list-addon.csv services-list.csv + network-list.csv \ No newline at end of file diff --git a/network-list.csv b/network-list.csv new file mode 100644 index 0000000..dc8b9cc --- /dev/null +++ b/network-list.csv @@ -0,0 +1,45 @@ +TYPE;NAME +Ethernet;enp0s0 +Ethernet;enp0s1 +Ethernet;enp0s2 +Ethernet;enp0s3 +Ethernet;enp1s0 +Ethernet;enp1s1 +Ethernet;enp1s2 +Ethernet;enp1s3 +Ethernet;enp2s0 +Ethernet;enp2s1 +Ethernet;enp2s2 +Ethernet;enp2s3 +Ethernet;enp3s0 +Ethernet;enp3s1 +Ethernet;enp3s2 +Ethernet;enp3s3 +Ethernet;ens160 +Ethernet;ens35 +WiFi;wifi +WiFi;wl0 +WiFi;wl1 +WiFi;wl2 +WiFi;wl3 +WiFi;wlan0 +WiFi;wlan1 +WiFi;wlan2 +WiFi;wlan3 +VPN;tap0 +VPN;tap1 +VPN;tap2 +VPN;tap3 +VPN;tun0 +VPN;tun0 +VPN;tun1 +VPN;tun2 +VPN;tun3 +VPN;pppoe0 +VPN;pppoe1 +VPN;pppoe2 +VPN;pppoe3 +Bridge;br0 +Bridge;br1 +Bridge;br2 +Bridge;br3 \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index f7b276d..188d38a 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -78,6 +78,7 @@ set(DEPENDFILES ../kernel-list.csv ../kernel-list-addon.csv ../services-list.csv + ../network-list.csv ) file(COPY ${DEPENDFILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/source/ubinstall-gtk-bootloader.c b/source/ubinstall-gtk-bootloader.c index dc5bdc4..0782600 100644 --- a/source/ubinstall-gtk-bootloader.c +++ b/source/ubinstall-gtk-bootloader.c @@ -400,6 +400,42 @@ void yon_bootloader_interface_update(main_window *widgets){ } -// void yon_bootloader_setup(main_window *widgets){ +void yon_bootloader_init(main_window *widgets){ + char *timeout = config(GRUB_TIMEOUT_parameter); + char *os = config(GRUB_DEFAULT_parameter); + char *autologin = config(AUTOLOGINUSER_parameter); + char *admins = config(GRUB_SUPERUSERS_parameter); + int size; + config_str users = yon_config_get_all_by_key(GRUB_PASSWORD_parameter_search,&size); + if (!yon_char_is_empty(timeout)){ + long timeout_long = atol(timeout); + gtk_switch_set_active(GTK_SWITCH(widgets->BootloadTimerSwitch),1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->BootloadTimerSpin),timeout_long); + } else{ + gtk_switch_set_active(GTK_SWITCH(widgets->BootloadTimerSwitch),0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->BootloadTimerSpin),0); + } + if (!yon_char_is_empty(os)){ + gtk_entry_set_text(GTK_ENTRY(widgets->BootloadDefaultOSEntry),os); + } else { + gtk_entry_set_text(GTK_ENTRY(widgets->BootloadDefaultOSEntry),DEFAULT_BOOTLOAD_MENU_ITEM_LABEL); + } + if (!yon_char_is_empty(autologin)&&(!strcmp(autologin,"yes")||!strcmp(autologin,"enable"))){ + gtk_switch_set_active(GTK_SWITCH(widgets->BootloadNoPasswordSwitch),1); + int admins_size; + config_str admins_parsed = yon_char_parse(admins,&admins_size,","); + GtkTreeIter iter; + for (int i=0;iBootloadUsersList,&iter); + gtk_list_store_set(widgets->BootloadUsersList,&iter,0,yon_char_parsed_check_exist(admins_parsed,admins_size,key),1,key,2,parameter,3,"******",-1); + free(parameter); + free(parameter_name); + free(key); + } + yon_char_parsed_free(admins_parsed,admins_size); + } +} \ No newline at end of file diff --git a/source/ubinstall-gtk-kernel.c b/source/ubinstall-gtk-kernel.c index db1756c..ab6f9d2 100644 --- a/source/ubinstall-gtk-kernel.c +++ b/source/ubinstall-gtk-kernel.c @@ -1,5 +1,12 @@ #include "ubinstall-gtk.h" +void on_kernel_install_enabled(GtkWidget *, kernel_row *row){ + int active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->InstallCheck)); + gtk_widget_set_sensitive(row->EnableRadio,active); + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->InstallCheck))){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(main_config.kernel_unchosen_radio),1); + } +} kernel_row *yon_kernel_row_new(){ kernel_row *row = new(kernel_row); @@ -18,6 +25,8 @@ kernel_row *yon_kernel_row_new(){ row->modules=NULL; row->package=NULL; + g_signal_connect(G_OBJECT(row->InstallCheck),"toggled",G_CALLBACK(on_kernel_install_enabled),row); + row->row = gtk_list_box_row_new(); gtk_container_add(GTK_CONTAINER(row->row),row->RowBox); gtk_widget_show(row->row); @@ -186,7 +195,6 @@ void yon_kernel_setup(main_window *widgets){ config_str kernels = yon_resource_open_file(kernel_list_path,&size); gtk_size_group_add_widget(widgets->KernelSizeGroup,widgets->KernelTagsLabel); - GtkWidget *radio_group = NULL; for (int i=1;iKernelListBox),row->row,-1); gtk_size_group_add_widget(widgets->KernelSizeGroup,row->TagsBox); - if (!radio_group) { - radio_group = row->EnableRadio; - } - gtk_radio_button_join_group(GTK_RADIO_BUTTON(row->EnableRadio),GTK_RADIO_BUTTON(radio_group)); + gtk_radio_button_join_group(GTK_RADIO_BUTTON(row->EnableRadio),GTK_RADIO_BUTTON(main_config.kernel_unchosen_radio)); yon_kernel_row_setup(row,name,modules,package,tags,description); yon_char_parsed_free(parsed,parsed_size); @@ -232,7 +237,6 @@ void yon_kernel_addon_setup(main_window *widgets){ int size; config_str kernels = yon_resource_open_file(kernel_list_addon_path,&size); - GtkWidget *radio_group = NULL; for (int i=1;iEnableRadio); gtk_widget_destroy(row->EnableSeparator); - if (!radio_group) { - radio_group = row->EnableRadio; - } - gtk_radio_button_join_group(GTK_RADIO_BUTTON(row->EnableRadio),GTK_RADIO_BUTTON(radio_group)); - yon_kernel_row_setup(row,name,modules,package,tags,description); yon_char_parsed_free(parsed,parsed_size); } diff --git a/source/ubinstall-gtk-network.c b/source/ubinstall-gtk-network.c index 3fcc610..5aa2ebb 100644 --- a/source/ubinstall-gtk-network.c +++ b/source/ubinstall-gtk-network.c @@ -11,8 +11,8 @@ void on_autohostname_check(GtkWidget *, main_window *widgets){ } } -void on_autohostname_sensitiveness_check(GtkWidget *, main_window *widgets){ - if (gtk_switch_get_active(GTK_SWITCH(widgets->HostnameSensitiveSwitch))){ +void on_autohostname_sensitiveness_check(GtkWidget *, int status, main_window *widgets){ + if (status){ gtk_widget_set_sensitive(widgets->AutoHostnameCheck,1); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){ gtk_widget_set_sensitive(widgets->HotnameEntry,0); @@ -29,6 +29,21 @@ void on_hostname_entry_changed (GtkWidget *, main_window *widgets){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0); } +void on_type_changed(GtkComboBox *self,network_info *info){ + gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(info->ConnectionCombo)); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(info->ConnectionCombo),DEFAULT_LABEL); + const char *id = gtk_combo_box_get_active_id(self); + GHashTable *table = g_hash_table_lookup(main_config.network_types,id); + if (table){ + GList *list = g_hash_table_get_keys(table); + GList *iter; + for (iter=list;iter;iter=iter->next){ + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(info->ConnectionCombo),iter->data,iter->data); + } + g_list_free(list); + } +} + network_info *yon_network_info_new(){ network_info *info = new(network_info); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_network_info); @@ -39,6 +54,7 @@ network_info *yon_network_info_new(){ info->EnabledSwitch = yon_gtk_builder_get_widget(builder,"EnabledSwitch"); info->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton"); info->AutoGetIPSwitch = yon_gtk_builder_get_widget(builder,"AutoGetIPSwitch"); + info->IpRevealer = yon_gtk_builder_get_widget(builder,"IpRevealer"); info->IpAdressEntry = yon_gtk_builder_get_widget(builder,"IpAdressEntry"); info->GatewayEntry = yon_gtk_builder_get_widget(builder,"GatewayEntry"); info->MaskEntry = yon_gtk_builder_get_widget(builder,"MaskEntry"); @@ -61,7 +77,16 @@ network_info *yon_network_info_new(){ g_signal_connect(G_OBJECT(info->AutoGetIPSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),info->GatewayEntry); g_signal_connect(G_OBJECT(info->AutoGetIPSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),info->MaskEntry); g_signal_connect(G_OBJECT(info->AutoGetIPSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),info->DNSEntry); + g_signal_connect(G_OBJECT(info->TypeCombo),"changed",G_CALLBACK(on_type_changed),info); + + yon_gtk_revealer_set_from_switch_inversed(GTK_REVEALER(info->IpRevealer),GTK_SWITCH(info->AutoGetIPSwitch)); + GList *list = g_hash_table_get_keys(main_config.network_types); + GList *iter; + for (iter=list;iter;iter=iter->next){ + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(info->TypeCombo),iter->data,iter->data); + } + g_list_free(list); gtk_widget_show(info->MainBox); return info; @@ -190,12 +215,16 @@ int yon_network_save(main_window *widgets){ network_info *info = g_object_get_data(G_OBJECT(iter->data),"network_info"); // char *type = gtk_combo_box_get_active_id(GTK_COMBO_BOX(info->TypeCombo)); char *connection = (char*)gtk_entry_get_text(GTK_ENTRY(info->ConnectionEntry)); - // int active = gtk_switch_get_active(GTK_SWITCH(info->EnabledSwitch)); + int active = gtk_switch_get_active(GTK_SWITCH(info->EnabledSwitch)); + int parameters_size=0; + config_str parameters = NULL; if (!gtk_switch_get_active(GTK_SWITCH(info->AutoGetIPSwitch))){ char *ip = (char*)gtk_entry_get_text(GTK_ENTRY(info->IpAdressEntry)); char *mask = (char*)gtk_entry_get_text(GTK_ENTRY(info->MaskEntry)); char *gateway = (char*)gtk_entry_get_text(GTK_ENTRY(info->GatewayEntry)); char *dns = (char*)gtk_entry_get_text(GTK_ENTRY(info->DNSEntry)); + + yon_char_parsed_add_or_create_if_exists(parameters,¶meters_size,"ipv4.method manual"); if (!yon_ip_check(ip)){ yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),WRONG_IP_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(info->IpAdressEntry); @@ -205,26 +234,98 @@ int yon_network_save(main_window *widgets){ yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),WRONG_IP_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(info->MaskEntry); return 0; + } else { + int bitmask = yon_ip_mask_get_bits(mask); + mask = yon_char_from_int(bitmask); + char *ip_param = yon_char_unite("ipv4.addr", ip,"/",mask,NULL); + yon_char_parsed_add_or_create_if_exists(parameters,¶meters_size,ip_param); + free(ip_param); + } - if (!yon_ip_check(gateway)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),WRONG_IP_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(info->GatewayEntry); - return 0; + if (yon_ip_check(gateway)){ + char *ip_param = yon_char_append("ipv4.gateway", gateway); + yon_char_parsed_add_or_create_if_exists(parameters,¶meters_size,ip_param); + free(ip_param); } - if (!yon_ip_check(dns)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),WRONG_IP_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(info->DNSEntry); - return 0; + if (yon_ip_check(dns)){ + char *ip_param = yon_char_append("ipv4.dns", dns); + yon_char_parsed_add_or_create_if_exists(parameters,¶meters_size,ip_param); + free(ip_param); + } + if (!active){ + yon_char_parsed_add_or_create_if_exists(parameters,¶meters_size,""); } - int bitmask = yon_ip_mask_get_bits(mask); - mask = yon_char_from_int(bitmask); - char *value = network_value(ip,mask,gateway,dns); - yon_config_register(NETWORK_parameter(connection),NETWORK_parameter_command(connection),value); + char *value = yon_char_parsed_to_string(parameters,parameters_size,"yes"); + yon_config_register(NETWORK_devdown_parameter(connection),NETWORK_devdown_parameter_command(connection),value); } else { yon_config_register(NETWORK_parameter(connection),NETWORK_parameter_command(connection),network_value_auto); } } return 1; -} \ No newline at end of file +} + +void yon_network_init(main_window *widgets){ + int size; + config_str network_types = yon_resource_open_file(network_path,&size); + for (int i=1;iNetworkConnectionsBox),info->MainBox,0,0,0); + gtk_widget_show(info->MainBox); + + int connection_size; + config_str connection = yon_char_parse(parameter,&connection_size," "); + for (int k=0;kAutoGetIPSwitch),0); + } else if (!strcmp(connection[k],"ipv4.addr")){ + char *mask = yon_char_new(connection[++k]); + char *ip = yon_char_divide_search(mask,"/",-1); + gtk_entry_set_text(GTK_ENTRY(info->MaskEntry),mask); + gtk_entry_set_text(GTK_ENTRY(info->IpAdressEntry),ip); + free(mask); + free(ip); + + } else if (!strcmp(connection[k],"ipv4.gateway")){ + gtk_entry_set_text(GTK_ENTRY(info->GatewayEntry),connection[++k]); + + } else if (!strcmp(connection[k],"ipv4.dns")){ + gtk_entry_set_text(GTK_ENTRY(info->DNSEntry),connection[++k]); + + } + } + + GList *list = g_hash_table_get_keys(main_config.network_types); + GList *iter; + for (iter=list;iter;iter=iter->next){ + if (g_hash_table_contains(g_hash_table_lookup(main_config.network_types,(char*)iter->data),key)){ + gtk_combo_box_set_active_id(GTK_COMBO_BOX(info->TypeCombo),(char*)iter->data); + gtk_combo_box_set_active_id(GTK_COMBO_BOX(info->ConnectionCombo),key); + break; + } + } + } + } +} diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index 24fb3be..edad637 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -290,11 +290,43 @@ enum YON_PAGES yon_recovery_get_next(main_window *widgets){ return YON_PAGE_SECTIONS; } +void yon_page_init(main_window *widgets, enum YON_PAGES page){ + switch(page){ + case YON_PAGE_OS_COMPONENTS: + case YON_PAGE_KERNEL: + case YON_PAGE_KERNEL_ADDON: + case YON_PAGE_SOFTWARE: + case YON_PAGE_PACMAN_SOFTWARE: + case YON_PAGE_REGION: + case YON_PAGE_KEYBOARD: + case YON_PAGE_USERS: + case YON_PAGE_STARTUP: + case YON_PAGE_BOOTLOADER: + yon_bootloader_init(widgets); + break; + case YON_PAGE_NETWORK: + yon_network_init(widgets); + break; + case YON_PAGE_INSTALL_COMMON: + case YON_PAGE_INSTALL_SEPARATE: + case YON_PAGE_INSTALL_SAME_PARTITION: + case YON_PAGE_INSTALL_ADVANCED: + case YON_PAGE_RECOVERY_GRUB_INSTALL: + case YON_PAGE_RECOVERY_GRUB_UPDATE: + case YON_PAGE_RECOVERY_OS_ONLY: + case YON_PAGE_RECOVERY_USRDATA_ONLY: + case YON_PAGE_INSTALLATION_BEGIN: + break; + default: break; + } +} + void on_page_next_clicked(GtkWidget *, main_window *widgets){ enum YON_PAGES page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); page = yon_page_get_next(widgets,page); if ((int)page!=-1){ gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page); + yon_page_init(widgets,page); } yon_page_update(widgets); } diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index f89197d..e03540b 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -152,6 +152,7 @@ void config_init(){ main_config.log_end=0; main_config.exit_accepted=0; yon_packages_init(); + main_config.network_types = g_hash_table_new(g_str_hash,g_str_equal); } // void on_root_get_root(char *argline){ @@ -285,6 +286,8 @@ main_window *yon_main_window_complete(){ widgets->PartitionsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"PartitionsList")); + main_config.kernel_unchosen_radio = yon_gtk_builder_get_widget(builder,"KernelUnchosenRadio"); + widgets->MainWindow=yon_gtk_builder_get_widget(builder,"MainWindow"); widgets->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); widgets->Notebook = yon_gtk_builder_get_widget(builder,"Notebook"); @@ -603,7 +606,7 @@ main_window *yon_main_window_complete(){ g_signal_connect(G_OBJECT(widgets->NetworkNTPServerSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->NetworkNTPEntry); g_signal_connect(G_OBJECT(widgets->HostnameSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->HotnameEntry); g_signal_connect(G_OBJECT(widgets->HostnameSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->AutoHostnameCheck); - g_signal_connect(G_OBJECT(widgets->HostnameSensitiveSwitch),"toggled",G_CALLBACK(on_autohostname_sensitiveness_check),widgets); + g_signal_connect(G_OBJECT(widgets->HostnameSensitiveSwitch),"state-set",G_CALLBACK(on_autohostname_sensitiveness_check),widgets); g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(on_autohostname_check),widgets); g_signal_connect(G_OBJECT(widgets->HotnameEntry),"changed",G_CALLBACK(on_hostname_entry_changed),widgets); g_signal_connect(G_OBJECT(widgets->NetworkConnectionsAddButton),"clicked",G_CALLBACK(on_connection_add),widgets); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 82f4d52..cac61ba 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -59,6 +59,7 @@ #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 network_path "resource:///com/ublinux/csv/network-list.csv" #define slide_0_path "/com/ublinux/images/slide-0.png" @@ -179,8 +180,6 @@ NULL #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_SUPERUSERS_parameter "AUTOINSTALL['ubconfig set [boot] GRUB_SUPERUSERS']" -#define GRUB_SUPERUSERS_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] GRUB_SUPERUSERS']" #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) @@ -188,8 +187,11 @@ NULL #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_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_parameter_command(target) yon_char_unite("ubconfig get autoinstall AUTOINSTALL['ubconfig set [network] NETWORK[",target,"@connmod]']",NULL) +#define NETWORK_devdown_parameter_command(target) yon_char_unite("ubconfig get autoinstall AUTOINSTALL['ubconfig set [network] NETWORK[",target,"@devdown]']",NULL) #define NETWORK(target) yon_char_unite("NETWORK[",target,"@connmod]",NULL) #define save_config_command(parameters) yon_char_unite("ubconfig --target system set [autoinstall] AUTOINSTALL[log]=yes ",parameters, "; nice ubinstall2 --debug autoinstall", NULL) @@ -350,6 +352,8 @@ typedef struct { int arg_size; config_str arg_target; GtkWidget *status_box; + GHashTable *network_types; + GtkWidget *kernel_unchosen_radio; } config; extern config main_config; @@ -704,6 +708,7 @@ typedef struct { GtkWidget *EnabledSwitch; GtkWidget *RemoveButton; GtkWidget *AutoGetIPSwitch; + GtkWidget *IpRevealer; GtkWidget *IpAdressEntry; GtkWidget *GatewayEntry; GtkWidget *MaskEntry; @@ -817,7 +822,7 @@ 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 *, main_window *widgets); +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); @@ -954,4 +959,9 @@ 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); \ No newline at end of file +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); \ No newline at end of file diff --git a/ubinstall-gtk-kernel-row.glade b/ubinstall-gtk-kernel-row.glade index 8ca911b..b41c8db 100644 --- a/ubinstall-gtk-kernel-row.glade +++ b/ubinstall-gtk-kernel-row.glade @@ -1,5 +1,5 @@ - + @@ -45,11 +45,11 @@ True + False True False center 5 - True True diff --git a/ubinstall-gtk-network-box.glade b/ubinstall-gtk-network-box.glade index 318193b..82ad023 100644 --- a/ubinstall-gtk-network-box.glade +++ b/ubinstall-gtk-network-box.glade @@ -44,13 +44,6 @@ True False 0 - - Wired - Wireless - Tunnel - Bridge - Modem - False @@ -65,12 +58,12 @@ 0 True - Deafault + Default True - Deafault + Default @@ -136,6 +129,7 @@ True True + True False @@ -174,59 +168,151 @@ - + True False - 5 - - - True - False - IP adress: - 0 - - - False - True - 0 - - - - - True - True - 123.123.123.123 - - - True - True - 1 - - - + True False - Gateway: - 0 - - - False - True - 2 - - - - - True - True - 123.123.123.123 + vertical + 5 + + + True + False + + + False + True + 0 + + + + + True + False + 5 + + + True + False + IP adress: + 0 + + + False + True + 0 + + + + + True + True + 192.168.0.1 + + + True + True + 1 + + + + + True + False + Gateway: + 0 + + + False + True + 2 + + + + + True + True + 192.168.0.254 + + + True + True + 3 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + False + Mask: + 0 + + + False + True + 0 + + + + + True + True + 24 + + + True + True + 1 + + + + + True + False + DNS-server: + 0 + + + False + True + 2 + + + + + True + True + 192.168.0.254 + + + True + True + 3 + + + + + False + True + 2 + + - - True - True - 3 - @@ -235,68 +321,6 @@ 3 - - - True - False - 5 - - - True - False - Mask: - 0 - - - False - True - 0 - - - - - True - True - 123.123.123.123 - - - True - True - 1 - - - - - True - False - DNS-server: - 0 - - - False - True - 2 - - - - - True - True - 123.123.123.123 - - - True - True - 3 - - - - - False - True - 4 - - True diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 0d64f40..d7adb0a 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -46,6 +46,16 @@ + + True + False + True + False + center + 5 + True + True + @@ -4230,6 +4240,8 @@ and help you install UBLinux on your computer True False True + False + * 10 @@ -4378,43 +4390,68 @@ and help you install UBLinux on your computer - + True False - vertical - 5 + 0.019999999552965164 + in - + True False - vertical - 5 + 5 + 5 + 5 + 5 - + + True + False + vertical + 5 + + + True + False + vertical + 5 + + + + + + False + True + 0 + + + + + + + True + True + True + + + + False + True + end + 1 + + + - - False - True - 0 - - - - + + + True - True - True - + False + Net interfaces - - False - True - end - 1 - -- 2.35.1 From 03ad0347521298ead7437b430a061291eef7034f Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 29 Jul 2025 18:02:17 +0600 Subject: [PATCH 13/18] Test parameters loading; Advanced installation parameters loading WIP --- source/ubinstall-gtk-components.c | 98 ++++++++++- source/ubinstall-gtk-installation.c | 242 ++++++++++++++++++++++++++-- source/ubinstall-gtk-kernel.c | 32 ++++ source/ubinstall-gtk-keyboard.c | 45 ++++++ source/ubinstall-gtk-page-switch.c | 19 +++ source/ubinstall-gtk-region.c | 40 +++++ source/ubinstall-gtk-saving.c | 2 +- source/ubinstall-gtk-users.c | 53 ++++++ source/ubinstall-gtk.c | 178 ++++---------------- source/ubinstall-gtk.h | 54 +++++-- ubinstall-gtk.glade | 174 ++++++++++++++++---- 11 files changed, 732 insertions(+), 205 deletions(-) diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index fed11dd..0890614 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -47,7 +47,6 @@ int yon_kernel_addon_save(main_window *widgets){ } int yon_os_components_save(main_window *widgets){ - GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(widgets->OSSoftwareList); int size = 0; @@ -69,6 +68,47 @@ int yon_os_components_save(main_window *widgets){ return 1; } +void yon_os_components_init(main_window *widgets){ + GtkTreeIter iter; + if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->OSSoftwareList),&iter)){ + int base_size; + config_str base = yon_file_ls(system_base_modules_path,&base_size); + for (int i=0;iOSSoftwareList,&iter); + gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,base[i],2,version,3,description,-1); + } + int modules_size; + config_str modules = yon_file_ls(system_modules_path,&modules_size); + for (int i=0;iOSSoftwareList,&iter); + char *version = yon_packages_get_version(YON_PACKAGES_SYNC,base[i]); + char *description = yon_packages_get_description(YON_PACKAGES_SYNC,base[i]); + gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,modules[i],2,version,3,description,-1); + } + } + + char *modules = config(modules_parameter); + if (!yon_char_is_empty(modules)){ + int parsed_size; + config_str parsed = yon_char_parse(modules,&parsed_size,","); + GtkTreeIter iter; + for_iter (GTK_TREE_MODEL(widgets->OSSoftwareList),&iter){ + char *target; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->OSSoftwareList),&iter,1,&target,-1); + if (yon_char_parsed_check_exist(parsed,parsed_size,target)>-1){ + gtk_list_store_set(widgets->OSSoftwareList,0,1,-1); + } else { + gtk_list_store_set(widgets->OSSoftwareList,0,0,-1); + } + } + yon_char_parsed_free(parsed,parsed_size); + } +} + int yon_software_save(main_window *widgets){ GtkTreeIter iter; @@ -93,6 +133,40 @@ int yon_software_save(main_window *widgets){ return 1; } +void yon_software_init(main_window *widgets){ + GtkTreeIter iter; + if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->AdditionalSoftwareList),&iter)){ + int size; + config_str parsed = NULL; + parsed = yon_resource_open_file(additional_software_path,&size); + for (int i=1;iAdditionalSoftwareList,&iter); + gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,1,1,module_parsed[0],2,module_parsed[1],3,module_parsed[2],-1); //2,module_parsed[2] + yon_char_parsed_free(module_parsed,module_size); + } + } + if (size) yon_char_parsed_free(parsed,size); + } + + char *modules = config(modules_extra_parameter); + + int size; + config_str parsed = yon_char_parse(modules,&size,","); + for_iter(GTK_TREE_MODEL(widgets->AdditionalSoftwareList),&iter){ + char *target; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->AdditionalSoftwareList),&iter,1,&target); + if (yon_char_parsed_check_exist(parsed,size,target)>-1){ + gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,1,-1); + } else { + gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,0,-1); + } + } + yon_char_parsed_free(parsed,size); +} + int yon_pacman_software_save(main_window *widgets){ GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(widgets->PacmanSoftwareChosenList); @@ -106,10 +180,24 @@ int yon_pacman_software_save(main_window *widgets){ char *final = yon_char_parsed_to_string(parameters,size,","); yon_char_parsed_free(parameters,size); if (!yon_char_is_empty(final)){ - char *parameter = config(modules_extra_parameter); - char *parameter_new = yon_char_unite(!yon_char_is_empty(parameter)?parameter:"",!yon_char_is_empty(parameter)?",":"",final,NULL); - yon_config_register(modules_extra_parameter,modules_extra_parameter_command,parameter_new); - free(parameter_new); + yon_config_register(packages_parameter,packages_parameter_command,final); + } else { + yon_config_remove_by_key(packages_parameter); } return 1; +} + +void yon_pacman_init(main_window *widgets){ + char *pacman_packages = config(packages_parameter); + + int size; + config_str parsed = yon_char_parse(pacman_packages,&size,","); + for (int i=0;iPacmanSoftwareChosenList,&iter); + gtk_list_store_set(widgets->PacmanSoftwareChosenList,&iter,0,1,1,parsed[i],2,version,3,description,-1); + } + yon_char_parsed_free(parsed,size); } \ No newline at end of file diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index f95e88d..6fb2980 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -24,9 +24,9 @@ int yon_install_common_save(main_window *widgets){ char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->CommonInstallationFilesystemTypeCombo)); if (!yon_char_is_empty(file_system_type)){ - yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type); + yon_config_register(part_fs_type_parameter,part_fs_type_parameter_command,file_system_type); } else { - yon_config_remove_by_key(part_type_parameter); + yon_config_remove_by_key(part_fs_type_parameter); } return 1; } @@ -67,18 +67,18 @@ int yon_install_separate_save(main_window *widgets){ char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->NextInstallationFilesystemTypeCombo)); if (!yon_char_is_empty(file_system_type)){ - yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type); + yon_config_register(part_fs_type_parameter,part_fs_type_parameter_command,file_system_type); } else { - yon_config_remove_by_key(part_type_parameter); + yon_config_remove_by_key(part_fs_type_parameter); } } else { yon_config_register(part_format_parameter,part_format_parameter_command,"no"); yon_config_remove_by_key(part_label_parameter); - yon_config_remove_by_key(part_type_parameter); + yon_config_remove_by_key(part_fs_type_parameter); yon_config_remove_by_key(part_format_parameter); - yon_config_remove_by_key(part_type_parameter); + yon_config_remove_by_key(part_fs_type_parameter); yon_config_remove_by_key(part_format_parameter); } @@ -123,16 +123,16 @@ int yon_install_same_partition_save(main_window *widgets){ char *file_system_type = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->SameInstallationFilesystemTypeCombo)); if (!yon_char_is_empty(file_system_type)){ - yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type); + yon_config_register(part_fs_type_parameter,part_fs_type_parameter_command,file_system_type); } else { - yon_config_remove_by_key(part_type_parameter); + yon_config_remove_by_key(part_fs_type_parameter); } } else { yon_config_register(part_format_parameter,part_format_parameter_command,"no"); yon_config_remove_by_key(part_label_parameter); yon_config_remove_by_key(part_format_parameter); - yon_config_remove_by_key(part_type_parameter); + yon_config_remove_by_key(part_fs_type_parameter); } return 1; } @@ -174,7 +174,7 @@ int yon_advanced_sections_save(dictionary *dict){ char *fs_type_first = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(first_section->FileSystemTypeCombo)); char *fs_type_last = last_section&&!strcmp(format_last,"yes")?(char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(last_section->FileSystemTypeCombo)):NULL; char *fs_type = yon_char_unite(fs_type_first,fs_type_last?",":NULL,fs_type_last,NULL); - yon_config_register(part_type_parameter,part_type_parameter_command,fs_type); + yon_config_register(part_fs_type_parameter,part_fs_type_parameter_command,fs_type); char *part_crypt_first = gtk_combo_box_get_active(GTK_COMBO_BOX(first_section->EncryptionCombo))?(char*)gtk_entry_get_text(GTK_ENTRY(first_section->EncryptionEntry)):NULL; char *part_crypt_last = last_section&&!strcmp(format_last,"yes")&>k_combo_box_get_active(GTK_COMBO_BOX(last_section->EncryptionCombo))?(char*)gtk_entry_get_text(GTK_ENTRY(first_section->EncryptionEntry)):NULL; @@ -245,6 +245,11 @@ int yon_install_advanced_save(main_window *widgets){ return 1; } +void yon_install_advanced_init(main_window *){ + // char *boot = config(boot_parameter); + // char *swap = config(swap_parameter); +} + void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_button, GtkComboBox *spin_combo){ GtkTreeModel *model; GtkTreeIter iter; @@ -330,3 +335,220 @@ void on_device_selection_changed(GtkWidget *self, main_window *widgets){ gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin)),0.0); } } + +void yon_devices_setup(main_window *widgets){ + GtkTreeIter iter; + if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->DevicesList),&iter)) return; + int size; + config_str parsed = NULL; + parsed = yon_config_load(yon_debug_output("%s\n",get_devices_command),&size); + char *string = yon_char_parsed_to_string(parsed,size,""); + struct json_object *root; + struct json_object *blockdevices; + root = json_tokener_parse(string); + free(string); + json_object_object_get_ex(root, "blockdevices", &blockdevices); + for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { + struct json_object *device = json_object_array_get_idx(blockdevices, i); + struct json_object *path, *size, *model, *vendor, *serial; + + json_object_object_get_ex(device, "path", &path); + json_object_object_get_ex(device, "size", &size); + json_object_object_get_ex(device, "model", &model); + json_object_object_get_ex(device, "vendor", &vendor); + json_object_object_get_ex(device, "serial", &serial); + + gtk_list_store_append(widgets->DevicesList,&iter); + gtk_list_store_set(widgets->DevicesList,&iter,0,json_object_get_string(path),1,json_object_get_string(model),2,json_object_get_string(serial),3,json_object_get_string(size),4,json_object_get_string(vendor),-1); + + } + yon_char_parsed_free(parsed,size); +} + +void yon_install_init(main_window *widgets, enum YON_PAGES page){ + yon_devices_setup(widgets); + + GtkWidget *device_tree = NULL; + GtkWidget *partition_tree = NULL; + GtkWidget *format_switch = NULL; + GtkWidget *device_label = NULL; + GtkWidget *fs_type_combo = NULL; + GtkWidget *partition_size_spin = NULL; + GtkWidget *partition_size_combo = NULL; + GtkWidget *partition_mark_entry = NULL; + GtkWidget *partition_fs_mark_entry = NULL; + GtkWidget *partition_encryption_combo = NULL; + GtkWidget *partition_encryption_entry = NULL; + + switch(page){ + case YON_PAGE_INSTALL_COMMON: + device_tree = widgets->CommonInstallationDevicesTree; + device_label = widgets->CommonInstallationSectionNameEntry; + format_switch = widgets->CommonFormatSwitch; + fs_type_combo = widgets->CommonInstallationFilesystemTypeCombo; + break; + case YON_PAGE_INSTALL_SAME_PARTITION: + device_tree = widgets->NextInstallationSysDevicesTree; + partition_tree = widgets->NextInstallationSysSectionTree; + format_switch = widgets->NextInstallationFormatSwitch; + partition_size_spin = widgets->NextInstallationSizeSpin; + partition_size_combo = widgets->NextInstallationSizeTypeSpin; + partition_mark_entry = widgets->NextInstallationSectionNameEntry; + fs_type_combo = widgets->NextInstallationFilesystemTypeCombo; + break; + case YON_PAGE_INSTALL_SEPARATE: + device_tree = widgets->SamePlaceDeviceTree; + partition_tree = widgets->SamePlacePartTree; + format_switch = widgets->SameInstallationFormatSwitch; + partition_mark_entry = widgets->SameInstallationSectionNameEntry; + fs_type_combo = widgets->SameInstallationFilesystemTypeCombo; + + break; + case YON_PAGE_INSTALL_ADVANCED: + yon_install_advanced_init(widgets); + return; + break; + case YON_PAGE_RECOVERY_GRUB_INSTALL: + device_tree = widgets->GrubInstallDevicesTree; + partition_tree = widgets->GrubInstallPartitionTree; + + break; + case YON_PAGE_RECOVERY_GRUB_UPDATE: + device_tree = widgets->GrubUpdateDevicesTree; + partition_tree = widgets->GrubUpdatePartitionTree; + + break; + case YON_PAGE_RECOVERY_OS_ONLY: + device_tree = widgets->OSDevicesTree; + partition_tree = widgets->OSSysSectionTree; + format_switch = widgets->OSFormatSwitch; + partition_size_spin = widgets->OSFormatSizeSpin; + partition_size_combo = widgets->OSFormatSizeCombo; + partition_mark_entry = widgets->OSFormatPartitionEntry; + fs_type_combo = widgets->OSFilesystemTypeCombo; + partition_fs_mark_entry = widgets->OSFormatFSMarkEntry; + partition_encryption_combo = widgets->OSFormatEncryptionCombo; + partition_encryption_entry = widgets->OSFormatEncryptionEntry; + + break; + case YON_PAGE_RECOVERY_USRDATA_ONLY: + device_tree = widgets->UserdataDevicesTree; + partition_tree = widgets->UserdataSysSectionTree; + format_switch = widgets->OSFormatSwitch; + partition_size_spin = widgets->UserdataFormatSwitch; + partition_size_combo = widgets->UserdataFormatSizeCombo; + partition_mark_entry = widgets->UserdataFormatPartitionEntry; + fs_type_combo = widgets->UserdataFilesystemTypeCombo; + partition_fs_mark_entry = widgets->UserdataFormatFSMarkEntry; + partition_encryption_combo = widgets->UserdataFormatEncryptionCombo; + partition_encryption_entry = widgets->UserdataFormatEncryptionEntry; + break; + default:return; + } + + + char *device = config(AUTOINSTALL_DEVICE); + char *part = config(part_parameter); + + + if (!yon_char_is_empty(device)){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->DevicesList); + for_iter(model,&iter){ + char *target; + gtk_tree_model_get(model,&iter,0,&target,-1); + if (!yon_char_is_empty(target)&&!strcmp(target,device)){ + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(device_tree)),&iter); + break; + } + } + if (partition_tree&&!yon_char_is_empty(part)){ + model = GTK_TREE_MODEL(widgets->PartitionsList); + for_iter(model,&iter){ + char *target; + gtk_tree_model_get(model,&iter,0,&target,-1); + if (!yon_char_is_empty(target)&&!strcmp(target,device)){ + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(partition_tree)),&iter); + break; + } + } + } + } + if (format_switch){ + char *format = config(part_format_parameter); + if (!strcmp(format,"yes")){ + gtk_switch_set_active(GTK_SWITCH(format_switch),1); + if (device_label){ + char *parameter = config(part_label_parameter); + if (!yon_char_is_empty(parameter)){ + gtk_entry_set_text(GTK_ENTRY(device_label),parameter); + } else { + gtk_entry_set_text(GTK_ENTRY(device_label),""); + } + } + if (fs_type_combo){ + char *parameter = config(part_fs_type_parameter); + if (!yon_char_is_empty(parameter)){ + gtk_combo_box_set_active_id(GTK_COMBO_BOX(fs_type_combo),parameter); + } else { + gtk_combo_box_set_active(GTK_COMBO_BOX(fs_type_combo),0); + } + } + if (partition_size_spin&&partition_size_combo){ + char *parameter = config(part_size_parameter); + if (!yon_char_is_empty(parameter)){ + gtk_spin_button_set_value(GTK_SPIN_BUTTON(partition_size_spin),atol(parameter)); + gtk_combo_box_set_active(GTK_COMBO_BOX(partition_size_combo),yon_get_size_get_from_letter(parameter[strlen(parameter)-1])); + } else { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(partition_size_spin),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(partition_size_combo),0); + } + } + if (partition_mark_entry){ + char *parameter = config(part_fs_label_parameter); + if (!yon_char_is_empty(parameter)){ + gtk_entry_set_text(GTK_ENTRY(partition_mark_entry),parameter); + } else { + gtk_entry_set_text(GTK_ENTRY(partition_mark_entry),""); + } + } + if (partition_fs_mark_entry){ + char *parameter = config(part_fs_label_parameter); + if (!yon_char_is_empty(parameter)){ + gtk_entry_set_text(GTK_ENTRY(partition_fs_mark_entry),parameter); + } else { + gtk_entry_set_text(GTK_ENTRY(partition_fs_mark_entry),""); + } + } + if (partition_encryption_combo && partition_encryption_entry){ + char *parameter = config(part_crypt_parameter); + if (!yon_char_is_empty(parameter)&&!strstr(parameter,",")){ + char *password = yon_char_new(parameter); + char *crypt = yon_char_divide_search(password,":",-1); + gtk_combo_box_set_active_id(GTK_COMBO_BOX(partition_encryption_combo),crypt); + gtk_entry_set_text(GTK_ENTRY(partition_encryption_entry),password); + free(password); + free(crypt); + } else { + gtk_combo_box_set_active(GTK_COMBO_BOX(partition_encryption_combo),0); + gtk_entry_set_text(GTK_ENTRY(partition_encryption_entry),""); + } + } + } else { + gtk_switch_set_active(GTK_SWITCH(format_switch),0); + } + } + +} + +void on_install_advanced_add_new(GtkWidget *, main_window *){ + +} + +void on_install_advanced_device_chosen(GtkCellRenderer, gchar *, main_window *){ + +} + +void on_install_advanced_partition_chosen(GtkCellRenderer, gchar *, main_window *){ + +} \ No newline at end of file diff --git a/source/ubinstall-gtk-kernel.c b/source/ubinstall-gtk-kernel.c index ab6f9d2..04e0f5a 100644 --- a/source/ubinstall-gtk-kernel.c +++ b/source/ubinstall-gtk-kernel.c @@ -191,6 +191,15 @@ void yon_kernel_setup(main_window *widgets){ } g_list_free(list); + char *modules = config(modules_extra_parameter); + char *enabled = config(KERNEL_BOOT_parameter); + + int parsed_size; + config_str modules_parsed = NULL; + if (!yon_char_is_empty(modules)){ + modules_parsed = yon_char_parse(modules,&parsed_size,","); + } + int size; config_str kernels = yon_resource_open_file(kernel_list_path,&size); gtk_size_group_add_widget(widgets->KernelSizeGroup,widgets->KernelTagsLabel); @@ -212,6 +221,15 @@ void yon_kernel_setup(main_window *widgets){ yon_kernel_row_setup(row,name,modules,package,tags,description); yon_char_parsed_free(parsed,parsed_size); + + if (yon_char_parsed_check_exist(modules_parsed,parsed_size,name)>-1){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(row->InstallCheck),1); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(row->InstallCheck),0); + } + if (!yon_char_is_empty(enabled)&&!strcmp(name,enabled)){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(row->EnableRadio),1); + } } yon_kernel_resize(widgets); @@ -234,6 +252,14 @@ void yon_kernel_addon_setup(main_window *widgets){ } g_list_free(list); + char *modules = config(modules_extra_parameter); + + int parsed_size; + config_str modules_parsed = NULL; + if (!yon_char_is_empty(modules)){ + modules_parsed = yon_char_parse(modules,&parsed_size,","); + } + int size; config_str kernels = yon_resource_open_file(kernel_list_addon_path,&size); @@ -256,6 +282,12 @@ void yon_kernel_addon_setup(main_window *widgets){ yon_kernel_row_setup(row,name,modules,package,tags,description); yon_char_parsed_free(parsed,parsed_size); + + if (yon_char_parsed_check_exist(modules_parsed,parsed_size,name)>-1){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(row->InstallCheck),1); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(row->InstallCheck),0); + } } yon_kernel_addon_resize(widgets); diff --git a/source/ubinstall-gtk-keyboard.c b/source/ubinstall-gtk-keyboard.c index 0d4c290..b9c92d9 100644 --- a/source/ubinstall-gtk-keyboard.c +++ b/source/ubinstall-gtk-keyboard.c @@ -244,4 +244,49 @@ void on_keyboard_clicked (GtkWidget *, main_window *widgets){ g_signal_connect(G_OBJECT(window->ActiveToggle),"toggled",G_CALLBACK(on_layout_toggle),window); g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_keyboard_accept),widgets); gtk_widget_show(window->MainWindow); +} + +void yon_keyboard_init(main_window *widgets){ + int size; + config_str parsed = NULL; + GtkTreeIter iter; + parsed = yon_config_load(yon_debug_output("%s\n",get_layouts_command),&size); + GtkTreeIter itar; + for (int i=0;iLayoutList,&iter,NULL); + gtk_tree_store_set(widgets->LayoutList,&iter,0,layout[0],1,_(layout[1]),2,1,-1); + yon_char_parsed_free(layout,layout_size); + char *command = get_layouts_local_command(layout_id); + config_str layout_local = yon_config_load(yon_debug_output("%s\n",command),&layout_size); + free(command); + free(layout_id); + for (int j=0;jLayoutList,&itar,&iter); + gtk_tree_store_set(widgets->LayoutList,&itar,0,layouts_parsed[0],1,_(layouts_parsed[1]),2,1,3,0,-1); + yon_char_parsed_free(layouts_parsed,parsed_size); + } + } + if (layout_size==-1) { + gtk_tree_store_set(widgets->LayoutList,&iter,2,1,-1); + } + yon_char_parsed_free(layout_local,layout_size); + } + } + yon_char_parsed_free(parsed,size); + config_str models = yon_config_load(yon_debug_output("%s\n",get_models_command),&size); + for (int i=0;iKeyboardModelCombo),models[i],_(models[i+1])); + } + if (size) yon_char_parsed_free(models,size); } \ No newline at end of file diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index edad637..2a441de 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -293,14 +293,32 @@ enum YON_PAGES yon_recovery_get_next(main_window *widgets){ void yon_page_init(main_window *widgets, enum YON_PAGES page){ switch(page){ case YON_PAGE_OS_COMPONENTS: + yon_os_components_init(widgets); + break; case YON_PAGE_KERNEL: + yon_kernel_setup(widgets); + break; case YON_PAGE_KERNEL_ADDON: + yon_kernel_addon_setup(widgets); + break; case YON_PAGE_SOFTWARE: + yon_software_init(widgets); + break; case YON_PAGE_PACMAN_SOFTWARE: + yon_pacman_init(widgets); + break; case YON_PAGE_REGION: + yon_region_init(widgets); + break; case YON_PAGE_KEYBOARD: + yon_keyboard_init(widgets); + break; case YON_PAGE_USERS: + yon_user_init(widgets); + break; case YON_PAGE_STARTUP: + yon_startup_services_setup(widgets); + break; case YON_PAGE_BOOTLOADER: yon_bootloader_init(widgets); break; @@ -316,6 +334,7 @@ void yon_page_init(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_RECOVERY_OS_ONLY: case YON_PAGE_RECOVERY_USRDATA_ONLY: case YON_PAGE_INSTALLATION_BEGIN: + yon_install_init(widgets,page); break; default: break; } diff --git a/source/ubinstall-gtk-region.c b/source/ubinstall-gtk-region.c index 2c3fce1..7612327 100644 --- a/source/ubinstall-gtk-region.c +++ b/source/ubinstall-gtk-region.c @@ -63,3 +63,43 @@ void on_region_changed(GtkComboBox *self, main_window *widgets){ } free(active); } + +void yon_region_init(main_window *widgets){ + int size; + config_str parsed = NULL; + int langsize; + config_str lang = default_langs(&langsize); + + GtkTreeIter iter; + gtk_list_store_clear(widgets->LanguagesList); + parsed = yon_file_open(languages_path,&size); + for (int i=0;iLanguagesList,&iter); + gtk_list_store_set(widgets->LanguagesList,&iter,0,0,1,_(cur[1]),2,cur[0],-1); + } + yon_char_parsed_free(cur,cur_size); + } + yon_char_parsed_free(parsed,size); + if (lang) + yon_char_parsed_free(lang,langsize); + + parsed = yon_dir_get_contents(zone_path,&size); + for (int i=0;iRegionCombo),parsed[i],_(parsed[i])); + } + free(path); + } + } + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->RegionCombo),0); + yon_char_parsed_free(parsed,size); + + gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter),0); + gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); +} \ No newline at end of file diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c index a62e573..14e77a3 100644 --- a/source/ubinstall-gtk-saving.c +++ b/source/ubinstall-gtk-saving.c @@ -172,7 +172,7 @@ // char *part = NULL; // if (page!=YON_PAGE_INSTALL_COMMON) // part = config(part_parameter); -// char *fs_type = config(part_type_parameter); +// char *fs_type = config(part_fs_type_parameter); // char *device_label = config(device_label_parameter); // char *format = config(part_format_parameter); // char *part_size = config(part_size_parameter); diff --git a/source/ubinstall-gtk-users.c b/source/ubinstall-gtk-users.c index 53b045c..d49303c 100644 --- a/source/ubinstall-gtk-users.c +++ b/source/ubinstall-gtk-users.c @@ -101,4 +101,57 @@ yon_user_struct *yon_user_struct_new(){ g_signal_connect(G_OBJECT(user->PasswordButton),"clicked",G_CALLBACK(yon_password_new),user); g_signal_connect(G_OBJECT(user->RemoveButton),"clicked",G_CALLBACK(on_user_remove_clicked),user); return user; +} + +void yon_user_init(main_window *widgets){ + yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->UserRootPasswordEntry)); + char *root_password = config(root_password_parameter); + char *autologin = config(autologin_parameter); + if (!yon_char_is_empty(root_password)){ + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),1); + gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),root_password); + } else { + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),0); + gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),""); + } + if (!yon_char_is_empty(autologin)&&(!strcmp(autologin,"yes")||!strcmp(autologin,"enable"))){ + gtk_switch_set_active(GTK_SWITCH(widgets->UserAutologinSwitch),1); + } else { + gtk_switch_set_active(GTK_SWITCH(widgets->UserAutologinSwitch),0); + } + + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->UserAddBox)); + GList *iter; + for (iter = list; iter; iter = iter->next){ + yon_user_struct *user = g_object_get_data(G_OBJECT(iter->data),"yon_user_struct"); + gtk_widget_destroy(user->MainBox); + free(user); + } + int users_size; + config_str users = yon_config_get_all_by_key(USERADD_parameter_search,&users_size); + if (!users_size){ + yon_user_struct *user = yon_user_struct_new(); + gtk_box_pack_start(GTK_BOX(widgets->UserAddBox),user->MainBox,0,0,0); + gtk_entry_set_text(GTK_ENTRY(user->UsernameEntry),ADMINISTRATOR_LABEL); + gtk_entry_set_text(GTK_ENTRY(user->LoginEntry),"superadmin"); + } + for (int i=0;iUserAddBox),user->MainBox,0,0,0); + + int parsed_size; + char *parameter = yon_char_new(users[i]); + char *parameter_name = yon_char_divide_search(parameter,"=",-1); + char *key = yon_config_parameter_get_key(parameter_name); + config_str parsed = yon_char_parse(parameter,&parsed_size,":"); + + gtk_entry_set_text(GTK_ENTRY(user->LoginEntry),key); + if (parsed_size>0) + gtk_entry_set_text(GTK_ENTRY(user->UsernameEntry),parsed[0]); + if (parsed_size>5){ + gtk_entry_set_text(GTK_ENTRY(user->PasswordEntry),parsed[5]); + gtk_combo_box_set_active(GTK_COMBO_BOX(user->PasswordCombo),1); + } + gtk_widget_show(user->MainBox); + } } \ No newline at end of file diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index e03540b..4ef6110 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -348,6 +348,7 @@ main_window *yon_main_window_complete(){ widgets->CommonInstallationDevicesTree = yon_gtk_builder_get_widget(builder,"CommonInstallationDevicesTree"); widgets->CommonInstallationFilesystemTypeCombo = yon_gtk_builder_get_widget(builder,"CommonInstallationFilesystemTypeCombo"); widgets->CommonInstallationSectionNameEntry = yon_gtk_builder_get_widget(builder,"CommonInstallationSectionNameEntry"); + widgets->CommonFormatSwitch = yon_gtk_builder_get_widget(builder,"CommonFormatSwitch"); widgets->GpartedCommonButton = yon_gtk_builder_get_widget(builder,"GpartedCommonButton"); widgets->SamePlaceDeviceTree = yon_gtk_builder_get_widget(builder,"SamePlaceDeviceTree"); @@ -368,6 +369,8 @@ main_window *yon_main_window_complete(){ widgets->NextInstallationSysSectionTree = yon_gtk_builder_get_widget(builder,"NextInstallationSysSectionTree"); widgets->GpartedNextInstallationButton = yon_gtk_builder_get_widget(builder,"GpartedNextInstallationButton"); + widgets->AdvancedDevicesCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"AdvancedDevicesCell")); + widgets->AdvancedPartitionsCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"AdvancedPartitionsCell")); widgets->AdvancedDeviceTree = yon_gtk_builder_get_widget(builder,"AdvancedDeviceTree"); widgets->AdvancedVirtualDeviceCombo = yon_gtk_builder_get_widget(builder,"AdvancedVirtualDeviceCombo"); widgets->AdvancedPartitionTree = yon_gtk_builder_get_widget(builder,"AdvancedPartitionTree"); @@ -393,10 +396,26 @@ main_window *yon_main_window_complete(){ widgets->OSDevicesTree = yon_gtk_builder_get_widget(builder,"OSDevicesTree"); widgets->OSSysSectionTree = yon_gtk_builder_get_widget(builder,"OSSysSectionTree"); widgets->GpartedOSButton = yon_gtk_builder_get_widget(builder,"GpartedOSButton"); + widgets->OSFormatSwitch = yon_gtk_builder_get_widget(builder,"OSFormatSwitch"); + widgets->OSFormatSizeSpin = yon_gtk_builder_get_widget(builder,"OSFormatSizeSpin"); + widgets->OSFormatSizeCombo = yon_gtk_builder_get_widget(builder,"OSFormatSizeCombo"); + widgets->OSFormatPartitionEntry = yon_gtk_builder_get_widget(builder,"OSFormatPartitionEntry"); + widgets->OSFilesystemTypeCombo = yon_gtk_builder_get_widget(builder,"OSFilesystemTypeCombo"); + widgets->OSFormatFSMarkEntry = yon_gtk_builder_get_widget(builder,"OSFormatFSMarkEntry"); + widgets->OSFormatEncryptionCombo = yon_gtk_builder_get_widget(builder,"OSFormatEncryptionCombo"); + widgets->OSFormatEncryptionEntry = yon_gtk_builder_get_widget(builder,"OSFormatEncryptionEntry"); widgets->UserdataDevicesTree = yon_gtk_builder_get_widget(builder,"UserdataDevicesTree"); widgets->UserdataSysSectionTree = yon_gtk_builder_get_widget(builder,"UserdataSysSectionTree"); widgets->GpartedUserdataButton = yon_gtk_builder_get_widget(builder,"UserdataGpartedButton"); + widgets->UserdataFormatSwitch = yon_gtk_builder_get_widget(builder,"UserdataFormatSwitch"); + widgets->UserdataFormatSizeSpin = yon_gtk_builder_get_widget(builder,"UserdataFormatSizeSpin"); + widgets->UserdataFormatSizeCombo = yon_gtk_builder_get_widget(builder,"UserdataFormatSizeCombo"); + widgets->UserdataFormatPartitionEntry = yon_gtk_builder_get_widget(builder,"UserdataFormatPartitionEntry"); + widgets->UserdataFilesystemTypeCombo = yon_gtk_builder_get_widget(builder,"UserdataFilesystemTypeCombo"); + widgets->UserdataFormatFSMarkEntry = yon_gtk_builder_get_widget(builder,"UserdataFormatFSMarkEntry"); + widgets->UserdataFormatEncryptionCombo = yon_gtk_builder_get_widget(builder,"UserdataFormatEncryptionCombo"); + widgets->UserdataFormatEncryptionEntry = yon_gtk_builder_get_widget(builder,"UserdataFormatEncryptionEntry"); widgets->LanguagesFilter = GTK_TREE_MODEL(gtk_builder_get_object(builder,"LanguagesFilter")); widgets->LayoutsFilter = GTK_TREE_MODEL(gtk_builder_get_object(builder,"LayoutsFilter")); @@ -539,7 +558,6 @@ main_window *yon_main_window_complete(){ g_signal_connect(G_OBJECT(widgets->GpartedSameButton),"clicked",G_CALLBACK(on_gparted_open),NULL); g_signal_connect(G_OBJECT(widgets->GpartedNextInstallationButton),"clicked",G_CALLBACK(on_gparted_open),NULL); - // g_signal_connect(G_OBJECT(widgets->Notebook),"switch-page",G_CALLBACK(on_page_changed),widgets); // g_signal_connect(G_OBJECT(widgets->MainWindow),"check-resize",G_CALLBACK(on_region_resized),widgets); g_signal_connect(G_OBJECT(widgets->NextButton),"clicked",G_CALLBACK(on_page_next_clicked),widgets); g_signal_connect(G_OBJECT(widgets->BackButton),"clicked",G_CALLBACK(on_page_prev_clicked),widgets); @@ -612,15 +630,12 @@ main_window *yon_main_window_complete(){ g_signal_connect(G_OBJECT(widgets->NetworkConnectionsAddButton),"clicked",G_CALLBACK(on_connection_add),widgets); g_signal_connect(G_OBJECT(widgets->NetworkNTPCombo),"changed",G_CALLBACK(on_ntp_sync),widgets); - { - yon_user_struct *user = yon_user_struct_new(); - gtk_box_pack_start(GTK_BOX(widgets->UserAddBox),user->MainBox,0,0,0); - gtk_entry_set_text(GTK_ENTRY(user->UsernameEntry),ADMINISTRATOR_LABEL); - gtk_entry_set_text(GTK_ENTRY(user->LoginEntry),"superadmin"); - } + g_signal_connect(G_OBJECT(widgets->AdvancedAddButton),"clicked",G_CALLBACK(on_install_advanced_add_new),widgets); + g_signal_connect(G_OBJECT(widgets->AdvancedDevicesCell),"toggled",G_CALLBACK(on_install_advanced_device_chosen),widgets); + g_signal_connect(G_OBJECT(widgets->AdvancedPartitionsCell),"toggled",G_CALLBACK(on_install_advanced_partition_chosen),widgets); + { - yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->UserRootPasswordEntry)); if (main_config.lock_load_global == 1){ gtk_widget_set_sensitive(widgets->LoadGlobalConfigurationMenuItem,0); @@ -637,12 +652,11 @@ main_window *yon_main_window_complete(){ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widgets->ConfigurationModeMenuItem),1); } - gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter),0); - gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); gtk_window_set_title(GTK_WINDOW(widgets->MainWindow),TITLE_LABEL); gtk_window_set_icon_name(GTK_WINDOW(widgets->MainWindow),icon_path); - + } + { int size; config_str parsed = NULL; parsed = yon_file_open(licence_path,&size); @@ -652,7 +666,9 @@ main_window *yon_main_window_complete(){ free(licence); yon_char_parsed_free(parsed,size); } - + } + { + int size; config_str slides = yon_char_parsed_new(&size,slide_repeat_path); widgets->regions_original = gdk_pixbuf_new_from_resource(regions_path,NULL); widgets->keyboard_original = gdk_pixbuf_new_from_resource(keyboard_path,NULL); @@ -675,142 +691,10 @@ main_window *yon_main_window_complete(){ pix = gdk_pixbuf_scale_simple((GdkPixbuf*)g_list_nth_data(widgets->slides_original,0),600,400,GDK_INTERP_BILINEAR); gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->SlidesImage),pix); g_object_unref(pix); - - int langsize; - config_str lang = default_langs(&langsize); - - GtkTreeIter iter; - gtk_list_store_clear(widgets->LanguagesList); - parsed = yon_file_open(languages_path,&size); - for (int i=0;iLanguagesList,&iter); - gtk_list_store_set(widgets->LanguagesList,&iter,0,0,1,_(cur[1]),2,cur[0],-1); - } - yon_char_parsed_free(cur,cur_size); - } - yon_char_parsed_free(parsed,size); - if (lang) - yon_char_parsed_free(lang,langsize); - - parsed = yon_dir_get_contents(zone_path,&size); - for (int i=0;iRegionCombo),parsed[i],_(parsed[i])); - } - free(path); - } - } - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->RegionCombo),0); - yon_char_parsed_free(parsed,size); - parsed = yon_config_load(yon_debug_output("%s\n",get_layouts_command),&size); - GtkTreeIter itar; - for (int i=0;iLayoutList,&iter,NULL); - gtk_tree_store_set(widgets->LayoutList,&iter,0,layout[0],1,_(layout[1]),2,1,-1); - yon_char_parsed_free(layout,layout_size); - char *command = get_layouts_local_command(layout_id); - config_str layout_local = yon_config_load(yon_debug_output("%s\n",command),&layout_size); - free(command); - free(layout_id); - for (int j=0;jLayoutList,&itar,&iter); - gtk_tree_store_set(widgets->LayoutList,&itar,0,layouts_parsed[0],1,_(layouts_parsed[1]),2,1,3,0,-1); - yon_char_parsed_free(layouts_parsed,parsed_size); - } - } - if (layout_size==-1) { - gtk_tree_store_set(widgets->LayoutList,&iter,2,1,-1); - } - yon_char_parsed_free(layout_local,layout_size); - } - } - yon_char_parsed_free(parsed,size); - { - parsed = yon_config_load(yon_debug_output("%s\n",get_devices_command),&size); - char *string = yon_char_parsed_to_string(parsed,size,""); - struct json_object *root; - struct json_object *blockdevices; - root = json_tokener_parse(string); - free(string); - json_object_object_get_ex(root, "blockdevices", &blockdevices); - for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) { - struct json_object *device = json_object_array_get_idx(blockdevices, i); - struct json_object *path, *size, *model, *vendor, *serial; - - json_object_object_get_ex(device, "path", &path); - json_object_object_get_ex(device, "size", &size); - json_object_object_get_ex(device, "model", &model); - json_object_object_get_ex(device, "vendor", &vendor); - json_object_object_get_ex(device, "serial", &serial); - - gtk_list_store_append(widgets->DevicesList,&iter); - gtk_list_store_set(widgets->DevicesList,&iter,0,json_object_get_string(path),1,json_object_get_string(model),2,json_object_get_string(serial),3,json_object_get_string(size),4,json_object_get_string(vendor),-1); - - } - yon_char_parsed_free(parsed,size); - } - { - int base_size; - config_str base = yon_file_ls(system_base_modules_path,&base_size); - for (int i=0;iOSSoftwareList,&iter); - gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,base[i],2,version,3,description,-1); - } - int modules_size; - config_str modules = yon_file_ls(system_modules_path,&modules_size); - for (int i=0;iOSSoftwareList,&iter); - char *version = yon_packages_get_version(YON_PACKAGES_SYNC,base[i]); - char *description = yon_packages_get_description(YON_PACKAGES_SYNC,base[i]); - gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,modules[i],2,version,3,description,-1); - } - } - - parsed = yon_resource_open_file(additional_software_path,&size); - for (int i=1;iAdditionalSoftwareList,&iter); - gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,1,1,module_parsed[0],2,module_parsed[1],3,module_parsed[2],-1); //2,module_parsed[2] - yon_char_parsed_free(module_parsed,module_size); - } - } - if (size) yon_char_parsed_free(parsed,size); - - config_str models = yon_config_load(yon_debug_output("%s\n",get_models_command),&size); - for (int i=0;iKeyboardModelCombo),models[i],_(models[i+1])); - } - if (size) yon_char_parsed_free(models,size); - gtk_builder_connect_signals(builder,NULL); - // yon_load_proceed(YON_CONFIG_DEFAULT); - // yon_interface_update(widgets); - yon_kernel_setup(widgets); - yon_kernel_addon_setup(widgets); - yon_startup_services_setup(widgets); } + gtk_builder_connect_signals(builder,NULL); + // yon_load_proceed(YON_CONFIG_DEFAULT); + // yon_interface_update(widgets); return widgets; } diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index cac61ba..94fd98c 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -113,6 +113,7 @@ NULL #define modules_extra_parameter "AUTOINSTALL[modules_extra]" #define modules_extra_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[modules_extra]" +/*------------------------------------------------------------*/ #define user_name_parameter "AUTOINSTALL[user_name]" #define user_name_parameter_command "ubconfig --source global --conarg get [autoinstall] AUTOINSTALL[user_name]" #define user_gecos_parameter "AUTOINSTALL[user_gecos]" @@ -139,10 +140,12 @@ NULL #define lang_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[lang]" #define locale_parameter "AUTOINSTALL[locale]" #define locale_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[locale]" +/*------------------------------------------------------------*/ + #define part_size_parameter "AUTOINSTALL[part_size]" #define part_size_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_size]" -#define part_type_parameter "AUTOINSTALL[part_fs_type]" -#define part_type_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_fs_type]" +#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]" @@ -168,6 +171,7 @@ NULL #define DOMAIN_admanger_parameter "AOUTINSTALL['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']" @@ -233,7 +237,7 @@ NULL AUTOINSTALL_DEVICE,\ part_format_parameter,\ part_label_parameter,\ - part_type_parameter + part_fs_type_parameter #define install_part_parameters \ AUTOINSTALL_TYPE_INSTALL,\ @@ -241,7 +245,7 @@ NULL part_format_parameter,\ part_fs_label_parameter,\ part_parameter,\ - part_type_parameter,\ + part_fs_type_parameter,\ part_fs_label_parameter #define install_next_parameters \ @@ -250,7 +254,7 @@ NULL part_format_parameter,\ part_fs_label_parameter,\ part_parameter,\ - part_type_parameter,\ + part_fs_type_parameter,\ part_size_parameter #define install_advanced_parameters \ @@ -259,7 +263,7 @@ NULL part_format_parameter,\ part_label_parameter,\ part_parameter,\ - part_type_parameter,\ + part_fs_type_parameter,\ part_size_parameter #define install_grub_install_update_parameters \ @@ -273,7 +277,7 @@ NULL part_format_parameter,\ part_label_parameter,\ part_parameter,\ - part_type_parameter,\ + part_fs_type_parameter,\ part_size_parameter,\ part_crypt_parameter @@ -283,7 +287,7 @@ NULL part_format_parameter,\ part_label_parameter,\ part_parameter,\ - part_type_parameter,\ + part_fs_type_parameter,\ part_size_parameter,\ part_crypt_parameter @@ -455,6 +459,7 @@ typedef struct { GtkWidget *CommonInstallationDevicesTree; GtkWidget *CommonInstallationFilesystemTypeCombo; GtkWidget *CommonInstallationSectionNameEntry; + GtkWidget *CommonFormatSwitch; GtkWidget *GpartedCommonButton; GtkWidget *NextInstallationSysDevicesTree; @@ -508,10 +513,26 @@ typedef struct { GtkWidget *GpartedOSButton; GtkWidget *OSDevicesTree; GtkWidget *OSSysSectionTree; + GtkWidget *OSFormatSwitch; + GtkWidget *OSFormatSizeSpin; + GtkWidget *OSFormatSizeCombo; + GtkWidget *OSFormatPartitionEntry; + GtkWidget *OSFilesystemTypeCombo; + GtkWidget *OSFormatFSMarkEntry; + GtkWidget *OSFormatEncryptionCombo; + GtkWidget *OSFormatEncryptionEntry; GtkWidget *GpartedUserdataButton; GtkWidget *UserdataDevicesTree; GtkWidget *UserdataSysSectionTree; + GtkWidget *UserdataFormatSwitch; + GtkWidget *UserdataFormatSizeSpin; + GtkWidget *UserdataFormatSizeCombo; + GtkWidget *UserdataFormatPartitionEntry; + GtkWidget *UserdataFilesystemTypeCombo; + GtkWidget *UserdataFormatFSMarkEntry; + GtkWidget *UserdataFormatEncryptionCombo; + GtkWidget *UserdataFormatEncryptionEntry; GtkTreeModel *LanguagesFilter; GtkTreeModel *LayoutsFilter; @@ -595,6 +616,8 @@ typedef struct { GtkWidget *NetworkConnectionsAddButton; GHashTable *network_connections; + GtkCellRenderer *AdvancedDevicesCell; + GtkCellRenderer *AdvancedPartitionsCell; GtkWidget *AdvancedDeviceTree; GtkWidget *AdvancedVirtualDeviceCombo; GtkWidget *AdvancedPartitionTree; @@ -611,6 +634,7 @@ typedef struct { GtkWidget *AdvancedSwapFixedSizeSwitch; dictionary *advanced_sections; + GFile *install_progress_file; GFileMonitor *install_progress_monitor; GFile *install_info_file; @@ -964,4 +988,16 @@ 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); \ No newline at end of file +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_add_new(GtkWidget *, 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); \ No newline at end of file diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index d7adb0a..b5b1e9d 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -34,15 +34,15 @@ - + - + - + - + - + @@ -5330,15 +5330,15 @@ or continue working in the UBLinux Live environment. False 1 - ext3 - ext4 - fat16 - fat32 - exfat - riserfs - udf - xfs - zfs + ext3 + ext4 + fat16 + fat32 + exfat + riserfs + udf + xfs + zfs @@ -5700,7 +5700,7 @@ installed. True False - Choose a section: + Choose a partition: 0 @@ -6381,7 +6381,7 @@ installed. True False - Choose a section: + Choose a partition: 0 @@ -6646,15 +6646,15 @@ installed. False 1 - ext3 - ext4 - fat16 - fat32 - exfat - riserfs - udf - xfs - zfs + ext3 + ext4 + fat16 + fat32 + exfat + riserfs + udf + xfs + zfs @@ -6909,8 +6909,62 @@ separately into the selected partition. True True - - + DevicesList + 0 + + + Device + + + + 0 + + + + + + + Description + + + + 1 + + + + + + + Label + + + + 2 + + + + + + + Size + + + + 3 + + + + + + + Serial + + + + 4 + + + @@ -7003,8 +7057,62 @@ separately into the selected partition. True True - - + PartitionsList + 0 + + + Section + + + + 0 + + + + + + + Capacity + + + + 1 + + + + + + + Free space + + + + 2 + + + + + + + File system + + + + 3 + + + + + + + Label + + + + 4 + + + @@ -8319,7 +8427,7 @@ separately into the selected partition. True False - Choose a section: + Choose a partition: 0 @@ -8694,7 +8802,7 @@ separately into the selected partition. True False - Choose a section: + Choose a partition: 0 @@ -9062,7 +9170,7 @@ separately into the selected partition. True False - Choose a section: + Choose a partition: 0 @@ -9789,7 +9897,7 @@ separately into the selected partition. True False - Choose a section: + Choose a partition: 0 -- 2.35.1 From ce18ca4aac3ae6b400d054a5f7f87feb6802c872 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 30 Jul 2025 18:03:37 +0600 Subject: [PATCH 14/18] WIP Advanced installation window --- gresource.xml | 1 + source/CMakeLists.txt | 1 + source/ubinstall-gtk-installation.c | 187 +++- source/ubinstall-gtk.c | 8 +- source/ubinstall-gtk.h | 18 +- ubinstall-gtk-advanced-box.glade | 15 +- ubinstall-gtk.glade | 1302 ++++++++++++++------------- 7 files changed, 885 insertions(+), 647 deletions(-) diff --git a/gresource.xml b/gresource.xml index 5535760..0c44160 100644 --- a/gresource.xml +++ b/gresource.xml @@ -15,6 +15,7 @@ ubinstall-gtk-service-window.glade ubinstall-gtk-bootloader-user.glade ubinstall-gtk-network-box.glade + ubinstall-gtk-advanced-box.glade ubinstall-gtk.css diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 188d38a..8d983f6 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -72,6 +72,7 @@ set(DEPENDFILES ../ubinstall-gtk-service-window.glade ../ubinstall-gtk-bootloader-user.glade ../ubinstall-gtk-network-box.glade + ../ubinstall-gtk-advanced-box.glade ../gresource.xml ../ubinstall-gtk.css ../modules.csv diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 6fb2980..7fae166 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -139,10 +139,10 @@ int yon_install_same_partition_save(main_window *widgets){ int yon_advanced_sections_save(dictionary *dict){ if (!dict) return 0; - advanced_section *first_section = yon_dictionary_get_data(dict->first,advanced_section*); - advanced_section *last_section = NULL; + advanced_partition *first_section = yon_dictionary_get_data(dict->first,advanced_partition*); + advanced_partition *last_section = NULL; if (dict->first->next){ - last_section = yon_dictionary_get_data(dict->first->next,advanced_section*); + last_section = yon_dictionary_get_data(dict->first->next,advanced_partition*); } char *part_first = first_section->part; @@ -302,7 +302,7 @@ void on_device_selection_changed(GtkWidget *self, main_window *widgets){ long free_space_long = 0; char *fs_type = NULL; char *label = NULL; - + if (parsed_size>2){ char sizemod='\0'; capacity_long = atol(parsed[2]); @@ -359,7 +359,7 @@ void yon_devices_setup(main_window *widgets){ json_object_object_get_ex(device, "serial", &serial); gtk_list_store_append(widgets->DevicesList,&iter); - gtk_list_store_set(widgets->DevicesList,&iter,0,json_object_get_string(path),1,json_object_get_string(model),2,json_object_get_string(serial),3,json_object_get_string(size),4,json_object_get_string(vendor),-1); + gtk_list_store_set(widgets->DevicesList,&iter,0,json_object_get_string(path),1,json_object_get_string(model),2,json_object_get_string(serial),3,json_object_get_string(size),4,json_object_get_string(vendor),6,1,-1); } yon_char_parsed_free(parsed,size); @@ -541,14 +541,187 @@ void yon_install_init(main_window *widgets, enum YON_PAGES page){ } +void on_advanced_password_clicked(GtkWidget *, advanced_partition *part){ + yon_password_open(GTK_ENTRY(part->EncryptionEntry)); +} + +advanced_partition *yon_advanced_partition_new(){ + advanced_partition *part = new(advanced_partition); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_advanced_part); + part->MainBox = yon_gtk_builder_get_widget(builder,"MainBox"); + part->SectionLabel = yon_gtk_builder_get_widget(builder,"SectionLabel"); + part->SystemSectionToggle = yon_gtk_builder_get_widget(builder,"SystemSectionToggle"); + part->UserDataSectionToggle = yon_gtk_builder_get_widget(builder,"UserDataSectionToggle"); + part->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton"); + part->FormatSwitch = yon_gtk_builder_get_widget(builder,"FormatSwitch"); + part->SizeSpin = yon_gtk_builder_get_widget(builder,"SizeSpin"); + part->SizeCombo = yon_gtk_builder_get_widget(builder,"SizeCombo"); + part->SectionMarkEntry = yon_gtk_builder_get_widget(builder,"SectionMarkEntry"); + part->FileSystemTypeCombo = yon_gtk_builder_get_widget(builder,"FileSystemTypeCombo"); + part->FileSystemMarkentry = yon_gtk_builder_get_widget(builder,"FileSystemMarkentry"); + part->EncryptionCombo = yon_gtk_builder_get_widget(builder,"EncryptionCombo"); + part->EncryptionEntry = yon_gtk_builder_get_widget(builder,"EncryptionEntry"); + part->EncryptionButton = yon_gtk_builder_get_widget(builder,"EncryptionButton"); + part->FormatRevealer = yon_gtk_builder_get_widget(builder,"FormatRevealer"); + + yon_gtk_revealer_set_from_switch(GTK_REVEALER(part->FormatRevealer),GTK_SWITCH(part->FormatSwitch)); + g_signal_connect(G_OBJECT(part->EncryptionButton),"clicked",G_CALLBACK(on_advanced_password_clicked),part); + // g_signal_connect(G_OBJECT(part->SystemSectionToggle),"clicked",G_CALLBACK(on_advanced_system_toggled),part); + // g_signal_connect(G_OBJECT(part->UserDataSectionToggle),"clicked",G_CALLBACK(on_advanced_user_toggled),part); + + g_object_set_data(G_OBJECT(part->MainBox),"advanced_partition",part); + g_object_set_data(G_OBJECT(part->RemoveButton),"advanced_partition",part); + + return part; +} + void on_install_advanced_add_new(GtkWidget *, main_window *){ } -void on_install_advanced_device_chosen(GtkCellRenderer, gchar *, main_window *){ +void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_window *widgets){ + gtk_list_store_clear(widgets->PartitionsList); + + int size; + config_str partitions; + partitions = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); + for (int i=0;iDevicesList); + + int chosen = 0; + for_iter (model,&iter){ + char *disk_path; + int status; + gtk_tree_model_get(model,&iter,0,&disk_path,5,&status,-1); + if (status) chosen++; + + } + + + if (gtk_tree_model_get_iter_from_string(model,&iter,path)){ + int status; + gtk_tree_model_get(model,&iter,5,&status,-1); + if (!status){ + if (chosen <2){ + gtk_list_store_set(widgets->DevicesList,&iter,5,!status,-1); + chosen++; + } else { + for_iter (model,&iter){ + gtk_tree_model_get(model,&iter,5,&status,-1); + if (!status){ + gtk_list_store_set(widgets->DevicesList,&iter,6,0,-1); + } + } + + } + } else { + gtk_list_store_set(widgets->DevicesList,&iter,5,!status,-1); + if (chosen == 2){ + for_iter (model,&iter){ + gtk_list_store_set(widgets->DevicesList,&iter,6,1,-1); + } + } + chosen--; + } + } + + if (chosen) gtk_widget_set_sensitive(widgets->AdvancedAddButton,1); + else gtk_widget_set_sensitive(widgets->AdvancedAddButton,0); + + for_iter (model,&iter){ + char *disk_path; + int status; + gtk_tree_model_get(model,&iter,0,&disk_path,5,&status,-1); + if (!status) continue; + + for (int i=0;i2){ + char sizemod='\0'; + capacity_long = atol(parsed[2]); + + char *temp = yon_char_from_double(yon_size_long_convert_automatic(capacity_long,&sizemod)); + capacity = yon_char_append_c(temp,sizemod); + free(temp); + } + if (parsed_size>7&&!yon_char_is_empty(parsed[7])){ + char sizemod='\0'; + free_space_long = capacity_long-atol(parsed[7]); + char *temp = yon_char_from_double(yon_size_long_convert_automatic(free_space_long,&sizemod)); + free_space = yon_char_append_c(temp,sizemod); + free(temp); + } + if (parsed_size>3){ + fs_type = parsed[3]; + } + if (parsed_size>4){ + label = parsed[4]; + } + + GtkTreeIter itar; + gtk_list_store_append(widgets->PartitionsList,&itar); + gtk_list_store_set(widgets->PartitionsList,&itar,0,name,1,capacity,2,free_space,3,fs_type,4,label,5,capacity_long,6,free_space_long,8,1,-1); + } + yon_char_parsed_free(parsed,parsed_size); + } + } + } } -void on_install_advanced_partition_chosen(GtkCellRenderer, gchar *, main_window *){ +void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_window *widgets){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->PartitionsList); + + int chosen = 0; + + for_iter(model,&iter){ + int status; + gtk_tree_model_get(model,&iter,7,&status,-1); + if (status) chosen++; + } + + gtk_tree_model_get_iter_from_string(model,&iter,path); + int status; + gtk_tree_model_get(model,&iter,7,&status,-1); + if (!status){ + if (chosen<2){ + gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1); + chosen++; + advanced_partition *part = yon_advanced_partition_new(); + gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0); + gtk_widget_show(part->MainBox); + } + if (chosen>=2){ + for_iter(model,&iter){ + gtk_tree_model_get(model,&iter,7,&status,-1); + if (!status){ + gtk_list_store_set(widgets->PartitionsList,&iter,8,0,-1); + } + } + } + } else { + gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1); + if (chosen==2) + for_iter (model,&iter){ + gtk_list_store_set(widgets->PartitionsList,&iter,8,1,-1); + } + chosen--; + } } \ No newline at end of file diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 4ef6110..4b8b4a9 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -369,8 +369,8 @@ main_window *yon_main_window_complete(){ widgets->NextInstallationSysSectionTree = yon_gtk_builder_get_widget(builder,"NextInstallationSysSectionTree"); widgets->GpartedNextInstallationButton = yon_gtk_builder_get_widget(builder,"GpartedNextInstallationButton"); - widgets->AdvancedDevicesCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"AdvancedDevicesCell")); - widgets->AdvancedPartitionsCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"AdvancedPartitionsCell")); + widgets->AdvancedDeviceChosenCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"AdvancedDeviceChosenCell")); + widgets->AdvancedPartChosenCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"AdvancedPartChosenCell")); widgets->AdvancedDeviceTree = yon_gtk_builder_get_widget(builder,"AdvancedDeviceTree"); widgets->AdvancedVirtualDeviceCombo = yon_gtk_builder_get_widget(builder,"AdvancedVirtualDeviceCombo"); widgets->AdvancedPartitionTree = yon_gtk_builder_get_widget(builder,"AdvancedPartitionTree"); @@ -631,8 +631,8 @@ main_window *yon_main_window_complete(){ g_signal_connect(G_OBJECT(widgets->NetworkNTPCombo),"changed",G_CALLBACK(on_ntp_sync),widgets); g_signal_connect(G_OBJECT(widgets->AdvancedAddButton),"clicked",G_CALLBACK(on_install_advanced_add_new),widgets); - g_signal_connect(G_OBJECT(widgets->AdvancedDevicesCell),"toggled",G_CALLBACK(on_install_advanced_device_chosen),widgets); - g_signal_connect(G_OBJECT(widgets->AdvancedPartitionsCell),"toggled",G_CALLBACK(on_install_advanced_partition_chosen),widgets); + g_signal_connect(G_OBJECT(widgets->AdvancedDeviceChosenCell),"toggled",G_CALLBACK(on_install_advanced_device_chosen),widgets); + g_signal_connect(G_OBJECT(widgets->AdvancedPartChosenCell),"toggled",G_CALLBACK(on_install_advanced_partition_chosen),widgets); { diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 94fd98c..25fc273 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -32,6 +32,7 @@ #define glade_path_kernel_row "/com/ublinux/ui/ubinstall-gtk-kernel-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 CssPath "/com/ublinux/css/ubinstall-gtk.css" #define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) @@ -616,8 +617,8 @@ typedef struct { GtkWidget *NetworkConnectionsAddButton; GHashTable *network_connections; - GtkCellRenderer *AdvancedDevicesCell; - GtkCellRenderer *AdvancedPartitionsCell; + GtkCellRenderer *AdvancedDeviceChosenCell; + GtkCellRenderer *AdvancedPartChosenCell; GtkWidget *AdvancedDeviceTree; GtkWidget *AdvancedVirtualDeviceCombo; GtkWidget *AdvancedPartitionTree; @@ -644,11 +645,12 @@ typedef struct { typedef struct { GtkWidget *MainBox; + GtkWidget *SectionLabel; GtkWidget *SystemSectionToggle; GtkWidget *UserDataSectionToggle; GtkWidget *RemoveButton; GtkWidget *FormatSwitch; - GtkWidget *FormatExpander; + GtkWidget *FormatRevealer; GtkWidget *SizeSpin; GtkWidget *SizeCombo; GtkWidget *SectionMarkEntry; @@ -659,7 +661,7 @@ typedef struct { GtkWidget *EncryptionButton; char *part; -} advanced_section; +} advanced_partition; typedef struct { GtkWidget *Window; @@ -998,6 +1000,8 @@ 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_add_new(GtkWidget *, 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); \ No newline at end of file +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_partition *part); +advanced_partition *yon_advanced_partition_new(); \ No newline at end of file diff --git a/ubinstall-gtk-advanced-box.glade b/ubinstall-gtk-advanced-box.glade index 0a883d0..ead6d05 100644 --- a/ubinstall-gtk-advanced-box.glade +++ b/ubinstall-gtk-advanced-box.glade @@ -23,7 +23,7 @@ False com.ublinux.libublsettingsui-gtk3.edit-symbolic - + True False vertical @@ -55,7 +55,7 @@ - + True False /dev/sdb @@ -156,10 +156,9 @@ - + True - True - True + False True @@ -364,6 +363,9 @@ True True image4 + False @@ -380,9 +382,6 @@ - - - False diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index b5b1e9d..4151879 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -1,5 +1,5 @@ - + @@ -44,6 +44,10 @@ + + + + @@ -161,6 +165,10 @@ + + + + @@ -6847,28 +6855,155 @@ separately into the selected partition. - + True - False - vertical - 5 + True + in - + True False - vertical - 5 True False + vertical 5 - + True False - Select device: - 0 + vertical + 5 + + + True + False + 5 + + + True + False + Select device: + 0 + + + False + True + 0 + + + + + True + True + True + image20 + + + + False + True + end + 1 + + + + + False + True + 0 + + + + + True + True + in + 105 + + + True + True + DevicesList + 0 + + + + + + 6 + 5 + + + + + + + Device + + + + 0 + + + + + + + Description + + + + 1 + + + + + + + Label + + + + 2 + + + + + + + Size + + + + 3 + + + + + + + Serial + + + + 4 + + + + + + + + + False + True + 1 + + False @@ -6877,476 +7012,149 @@ separately into the selected partition. - + True - True - True - image20 - + False + 5 + + + True + False + Virtual device type: + 0 + + + False + True + 0 + + + + + True + False + False + 0 + + No + RAID0 + RAID1 + DAID4 + RAID5 + RAID6 + LVM + LVM_DYNAMIC + + + + False + True + 1 + + False True - end 1 - - - False - True - 0 - - - - - True - True - in - + True - True - DevicesList - 0 - - - Device - - - - 0 - - - - - - - Description - - - - 1 - - - - - - - Label - - - - 2 - - - - + False + vertical + 5 - - Size - - - - 3 - - + + True + False + Select partiton: + 0 + + False + True + 0 + - - Serial + + True + True + in + 140 - - - 4 - - - - - - - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - False - Virtual device type: - 0 - - - False - True - 0 - - - - - True - False - 0 - - No - RAID0 - RAID1 - DAID4 - RAID5 - RAID6 - LVM - LVM_DYNAMIC - - - - False - True - 1 - - - - - False - True - 1 - - - - - True - False - vertical - 5 - - - True - False - Select partiton: - 0 - - - False - True - 0 - - - - - True - True - in - - - True - True - PartitionsList - 0 - - - Section - - - - 0 - - - - - - - Capacity - - - - 1 - - - - - - - Free space - - - - 2 - - - - - - - File system - - - - 3 - - - - - - - Label - - - - 4 - - - - - - - - - False - True - 1 - - - - - False - True - 2 - - - - - True - False - vertical - 5 - - - - - - + - True - True - True - - - - False - True - 2 - - - - - False - True - 3 - - - - - True - False - 5 - - - True - False - start - 0 - none - - - True - False - 5 - 5 - 5 - 5 - vertical - 5 - - - True - False - 5 - - - True - False - Load type - - - False - True - 0 - - - - + True True - False - True - - - - - - - False - True - end - 1 - - - - - True - True - - - False - True - end - 2 - - - - - False - True - 0 - - - - - True - False - none - True - - - True - False - vertical - 5 + PartitionsList + 0 - - True - False + + + + + 8 + 7 + + - - False - True - 0 - - - True - False - 5 + + Section - - True - False - BIOS Boot sector - - - False - True - 0 - + + + 0 + + + + + + Capacity - - True - True - - - False - True - end - 2 - + + + 1 + - - False - True - 1 - - - True - False + + Free space + + + + 2 + + - - False - True - 2 - - - True - False - 5 + + File system - - True - False - EFI section - - - False - True - 0 - + + + 3 + + + + + + Label - - True - True - - - False - True - end - 2 - + + + 4 + - - False - True - 4 - @@ -7358,86 +7166,26 @@ separately into the selected partition. + + False + True + 2 + - - - - - - - True - True - 0 - - - - - True - False - 0 - none True False - 5 - 5 - 5 - 5 vertical 5 - + True False + vertical 5 - - True - False - Swap file - - - False - True - 0 - - - - - True - True - False - True - - - - - - - False - True - end - 1 - - - - - True - True - - - False - True - end - 2 - + @@ -7447,28 +7195,51 @@ separately into the selected partition. - + + + + True + False + True + True + + + + False + True + 2 + + + + + False + True + 3 + + + + + True + False + 5 + + True False - none - True + start + 0 + none True False + 5 + 5 + 5 + 5 vertical 5 - - - True - False - - - False - True - 0 - - True @@ -7478,7 +7249,7 @@ separately into the selected partition. True False - Automatically + Load type False @@ -7487,54 +7258,29 @@ separately into the selected partition. - + True True + False + True + + + + False True end - 2 - - - - - False - True - 1 - - - - - True - False - - - False - True - 2 - - - - - True - False - 5 - - - True - False - Corresponds to RAM size - - - False - True - 0 + 1 - + True True @@ -7549,20 +7295,155 @@ separately into the selected partition. False True - 3 + 0 - + True False + none + True + + + True + False + vertical + 5 + + + True + False + + + False + True + 0 + + + + + True + False + 5 + + + True + False + BIOS Boot sector + + + False + True + 0 + + + + + True + True + + + False + True + end + 2 + + + + + False + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + False + 5 + + + True + False + EFI section + + + False + True + 0 + + + + + True + True + + + False + True + end + 2 + + + + + False + True + 4 + + + + False True - 4 + 1 + + + + + + + + + True + True + 0 + + + + + True + False + 0 + none + + + True + False + 5 + 5 + 5 + 5 + vertical + 5 True @@ -7572,7 +7453,7 @@ separately into the selected partition. True False - Fixed size: + Swap file False @@ -7581,18 +7462,29 @@ separately into the selected partition. - + True True + False + True + + + + False True + end 1 - + True True @@ -7603,82 +7495,250 @@ separately into the selected partition. 2 + + + False + True + 0 + + + + + True + False + none + True - - True - False - Mb - - - False - True - 3 - - - - - True - True - - - False - True - 4 - - - - + True False - Gb + vertical + 5 + + + True + False + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Automatically + + + False + True + 0 + + + + + True + True + + + False + True + end + 2 + + + + + False + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + False + 5 + + + True + False + Corresponds to RAM size + + + False + True + 0 + + + + + True + True + + + False + True + end + 2 + + + + + False + True + 3 + + + + + True + False + + + False + True + 4 + + + + + True + False + 5 + + + True + False + Fixed size: + + + False + True + 0 + + + + + True + True + + + False + True + 1 + + + + + True + True + + + False + True + end + 2 + + + + + True + False + Mb + + + False + True + 3 + + + + + True + True + + + False + True + 4 + + + + + True + False + Gb + + + False + True + 5 + + + + + False + True + 5 + + - - False - True - 5 - False True - 5 + 1 + + + + - False + True True 1 + + False + True + 4 + - - - - - - True - True - 1 - - - False - True - 4 - - False + True True 2 -- 2.35.1 From fdb820910e0417172781d92d57ef5370b60b82bb Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 31 Jul 2025 18:12:15 +0600 Subject: [PATCH 15/18] WIP advanced installation slide --- source/ubinstall-gtk-installation.c | 143 ++++++++++++++++++++++------ source/ubinstall-gtk.c | 4 +- source/ubinstall-gtk.h | 18 +++- ubinstall-gtk.glade | 11 ++- 4 files changed, 143 insertions(+), 33 deletions(-) diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 7fae166..f6018a1 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -476,7 +476,7 @@ void yon_install_init(main_window *widgets, enum YON_PAGES page){ } if (format_switch){ char *format = config(part_format_parameter); - if (!strcmp(format,"yes")){ + if (!yon_char_is_empty(format)&&!strcmp(format,"yes")){ gtk_switch_set_active(GTK_SWITCH(format_switch),1); if (device_label){ char *parameter = config(part_label_parameter); @@ -545,6 +545,47 @@ void on_advanced_password_clicked(GtkWidget *, advanced_partition *part){ yon_password_open(GTK_ENTRY(part->EncryptionEntry)); } +void yon_advanced_partition_clear(main_window *widgets){ + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AdvancedPartitionAddBox)); + GList *iter; + for (iter=list;iter;iter=iter->next){ + advanced_partition *part = g_object_get_data(G_OBJECT(iter->data),"advanced_partition"); + gtk_widget_destroy(GTK_WIDGET(iter->data)); + free(part); + } + on_advanced_parts_removed(NULL,NULL,widgets); +} + +int yon_advanced_get_part_size(main_window *widgets){ + int size = 0; + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AdvancedPartitionAddBox)); + size = g_list_length(list); + g_list_free(list); + return size; +} + +void yon_advanced_set_part_sensitivity(main_window *widgets, gboolean state){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->PartitionsList); + int status; + for_iter(model,&iter){ + gtk_tree_model_get(model,&iter,8,&status,-1); + if (!status){ + gtk_list_store_set(widgets->PartitionsList,&iter,8,state?state:0,-1); + } else { + gtk_list_store_set(widgets->PartitionsList,&iter,8,1,-1); + } + } +} + +void yon_advanced_set_device_sensitivity(main_window *widgets, gboolean state){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->DevicesList); + for_iter(model,&iter){ + gtk_list_store_set(widgets->DevicesList,&iter,6,state,-1); + } +} + advanced_partition *yon_advanced_partition_new(){ advanced_partition *part = new(advanced_partition); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_advanced_part); @@ -563,6 +604,8 @@ advanced_partition *yon_advanced_partition_new(){ part->EncryptionEntry = yon_gtk_builder_get_widget(builder,"EncryptionEntry"); part->EncryptionButton = yon_gtk_builder_get_widget(builder,"EncryptionButton"); part->FormatRevealer = yon_gtk_builder_get_widget(builder,"FormatRevealer"); + part->order_iter = NULL; + part->part = NULL; yon_gtk_revealer_set_from_switch(GTK_REVEALER(part->FormatRevealer),GTK_SWITCH(part->FormatSwitch)); g_signal_connect(G_OBJECT(part->EncryptionButton),"clicked",G_CALLBACK(on_advanced_password_clicked),part); @@ -575,12 +618,67 @@ advanced_partition *yon_advanced_partition_new(){ return part; } -void on_install_advanced_add_new(GtkWidget *, main_window *){ - +void on_advanced_part_remove(GtkWidget *self, main_window *widgets){ + advanced_partition *part = g_object_get_data(G_OBJECT(self),"advanced_partition"); + + if (part->part_type == ADVANCED_PART_EXISTING){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->PartitionsList); + for_iter(model,&iter){ + int status; + char *target; + gtk_tree_model_get(model,&iter,0,&target,7,&status,-1); + if (status&&!strcmp(target,part->part)){ + gtk_list_store_set(GTK_LIST_STORE(model),&iter,7,0,-1); + yon_advanced_set_part_sensitivity(widgets,1); + } + + } + } + g_object_set_data(G_OBJECT(widgets->AdvancedPartitionAddBox),part->part,NULL); + g_sequence_remove(part->order_iter); + gtk_widget_destroy(part->MainBox); + on_advanced_parts_removed(NULL,NULL,widgets); + free(part); + +} + +void on_advanced_parts_added(GtkWidget *,GtkWidget*,main_window *widgets){ + if (yon_advanced_get_part_size(widgets)>=2){ + yon_advanced_set_part_sensitivity(widgets,0); + gtk_widget_hide(widgets->AdvancedAddButton); + } +} + +void on_advanced_parts_removed(GtkWidget *,GtkWidget*,main_window *widgets){ + int size = yon_advanced_get_part_size(widgets); + if (size<2){ + yon_advanced_set_part_sensitivity(widgets,1); + gtk_widget_show(widgets->AdvancedAddButton); + } + if (!size){ + + } +} + +void yon_advanced_partition_setup(advanced_partition *part,main_window *widgets){ + g_signal_connect(G_OBJECT(part->RemoveButton),"clicked",G_CALLBACK(on_advanced_part_remove),widgets); + g_object_set_data(G_OBJECT(widgets->AdvancedPartitionAddBox),part->part,part); +} + +void on_install_advanced_add_new(GtkWidget *, main_window *widgets){ + advanced_partition *part = yon_advanced_partition_new(); + part->part_type = ADVANCED_PART_NEW; + part->order_iter = g_sequence_append(widgets->advanced_partition_order,part); + gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0); + gtk_widget_show(part->MainBox); + yon_advanced_partition_setup(part,widgets); + on_advanced_parts_added(NULL,NULL,widgets); } void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_window *widgets){ gtk_list_store_clear(widgets->PartitionsList); + yon_advanced_partition_clear(widgets); int size; config_str partitions; @@ -593,14 +691,7 @@ void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_wind GtkTreeModel *model = GTK_TREE_MODEL(widgets->DevicesList); int chosen = 0; - for_iter (model,&iter){ - char *disk_path; - int status; - gtk_tree_model_get(model,&iter,0,&disk_path,5,&status,-1); - if (status) chosen++; - - } - + chosen = yon_advanced_get_part_size(widgets); if (gtk_tree_model_get_iter_from_string(model,&iter,path)){ int status; @@ -689,39 +780,31 @@ void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_wi GtkTreeModel *model = GTK_TREE_MODEL(widgets->PartitionsList); int chosen = 0; - - for_iter(model,&iter){ - int status; - gtk_tree_model_get(model,&iter,7,&status,-1); - if (status) chosen++; - } + chosen = yon_advanced_get_part_size(widgets); gtk_tree_model_get_iter_from_string(model,&iter,path); int status; - gtk_tree_model_get(model,&iter,7,&status,-1); + char *target_part; + gtk_tree_model_get(model,&iter,0,&target_part,7,&status,-1); if (!status){ if (chosen<2){ gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1); chosen++; advanced_partition *part = yon_advanced_partition_new(); + part->part_type = ADVANCED_PART_EXISTING; + part->order_iter = g_sequence_append(widgets->advanced_partition_order,part); + part->part = target_part; gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0); gtk_widget_show(part->MainBox); - } - if (chosen>=2){ - for_iter(model,&iter){ - gtk_tree_model_get(model,&iter,7,&status,-1); - if (!status){ - gtk_list_store_set(widgets->PartitionsList,&iter,8,0,-1); - } - } + yon_advanced_partition_setup(part,widgets); + on_advanced_parts_added(NULL,NULL,widgets); } } else { gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1); - if (chosen==2) - for_iter (model,&iter){ - gtk_list_store_set(widgets->PartitionsList,&iter,8,1,-1); + advanced_partition *part = g_object_get_data(G_OBJECT(widgets->AdvancedPartitionAddBox),target_part); + if (part){ + on_advanced_part_remove(part->RemoveButton,widgets); } - chosen--; } } \ No newline at end of file diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 4b8b4a9..1c69364 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -384,6 +384,7 @@ main_window *yon_main_window_complete(){ widgets->AdvancedSwapRamSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapRamSwitch"); widgets->AdvancedSwapFixedSwitch = yon_gtk_builder_get_widget(builder,"AdvancedSwapFixedSwitch"); widgets->AdvancedSwapFixedSpin = yon_gtk_builder_get_widget(builder,"AdvancedSwapFixedSpin"); + widgets->advanced_partition_order = g_sequence_new(NULL); widgets->GrubInstallDevicesTree = yon_gtk_builder_get_widget(builder,"GrubInstallDevicesTree"); widgets->GrubInstallPartitionTree = yon_gtk_builder_get_widget(builder,"GrubInstallPartitionTree"); @@ -633,7 +634,8 @@ main_window *yon_main_window_complete(){ g_signal_connect(G_OBJECT(widgets->AdvancedAddButton),"clicked",G_CALLBACK(on_install_advanced_add_new),widgets); g_signal_connect(G_OBJECT(widgets->AdvancedDeviceChosenCell),"toggled",G_CALLBACK(on_install_advanced_device_chosen),widgets); g_signal_connect(G_OBJECT(widgets->AdvancedPartChosenCell),"toggled",G_CALLBACK(on_install_advanced_partition_chosen),widgets); - + // g_signal_connect(G_OBJECT(widgets->AdvancedPartitionAddBox),"add",G_CALLBACK(on_advanced_parts_added),widgets); + // g_signal_connect(G_OBJECT(widgets->AdvancedPartitionAddBox),"remove",G_CALLBACK(on_advanced_parts_removed),widgets); { diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 25fc273..9203665 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -634,6 +634,7 @@ typedef struct { GtkWidget *AdvancedSwapFixedSwitch; GtkWidget *AdvancedSwapFixedSizeSwitch; dictionary *advanced_sections; + GSequence *advanced_partition_order; GFile *install_progress_file; @@ -643,6 +644,11 @@ typedef struct { } main_window; +enum ADVANCED_PART_TYPE { + ADVANCED_PART_NEW, + ADVANCED_PART_EXISTING +}; + typedef struct { GtkWidget *MainBox; GtkWidget *SectionLabel; @@ -659,7 +665,9 @@ typedef struct { GtkWidget *EncryptionCombo; GtkWidget *EncryptionEntry; GtkWidget *EncryptionButton; + GSequenceIter *order_iter; + enum ADVANCED_PART_TYPE part_type; char *part; } advanced_partition; @@ -1004,4 +1012,12 @@ void on_install_advanced_device_chosen(GtkCellRenderer*, gchar *path, main_windo 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_partition *part); -advanced_partition *yon_advanced_partition_new(); \ No newline at end of file +advanced_partition *yon_advanced_partition_new(); +void yon_advanced_partition_setup(advanced_partition *part,main_window *widgets); +void on_advanced_part_remove(GtkWidget *self, main_window *widgets); +int yon_advanced_get_part_size(main_window *widgets); +void yon_advanced_set_part_sensitivity(main_window *widgets, gboolean state); +void yon_advanced_set_device_sensitivity(main_window *widgets, gboolean state); +void on_advanced_parts_removed(GtkWidget *,GtkWidget*,main_window *widgets); +void on_advanced_parts_added(GtkWidget *,GtkWidget*,main_window *widgets); +void yon_advanced_partition_clear(main_window *widgets); \ No newline at end of file diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 4151879..796b36b 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -6858,7 +6858,6 @@ separately into the selected partition. True True - in True @@ -6929,6 +6928,11 @@ separately into the selected partition. True DevicesList 0 + + + none + + @@ -7090,6 +7094,11 @@ separately into the selected partition. True PartitionsList 0 + + + none + + -- 2.35.1 From 20033e0c268596209fd59b802e453ee852a02a6e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 4 Aug 2025 18:05:14 +0600 Subject: [PATCH 16/18] WIP Installation finish --- source/ubinstall-gtk-components.c | 5 + source/ubinstall-gtk-keyboard.c | 50 ++++--- source/ubinstall-gtk-log.c | 229 ++++++++++++++--------------- source/ubinstall-gtk-page-switch.c | 5 +- source/ubinstall-gtk-saving.c | 19 ++- source/ubinstall-gtk.c | 10 +- source/ubinstall-gtk.h | 30 +++- source/ubl-strings.h | 4 +- 8 files changed, 192 insertions(+), 160 deletions(-) diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index 0890614..e637f86 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -16,6 +16,11 @@ int yon_kernel_save(main_window *widgets){ } } + if (yon_char_is_empty(enabled_module)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),ENABLED_KERNEL_MISSING_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return 0; + } + if (!yon_char_is_empty(install_modules)){ yon_config_register(modules_extra_parameter,modules_extra_parameter_command,install_modules); } else { diff --git a/source/ubinstall-gtk-keyboard.c b/source/ubinstall-gtk-keyboard.c index b9c92d9..86f032a 100644 --- a/source/ubinstall-gtk-keyboard.c +++ b/source/ubinstall-gtk-keyboard.c @@ -246,41 +246,45 @@ void on_keyboard_clicked (GtkWidget *, main_window *widgets){ gtk_widget_show(window->MainWindow); } +void yon_layout_build(char *key, GHashTable *value, main_window *widgets){ + GtkTreeIter parent; + GtkTreeIter iter; + gtk_tree_store_append(widgets->LayoutList,&parent,NULL); + gtk_tree_store_set(widgets->LayoutList,&parent,0,key,1,_((char*)g_hash_table_lookup(value,"")),2,1,3,0,-1); + + GList *list = g_hash_table_get_keys(value); + GList *iterator = NULL; + for (iterator=list;iterator;iterator=iterator->next){ + if (!yon_char_is_empty((char*)iterator->data)){ + gtk_tree_store_append(widgets->LayoutList,&iter,&parent); + gtk_tree_store_set(widgets->LayoutList,&iter,0,(char*)iterator->data,1,_((char*)g_hash_table_lookup(value,iterator->data)),2,1,3,0,-1); + } + } +} + void yon_keyboard_init(main_window *widgets){ int size; config_str parsed = NULL; - GtkTreeIter iter; parsed = yon_config_load(yon_debug_output("%s\n",get_layouts_command),&size); - GtkTreeIter itar; + GHashTable *table = g_hash_table_new(g_str_hash,g_str_equal); for (int i=0;iLayoutList,&iter,NULL); - gtk_tree_store_set(widgets->LayoutList,&iter,0,layout[0],1,_(layout[1]),2,1,-1); - yon_char_parsed_free(layout,layout_size); - char *command = get_layouts_local_command(layout_id); - config_str layout_local = yon_config_load(yon_debug_output("%s\n",command),&layout_size); - free(command); - free(layout_id); - for (int j=0;jLayoutList,&itar,&iter); - gtk_tree_store_set(widgets->LayoutList,&itar,0,layouts_parsed[0],1,_(layouts_parsed[1]),2,1,3,0,-1); - yon_char_parsed_free(layouts_parsed,parsed_size); - } + + if (g_hash_table_contains(table,layout[0])){ + GHashTable *child_table = g_hash_table_lookup(table,layout[0]); + g_hash_table_insert(child_table,yon_char_new(layout[1]),yon_char_new(layout[2])); + }else { + GHashTable *child_table = g_hash_table_new(g_str_hash,g_str_equal); + g_hash_table_insert(table,yon_char_new(layout[0]),child_table); + g_hash_table_insert(child_table,yon_char_new(layout[1]),yon_char_new(layout[2])); } - if (layout_size==-1) { - gtk_tree_store_set(widgets->LayoutList,&iter,2,1,-1); - } - yon_char_parsed_free(layout_local,layout_size); } } + + g_hash_table_foreach(table,(GHFunc)yon_layout_build,widgets); yon_char_parsed_free(parsed,size); config_str models = yon_config_load(yon_debug_output("%s\n",get_models_command),&size); for (int i=0;ifirst,main_window*); -// log_window *window = yon_dictionary_get_data(dict->first->next,log_window*); -// -// gtk_widget_set_sensitive(widgets->ReadFullLogButton,1); -// gtk_widget_set_sensitive(widgets->ReadShortLogButton,1); -// -// free(window->command); -// window->Window=NULL; -// } +void on_log_closed(GtkWidget *, log_window *window){ + main_window *widgets = g_object_get_data(G_OBJECT(window->Window),"widgets"); -// log_window *yon_log_window_new(){ -// log_window *window = malloc(sizeof(log_window)); -// GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_log_view); -// window->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); -// window->ScrollWindow = yon_gtk_builder_get_widget(builder,"ScrollWindow"); -// window->HeadLabel = yon_gtk_builder_get_widget(builder,"headerTopic"); -// window->LogLabel = yon_gtk_builder_get_widget(builder,"LogLabel"); -// window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); -// window->ScrollToEndCheck = yon_gtk_builder_get_widget(builder,"ScrollToEndCheck"); -// gtk_widget_show(window->Window); -// return window; -// } + gtk_widget_set_sensitive(widgets->ReadFullLogButton,1); + gtk_widget_set_sensitive(widgets->ReadShortLogButton,1); -// gboolean yon_read_log(void *data){ -// log_window *window = (log_window*)data; -// if (window->Window){ -// int size; -// g_mutex_lock(&main_config.progress_mutex); -// config_str parsed = yon_file_open(window->command,&size); -// g_mutex_unlock(&main_config.progress_mutex); -// if (size){ -// char *final = yon_char_parsed_to_string(parsed,size,""); -// gtk_label_set_text(GTK_LABEL(window->LogLabel),final); -// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck))){ -// gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)),gtk_adjustment_get_upper(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)))); -// } -// free(final); -// yon_char_parsed_free(parsed,size); -// } -// g_mutex_lock(&main_config.install_mutex); -// if (!main_config.install_complete){ -// g_mutex_unlock(&main_config.install_mutex); -// return 1; -// } else { -// g_mutex_unlock(&main_config.install_mutex); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck),0); -// gtk_widget_set_sensitive(window->ScrollToEndCheck,0); -// } -// } -// return 0; -// } + free(window->command); + window->Window=NULL; +} -// void on_process_log_view(GtkWidget *,main_window *widgets){ -// log_window *window = yon_log_window_new(); -// dictionary *dict=NULL; -// yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); -// yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); -// g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),dict); -// gtk_widget_set_sensitive(widgets->ReadFullLogButton,0); -// gtk_widget_set_sensitive(widgets->ReadShortLogButton,0); -// yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,INSTALL_LOG_LABEL,icon_path,"log_viewer"); -// window->command = yon_char_new(short_log_path); -// gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); -// } +log_window *yon_log_window_new(){ + log_window *window = malloc(sizeof(log_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_log_view); + window->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); + window->ScrollWindow = yon_gtk_builder_get_widget(builder,"ScrollWindow"); + window->HeadLabel = yon_gtk_builder_get_widget(builder,"headerTopic"); + window->LogLabel = yon_gtk_builder_get_widget(builder,"LogLabel"); + window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + window->ScrollToEndCheck = yon_gtk_builder_get_widget(builder,"ScrollToEndCheck"); + window->monitor = NULL; + gtk_widget_show(window->Window); + return window; +} -// void on_summary_log_view(GtkWidget *,main_window *widgets){ -// log_window *window = yon_log_window_new(); -// dictionary *dict=NULL; -// yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); -// yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); -// g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),dict); -// gtk_widget_set_sensitive(widgets->ReadFullLogButton,0); -// gtk_widget_set_sensitive(widgets->ReadShortLogButton,0); -// yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,PROGRESS_LOG_LABEL,icon_path,"log_viewer"); -// window->command = yon_char_new(full_log_path); -// gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); -// -// } +void yon_read_log(GFileMonitor *,GFile *,GFile *,GFileMonitorEvent ,log_window *window){ + if (window->Window){ + int size; + g_mutex_lock(&main_config.progress_mutex); + config_str parsed = yon_file_open(window->command,&size); + g_mutex_unlock(&main_config.progress_mutex); + if (size){ + char *final = yon_char_parsed_to_string(parsed,size,""); + gtk_label_set_text(GTK_LABEL(window->LogLabel),final); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck))){ + gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)),gtk_adjustment_get_upper(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)))); + } + free(final); + yon_char_parsed_free(parsed,size); + } + g_mutex_lock(&main_config.install_mutex); + if (!main_config.install_complete){ + g_mutex_unlock(&main_config.install_mutex); + return; + } else { + g_mutex_unlock(&main_config.install_mutex); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck),0); + gtk_widget_set_sensitive(window->ScrollToEndCheck,0); + } + } + return ; +} -// gboolean yon_installation_progress_update(void *data) { -// main_window *widgets = (main_window*)data; -// int size; -// -// g_mutex_lock(&main_config.progress_mutex); -// config_str text = yon_file_open(progress_path, &size); -// g_mutex_unlock(&main_config.progress_mutex); -// -// if (size) { -// if (!yon_char_is_empty(text[size-1]) && text[size-1][0] == '(') { -// char *current_copy = yon_char_new(text[size-1]); -// char *percentage = yon_char_divide_search(current_copy, ")", -1); -// -// if (!strstr(percentage, "#pb")) { -// double fraction = atof(percentage+1); -// gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel), current_copy); -// gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress), fraction / 100); -// gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress), 0); -// gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), ""); -// } else { -// gtk_widget_show(gtk_widget_get_parent(widgets->PackageInstallationProgress)); -// -// config_str parsed = yon_char_parse(current_copy, &size, " "); -// if (size >= 3) { -// double fraction = atof(parsed[2]) / 100; -// gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress), fraction); -// gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), yon_char_parsed_to_string(parsed, size, " ")); -// } -// } -// -// } -// yon_char_parsed_free(text, size); -// } -// -// g_mutex_lock(&main_config.install_mutex); -// if (main_config.install_thread) { -// g_mutex_unlock(&main_config.install_mutex); -// return 1; -// } else { -// g_mutex_unlock(&main_config.install_mutex); -// gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), ""); -// return 0; -// } -// } +void on_process_log_view(GtkWidget *,main_window *widgets){ + log_window *window = yon_log_window_new(); + g_object_set_data(G_OBJECT(window->Window),"widgets",widgets); + g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),window); + gtk_widget_set_sensitive(widgets->ReadFullLogButton,0); + gtk_widget_set_sensitive(widgets->ReadShortLogButton,0); + yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,INSTALL_LOG_LABEL,icon_path,"log_viewer"); + window->command = yon_char_new(short_log_path); + GFile *file = g_file_new_for_path(window->command); + window->monitor = g_file_monitor_file(file,G_FILE_MONITOR_NONE,NULL,NULL); + g_signal_connect(G_OBJECT(window->monitor),"changed",G_CALLBACK(yon_read_log),window); + g_object_unref(file); + yon_read_log(NULL,NULL,NULL,NULL,window); +} + +void on_summary_log_view(GtkWidget *,main_window *widgets){ + log_window *window = yon_log_window_new(); + g_object_set_data(G_OBJECT(window->Window),"widgets",widgets); + g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),window); + gtk_widget_set_sensitive(widgets->ReadFullLogButton,0); + gtk_widget_set_sensitive(widgets->ReadShortLogButton,0); + yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,PROGRESS_LOG_LABEL,icon_path,"log_viewer"); + window->command = yon_char_new(full_log_path); + GFile *file = g_file_new_for_path(window->command); + window->monitor = g_file_monitor_file(file,G_FILE_MONITOR_NONE,NULL,NULL); + g_signal_connect(G_OBJECT(window->monitor),"changed",G_CALLBACK(yon_read_log),window); + g_object_unref(file); + yon_read_log(NULL,NULL,NULL,NULL,window); +} + +void yon_installation_progress_update(GFileMonitor *,GFile *,GFile *,GFileMonitorEvent ,main_window *widgets) { + int size; + + g_mutex_lock(&main_config.progress_mutex); + config_str text = yon_file_open(progress_path, &size); + g_mutex_unlock(&main_config.progress_mutex); + + if (size) { + if (!yon_char_is_empty(text[size-1]) && text[size-1][0] == '(') { + char *current_copy = yon_char_new(text[size-1]); + char *percentage = yon_char_divide_search(current_copy, ")", -1); + + if (!strstr(percentage, "#pb")) { + double fraction = atof(percentage+1); + gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel), current_copy); + gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress), fraction / 100); + gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress), 0); + gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), ""); + } else { + gtk_widget_show(gtk_widget_get_parent(widgets->PackageInstallationProgress)); + + config_str parsed = yon_char_parse(current_copy, &size, " "); + if (size >= 3) { + double fraction = atof(parsed[2]) / 100; + gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress), fraction); + gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), yon_char_parsed_to_string(parsed, size, " ")); + } + } + + } + yon_char_parsed_free(text, size); + } +} diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index 2a441de..7914afc 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -334,7 +334,10 @@ void yon_page_init(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_RECOVERY_OS_ONLY: case YON_PAGE_RECOVERY_USRDATA_ONLY: case YON_PAGE_INSTALLATION_BEGIN: - yon_install_init(widgets,page); + yon_install_init(widgets,page); + break; + case YON_PAGE_INSTALLATION: + main_config.save_configured=1; break; default: break; } diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c index 14e77a3..b032a1b 100644 --- a/source/ubinstall-gtk-saving.c +++ b/source/ubinstall-gtk-saving.c @@ -489,7 +489,7 @@ enum INSTALL_TYPE{ */ enum INSTALL_TYPE yon_ubl_get_install_mode(){ char *value = config(AUTOINSTALL_TYPE_INSTALL); - if (!strcmp(value,"common")){ + if (!strcmp(value,"fast")){ return INSTALL_COMMON; } else if (!strcmp(value,"part")){ return INSTALL_PART; @@ -539,12 +539,18 @@ void *on_config_save(void *data){ parameters = yon_config_get_selection_by_key_no_ignored(&size,install_userdata_only_parameters,NULL); break; default: - yon_ubl_status_box_render(ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),ERROR_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); return 0; } FILE *file = fopen(progress_path,"w"); - if (file) + if (file){ fclose(file); + } + GFile *file_desc = g_file_new_for_path(progress_path); + widgets->install_info_monitor = g_file_monitor_file(file_desc,G_FILE_MONITOR_NONE,NULL,NULL); + g_signal_connect(G_OBJECT(widgets->install_info_monitor),"changed",G_CALLBACK(yon_installation_progress_update),widgets); + g_object_unref(file_desc); + gtk_widget_show(gtk_widget_get_parent(widgets->InstallationProgress)); char *command = yon_debug_output("%s\n",save_config_command(yon_char_parsed_to_string(parameters,size," "))); yon_char_parsed_free(parameters,size); yon_debug_output("%s\n","Entered installation"); @@ -561,9 +567,10 @@ void *on_config_save(void *data){ g_mutex_lock(&main_config.install_mutex); main_config.install_complete=1; g_mutex_unlock(&main_config.install_mutex); - if (!main_config.save_done&&main_config.save_configured){ - on_setup_system_configuration(widgets); - } + if ((!main_config.save_done)&&main_config.save_configured){ + on_setup_system_configuration(widgets); + on_page_next_clicked(NULL,widgets); + } return 0; } diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 1c69364..4088503 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -552,8 +552,8 @@ main_window *yon_main_window_complete(){ // g_signal_connect(G_OBJECT(widgets->SaveLocalConfigurationMenuItem),"activate",G_CALLBACK(on_config_local_save),widgets); // g_signal_connect(G_OBJECT(widgets->SaveExternalConfigurationMenuItem),"activate",G_CALLBACK(on_config_custom_save),widgets); - // g_signal_connect(G_OBJECT(widgets->ReadFullLogButton),"clicked",G_CALLBACK(on_process_log_view),widgets); - // g_signal_connect(G_OBJECT(widgets->ReadShortLogButton),"clicked",G_CALLBACK(on_summary_log_view),widgets); + g_signal_connect(G_OBJECT(widgets->ReadFullLogButton),"clicked",G_CALLBACK(on_process_log_view),widgets); + g_signal_connect(G_OBJECT(widgets->ReadShortLogButton),"clicked",G_CALLBACK(on_summary_log_view),widgets); g_signal_connect(G_OBJECT(widgets->GpartedCommonButton),"clicked",G_CALLBACK(on_gparted_open),NULL); g_signal_connect(G_OBJECT(widgets->GpartedSameButton),"clicked",G_CALLBACK(on_gparted_open),NULL); @@ -566,8 +566,8 @@ main_window *yon_main_window_complete(){ g_signal_connect(G_OBJECT(widgets->AvailableLanguagesButton),"clicked",G_CALLBACK(on_language_clicked),widgets); g_signal_connect(G_OBJECT(widgets->RegionCombo),"changed",G_CALLBACK(on_region_changed),widgets); g_signal_connect(G_OBJECT(widgets->LayoutSensitiveCheck),"toggled",G_CALLBACK(on_layout_toggle_button_switch),widgets); - // g_signal_connect(G_OBJECT(widgets->AddButton),"clicked",G_CALLBACK(on_keyboard_clicked),widgets); - // g_signal_connect(G_OBJECT(widgets->RemoveButton),"clicked",G_CALLBACK(on_keyboard_removed),widgets); + g_signal_connect(G_OBJECT(widgets->AddButton),"clicked",G_CALLBACK(on_keyboard_clicked),widgets); + g_signal_connect(G_OBJECT(widgets->RemoveButton),"clicked",G_CALLBACK(on_keyboard_removed),widgets); g_signal_connect(G_OBJECT(widgets->GrubInstallDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->GrubUpdateDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); @@ -589,7 +589,7 @@ main_window *yon_main_window_complete(){ g_signal_connect(G_OBJECT(widgets->UserAddButton),"clicked",G_CALLBACK(on_user_add),widgets); g_signal_connect(G_OBJECT(widgets->UserRootPasswordButton),"clicked",G_CALLBACK(yon_password_root_new),widgets); g_signal_connect(G_OBJECT(widgets->BootloadDefaulOSButton),"clicked",G_CALLBACK(yon_menu_window_open),widgets); - // gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),3); + gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),3); // g_signal_connect(G_OBJECT(widgets->LanguageCombo),"changed",G_CALLBACK(on_locale_changed),widgets); g_signal_connect(G_OBJECT(widgets->AdditionalSoftwareCell),"toggled",G_CALLBACK(on_additional_software_toggled),widgets); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 9203665..344da05 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -94,7 +94,24 @@ 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 get_layouts_command "xkbcli list --load-exotic | awk \"layout && /description:/ {match(\\$0,/: *(.*)/,matches);description=matches[1];printf \\\"%s|%s\\n\\\",layout,description;layout=\\\"\\\"} /layout:/ {match(\\$0, /: *'([^']+)'/,matches);l=matches[1];if (layouts[l]) next;layout=layouts[l]=l}\" | sort -u" +#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 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,253" #define get_parts_and_devices_command "lsblk --noheadings --bytes -o TYPE,PATH,SIZE,FSTYPE,LABEL,PARTLABEL,MOUNTPOINT,FSUSED,FSUSE% --exclude 7,253 |awk '{print ($1\";\"$2\";\"$3\";\"$4\";\"$5\";\"$6\";\"$7\";\"$8\";\"$9)}'" @@ -723,6 +740,8 @@ typedef struct { GtkWidget *HeadLabel; GtkWidget *LogLabel; GtkWidget *ScrollToEndCheck; + GFileMonitor *monitor; + char *command; } log_window; @@ -887,11 +906,11 @@ void on_region_changed(GtkComboBox *self, main_window *widgets); void on_page_navigation_clicked(GtkWidget *self, 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); -gboolean yon_read_log(void *data); +void yon_read_log(GFileMonitor *,GFile *,GFile *,GFileMonitorEvent ,log_window *window); log_window *yon_log_window_new(); -void on_log_closed(GtkWidget *, dictionary *dict); +void on_log_closed(GtkWidget *, log_window *window); void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets); -gboolean yon_installation_progress_update(void *data); +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); gboolean on_image_slide(void *data); @@ -1020,4 +1039,5 @@ void yon_advanced_set_part_sensitivity(main_window *widgets, gboolean state); void yon_advanced_set_device_sensitivity(main_window *widgets, gboolean state); void on_advanced_parts_removed(GtkWidget *,GtkWidget*,main_window *widgets); void on_advanced_parts_added(GtkWidget *,GtkWidget*,main_window *widgets); -void yon_advanced_partition_clear(main_window *widgets); \ No newline at end of file +void yon_advanced_partition_clear(main_window *widgets); +void yon_layout_build(char *key, GHashTable *value, main_window *widgets); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 24df689..65e5c25 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -204,4 +204,6 @@ #define BOOTLOADER_USER_EXIST_LABEL(target) yon_char_unite(_("User")," ", target," ", _("is already exists. Do you really want to save user")," ",target,"?",NULL) #define GRUB_PASSWORD(target) yon_char_unite("GRUB_PASSWORD[",target,"]",NULL) -#define WRONG_IP_LABEL _("Ip adress is incorrect") \ No newline at end of file +#define WRONG_IP_LABEL _("Ip adress is incorrect") + +#define ENABLED_KERNEL_MISSING_LABEL _("No kernel was enabled") \ No newline at end of file -- 2.35.1 From 22fdc6a99901a4e8771ecfa91619d3a61a8db348 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 6 Aug 2025 18:29:17 +0600 Subject: [PATCH 17/18] Installation process finish; WIP os components --- gresource.xml | 1 + source/CMakeLists.txt | 1 + source/ubinstall-gtk-components.c | 111 ++++++++++++++----- source/ubinstall-gtk-kernel.c | 4 +- source/ubinstall-gtk-log.c | 4 +- source/ubinstall-gtk-network.c | 10 +- source/ubinstall-gtk-page-switch.c | 16 ++- source/ubinstall-gtk-saving.c | 45 +++++++- source/ubinstall-gtk-startup-services.c | 2 +- source/ubinstall-gtk.c | 17 +-- source/ubinstall-gtk.h | 84 +++++++++------ ubinstall-gtk-kernel-row.glade | 2 +- ubinstall-gtk-os-row.glade | 135 ++++++++++++++++++++++++ ubinstall-gtk.glade | 69 ++++-------- 14 files changed, 365 insertions(+), 136 deletions(-) create mode 100644 ubinstall-gtk-os-row.glade diff --git a/gresource.xml b/gresource.xml index 0c44160..0ed7fcf 100644 --- a/gresource.xml +++ b/gresource.xml @@ -12,6 +12,7 @@ ubinstall-gtk-menu.glade ubinstall-gtk-menu-item.glade ubinstall-gtk-kernel-row.glade + ubinstall-gtk-os-row.glade ubinstall-gtk-service-window.glade ubinstall-gtk-bootloader-user.glade ubinstall-gtk-network-box.glade diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 8d983f6..990ee99 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -69,6 +69,7 @@ set(DEPENDFILES ../ubinstall-gtk-menu.glade ../ubinstall-gtk-menu-item.glade ../ubinstall-gtk-kernel-row.glade + ../ubinstall-gtk-os-row.glade ../ubinstall-gtk-service-window.glade ../ubinstall-gtk-bootloader-user.glade ../ubinstall-gtk-network-box.glade diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index e637f86..45e586d 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -52,18 +52,19 @@ int yon_kernel_addon_save(main_window *widgets){ } int yon_os_components_save(main_window *widgets){ - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->OSSoftwareList); - int size = 0; + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->OSSoftwareListBox)); + GList *iter; + int size; config_str modules = NULL; - for_iter(model,&iter){ - char *target; - int status; - gtk_tree_model_get(model,&iter,0,&status,1,&target,-1); + for(iter = list;iter;iter=iter->next){ + kernel_row *row = g_object_get_data(iter->data,"kernel_row"); + char *target = row->name; + int status = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->InstallCheck)); if (status){ yon_char_parsed_add_or_create_if_exists(modules,&size,target); } } + g_list_free(list); if (size){ char *final = yon_char_parsed_to_string(modules,size,","); yon_config_register(modules_parameter,modules_parameter_command,final); @@ -73,26 +74,79 @@ int yon_os_components_save(main_window *widgets){ return 1; } +os_row *yon_os_row_new(){ + os_row *row = new(os_row); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_os_row); + row->RowBox = yon_gtk_builder_get_widget(builder,"TableRow"); + row->InstallCheck = yon_gtk_builder_get_widget(builder,"InstallCheck"); + row->NameLabel = yon_gtk_builder_get_widget(builder,"NameLabel"); + row->TagsBox = yon_gtk_builder_get_widget(builder,"TagsBox"); + row->VersionLabel = yon_gtk_builder_get_widget(builder,"VersionLabel"); + row->DescriptionLabel = yon_gtk_builder_get_widget(builder,"DescriptionLabel"); + row->name=NULL; + row->modules=NULL; + row->version=NULL; + + g_signal_connect(G_OBJECT(row->InstallCheck),"toggled",G_CALLBACK(on_kernel_install_enabled),row); + + row->row = gtk_list_box_row_new(); + gtk_container_add(GTK_CONTAINER(row->row),row->RowBox); + gtk_widget_show(row->row); + + g_object_set_data(G_OBJECT(row->InstallCheck),"kernel_row",row); + g_object_set_data(G_OBJECT(row->row),"kernel_row",row); + + return row; +} + +void yon_os_row_setup(os_row *row, char *name, char *version,char *tags, char *description){ + row->name = yon_char_new(name); + + char *description_full = yon_char_new(description); + if (strlen(description)>100){ + guint size; + config_str description_wrapped = yon_char_wrap_to_lines(description,3,&size); + description_full = yon_char_parsed_to_string(description_wrapped,size,"\n"); + yon_char_parsed_free(description_wrapped,size); + } + gtk_label_set_label(GTK_LABEL(row->NameLabel),name); + gtk_label_set_label(GTK_LABEL(row->VersionLabel),version); + gtk_label_set_label(GTK_LABEL(row->DescriptionLabel),description_full); + + yon_kernel_row_setup_tags((kernel_row*)row,tags); + free(description_full); +} + void yon_os_components_init(main_window *widgets){ - GtkTreeIter iter; - if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->OSSoftwareList),&iter)){ + int size = 0; + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->OSSoftwareListBox)); + GList *iter; + if (!list){ int base_size; - config_str base = yon_file_ls(system_base_modules_path,&base_size); + config_str base = yon_config_load(get_modules_command,&base_size); for (int i=0;iOSSoftwareList,&iter); - gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,base[i],2,version,3,description,-1); + int parsed_size; + config_str parsed = yon_char_parse(base[i],&parsed_size,";"); + char *version = parsed[1]; + char *name = parsed[0]; + char *tags = yon_char_replace(parsed[2]," ",", "); + char *description = parsed[3]; + os_row *row = yon_os_row_new(); + yon_os_row_setup(row,name,version,tags,description); + gtk_list_box_insert(GTK_LIST_BOX(widgets->OSSoftwareListBox),row->row,-1); + int min_size=0; + gtk_widget_get_preferred_width(row->NameLabel,&min_size,NULL); + if (min_size>size) size=min_size; + + } - int modules_size; - config_str modules = yon_file_ls(system_modules_path,&modules_size); - for (int i=0;iOSSoftwareList,&iter); - char *version = yon_packages_get_version(YON_PACKAGES_SYNC,base[i]); - char *description = yon_packages_get_description(YON_PACKAGES_SYNC,base[i]); - gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,modules[i],2,version,3,description,-1); + yon_char_parsed_free(base,base_size); + while(gtk_events_pending()) gtk_main_iteration(); + list = gtk_container_get_children(GTK_CONTAINER(widgets->OSSoftwareListBox)); + for(iter = list;iter;iter=iter->next){ + os_row *row = g_object_get_data(iter->data,"kernel_row"); + gtk_widget_set_size_request(row->NameLabel,size,-1); } } @@ -100,17 +154,16 @@ void yon_os_components_init(main_window *widgets){ if (!yon_char_is_empty(modules)){ int parsed_size; config_str parsed = yon_char_parse(modules,&parsed_size,","); - GtkTreeIter iter; - for_iter (GTK_TREE_MODEL(widgets->OSSoftwareList),&iter){ - char *target; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->OSSoftwareList),&iter,1,&target,-1); + for(iter = list;iter;iter=iter->next){ + os_row *row = g_object_get_data(iter->data,"kernel_row"); + char *target = row->name; if (yon_char_parsed_check_exist(parsed,parsed_size,target)>-1){ - gtk_list_store_set(widgets->OSSoftwareList,0,1,-1); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(row->InstallCheck),1); } else { - gtk_list_store_set(widgets->OSSoftwareList,0,0,-1); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(row->InstallCheck),1); } } - yon_char_parsed_free(parsed,parsed_size); + yon_char_parsed_free(parsed,parsed_size); } } diff --git a/source/ubinstall-gtk-kernel.c b/source/ubinstall-gtk-kernel.c index 04e0f5a..3b9d3bf 100644 --- a/source/ubinstall-gtk-kernel.c +++ b/source/ubinstall-gtk-kernel.c @@ -85,7 +85,9 @@ void yon_kernel_row_setup_tags(kernel_row *row, char *tags){ tag_type = "tag_blue"; } else if (!strcmp(tag_name,REACTIVE_TAG)){ tag_type = "tag_purple"; - } else continue; + } else{ + tag_type = "tag_green"; + }; yon_tag_add(GTK_BOX(row->TagsBox),tag_name,tag_type,NULL); } } diff --git a/source/ubinstall-gtk-log.c b/source/ubinstall-gtk-log.c index 27c54a5..5de4a71 100644 --- a/source/ubinstall-gtk-log.c +++ b/source/ubinstall-gtk-log.c @@ -65,7 +65,7 @@ void on_process_log_view(GtkWidget *,main_window *widgets){ window->monitor = g_file_monitor_file(file,G_FILE_MONITOR_NONE,NULL,NULL); g_signal_connect(G_OBJECT(window->monitor),"changed",G_CALLBACK(yon_read_log),window); g_object_unref(file); - yon_read_log(NULL,NULL,NULL,NULL,window); + yon_read_log(NULL,NULL,NULL,G_FILE_MONITOR_EVENT_CHANGED,window); } void on_summary_log_view(GtkWidget *,main_window *widgets){ @@ -80,7 +80,7 @@ void on_summary_log_view(GtkWidget *,main_window *widgets){ window->monitor = g_file_monitor_file(file,G_FILE_MONITOR_NONE,NULL,NULL); g_signal_connect(G_OBJECT(window->monitor),"changed",G_CALLBACK(yon_read_log),window); g_object_unref(file); - yon_read_log(NULL,NULL,NULL,NULL,window); + yon_read_log(NULL,NULL,NULL,G_FILE_MONITOR_EVENT_CHANGED,window); } void yon_installation_progress_update(GFileMonitor *,GFile *,GFile *,GFileMonitorEvent ,main_window *widgets) { diff --git a/source/ubinstall-gtk-network.c b/source/ubinstall-gtk-network.c index 5aa2ebb..24a0e8b 100644 --- a/source/ubinstall-gtk-network.c +++ b/source/ubinstall-gtk-network.c @@ -151,8 +151,8 @@ void on_connection_add(GtkWidget *,main_window *widgets){ int yon_network_save(main_window *widgets){ if (gtk_switch_get_active(GTK_SWITCH(widgets->NetworkDomainSwitch))){ const char *domain_name = gtk_entry_get_text(GTK_ENTRY(widgets->NetworkDomainNameEntry)); - if (!yon_char_is_empty(domain_name)){ - yon_ubl_status_box_render(EMPTY_IMPORTANT_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + if (yon_char_is_empty(domain_name)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(widgets->NetworkDomainNameEntry); return 0; } @@ -161,7 +161,7 @@ int yon_network_save(main_window *widgets){ if (!yon_char_is_empty(domain_name)) yon_config_register(DOMAIN_parameter,DOMAIN_parameter_command,(char*)domain_name); else yon_config_remove_by_key(DOMAIN_parameter); if ((!yon_char_is_empty(domain_admin)&&yon_char_is_empty(domain_password))||(yon_char_is_empty(domain_admin)&&!yon_char_is_empty(domain_password))){ - yon_ubl_status_box_render(EMPTY_IMPORTANT_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(widgets->NetworkDomainAdminEntry); yon_ubl_status_highlight_incorrect(widgets->NetworkDomainPasswordEntry); return 0; @@ -170,7 +170,7 @@ int yon_network_save(main_window *widgets){ int size; config_str encrypted_password = yon_config_load(encrypt_domain_password_command(domain_password),&size); if (!size){ - yon_ubl_status_box_render(ENCRYPT_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),ENCRYPT_ERROR_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(widgets->NetworkDomainPasswordEntry); return 0; } @@ -199,7 +199,7 @@ int yon_network_save(main_window *widgets){ case 4: char *value = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->NetworkNTPEntry)); if (yon_char_is_empty(value)) { - yon_ubl_status_box_render(EMPTY_IMPORTANT_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(widgets->NetworkNTPEntry); return 0; } diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index 7914afc..cdb47bd 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -20,10 +20,10 @@ enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_STARTUP: return YON_PAGE_BOOTLOADER; break; case YON_PAGE_BOOTLOADER: return YON_PAGE_NETWORK; break; case YON_PAGE_NETWORK: return main_config.configure_mode? YON_PAGE_CONFIGURE_END : YON_PAGE_INSTALLATION; break; - case YON_PAGE_INSTALL_COMMON: return main_config.configure_mode?YON_PAGE_KERNEL:YON_PAGE_INSTALLATION_BEGIN; break; - case YON_PAGE_INSTALL_SEPARATE: return main_config.configure_mode?YON_PAGE_KERNEL:YON_PAGE_INSTALLATION_BEGIN; break; - case YON_PAGE_INSTALL_SAME_PARTITION: return main_config.configure_mode?YON_PAGE_KERNEL:YON_PAGE_INSTALLATION_BEGIN; break; - case YON_PAGE_INSTALL_ADVANCED: return main_config.configure_mode?YON_PAGE_KERNEL:YON_PAGE_INSTALLATION_BEGIN; break; + case YON_PAGE_INSTALL_COMMON: return main_config.configure_mode?YON_PAGE_KERNEL:YON_PAGE_OS_COMPONENTS; break; + case YON_PAGE_INSTALL_SEPARATE: return main_config.configure_mode?YON_PAGE_KERNEL:YON_PAGE_OS_COMPONENTS; break; + case YON_PAGE_INSTALL_SAME_PARTITION: return main_config.configure_mode?YON_PAGE_KERNEL:YON_PAGE_OS_COMPONENTS; break; + case YON_PAGE_INSTALL_ADVANCED: return main_config.configure_mode?YON_PAGE_KERNEL:YON_PAGE_OS_COMPONENTS; break; case YON_PAGE_INSTALL_RECOVERY: return yon_recovery_get_next(widgets); break; case YON_PAGE_RECOVERY_GRUB_INSTALL: return main_config.configure_mode?YON_PAGE_INSTALLATION:YON_PAGE_INSTALLATION_BEGIN; break; case YON_PAGE_RECOVERY_GRUB_UPDATE: return main_config.configure_mode?YON_PAGE_INSTALLATION:YON_PAGE_INSTALLATION_BEGIN; break; @@ -338,6 +338,14 @@ void yon_page_init(main_window *widgets, enum YON_PAGES page){ break; case YON_PAGE_INSTALLATION: main_config.save_configured=1; + g_mutex_lock(&main_config.install_mutex); + if (main_config.install_complete){ + g_mutex_unlock(&main_config.install_mutex); + on_setup_system_configuration(widgets); + on_page_next_clicked(NULL,widgets); + } else { + g_mutex_unlock(&main_config.install_mutex); + } break; default: break; } diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c index b032a1b..11b49bb 100644 --- a/source/ubinstall-gtk-saving.c +++ b/source/ubinstall-gtk-saving.c @@ -580,9 +580,6 @@ void *on_setup_system_configuration(void * data){ if (widgets){}; int size; config_str all_parameters = yon_config_get_selection_by_key(&size, - user_name_parameter, - user_gecos_parameter, - user_password_parameter, root_password_parameter, autologin_parameter, xkbmodel_parameter, @@ -593,7 +590,49 @@ void *on_setup_system_configuration(void * data){ zone_parameter, lang_parameter, locale_parameter, + SERVICES_ENABLE_parameter, + GRUB_DEFAULT_parameter, + GRUB_TIMEOUT_parameter, + AUTOLOGINUSER_parameter, + GRUB_SUPERUSERS_parameter, + DOMAIN_parameter, + DOMAIN_admanger_parameter, + NTPSERVERS_parameter, + modules_extra_parameter, + KERNEL_BOOT_parameter, + modules_parameter, + packages_parameter, NULL); + int user_size=0; + config_str users = yon_config_get_all_by_key(USERADD_parameter_search,&user_size); + if (user_size){ + int final_size; + config_str final = yon_char_parsed_merge(all_parameters,size,users,user_size,&final_size); + yon_char_parsed_free(users,user_size); + if (size) yon_char_parsed_free(all_parameters,size); + all_parameters = final; + size = final_size; + } + users = yon_config_get_all_by_key(GRUB_PASSWORD_parameter_search,&user_size); + if (users){ + int final_size; + config_str final = yon_char_parsed_merge(all_parameters,size,users,user_size,&final_size); + yon_char_parsed_free(users,user_size); + if (size) yon_char_parsed_free(all_parameters,size); + all_parameters = final; + size = final_size; + } + int network_size; + config_str networks = yon_config_get_all_by_key(NETWORK_parameter_search,&network_size); + if (network_size){ + int final_size; + config_str final = yon_char_parsed_merge(all_parameters,size,networks,network_size,&final_size); + yon_char_parsed_free(networks,network_size); + if (size) yon_char_parsed_free(all_parameters,size); + all_parameters = final; + size = final_size; + } + if (all_parameters){ char *parameter_string = yon_char_parsed_to_string(all_parameters,size," "); char *command = set_user_config_command(parameter_string); diff --git a/source/ubinstall-gtk-startup-services.c b/source/ubinstall-gtk-startup-services.c index 92005b4..aaa0fbd 100644 --- a/source/ubinstall-gtk-startup-services.c +++ b/source/ubinstall-gtk-startup-services.c @@ -144,7 +144,7 @@ int yon_startup_save(main_window *widgets){ list_size++; char *target; int status; - gtk_tree_model_get(model,&iter,0,&status,1,&target,-1); + gtk_tree_model_get(model,&iter,0,&status,2,&target,-1); if (status){ yon_char_parsed_add_or_create_if_exists(modules,&size,target); } diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 4088503..046599c 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -6,14 +6,6 @@ int cur_slide=0; // //functions -void on_os_components_toggled(GtkWidget*, char *path, main_window *widgets){ - GtkTreeIter iter; - int status; - gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(widgets->OSSoftwareList),&iter,path); - gtk_tree_model_get(GTK_TREE_MODEL(widgets->OSSoftwareList),&iter,0,&status,-1); - gtk_list_store_set(widgets->OSSoftwareList,&iter,0,!status,-1); -} - void on_pacman_software_all_toggled(GtkWidget *, char *path, main_window *widgets){ GtkTreeIter iter; char *name, *type, *description; @@ -485,9 +477,11 @@ main_window *yon_main_window_complete(){ widgets->KernelAddonModulesLabel = yon_gtk_builder_get_widget(builder,"KernelAddonModulesLabel"); widgets->KernelAddonDescriptionLabel = yon_gtk_builder_get_widget(builder,"KernelAddonDescriptionLabel"); - widgets->OSSoftwareTree = yon_gtk_builder_get_widget(builder,"OSSoftwareTree"); - widgets->OSSoftwareList = GTK_LIST_STORE(gtk_builder_get_object(builder,"OSSoftwareList")); - widgets->OSSoftwareCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"OSSoftwareCell")); + widgets->OSSoftwareListBox = yon_gtk_builder_get_widget(builder,"OSSoftwareListBox"); + widgets->OSSoftwareInstallLabel = yon_gtk_builder_get_widget(builder,"OSSoftwareInstallLabel"); + widgets->OSSoftwareNameLabel = yon_gtk_builder_get_widget(builder,"OSSoftwareNameLabel"); + widgets->OSSoftwareTagsLabel = yon_gtk_builder_get_widget(builder,"OSSoftwareTagsLabel"); + widgets->OSSoftwareDescriptionLabel = yon_gtk_builder_get_widget(builder,"OSSoftwareDescriptionLabel"); widgets->PacmanSoftwareSearchEntry = yon_gtk_builder_get_widget(builder,"PacmanSoftwareSearchEntry"); widgets->PacmanSoftwareStatusImage = yon_gtk_builder_get_widget(builder,"PacmanSoftwareStatusImage"); @@ -607,7 +601,6 @@ main_window *yon_main_window_complete(){ yon_gtk_revealer_set_from_switch(GTK_REVEALER(widgets->NextInstallationFormatRevealer),GTK_SWITCH(widgets->NextInstallationFormatSwitch)); yon_gtk_revealer_set_from_switch(GTK_REVEALER(widgets->SameInstallationFormatRevealer),GTK_SWITCH(widgets->SameInstallationFormatSwitch)); - g_signal_connect(G_OBJECT(widgets->OSSoftwareCell),"toggled",G_CALLBACK(on_os_components_toggled),widgets); g_signal_connect(G_OBJECT(widgets->PacmanSoftwareAllCell),"toggled",G_CALLBACK(on_pacman_software_all_toggled),widgets); g_signal_connect(G_OBJECT(widgets->PacmanSoftwareChosenCell),"toggled",G_CALLBACK(on_pacman_software_chosen_toggled),widgets); g_signal_connect(G_OBJECT(widgets->PacmanSoftwareSearchEntry),"icon-press",G_CALLBACK(on_pacman_icon_press),widgets); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 344da05..92bb622 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -30,6 +30,7 @@ #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_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" @@ -78,6 +79,8 @@ "/com/ublinux/images/slide-12.png", \ NULL +#define get_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_menuentry" @@ -132,32 +135,32 @@ layout && /description:/ {\ #define modules_extra_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[modules_extra]" /*------------------------------------------------------------*/ -#define user_name_parameter "AUTOINSTALL[user_name]" -#define user_name_parameter_command "ubconfig --source global --conarg get [autoinstall] AUTOINSTALL[user_name]" -#define user_gecos_parameter "AUTOINSTALL[user_gecos]" -#define user_gecos_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[user_gecos]" -#define user_password_parameter "AUTOINSTALL[user_password]" -#define user_password_parameter_command "ubconfig --source global --conarg get [autoinstall] AUTOINSTALL[user_password]" -#define root_password_parameter "AUTOINSTALL[root_password]" -#define root_password_parameter_command "ubconfig --source global --conarg get [autoinstall] AUTOINSTALL[root_password]" -#define autologin_parameter "AUTOINSTALL[autologin]" -#define autologin_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[autologin]" -#define xkbmodel_parameter "AUTOINSTALL[xkbmodel]" -#define xkbmodel_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[xkbmodel]" -#define xkblayout_parameter "AUTOINSTALL[xkblayout]" -#define xkblayout_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[xkblayout]" -#define xkbvariant_parameter "AUTOINSTALL[xkbvariant]" -#define xkbvariant_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[xkbvariant]" -#define xkboptions_parameter "AUTOINSTALL[xkboptions]" -#define xkboptions_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[xkboptions]" -#define hostname_parameter "AUTOINSTALL[hostname]" -#define hostname_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[hostname]" -#define zone_parameter "AUTOINSTALL[zone]" -#define zone_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[zone]" -#define lang_parameter "AUTOINSTALL[lang]" -#define lang_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[lang]" -#define locale_parameter "AUTOINSTALL[locale]" -#define locale_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[locale]" +// #define user_name_parameter "AUTOINSTALL[user_name]" +// #define user_name_parameter_command "ubconfig --source global --conarg get [autoinstall] AUTOINSTALL[user_name]" +// #define user_gecos_parameter "AUTOINSTALL[user_gecos]" +// #define user_gecos_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[user_gecos]" +// #define user_password_parameter "AUTOINSTALL[user_password]" +// #define user_password_parameter_command "ubconfig --source global --conarg get [autoinstall] AUTOINSTALL[user_password]" +#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 part_size_parameter "AUTOINSTALL[part_size]" @@ -587,9 +590,11 @@ typedef struct { GtkWidget *KernelAddonModulesLabel; GtkWidget *KernelAddonDescriptionLabel; - GtkWidget *OSSoftwareTree; - GtkListStore *OSSoftwareList; - GtkCellRenderer *OSSoftwareCell; + GtkWidget *OSSoftwareListBox; + GtkWidget *OSSoftwareInstallLabel; + GtkWidget *OSSoftwareNameLabel; + GtkWidget *OSSoftwareTagsLabel; + GtkWidget *OSSoftwareDescriptionLabel; GtkWidget *PacmanSoftwareSearchEntry; GtkWidget *PacmanSoftwareStatusImage; @@ -812,10 +817,10 @@ typedef struct { typedef struct { GtkWidget *row; GtkWidget *RowBox; + GtkWidget *TagsBox; GtkWidget *InstallCheck; GtkWidget *EnableRadio; GtkWidget *EnableSeparator; - GtkWidget *TagsBox; GtkWidget *TagsSeparator; GtkWidget *NameLabel; GtkWidget *DescriptionLabel; @@ -826,6 +831,20 @@ typedef struct { char *package; } kernel_row; +typedef struct { + GtkWidget *row; + GtkWidget *RowBox; + GtkWidget *TagsBox; + GtkWidget *InstallCheck; + GtkWidget *NameLabel; + GtkWidget *VersionLabel; + GtkWidget *DescriptionLabel; + + char *name; + char *modules; + char *version; +} os_row; + typedef struct { GtkWidget *Window; GtkWidget *StatusBox; @@ -1000,7 +1019,6 @@ void on_startup_add_accept(GtkWidget *, main_window *widgets); void yon_startup_services_setup(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_os_components_toggled(GtkWidget*, char *path, 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); @@ -1040,4 +1058,6 @@ void yon_advanced_set_device_sensitivity(main_window *widgets, gboolean state); void on_advanced_parts_removed(GtkWidget *,GtkWidget*,main_window *widgets); void on_advanced_parts_added(GtkWidget *,GtkWidget*,main_window *widgets); void yon_advanced_partition_clear(main_window *widgets); -void yon_layout_build(char *key, GHashTable *value, main_window *widgets); \ No newline at end of file +void yon_layout_build(char *key, GHashTable *value, main_window *widgets); +void yon_os_row_setup(os_row *row, char *name, char *version,char *tags, char *description); +os_row *yon_os_row_new(); \ No newline at end of file diff --git a/ubinstall-gtk-kernel-row.glade b/ubinstall-gtk-kernel-row.glade index b41c8db..7a5bd27 100644 --- a/ubinstall-gtk-kernel-row.glade +++ b/ubinstall-gtk-kernel-row.glade @@ -1,5 +1,5 @@ - + diff --git a/ubinstall-gtk-os-row.glade b/ubinstall-gtk-os-row.glade new file mode 100644 index 0000000..6bde8c2 --- /dev/null +++ b/ubinstall-gtk-os-row.glade @@ -0,0 +1,135 @@ + + + + + + + True + False + 11 + + + True + True + False + True + + + False + True + 0 + + + + + True + False + 1 + vertical + 1 + + + True + False + 7 + + + True + False + Name + 0 + False + 0 + + + + + + False + True + 0 + + + + + True + False + Version + True + 15 + False + 0 + + + False + True + 1 + + + + + True + False + start + 3 + 5 + 2 + + + + + + False + True + 6 + + + + + + False + True + 0 + + + + + True + False + 2 + Description + 0 + 0 + + + True + True + end + 1 + + + + + True + False + + + False + True + 2 + + + + + True + True + 1 + + + + + diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 796b36b..4355f51 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -731,6 +731,7 @@ agreement 5 5 left + False True @@ -1405,55 +1406,31 @@ and help you install UBLinux on your computer True in - + True - True - OSSoftwareList - 0 - both - - - - - - - - - 0 - - - - - - - Module name - - - - 1 - - - - - - - Type - - - - 2 - - - - + False + 5 + 5 + 5 + 5 + 5 + 5 - - Description + + True + False + vertical - - - 3 - + + True + False + none + + + True + True + 1 + -- 2.35.1 From 98c90ed7b12de2c262f0c0d1b82f7f89e3d8763f Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 7 Aug 2025 18:06:17 +0600 Subject: [PATCH 18/18] WIP parameters loading --- source/ubinstall-gtk-components.c | 2 +- source/ubinstall-gtk-install-start.c | 9 +- source/ubinstall-gtk-installation.c | 18 +- source/ubinstall-gtk-kernel.c | 20 +- source/ubinstall-gtk-keyboard.c | 39 ++++ source/ubinstall-gtk-page-switch.c | 156 ++------------ source/ubinstall-gtk-region.c | 44 ++++ source/ubinstall-gtk-saving.c | 103 ++++----- source/ubinstall-gtk.c | 9 +- source/ubinstall-gtk.h | 71 +++--- ubinstall-gtk.glade | 308 +++++++++------------------ 11 files changed, 314 insertions(+), 465 deletions(-) diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index 45e586d..8191083 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -57,7 +57,7 @@ int yon_os_components_save(main_window *widgets){ int size; config_str modules = NULL; for(iter = list;iter;iter=iter->next){ - kernel_row *row = g_object_get_data(iter->data,"kernel_row"); + os_row *row = g_object_get_data(iter->data,"kernel_row"); char *target = row->name; int status = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->InstallCheck)); if (status){ diff --git a/source/ubinstall-gtk-install-start.c b/source/ubinstall-gtk-install-start.c index e4e97a8..d6648ca 100644 --- a/source/ubinstall-gtk-install-start.c +++ b/source/ubinstall-gtk-install-start.c @@ -1,6 +1,11 @@ #include "ubinstall-gtk.h" int yon_installation_start(main_window *widgets){ - g_thread_new("install_thread",(GThreadFunc)on_config_save,widgets); - return 1; + return !pthread_create(&main_config.install_thread,NULL,on_config_save,widgets); +} + +void yon_quick_install(GtkWidget *, main_window *widgets){ + main_config.save_configured=1; + pthread_create(&main_config.install_thread,NULL,on_config_save,widgets); + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION); } \ No newline at end of file diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index f6018a1..ac01b58 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -388,6 +388,13 @@ void yon_install_init(main_window *widgets, enum YON_PAGES page){ fs_type_combo = widgets->CommonInstallationFilesystemTypeCombo; break; case YON_PAGE_INSTALL_SAME_PARTITION: + device_tree = widgets->SamePlaceDeviceTree; + partition_tree = widgets->SamePlacePartTree; + format_switch = widgets->SameInstallationFormatSwitch; + partition_mark_entry = widgets->SameInstallationSectionNameEntry; + fs_type_combo = widgets->SameInstallationFilesystemTypeCombo; + break; + case YON_PAGE_INSTALL_SEPARATE: device_tree = widgets->NextInstallationSysDevicesTree; partition_tree = widgets->NextInstallationSysSectionTree; format_switch = widgets->NextInstallationFormatSwitch; @@ -395,13 +402,6 @@ void yon_install_init(main_window *widgets, enum YON_PAGES page){ partition_size_combo = widgets->NextInstallationSizeTypeSpin; partition_mark_entry = widgets->NextInstallationSectionNameEntry; fs_type_combo = widgets->NextInstallationFilesystemTypeCombo; - break; - case YON_PAGE_INSTALL_SEPARATE: - device_tree = widgets->SamePlaceDeviceTree; - partition_tree = widgets->SamePlacePartTree; - format_switch = widgets->SameInstallationFormatSwitch; - partition_mark_entry = widgets->SameInstallationSectionNameEntry; - fs_type_combo = widgets->SameInstallationFilesystemTypeCombo; break; case YON_PAGE_INSTALL_ADVANCED: @@ -476,7 +476,7 @@ void yon_install_init(main_window *widgets, enum YON_PAGES page){ } if (format_switch){ char *format = config(part_format_parameter); - if (!yon_char_is_empty(format)&&!strcmp(format,"yes")){ + if ((!yon_char_is_empty(format)&&!strcmp(format,"yes"))||format_switch==widgets->CommonFormatSwitch){ gtk_switch_set_active(GTK_SWITCH(format_switch),1); if (device_label){ char *parameter = config(part_label_parameter); @@ -505,7 +505,7 @@ void yon_install_init(main_window *widgets, enum YON_PAGES page){ } } if (partition_mark_entry){ - char *parameter = config(part_fs_label_parameter); + char *parameter = config(part_label_parameter); if (!yon_char_is_empty(parameter)){ gtk_entry_set_text(GTK_ENTRY(partition_mark_entry),parameter); } else { diff --git a/source/ubinstall-gtk-kernel.c b/source/ubinstall-gtk-kernel.c index 3b9d3bf..f41a73c 100644 --- a/source/ubinstall-gtk-kernel.c +++ b/source/ubinstall-gtk-kernel.c @@ -196,10 +196,10 @@ void yon_kernel_setup(main_window *widgets){ char *modules = config(modules_extra_parameter); char *enabled = config(KERNEL_BOOT_parameter); - int parsed_size; + int modules_size; config_str modules_parsed = NULL; if (!yon_char_is_empty(modules)){ - modules_parsed = yon_char_parse(modules,&parsed_size,","); + modules_parsed = yon_char_parse(modules,&modules_size," "); } int size; @@ -222,22 +222,22 @@ void yon_kernel_setup(main_window *widgets){ gtk_radio_button_join_group(GTK_RADIO_BUTTON(row->EnableRadio),GTK_RADIO_BUTTON(main_config.kernel_unchosen_radio)); yon_kernel_row_setup(row,name,modules,package,tags,description); - yon_char_parsed_free(parsed,parsed_size); - if (yon_char_parsed_check_exist(modules_parsed,parsed_size,name)>-1){ + if (yon_char_parsed_check_exist(modules_parsed,modules_size,parsed[1])>-1){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(row->InstallCheck),1); } else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(row->InstallCheck),0); } - if (!yon_char_is_empty(enabled)&&!strcmp(name,enabled)){ + if (!yon_char_is_empty(enabled)&&!strcmp(package,enabled)){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(row->EnableRadio),1); } + yon_char_parsed_free(parsed,parsed_size); } yon_kernel_resize(widgets); yon_char_parsed_free(kernels,size); - + yon_char_parsed_free(modules_parsed,modules_size); } void yon_kernel_addon_setup(main_window *widgets){ @@ -256,10 +256,10 @@ void yon_kernel_addon_setup(main_window *widgets){ char *modules = config(modules_extra_parameter); - int parsed_size; + int modules_size; config_str modules_parsed = NULL; if (!yon_char_is_empty(modules)){ - modules_parsed = yon_char_parse(modules,&parsed_size,","); + modules_parsed = yon_char_parse(modules,&modules_size," "); } int size; @@ -283,13 +283,13 @@ void yon_kernel_addon_setup(main_window *widgets){ gtk_widget_destroy(row->EnableSeparator); yon_kernel_row_setup(row,name,modules,package,tags,description); - yon_char_parsed_free(parsed,parsed_size); - if (yon_char_parsed_check_exist(modules_parsed,parsed_size,name)>-1){ + if (yon_char_parsed_check_exist(modules_parsed,modules_size,parsed[1])>-1){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(row->InstallCheck),1); } else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(row->InstallCheck),0); } + yon_char_parsed_free(parsed,parsed_size); } yon_kernel_addon_resize(widgets); diff --git a/source/ubinstall-gtk-keyboard.c b/source/ubinstall-gtk-keyboard.c index 86f032a..277a395 100644 --- a/source/ubinstall-gtk-keyboard.c +++ b/source/ubinstall-gtk-keyboard.c @@ -293,4 +293,43 @@ void yon_keyboard_init(main_window *widgets){ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->KeyboardModelCombo),models[i],_(models[i+1])); } if (size) yon_char_parsed_free(models,size); + + char *keyboard = config(xkbmodel_parameter); + char *option_parameter = config(xkboptions_parameter); + char *layouts = config(xkblayout_parameter); + + if (!yon_char_is_empty(keyboard)){ + gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo),keyboard); + } else { + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo),0); + } + + if (!yon_char_is_empty(option_parameter)){ + gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LayoutBindingCombo),option_parameter); + } else{ + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LayoutBindingCombo),0); + } + + if (!yon_char_is_empty(layouts)){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LayoutSensitiveCheck),1); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio),1); + int parsed_size; + config_str parsed = yon_char_parse(layouts,&parsed_size,","); + + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->LayoutList); + for_iter(model,&iter){ + char *target; + gtk_tree_model_get(model,&iter,0,&target,-1); + if (yon_char_parsed_check_exist(parsed,parsed_size,target)>-1){ + gtk_tree_store_set(widgets->LayoutList,&iter,2,1,3,1,-1); + } else { + gtk_tree_store_set(widgets->LayoutList,&iter,3,0,-1); + } + } + } else { + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LayoutSensitiveCheck),0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->DefaultLayoutRadio),1); + } } \ No newline at end of file diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index cdb47bd..59b5444 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -341,7 +341,7 @@ void yon_page_init(main_window *widgets, enum YON_PAGES page){ g_mutex_lock(&main_config.install_mutex); if (main_config.install_complete){ g_mutex_unlock(&main_config.install_mutex); - on_setup_system_configuration(widgets); + g_thread_new("install_thread",(GThreadFunc)on_setup_system_configuration,widgets); on_page_next_clicked(NULL,widgets); } else { g_mutex_unlock(&main_config.install_mutex); @@ -370,145 +370,15 @@ void on_page_prev_clicked(GtkWidget *, main_window *widgets){ yon_page_update(widgets); } -// void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){ -// if (widgets){}; -// switch(page){ -// case YON_PAGE_WELCOME: { -// gtk_widget_hide(widgets->SaveButton); -// gtk_widget_set_sensitive(widgets->CancelInstallButton,0); -// gtk_widget_set_sensitive(widgets->BackButton,0); -// gtk_widget_set_sensitive(widgets->NextButton,1); -// textdomain(LocaleName); -// gtk_button_set_label(GTK_BUTTON(widgets->NextButton),NEXT_LABEL); -// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),CANCEL_LABEL); -// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))),"com.ublinux.ubinstall-gtk.arrow-right-symbolic",GTK_ICON_SIZE_BUTTON); -// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->CancelInstallButton))),"com.ublinux.ubinstall-gtk.circle-exit-symbolic",GTK_ICON_SIZE_BUTTON); -// gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,1); -// yon_switch_page_render(widgets,0); -// } break; -// -// case YON_PAGE_LICENCE:{ -// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); -// gtk_widget_set_sensitive(widgets->BackButton,1); -// yon_switch_page_render(widgets,1); -// } break; -// -// case YON_PAGE_REGION: { -// yon_image_resize_from_container(GTK_IMAGE(widgets->RegionImage), widgets->regions_original); -// yon_switch_page_render(widgets,4); -// } break; -// -// case YON_PAGE_KEYBOARD: { -// -// yon_switch_page_render(widgets,5); -// yon_image_resize_from_container(GTK_IMAGE(widgets->KeyboardImage), widgets->keyboard_original); -// } break; -// -// case YON_PAGE_OS_COMPONENTS: -// case YON_PAGE_SOFTWARE: -// case YON_PAGE_INSTALLATION_BEGIN: -// yon_switch_page_render(widgets,3); -// -// break; -// case YON_PAGE_INSTALLATION:{ -// yon_switch_page_render(widgets,3); -// gtk_widget_set_sensitive(widgets->BackButton,0); -// if ((!main_config.configure_mode)) -// gtk_widget_set_sensitive(widgets->CancelInstallButton,0); -// if (!main_config.progress_thread&&!main_config.configure_mode) -// main_config.progress_thread = gdk_threads_add_timeout(500,(GSourceFunc)yon_installation_progress_update,widgets); -// -// if (!main_config.slider_thread&&!main_config.configure_mode) -// main_config.slider_thread = g_timeout_add(5000,(GSourceFunc)on_image_slide,widgets); -// gtk_widget_show(gtk_widget_get_parent(widgets->InstallationProgress)); -// } break; -// -// case YON_PAGE_USERS: -// yon_switch_page_render(widgets,6); -// gtk_widget_set_sensitive(widgets->NextButton,1); -// gtk_widget_hide(widgets->SaveButton); -// break; -// -// case YON_PAGE_INSTALL_ERROR:{ -// on_summary_log_view((GtkWidget*)NULL,widgets); -// -// yon_switch_page_render(widgets,7); -// gtk_widget_set_sensitive(widgets->BackButton,0); -// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); -// gtk_widget_hide(widgets->InstallationLabel); -// gtk_widget_hide(widgets->PackageInstallationLabel); -// gtk_widget_set_sensitive(widgets->NextButton,1); -// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); -// g_mutex_lock(&main_config.install_mutex); -// main_config.install_complete=0; -// g_mutex_unlock(&main_config.install_mutex); -// main_config.save_done=0; -// textdomain(LocaleName); -// gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL); -// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); -// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), -// "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); -// -// } break; -// case YON_PAGE_COMPLETION:{ -// yon_switch_page_render(widgets,7); -// gtk_widget_set_sensitive(widgets->BackButton,0); -// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); -// gtk_widget_hide(widgets->InstallationLabel); -// gtk_widget_hide(widgets->PackageInstallationLabel); -// gtk_widget_set_sensitive(widgets->NextButton,1); -// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); -// g_mutex_lock(&main_config.install_mutex); -// main_config.install_complete=0; -// g_mutex_unlock(&main_config.install_mutex); -// main_config.save_done=0; -// textdomain(LocaleName); -// gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL); -// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); -// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), -// "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); -// } -// gtk_widget_hide(gtk_widget_get_parent(widgets->InstallationProgress)); -// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); -// break; -// -// case YON_PAGE_COMPLETED:{ -// yon_switch_page_render(widgets,7); -// gtk_widget_set_sensitive(widgets->BackButton,1); -// gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); -// gtk_widget_hide(widgets->InstallationLabel); -// gtk_widget_hide(widgets->PackageInstallationLabel); -// gtk_widget_set_sensitive(widgets->NextButton,0); -// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); -// g_mutex_lock(&main_config.install_mutex); -// main_config.install_complete=0; -// g_mutex_unlock(&main_config.install_mutex); -// main_config.save_done=0; -// textdomain(LocaleName); -// gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); -// gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))), -// "com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON); -// -// }break; -// -// case YON_PAGE_SECTIONS: -// case YON_PAGE_INSTALL_COMMON: -// case YON_PAGE_INSTALL_SEPARATE: -// case YON_PAGE_INSTALL_SAME_PARTITION: -// case YON_PAGE_INSTALL_RECOVERY: -// case YON_PAGE_OPTIONS_GRUB_INSTALL: -// case YON_PAGE_OPTIONS_GRUB_UPDATE: -// case YON_PAGE_OPTIONS_SEPARATE: -// case YON_PAGE_OPTIONS_SEPARATE_USRDATA: -// case YON_PAGE_OPTIONS_OS_ONLY: -// case YON_PAGE_OPTIONS_USRDATA_ONLY: { -// yon_switch_page_render(widgets,2); -// } break; -// case YON_PAGE_CONFIGURE_END: { -// gtk_widget_set_sensitive(widgets->BackButton,1); -// gtk_widget_set_sensitive(widgets->NextButton,0); -// gtk_widget_set_sensitive(widgets->CancelInstallButton,1); -// gtk_widget_show(widgets->SaveButton); -// } -// } -// } +void on_page_cancel_clicked(GtkWidget *, main_window *widgets){ + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_WELCOME); + gtk_widget_hide(widgets->BackButton); + gtk_widget_hide(widgets->SourceButton); + gtk_widget_hide(widgets->SkipInstallationButton); + gtk_widget_show(widgets->NextButton); + gtk_widget_show(widgets->StartScenarioButton); + gtk_widget_set_sensitive(widgets->CancelInstallButton,0); + gtk_widget_set_sensitive(widgets->BackButton,1); + gtk_widget_set_sensitive(widgets->NextButton,1); + +} \ No newline at end of file diff --git a/source/ubinstall-gtk-region.c b/source/ubinstall-gtk-region.c index 7612327..2d7dd90 100644 --- a/source/ubinstall-gtk-region.c +++ b/source/ubinstall-gtk-region.c @@ -97,9 +97,53 @@ void yon_region_init(main_window *widgets){ free(path); } } + while(gtk_events_pending()) gtk_main_iteration(); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->RegionCombo),0); yon_char_parsed_free(parsed,size); gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter),0); gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); + + char *zone = yon_char_new(config(zone_parameter)); + char *locale = config(locale_parameter); + char *lang_param = config(lang_parameter); + + if (!yon_char_is_empty(zone)){ + char *timezone = yon_char_divide_search(zone,"/",-1); + gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->RegionCombo),timezone); + while(gtk_events_pending()) gtk_main_iteration(); + gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->ZoneCombo),zone); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck),1); + free(timezone); + } else { + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->RegionCombo),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ZoneCombo),0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck),0); + } + + if (!yon_char_is_empty(locale)){ + char *parameters_list = ""; + config_str parsed = yon_char_parse(locale,&size,","); + GtkTreeModel *model = GTK_TREE_MODEL(widgets->LanguagesList); + for_iter(model,&iter){ + char *target, *id; + gtk_tree_model_get(model,&iter,1,&target,2,&id,-1); + if (yon_char_parsed_check_exist(parsed,size,id)>-1){ + gtk_list_store_set(widgets->LanguagesList,&iter,0,1,-1); + char *temp = yon_char_unite(parameters_list,!yon_char_is_empty(parameters_list)?",":"",target,NULL); + if (!yon_char_is_empty(parameters_list)) free(parameters_list); + parameters_list=temp; + } else { + gtk_list_store_set(widgets->LanguagesList,&iter,0,0,-1); + } + } + gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),parameters_list); + if(!yon_char_is_empty(parameters_list)) free(parameters_list); + + } + + if (!yon_char_is_empty(lang_param)){ + gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LanguagesCombo),lang_param); + } + } \ No newline at end of file diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c index 11b49bb..ae7e979 100644 --- a/source/ubinstall-gtk-saving.c +++ b/source/ubinstall-gtk-saving.c @@ -18,60 +18,63 @@ // yon_debug_output("%s\n",yon_config_save_simple(type,path)); // } -// void yon_load_proceed(YON_CONFIG_TYPE type){ -// yon_config_clean(); -// if (!yon_char_is_empty(config_get_default_command)) -// yon_config_load_config(YON_CONFIG_DEFAULT,yon_debug_output("%s\n",config_get_default_command),NULL); -// if (type==YON_CONFIG_GLOBAL){ -// yon_config_load_config(type,yon_debug_output("%s\n",config_get_global_command),NULL); -// } else if (type==YON_CONFIG_LOCAL){ -// yon_config_load_config(type,yon_debug_output("%s\n",config_get_local_command),NULL); -// } else if (type==YON_CONFIG_CUSTOM){ -// char *path=""; -// GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL); -// yon_gtk_window_setup(GTK_WINDOW(dialog),NULL,TITLE_LABEL,icon_path,"FileChooserWindow"); -// textdomain(LocaleName); -// gtk_window_set_icon_name(GTK_WINDOW(dialog),"com.ublinux.ubinstall"); -// gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL); -// GtkFileFilter *filter = gtk_file_filter_new(); -// gtk_file_filter_add_pattern(filter,"*.ini"); -// gtk_file_filter_set_name(filter, "*.ini"); -// gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); -// gtk_widget_show(dialog); -// int response = gtk_dialog_run(GTK_DIALOG(dialog)); -// if (response == GTK_RESPONSE_ACCEPT){ -// char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); -// if (!yon_char_is_empty(file)){ -// path=yon_char_unite("'",file,"'",NULL); -// free(file); -// } -// gtk_widget_destroy(dialog); -// } else { -// gtk_widget_destroy(dialog); -// } -// yon_config_load_config(type,yon_debug_output("%s\n",yon_config_get_custom_command(path)),NULL); -// if (path) free(path); -// } -// } +void yon_load_proceed(YON_CONFIG_TYPE type){ + if (type!=YON_CONFIG_CUSTOM){ + yon_config_clean(); + if (!yon_char_is_empty(config_get_default_command)) + yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL); + } + if (type==YON_CONFIG_GLOBAL){ + yon_config_load_config(type,yon_config_get_command("global"),NULL); + } else if (type==YON_CONFIG_LOCAL){ + yon_config_load_config(type,yon_config_get_command("system"),NULL); + } else if (type==YON_CONFIG_CUSTOM){ + textdomain(template_ui_LocaleName); + GtkWidget *dialog = gtk_file_chooser_dialog_new(template_app_information.app_title,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL); + textdomain(LocaleName); + gtk_window_set_icon_name(GTK_WINDOW(dialog),"com.ublinux.ubl-settings-services"); + gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL); + GtkFileFilter *filter = gtk_file_filter_new(); + gtk_file_filter_add_pattern(filter,"*.ini"); + gtk_file_filter_set_name(filter, "*.ini"); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); + gtk_widget_show(dialog); + int response = gtk_dialog_run(GTK_DIALOG(dialog)); + if (response == GTK_RESPONSE_ACCEPT){ + char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); + if (!yon_char_is_empty(file)){ + main_config.config_load_path=yon_char_new(file); + yon_config_clean(); + if (!yon_char_is_empty(config_get_default_command)) + yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL); + char *command = yon_config_get_command(main_config.config_load_path); + yon_config_load_config(type,command,NULL); + } + gtk_widget_destroy(dialog); + } else { + gtk_widget_destroy(dialog); + } + } +} -// void on_config_local_load(GtkWidget *,main_window *widgets){ -// yon_load_proceed(YON_CONFIG_LOCAL); -// yon_interface_update(widgets); -// main_config.load_mode=1; -// } +void on_config_local_load(GtkWidget *,main_window *widgets){ + yon_load_proceed(YON_CONFIG_LOCAL); + yon_page_init(widgets,gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook))); + main_config.load_mode=YON_CONFIG_LOCAL; +} -// void on_config_global_load(GtkWidget *,main_window *widgets){ -// yon_load_proceed(YON_CONFIG_GLOBAL); -// yon_interface_update(widgets); -// main_config.load_mode=0; -// } +void on_config_global_load(GtkWidget *,main_window *widgets){ + yon_load_proceed(YON_CONFIG_GLOBAL); + yon_page_init(widgets,gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook))); + main_config.load_mode=YON_CONFIG_GLOBAL; +} -// void on_config_custom_load(GtkWidget *,main_window *widgets){ -// yon_load_proceed(YON_CONFIG_CUSTOM); -// yon_interface_update(widgets); -// main_config.load_mode=3; -// } +void on_config_custom_load(GtkWidget *,main_window *widgets){ + yon_load_proceed(YON_CONFIG_CUSTOM); + yon_page_init(widgets,gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook))); + main_config.load_mode=YON_CONFIG_CUSTOM; +} // void on_config_global_local_save(GtkWidget *,main_window *widgets){ // yon_save_proceed(NULL,YON_CONFIG_BOTH); diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 046599c..16e4812 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -139,10 +139,12 @@ void config_init(){ main_config.save_done=0; main_config.save_configured=0; main_config.configure_mode=0; - main_config.load_mode=-1; + main_config.load_mode=YON_CONFIG_LOCAL; main_config.log_progress_buzy=0; main_config.log_end=0; main_config.exit_accepted=0; + main_config.config_load_path = NULL; + main_config.config_save_path = NULL; yon_packages_init(); main_config.network_types = g_hash_table_new(g_str_hash,g_str_equal); } @@ -556,7 +558,7 @@ main_window *yon_main_window_complete(){ // g_signal_connect(G_OBJECT(widgets->MainWindow),"check-resize",G_CALLBACK(on_region_resized),widgets); g_signal_connect(G_OBJECT(widgets->NextButton),"clicked",G_CALLBACK(on_page_next_clicked),widgets); g_signal_connect(G_OBJECT(widgets->BackButton),"clicked",G_CALLBACK(on_page_prev_clicked),widgets); - // g_signal_connect(G_OBJECT(widgets->CancelInstallButton),"clicked",G_CALLBACK(on_page_navigation_clicked),widgets); + g_signal_connect(G_OBJECT(widgets->CancelInstallButton),"clicked",G_CALLBACK(on_page_cancel_clicked),widgets); g_signal_connect(G_OBJECT(widgets->AvailableLanguagesButton),"clicked",G_CALLBACK(on_language_clicked),widgets); g_signal_connect(G_OBJECT(widgets->RegionCombo),"changed",G_CALLBACK(on_region_changed),widgets); g_signal_connect(G_OBJECT(widgets->LayoutSensitiveCheck),"toggled",G_CALLBACK(on_layout_toggle_button_switch),widgets); @@ -629,6 +631,7 @@ main_window *yon_main_window_complete(){ g_signal_connect(G_OBJECT(widgets->AdvancedPartChosenCell),"toggled",G_CALLBACK(on_install_advanced_partition_chosen),widgets); // g_signal_connect(G_OBJECT(widgets->AdvancedPartitionAddBox),"add",G_CALLBACK(on_advanced_parts_added),widgets); // g_signal_connect(G_OBJECT(widgets->AdvancedPartitionAddBox),"remove",G_CALLBACK(on_advanced_parts_removed),widgets); + g_signal_connect(G_OBJECT(widgets->StartScenarioButton),"clicked",G_CALLBACK(yon_quick_install),widgets); { @@ -688,7 +691,7 @@ main_window *yon_main_window_complete(){ g_object_unref(pix); } gtk_builder_connect_signals(builder,NULL); - // yon_load_proceed(YON_CONFIG_DEFAULT); + yon_load_proceed(YON_CONFIG_LOCAL); // yon_interface_update(widgets); return widgets; } diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 92bb622..25ee006 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -141,25 +141,25 @@ layout && /description:/ {\ // #define user_gecos_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[user_gecos]" // #define user_password_parameter "AUTOINSTALL[user_password]" // #define user_password_parameter_command "ubconfig --source global --conarg get [autoinstall] AUTOINSTALL[user_password]" -#define root_password_parameter "AUTOINSTALL['ubconfig set [users] DEFAULTROOTPASSWD']" +#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 "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 "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 "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 "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 "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 "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 "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 "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 "AUTOINSTALL[ubconfig set [locale] LOCALE]" #define locale_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [locale] LOCALE']" /*------------------------------------------------------------*/ @@ -185,36 +185,36 @@ layout && /description:/ {\ #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 "AOUTINSTALL['ubconfig set [network] NTPSERVERS']" +#define NTPSERVERS_parameter "AOUTINSTALL['ubconfig set [network] NTPSERVERS]" #define NTPSERVERS_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [network] NTPSERVERS']" -#define DOMAIN_parameter "AOUTINSTALL['ubconfig set [network] DOMAIN']" +#define DOMAIN_parameter "AOUTINSTALL['ubconfig set [network] DOMAIN]" #define DOMAIN_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [network] DOMAIN']" -#define DOMAIN_admanger_parameter "AOUTINSTALL['ubconfig set [network] DOMAIN[admanger]']" +#define DOMAIN_admanger_parameter "AOUTINSTALL['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_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 "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 [boot] SERVICES_ENABLE']" +#define SERVICES_ENABLE_parameter "AUTOINSTALL[ubconfig set [boot] SERVICES_ENABLE]" #define SERVICES_ENABLE_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] SERVICES_ENABLE']" -#define GRUB_SUPERUSERS_parameter "AUTOINSTALL['ubconfig set [boot] GRUB_SUPERUSERS']" +#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 "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 "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_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 "AUTOINSTALL[ubconfig set [desktop] AUTOLOGINUSER]" #define AUTOLOGINUSER_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] AUTOLOGINUSER']" -#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_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_parameter_command(target) yon_char_unite("ubconfig get autoinstall AUTOINSTALL['ubconfig set [network] NETWORK[",target,"@connmod]']",NULL) #define NETWORK_devdown_parameter_command(target) yon_char_unite("ubconfig get autoinstall AUTOINSTALL['ubconfig set [network] NETWORK[",target,"@devdown]']",NULL) #define NETWORK(target) yon_char_unite("NETWORK[",target,"@connmod]",NULL) @@ -241,10 +241,9 @@ layout && /description:/ {\ #define full_log_path "/var/log/ubinstall.log" -#define yon_config_get_custom_command(target) yon_char_unite("ubconfig --source ",target," --conarg get [autoinstall] AUTOINSTALL[installer_lang] AUTOINSTALL[install_type] AUTOINSTALL[device] AUTOINSTALL[part] AUTOINSTALL[part_size] AUTOINSTALL[part_label] AUTOINSTALL[part_fs_type] AUTOINSTALL[part_format] UTOINSTALL[locale] AUTOINSTALL[lang] AUTOINSTALL[zone] AUTOINSTALL[user_name] AUTOINSTALL[user_gecos] AUTOINSTALL[user_password] AUTOINSTALL[root_password] AUTOINSTALL[autologin] AUTOINSTALL[xkbmodel] AUTOINSTALL[xkblayout] AUTOINSTALL[xkbvariant] AUTOINSTALL[xkboptions] AUTOINSTALL[hostname] AUTOINSTALL[modules] AUTOINSTALL[modules_extra] AUTOINSTALL[part_label] AUTOINSTALL[locale]",NULL) -#define config_get_local_command "ubconfig --source system --conarg get [autoinstall] AUTOINSTALL[installer_lang] AUTOINSTALL[install_type] AUTOINSTALL[device] AUTOINSTALL[part] AUTOINSTALL[part_size] AUTOINSTALL[part_label] AUTOINSTALL[part_fs_type] AUTOINSTALL[part_format] UTOINSTALL[locale] AUTOINSTALL[lang] AUTOINSTALL[zone] AUTOINSTALL[user_name] AUTOINSTALL[user_gecos] AUTOINSTALL[user_password] AUTOINSTALL[root_password] AUTOINSTALL[autologin] AUTOINSTALL[xkbmodel] AUTOINSTALL[xkblayout] AUTOINSTALL[xkbvariant] AUTOINSTALL[xkboptions] AUTOINSTALL[hostname] AUTOINSTALL[modules] AUTOINSTALL[modules_extra] AUTOINSTALL[part_label] AUTOINSTALL[locale]" -#define config_get_global_command yon_char_new("ubconfig --source global --conarg get [autoinstall] AUTOINSTALL[installer_lang] AUTOINSTALL[install_type] AUTOINSTALL[device] AUTOINSTALL[part] AUTOINSTALL[part_size] AUTOINSTALL[part_label] AUTOINSTALL[part_fs_type] AUTOINSTALL[part_format] UTOINSTALL[locale] AUTOINSTALL[lang] AUTOINSTALL[zone] AUTOINSTALL[user_name] AUTOINSTALL[user_gecos] AUTOINSTALL[user_password] AUTOINSTALL[root_password] AUTOINSTALL[autologin] AUTOINSTALL[xkbmodel] AUTOINSTALL[xkblayout] AUTOINSTALL[xkbvariant] AUTOINSTALL[xkboptions] AUTOINSTALL[hostname] AUTOINSTALL[modules] AUTOINSTALL[modules_extra] AUTOINSTALL[part_label] AUTOINSTALL[locale]") -#define config_get_default_command "ubconfig --source default --conarg get [autoinstall] AUTOINSTALL[installer_lang] AUTOINSTALL[install_type] AUTOINSTALL[device] AUTOINSTALL[part] AUTOINSTALL[part_size] AUTOINSTALL[part_label] AUTOINSTALL[part_fs_type] AUTOINSTALL[part_format] UTOINSTALL[locale] AUTOINSTALL[lang] AUTOINSTALL[zone] AUTOINSTALL[user_name] AUTOINSTALL[user_gecos] AUTOINSTALL[user_password] AUTOINSTALL[root_password] AUTOINSTALL[autologin] AUTOINSTALL[xkbmodel] AUTOINSTALL[xkblayout] AUTOINSTALL[xkbvariant] AUTOINSTALL[xkboptions] AUTOINSTALL[hostname] AUTOINSTALL[modules] AUTOINSTALL[modules_extra] AUTOINSTALL[part_label] AUTOINSTALL[locale]" +#define yon_config_get_command(target) yon_char_unite("ubconfig --source ",target," --conarg get [autoinstall] AUTOINSTALL[*]",NULL) + +#define config_get_default_command "ubconfig --source default --conarg get [autoinstall] AUTOINSTALL[*]" #define config_get_global_only_parameters "" #define config_get_local_only_parameters "" @@ -379,6 +378,9 @@ typedef struct { GtkWidget *status_box; GHashTable *network_types; GtkWidget *kernel_unchosen_radio; + + char *config_load_path; + char *config_save_path; } config; extern config main_config; @@ -922,7 +924,7 @@ void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_siz gboolean on_yon_exit(GtkWidget *,GdkEvent*, main_window *widgets); void on_locale_changed(GtkWidget *,main_window *); void on_region_changed(GtkComboBox *self, main_window *widgets); -void on_page_navigation_clicked(GtkWidget *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); @@ -1060,4 +1062,5 @@ void on_advanced_parts_added(GtkWidget *,GtkWidget*,main_window *widgets); void yon_advanced_partition_clear(main_window *widgets); void yon_layout_build(char *key, GHashTable *value, main_window *widgets); void yon_os_row_setup(os_row *row, char *name, char *version,char *tags, char *description); -os_row *yon_os_row_new(); \ No newline at end of file +os_row *yon_os_row_new(); +void yon_quick_install(GtkWidget *, main_window *widgets); \ No newline at end of file diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 4355f51..3d461df 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -731,7 +731,6 @@ agreement 5 5 left - False True @@ -2533,20 +2532,9 @@ and help you install UBLinux on your computer 10 5 - + True - False - False - True - - - - - True - True - Region: - - + True False @@ -2554,6 +2542,18 @@ and help you install UBLinux on your computer 0 + + + True + True + Region: + + + False + True + 1 + + True @@ -2652,20 +2652,10 @@ and help you install UBLinux on your computer False 5 - + True - True - False - True - - - - - True - False - Available languages in the system: - - + False + Available languages in the system: False @@ -2717,19 +2707,10 @@ and help you install UBLinux on your computer False 5 - + True - True - False - True - - - - True - False - Language: - - + False + Language: False @@ -2846,19 +2827,10 @@ and help you install UBLinux on your computer False 5 - + True - True - False - True - - - - True - False - Keyboard model: - - + False + Keyboard model: False @@ -2896,19 +2868,10 @@ and help you install UBLinux on your computer False 5 - + True - True - False - True - - - - True - False - Layout changing: - - + False + Layout changing: False @@ -2975,72 +2938,81 @@ and help you install UBLinux on your computer True False - vertical 5 - + True True - False - True + in + 128 - + + True + False + True + LayoutsFilter + 0 + + + column + + + True + + + 3 + + + + + + + Layout + + + + 0 + + + + + + + Designation + + + + 1 + + + + + - False + True True - 1 + 0 True False + vertical 5 - + True - False - vertical - 5 - - - Default layout (ru) - True - False - True - False - True - True - - - - False - True - 0 - - - - - Define - True - False - True - False - True - DefaultLayoutRadio - - - - - - - False - True - 1 - - + False + True + True + Add layouts + image13 + False @@ -3049,109 +3021,19 @@ and help you install UBLinux on your computer - + True - False - 5 - - - True - True - in - 128 - - - True - False - True - LayoutsFilter - 0 - - - - - - Layout - - - - 0 - - - - - - - Designation - - - - 1 - - - - - - - - - True - True - 0 - - - - - True - False - vertical - 5 - - - True - False - True - True - Add layouts - image13 - - - - False - True - 0 - - - - - True - False - True - True - Remove layout - image14 - - - - False - True - 1 - - - - - False - True - 1 - - + False + True + True + Remove layout + image14 + - True + False True 1 @@ -3160,7 +3042,7 @@ and help you install UBLinux on your computer False True - 2 + 1 @@ -5209,7 +5091,7 @@ or continue working in the UBLinux Live environment. False 5 - + True False True -- 2.35.1