From edb0ba299d5071c36a0f3cc13dcc55eceab302d7 Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Tue, 17 Feb 2026 18:39:27 +0600 Subject: [PATCH] WIP part/device size compare with installed modules and packages --- source/ubinstall-gtk-config-hub.c | 59 +++++++++++++++++++++++++++++ source/ubinstall-gtk-installation.c | 4 +- source/ubinstall-gtk.h | 3 +- ubinstall-gtk.glade | 2 + 4 files changed, 66 insertions(+), 2 deletions(-) diff --git a/source/ubinstall-gtk-config-hub.c b/source/ubinstall-gtk-config-hub.c index b19d9c0..1a2daea 100644 --- a/source/ubinstall-gtk-config-hub.c +++ b/source/ubinstall-gtk-config-hub.c @@ -1,6 +1,65 @@ #include "ubinstall-gtk.h" +int yon_installation_check_packages_size(main_window *widgets){ + char *packages = config(packages_parameter); + char *modules = config(modules_parameter); + char *install_mode = config(AUTOINSTALL_TYPE_INSTALL); + long part_size = 0; + + if (strcmp(install_mode,"fast")){ + char *part = config(part_parameter); + for (int i=0;i3&&!yon_char_is_empty(parsed[3])){ + part_size = atol(parsed[3]); + + yon_char_parsed_free(parsed,parsed_size); + break; + } + yon_char_parsed_free(parsed,parsed_size); + } + } else { + char *device = config(AUTOINSTALL_DEVICE); + GtkTreeIter iter; + for_iter(widgets->DevicesList,&iter){ + char *target; + long disk_size; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),&iter,0,&target,7,&disk_size,-1); + if (!strcmp(device,target)){ + part_size = disk_size; + } + } + } + long packages_size = 0; + long modules_size = 0; + + if (!yon_char_is_empty(packages)){ + int parsed_size; + config_str parsed = yon_char_parse(packages,&parsed_size,","); + for (int i=0;ipart_size){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NOT_ENOUGH_SPACE_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return 0; + } + return 1; +} + int yon_configuration_hub_save(main_window *widgets){ + if (!yon_installation_check_packages_size(widgets)) return 0; char *finish_button = (char *)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->ConfigHubRebootCombo)); if (!yon_char_is_empty(finish_button)){ yon_config_register(finish_parameter,finish_parameter_command,finish_button); diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 7b6e9f0..0734bd9 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -372,7 +372,9 @@ void yon_devices_setup(main_window *widgets){ 2,yon_char_return_if_exist(parsed[4],""), 3,yon_char_return_if_exist(size_string,""), 4,yon_char_return_if_exist(parsed[3],""), - 6,1,-1); + 6,1, + 7,atol(parsed[1]), + -1); yon_char_parsed_free(parsed,parsed_size); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index e4f2d91..8e5c3aa 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -1512,4 +1512,5 @@ void on_partition_size_changed(GtkWidget *self, main_window *widgets); void *yon_partitions_list_load(main_window *widgets); void *yon_modules_list_load(main_window *widgets); void yon_size_changed(GtkSpinButton *self, main_window *widgets); -void yon_pacman_software_update_overall_size(main_window *widgets); \ No newline at end of file +void yon_pacman_software_update_overall_size(main_window *widgets); +int yon_installation_check_packages_size(main_window *widgets); \ No newline at end of file diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 2c028f3..b55591a 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -3681,6 +3681,7 @@ agreement True False Chosen size: + 1 @@ -3731,6 +3732,7 @@ agreement True False Overall size: + 1