diff --git a/locale/ubinstall-gtk_ru.po b/locale/ubinstall-gtk_ru.po index 3337386..07a08ca 100644 --- a/locale/ubinstall-gtk_ru.po +++ b/locale/ubinstall-gtk_ru.po @@ -1027,7 +1027,7 @@ msgstr "Группа" #: source/ubl-strings.h:292 msgid "Chosen size:" -msgstr "Размер выбора:" +msgstr "Выбрано:" #: source/ubl-strings.h:292 msgid "Overall size:" diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index 748f0b9..3c521f6 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -49,7 +49,44 @@ int yon_kernel_addon_save(main_window *widgets){ return 1; } +int yon_os_components_check_packages_size(GtkWidget *, main_window *widgets){ + long pacman_size = 0; + { + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->OSSoftwareListBox)); + GList *listiter; + for (listiter=list;listiter;listiter=listiter->next){ + os_row *row = g_object_get_data(G_OBJECT(listiter->data),"kernel_row"); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->InstallCheck))){ + long cur_size = yon_packages_get_installed_size(YON_PACKAGES_ALL,row->name); + pacman_size += cur_size; + } + } + } + { + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->PacmanSoftwareChosenList); + for_iter(model, &iter){ + char *name; + gtk_tree_model_get(model,&iter,1,&name,-1); + long size = yon_packages_get_installed_size(YON_PACKAGES_ALL,name); + pacman_size+=size; + } + char *overall_str = NULL; + if (pacman_size){ + overall_str = yon_size_long_convert_automatic_to_string(pacman_size); + } else { + overall_str = yon_char_unite("0 ",yon_size_get_name_from_letter('K'),NULL); + } + gtk_label_set_text(GTK_LABEL(widgets->OSComponentsOverallSizeLabel),overall_str); + if (!yon_char_is_empty(overall_str)) free(overall_str); + } + + return 1; +} + int yon_os_components_save(main_window *widgets){ + if (!yon_installation_check_packages_size(widgets)) return 0; + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->OSSoftwareListBox)); GList *iter; int size=0; @@ -151,6 +188,7 @@ gboolean yon_os_component_insert(struct row_data *row_input){ os_row *row = yon_os_row_new(); main_window *widgets = row_input->widgets; + g_signal_connect(G_OBJECT(row->InstallCheck),"toggled",G_CALLBACK(yon_os_components_check_packages_size),widgets); gtk_list_box_insert(GTK_LIST_BOX(widgets->OSSoftwareListBox),row->row,-1); yon_os_row_setup(row,row_input->name,row_input->version,row_input->tags,_(row_input->description), row_input->source, row_input->size); char *modules = config(modules_parameter); diff --git a/source/ubinstall-gtk-config-hub.c b/source/ubinstall-gtk-config-hub.c index 1a2daea..6843526 100644 --- a/source/ubinstall-gtk-config-hub.c +++ b/source/ubinstall-gtk-config-hub.c @@ -1,17 +1,36 @@ #include "ubinstall-gtk.h" +config_str yon_os_components_get_modules(int *size){ + (*size) = 0; + int modules_size = main_config.devices_size; + config_str modules_list = main_config.devices; + config_str module_names = NULL; + for (int i=1;i3&&!yon_char_is_empty(parsed[3])){ + if (!strcmp(parsed[2],part)&&parsed_size>3&&!yon_char_is_empty(parsed[3])){ part_size = atol(parsed[3]); yon_char_parsed_free(parsed,parsed_size); @@ -44,7 +63,7 @@ int yon_installation_check_packages_size(main_window *widgets){ } if (!yon_char_is_empty(modules)){ int parsed_size; - config_str parsed = yon_char_parse(packages,&parsed_size,","); + config_str parsed = yon_char_parse(modules,&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); + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),PACKAGE_NOT_ENOUGH_SPACE_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); return 0; } return 1; diff --git a/source/ubinstall-gtk-install-start.c b/source/ubinstall-gtk-install-start.c index 67d6f6f..05a970a 100644 --- a/source/ubinstall-gtk-install-start.c +++ b/source/ubinstall-gtk-install-start.c @@ -6,6 +6,7 @@ int yon_installation_start(main_window *widgets){ } void yon_quick_install(GtkWidget *self, main_window *widgets){ + if (!yon_installation_check_packages_size(widgets)) return; main_config.save_configured=1; gtk_widget_hide(self); gtk_widget_show(gtk_widget_get_parent(widgets->InstallationProgress)); diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 0734bd9..38db982 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -354,13 +354,13 @@ void on_device_selection_changed(GtkWidget *self, main_window *widgets){ void yon_devices_setup(main_window *widgets){ GtkTreeIter iter; gtk_list_store_clear(widgets->DevicesList); - int size; - config_str parameters = NULL; - parameters = yon_config_load(yon_debug_output("%s\n",get_devices_command),&size); - for (int i=1;iOSFormatEncryptionCombo = yon_gtk_builder_get_widget(builder,"OSFormatEncryptionCombo"); widgets->OSFormatEncryptionEntry = yon_gtk_builder_get_widget(builder,"OSFormatEncryptionEntry"); widgets->OSFormatEncryptionButton = yon_gtk_builder_get_widget(builder,"OSFormatEncryptionButton"); + widgets->OSComponentsOverallSizeLabel = yon_gtk_builder_get_widget(builder,"OSComponentsOverallSizeLabel"); widgets->UserdataDevicesTree = yon_gtk_builder_get_widget(builder,"UserdataDevicesTree"); widgets->UserdataSysSectionTree = yon_gtk_builder_get_widget(builder,"UserdataSysSectionTree"); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 8e5c3aa..65cc094 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -464,6 +464,9 @@ typedef struct config_str partitions; int part_size; + config_str devices; + int devices_size; + char *part_size_default; } config; @@ -643,6 +646,7 @@ typedef struct GtkWidget *OSFormatEncryptionButton; GtkWidget *OSSpinner; GtkWidget *OSOverlay; + GtkWidget *OSComponentsOverallSizeLabel; GtkWidget *UserdataGpartedButton; GtkWidget *UserdataUpdateGpartedButton; @@ -1513,4 +1517,6 @@ void *yon_partitions_list_load(main_window *widgets); void *yon_modules_list_load(main_window *widgets); void yon_size_changed(GtkSpinButton *self, main_window *widgets); void yon_pacman_software_update_overall_size(main_window *widgets); -int yon_installation_check_packages_size(main_window *widgets); \ No newline at end of file +int yon_installation_check_packages_size(main_window *widgets); +config_str yon_os_components_get_modules(int *size); +int yon_os_components_check_packages_size(GtkWidget *, main_window *widgets); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 3da8cd7..cb86d7f 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -293,6 +293,8 @@ NULL) #define MAP_INFO_LABEL(tz_location) yon_char_unite(_("Geasfa"),tz_location,NULL) #define NOT_ENOUGH_FREE_SPACE_LABEL _("The size of the new partition exceeds the free space of the selected partition") //Размер нового раздела превышает свободное место выбранного раздела #define NOT_ENOUGH_SPACE_LABEL _("The size of the new disk partition is larger than the size of the selected partition") //Размер нового раздела диска превышает размер выбранного раздела +#define MODULE_NOT_ENOUGH_SPACE_LABEL _("There is not enough space to install modules") +#define PACKAGE_NOT_ENOUGH_SPACE_LABEL _("There is not enough space to install packages") // #define _LABEL _("Chosen size:") // #define _LABEL _("Overall size:") diff --git a/ubinstall-gtk-os-row.glade b/ubinstall-gtk-os-row.glade index 1d2390a..1a3da84 100644 --- a/ubinstall-gtk-os-row.glade +++ b/ubinstall-gtk-os-row.glade @@ -172,6 +172,7 @@ True False + start True 15 False diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index b55591a..b3fe2dd 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -41,6 +41,8 @@ + + @@ -2101,6 +2103,62 @@ agreement 1 + + + True + False + 5 + 5 + 5 + + + True + False + 5 + + + True + False + + + False + True + end + 0 + + + + + True + False + Overall size: + 1 + + + + + + False + True + end + 1 + + + + + False + True + end + 1 + + + + + False + True + 2 + + 3 @@ -3668,8 +3726,6 @@ agreement True False - end - vertical 5