From 7618fb56498a3543cf3fb0f1934fde40d7a60881 Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Tue, 17 Feb 2026 16:20:25 +0600 Subject: [PATCH] Added Overall size label for packages installation page --- locale/ubinstall-gtk.pot | 4 +++ locale/ubinstall-gtk_ru.po | 4 +++ source/ubinstall-gtk-components.c | 27 +++++++++++++++++++ source/ubinstall-gtk-region.c | 14 ---------- source/ubinstall-gtk.c | 1 + source/ubinstall-gtk.h | 4 ++- source/ubl-strings.h | 1 + ubinstall-gtk.glade | 45 +++++++++++++++++++++++++++++-- 8 files changed, 83 insertions(+), 17 deletions(-) diff --git a/locale/ubinstall-gtk.pot b/locale/ubinstall-gtk.pot index 7c1778a..7d1e8f7 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 "Overall size:" +msgstr "" + #: source/ubl-strings.h:292 msgid "Select your language:" msgstr "" diff --git a/locale/ubinstall-gtk_ru.po b/locale/ubinstall-gtk_ru.po index 202c5a0..94c36fa 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 "Overall size:" +msgstr "Общий размер:" + #: source/ubl-strings.h:292 msgid "Select your language:" msgstr "Выберите язык:" diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index 43f8528..8ac6f66 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -362,6 +362,7 @@ void yon_pacman_init(main_window *widgets){ gtk_list_store_set(widgets->PacmanSoftwareChosenList,&iter,0,1,1,parsed[i],2,version,3,_(description),4,size_str,-1); free(size_str); } + yon_pacman_software_update_overall_size(widgets); yon_char_parsed_free(parsed,size); } @@ -374,9 +375,33 @@ void on_pacman_software_all_toggled(GtkWidget *, char *path, main_window *widget gtk_list_store_append(widgets->PacmanSoftwareChosenList,&iter); gtk_list_store_set(widgets->PacmanSoftwareChosenList,&iter,0,1,1,name,2,type,3,description,4,size_str,-1); g_hash_table_add(widgets->pacmanchosen,yon_char_new(name)); + yon_pacman_software_update_overall_size(widgets); } +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; + } + 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); + } + gtk_label_set_text(GTK_LABEL(widgets->PacmanOverallSizeLabel),overall_str); +} + void on_pacman_software_chosen_toggled(GtkWidget *, char *path, main_window *widgets){ GtkTreeIter iter; char *name, *type, *description, *size_str; @@ -386,6 +411,7 @@ void on_pacman_software_chosen_toggled(GtkWidget *, char *path, main_window *wid gtk_list_store_append(widgets->PacmanSoftwareAllList,&iter); gtk_list_store_set(widgets->PacmanSoftwareAllList,&iter,0,0,1,name,2,type,3,description,4,size_str,-1); g_hash_table_remove(widgets->pacmanchosen,name); + yon_pacman_software_update_overall_size(widgets); } gboolean yon_pacman_fill(struct pacman_struct *pacman){ @@ -408,6 +434,7 @@ gboolean yon_pacman_fill(struct pacman_struct *pacman){ if (!yon_char_is_empty(version))free(version); if (!yon_char_is_empty(description)) free(description); } + yon_pacman_software_update_overall_size(widgets); yon_char_parsed_free(loaded,size); gtk_widget_set_sensitive(widgets->PacmanSoftwareSearchEntry,1); gtk_widget_set_sensitive(widgets->PacmanSoftwareChosenPackagesTree,1); diff --git a/source/ubinstall-gtk-region.c b/source/ubinstall-gtk-region.c index a2ac57a..87787cb 100644 --- a/source/ubinstall-gtk-region.c +++ b/source/ubinstall-gtk-region.c @@ -1,9 +1,7 @@ #include "ubinstall-gtk.h" // #define TIMEZONEMAP_INCLUDE -#ifdef TIMEZONEMAP_INCLUDE #include "timezonemap/cc-timezone-map.h" #include "timezonemap/tz.h" -#endif int yon_region_save(main_window *widgets){ if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->RegionCombo))==-1){ @@ -37,7 +35,6 @@ void on_region_changed(GtkComboBox *self, main_window *widgets){ } } - #ifdef TIMEZONEMAP_INCLUDE gboolean on_time_zone_status_hover(GtkWidget *, GdkEvent *, main_window *widgets){ gtk_style_context_add_class(gtk_widget_get_style_context(widgets->TimeZoneMapOverlayBox),"timezoneoverlay_hover"); @@ -145,13 +142,9 @@ void on_map_selection_changed(GtkWidget *,CcTimezoneLocation *location,main_wind g_signal_handlers_unblock_by_func(G_OBJECT(widgets->RegionEntry),G_CALLBACK(on_region_entry_changed),widgets); } -#endif - void yon_map_update(main_window *widgets, const char *timezone){ - #ifdef TIMEZONEMAP_INCLUDE g_signal_handlers_block_by_func(G_OBJECT(widgets->RegionMapTarget),G_CALLBACK(on_map_selection_changed),widgets); g_signal_handlers_block_by_func(G_OBJECT(widgets->ZoneCombo),G_CALLBACK(on_zone_changed),widgets); - #endif g_signal_handlers_block_by_func(G_OBJECT(widgets->RegionEntry),G_CALLBACK(on_region_entry_changed),widgets); textdomain(timezone_locale_name); char *region = yon_timezone_get_zone(timezone); @@ -163,14 +156,10 @@ void yon_map_update(main_window *widgets, const char *timezone){ gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->RegionCombo),region); gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->ZoneCombo),city); - #ifdef TIMEZONEMAP_INCLUDE cc_timezone_map_set_timezone(CC_TIMEZONE_MAP(widgets->RegionMapTarget),timezone); - #endif g_signal_handlers_unblock_by_func(G_OBJECT(widgets->RegionEntry),G_CALLBACK(on_region_entry_changed),widgets); - #ifdef TIMEZONEMAP_INCLUDE g_signal_handlers_unblock_by_func(G_OBJECT(widgets->ZoneCombo),G_CALLBACK(on_zone_changed),widgets); g_signal_handlers_unblock_by_func(G_OBJECT(widgets->RegionMapTarget),G_CALLBACK(on_map_selection_changed),widgets); - #endif textdomain(LocaleName); } @@ -197,7 +186,6 @@ void yon_region_init(main_window *widgets){ yon_timezone_init(); gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->RegionCombo)); gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->KeyboardNumLockCombo)); - #ifdef TIMEZONEMAP_INCLUDE // insert timezonemap's interactive map GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->RegionMapBox)); if (list){ GList *iter; @@ -214,9 +202,7 @@ void yon_region_init(main_window *widgets){ if (!yon_char_is_empty(config_param)){ cc_timezone_map_set_timezone(CC_TIMEZONE_MAP(widgets->RegionMapTarget),config_param); } - #else // if timezonemap does not installed, static image inserts - #endif size_t size; GtkTreeIter iter; config_str parsed = yon_timezone_get_all(&size); diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 1359eb3..ef3e819 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -558,6 +558,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->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 7fd036d..3238b3f 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -699,6 +699,7 @@ typedef struct GtkWidget *PacmanSoftwareChosenPackagesTree; GtkListStore *PacmanSoftwareChosenList; GtkCellRenderer *PacmanSoftwareChosenCell; + GtkWidget *PacmanOverallSizeLabel; // GtkWidget *StartupImage; GtkWidget *StartupServicesTree; @@ -1509,4 +1510,5 @@ void yon_map_update(main_window *widgets, const char *timezone); 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); \ No newline at end of file +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 diff --git a/source/ubl-strings.h b/source/ubl-strings.h index e6c40ed..bb39b63 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 _("Overall size:") // #define _LABEL _("Select your language:") // #define _LABEL _("Selecting additional system kernel components") // #define _LABEL _("Package:") diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 5b04e9d..01f7e2d 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -3337,7 +3337,7 @@ agreement False True - 1 + 0 @@ -3555,7 +3555,7 @@ agreement True True - 2 + 1 @@ -3657,6 +3657,47 @@ agreement True True + 2 + + + + + True + False + 5 + + + True + False + + + False + True + end + 0 + + + + + True + False + Overall size: + + + + + + False + True + end + 1 + + + + + False + True + end 3