From b3ae703a28973b7c5a4387e3d0fea9d3c84638e2 Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Tue, 17 Feb 2026 18:00:34 +0600 Subject: [PATCH] Added chosen and overall sizes at Installing Packages page --- locale/ubinstall-gtk.pot | 4 ++ locale/ubinstall-gtk_ru.po | 4 ++ source/ubinstall-gtk-components.c | 54 ++++++++++++------- source/ubinstall-gtk-installation.c | 10 ---- source/ubinstall-gtk.c | 1 + source/ubinstall-gtk.h | 1 + source/ubl-strings.h | 1 + ubinstall-gtk-os-row.glade | 10 ++-- ubinstall-gtk.glade | 82 +++++++++++++++++++++++++---- 9 files changed, 125 insertions(+), 42 deletions(-) diff --git a/locale/ubinstall-gtk.pot b/locale/ubinstall-gtk.pot index 7d1e8f7..8aa54a8 100644 --- a/locale/ubinstall-gtk.pot +++ b/locale/ubinstall-gtk.pot @@ -1005,6 +1005,10 @@ msgstr "" msgid "Group" msgstr "" +#: source/ubl-strings.h:292 +msgid "Chosen size:" +msgstr "" + #: source/ubl-strings.h:292 msgid "Overall size:" msgstr "" diff --git a/locale/ubinstall-gtk_ru.po b/locale/ubinstall-gtk_ru.po index 94c36fa..3337386 100644 --- a/locale/ubinstall-gtk_ru.po +++ b/locale/ubinstall-gtk_ru.po @@ -1025,6 +1025,10 @@ msgstr "Приложение" msgid "Group" msgstr "Группа" +#: source/ubl-strings.h:292 +msgid "Chosen size:" +msgstr "Размер выбора:" + #: source/ubl-strings.h:292 msgid "Overall size:" msgstr "Общий размер:" diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index 8ac6f66..748f0b9 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -380,26 +380,44 @@ void on_pacman_software_all_toggled(GtkWidget *, char *path, main_window *widget } void yon_pacman_software_update_overall_size(main_window *widgets){ - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->PacmanSoftwareChosenList); - long overall_size = 0; - 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); - overall_size+=size; + long pacman_size = 0; + { + 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->PacmanChosenLabel),overall_str); + if (!yon_char_is_empty(overall_str)) free(overall_str); } - char *overall_str = NULL; - if (overall_size){ - char mod = '\0'; - double size_converted = yon_size_long_convert_automatic(overall_size,&mod); - char *size_str = yon_char_from_double(size_converted); - overall_str = yon_char_unite(size_str," ", yon_size_get_name_from_letter(mod),NULL); - free(size_str); - } else { - overall_str = yon_char_unite("0 ",yon_size_get_name_from_letter('K'),NULL); + { + 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; + } + } + char *final_modules_size = NULL; + if (pacman_size){ + final_modules_size = yon_size_long_convert_automatic_to_string(pacman_size); + } else { + final_modules_size = yon_char_unite("0 ",yon_size_get_name_from_letter('K'),NULL); + } + gtk_label_set_text(GTK_LABEL(widgets->PacmanOverallSizeLabel),final_modules_size); + if (!yon_char_is_empty(final_modules_size)) free(final_modules_size); } - gtk_label_set_text(GTK_LABEL(widgets->PacmanOverallSizeLabel),overall_str); } void on_pacman_software_chosen_toggled(GtkWidget *, char *path, main_window *widgets){ diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index f0a07cd..7b6e9f0 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -1,15 +1,5 @@ #include "ubinstall-gtk.h" -char *yon_size_get_name_from_letter(char letter){ - switch (letter){ - case 'K': return yon_char_new(KB_LABEL); break; - case 'M': return yon_char_new(MB_LABEL); break; - case 'G': return yon_char_new(GB_LABEL); break; - case 'T': return yon_char_new(TB_LABEL); break; - } - return NULL; -} - int yon_install_common_save(main_window *widgets){ GtkTreeModel *model; GtkTreeIter iter; diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index ef3e819..fcb0854 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -559,6 +559,7 @@ void yon_main_window_create(main_window *widgets){ widgets->PacmanLoadingOverlay = yon_gtk_builder_get_widget(builder,"PacmanLoadingOverlay"); widgets->PacmanSoftwareAllPackagesTree = yon_gtk_builder_get_widget(builder,"PacmanSoftwareAllPackagesTree"); widgets->PacmanOverallSizeLabel = yon_gtk_builder_get_widget(builder,"PacmanOverallSizeLabel"); + widgets->PacmanChosenLabel = yon_gtk_builder_get_widget(builder,"PacmanChosenLabel"); widgets->PacmanSoftwareAllList = GTK_LIST_STORE(gtk_builder_get_object(builder,"PacmanSoftwareAllList")); widgets->PacmanSoftwareAllCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"PacmanSoftwareAllCell")); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 3238b3f..e4f2d91 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -700,6 +700,7 @@ typedef struct GtkListStore *PacmanSoftwareChosenList; GtkCellRenderer *PacmanSoftwareChosenCell; GtkWidget *PacmanOverallSizeLabel; + GtkWidget *PacmanChosenLabel; // GtkWidget *StartupImage; GtkWidget *StartupServicesTree; diff --git a/source/ubl-strings.h b/source/ubl-strings.h index bb39b63..3da8cd7 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -294,6 +294,7 @@ 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 _LABEL _("Chosen size:") // #define _LABEL _("Overall size:") // #define _LABEL _("Select your language:") // #define _LABEL _("Selecting additional system kernel components") diff --git a/ubinstall-gtk-os-row.glade b/ubinstall-gtk-os-row.glade index 1fd90f5..1d2390a 100644 --- a/ubinstall-gtk-os-row.glade +++ b/ubinstall-gtk-os-row.glade @@ -12,6 +12,8 @@ True False + 1 + 1 5 @@ -19,14 +21,15 @@ True False 5 + 10 + 5 + 5 True True False - 5 - 5 - 5 + 5 5 @@ -296,7 +299,6 @@ diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 01f7e2d..2c028f3 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -3470,7 +3470,9 @@ agreement PacmanSoftwareAllList 0 - + + none + @@ -3584,7 +3586,9 @@ agreement PacmanSoftwareChosenList 0 - + + none + @@ -3664,27 +3668,80 @@ agreement True False + end + vertical 5 - + True False + 5 + + + True + False + Chosen size: + + + + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + False True - end 0 - + True False - Overall size: - - - + 5 + + + True + False + + + False + True + end + 0 + + + + + True + False + Overall size: + + + + + + False + True + end + 1 + + False @@ -3697,7 +3754,6 @@ agreement False True - end 3 @@ -13990,6 +14046,12 @@ separately into the selected partition. + + + + + +