From 9a169e6f19e212077ec79a17ef8930beaadf2610 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 17 Oct 2025 18:23:11 +0600 Subject: [PATCH] WIP virtual device combobox changes --- gresource.xml | 1 + source/CMakeLists.txt | 1 + source/ubinstall-gtk-advanced.c | 60 ++++++++++++++++-- source/ubinstall-gtk-page-switch.c | 4 +- source/ubinstall-gtk.c | 1 + source/ubinstall-gtk.h | 3 + source/ubl-strings.h | 5 +- ubinstall-gtk.glade | 99 +++++++++++++++--------------- vfs-list.csv | 9 +++ 9 files changed, 126 insertions(+), 57 deletions(-) create mode 100644 vfs-list.csv diff --git a/gresource.xml b/gresource.xml index 8cfa3cf..a7ef298 100644 --- a/gresource.xml +++ b/gresource.xml @@ -57,5 +57,6 @@ services-list.csv network-list.csv filesystems-format-list.csv + vfs-list.csv \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 7f8ebf7..9e28868 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -79,6 +79,7 @@ set(DEPENDFILES ../services-list.csv ../network-list.csv ../filesystems-format-list.csv + ../vfs-list.csv ../icons-builtin/install_type_custom_normal.png ../icons-builtin/install_type_data_only_normal.png ../icons-builtin/install_type_fast_normal.png diff --git a/source/ubinstall-gtk-advanced.c b/source/ubinstall-gtk-advanced.c index 67a6904..affce7f 100644 --- a/source/ubinstall-gtk-advanced.c +++ b/source/ubinstall-gtk-advanced.c @@ -252,7 +252,19 @@ void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets){ } -void yon_install_advanced_init(main_window *){ +void yon_install_advanced_init(main_window *widgets){ + gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->AdvancedVirtualDeviceCombo)); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->AdvancedVirtualDeviceCombo),NO_LABEL); + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->AdvancedVirtualDeviceCombo),0); + int size; + config_str vmf_file = yon_resource_open_file(vfs_list_path,&size); + for (int i=1;iAdvancedVirtualDeviceCombo),parsed[2],parsed[0]); + yon_char_parsed_free(parsed,parsed_size); + } + yon_char_parsed_free(vmf_file,size); } void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_window *widgets){ @@ -768,12 +780,48 @@ int yon_advanced_section_append(advanced_section *section){ void on_advanced_virtual_device_changed(GtkWidget *, main_window *widgets){ yon_advanced_section_remove_all(); char *device = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->AdvancedVirtualDeviceCombo)); + int size; + config_str vfs_file = yon_resource_open_file(vfs_list_path,&size); + config_str cur_device = NULL; + for (int i=0;iAdvancedVirtualDeviceLabel),parsed[1]); + } + yon_char_parsed_free(parsed,parsed_size); + } if (!yon_char_is_empty(device)){ - advanced_section *section = yon_advanced_section_new(); - section->part_source = PART_SOURCE_VIRTUAL; - section->partition = device; - section->device = device; - yon_advanced_section_append(section); + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->DevicesList); + int active_devices=0; + for_iter(model,&iter){ + int status; + gtk_tree_model_get(model,&iter,5,&status,-1); + if (status) active_devices++; + } + if (atoi(cur_device[3])StatusBox),COUNT_INVALID_LABEL(cur_device[4]),5,BACKGROUND_IMAGE_INFO_TYPE); + yon_ubl_status_highlight_incorrect(widgets->AdvancedVirtualDeviceCombo); + yon_char_parsed_free(cur_device,4); + return; + } + + if (atoi(cur_device[4])%active_devices==0){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),PARITY_INVALID_LABEL(cur_device[4]),5,BACKGROUND_IMAGE_INFO_TYPE); + yon_ubl_status_highlight_incorrect(widgets->AdvancedVirtualDeviceCombo); + yon_char_parsed_free(cur_device,4); + return; + } + + advanced_section *section = yon_advanced_section_new(); + section->part_source = PART_SOURCE_VIRTUAL; + section->partition = device; + section->device = device; + yon_advanced_section_append(section); + } + yon_char_parsed_free(vfs_file,size); yon_advanced_update(widgets); } \ No newline at end of file diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index ebd9902..4fd29ca 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -360,10 +360,12 @@ void yon_page_init(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_NETWORK: yon_network_init(widgets); break; + case YON_PAGE_INSTALL_ADVANCED: + yon_install_advanced_init(widgets); + [[fallthrough]]; 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: diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index cd9e897..b363bf9 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -820,6 +820,7 @@ void yon_main_window_create(main_window *widgets){ widgets->NetworkConnectionsAddButton = yon_gtk_builder_get_widget(builder,"NetworkConnectionsAddButton"); widgets->HostnameSensitiveSwitch = yon_gtk_builder_get_widget(builder,"HostnameSensitiveSwitch"); widgets->AutoHostnameCheck=yon_gtk_builder_get_widget(builder,"AutoHostnameCheck"); + widgets->AdvancedVirtualDeviceLabel = yon_gtk_builder_get_widget(builder,"AdvancedVirtualDeviceLabel"); widgets->network_connections = NULL; widgets->pacmanchosen = g_hash_table_new_full(g_str_hash,g_str_equal,free,NULL); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 0600b76..1879dfe 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -71,6 +71,7 @@ #define services_list_path "resource:///com/ublinux/csv/services-list.csv" #define network_path "resource:///com/ublinux/csv/network-list.csv" #define fs_types_path "resource:///com/ublinux/csv/filesystems-format-list.csv" +#define vfs_list_path "resource:///com/ublinux/csv/vfs-list.csv" #define encryptions_list "luks1","luks2" @@ -92,6 +93,7 @@ "/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); @@ -677,6 +679,7 @@ typedef struct { GtkWidget *AdvancedSwapFixedSizeSwitch; GtkWidget *AdvancedSwapRevealer; GtkWidget *AdvancedLoadTypeRevealer; + GtkWidget *AdvancedVirtualDeviceLabel; dictionary *advanced_sections; GSequence *advanced_partition_order; diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 6066495..2206876 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -212,6 +212,10 @@ #define CONFIGURATION_MODE_TITLE_LABEL _("Choose installation configuration file") #define SAVE_AND_EXIT_LABEL _("Save and exit") +#define NO_LABEL _("No") + +#define PARITY_INVALID_LABEL(target) yon_char_unite(_("Cu"),target) +#define COUNT_INVALID_LABEL(target) yon_char_unite(_("Cu"),target) // #define _LABEL _("New section at") // #define _LABEL _("\"/ublinux-data/\" user data section") @@ -323,7 +327,6 @@ // #define _LABEL _("Common Installation") // #define _LABEL _("Select partiton:") // #define _LABEL _("Installation on same partition") -// #define _LABEL _("No") // #define _LABEL _("Advanced section") // #define _LABEL _("Recovery section") // #define _LABEL _("Start installation scenario") diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index cd362c1..da30ef4 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -1,5 +1,5 @@ - + @@ -6842,6 +6842,55 @@ separately into the selected partition. False vertical 5 + + + True + False + 5 + + + True + False + Virtual device type: + 0 + + + False + True + 0 + + + + + True + False + False + 0 + + + False + True + 1 + + + + + True + False + + + False + True + 2 + + + + + False + True + 0 + + True @@ -6991,54 +7040,6 @@ separately into the selected partition. - - False - True - 0 - - - - - True - 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 diff --git a/vfs-list.csv b/vfs-list.csv new file mode 100644 index 0000000..6116dfa --- /dev/null +++ b/vfs-list.csv @@ -0,0 +1,9 @@ +VFS_NAME;VFS_DESCRIPTION;VFS_CONFIG;VFS_MIN;VSF_PATITY +RAID0;raid0 description;raid0;2; +RAID1;raid1 description;raid1;2;2 +RAID4;raid4 description;raid4;2; +RAID5;raid5 description;raid5;3; +RAID6;raid5 description;raid6;2; +RAID10;raid10 description;raid10;4;2 +LVM;lvm description;lvm;2; +LVM DYNAMIC;lvm_dynamic description;lvm_dynamic;2; \ No newline at end of file