diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index e7bb303..30a254b 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -329,10 +329,47 @@ int yon_software_save(main_window *widgets){ return 1; } + +int yon_software_check_packages_size(GtkWidget *, main_window *widgets){ + long pacman_size = 0; + { + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AdditionalComponentsList)); + 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->AdditionalComponentsOverallSizeLabel),overall_str); + if (!yon_char_is_empty(overall_str)) free(overall_str); + } + + return 1; +} + gboolean yon_software_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_software_check_packages_size),widgets); gtk_list_box_insert(GTK_LIST_BOX(widgets->AdditionalComponentsList),row->row,-1); yon_os_row_setup(row,row_input->name,row_input->version,row_input->tags,_(row_input->description),NULL,row_input->size); @@ -384,25 +421,14 @@ void yon_software_init(main_window *widgets){ row->widgets=widgets; g_idle_add((GSourceFunc)yon_software_insert,row); } - // GList *languages = yon_packages_search_all("ubm-.*"); - // for (iter=languages;iter;iter=iter->next){ - // char *name = (char*)iter->data; - // yon_packages_info *info_struct = yon_package(YON_PACKAGES_ALL,name); - // struct row_data *row = malloc(sizeof(struct row_data)); - // row->version = info_struct->version; - // row->name = info_struct->package_name; - // row->tags = info_struct->groups; - // row->description = info_struct->description; - // row->widgets=widgets; - // g_idle_add((GSourceFunc)yon_software_insert,row); - // yon_packages_info_struct_free(info_struct); - // } g_idle_add((GSourceFunc)yon_spinner_switch_off,widgets->OSSpinner); yon_char_parsed_free(base,base_size); + yon_software_check_packages_size(NULL,widgets); return ; } int yon_pacman_software_save(main_window *widgets){ + if (!yon_installation_check_packages_size(widgets)) return 0; GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(widgets->PacmanSoftwareChosenList); char *config_parameter = config(packages_parameter); diff --git a/source/ubinstall-gtk-config-hub.c b/source/ubinstall-gtk-config-hub.c index 6245f4d..f75f7b5 100644 --- a/source/ubinstall-gtk-config-hub.c +++ b/source/ubinstall-gtk-config-hub.c @@ -273,6 +273,7 @@ void yon_flow_box_clear(GtkFlowBox *target){ void yon_configuration_hub_init(main_window *widgets){ gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->ConfigHubRebootCombo)); gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->ConfigHubRebootCombo),NULL,DEFAULT_LABEL); + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->ConfigHubRebootCombo),"close",CLOSE_INSTALLER_LABEL); gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->ConfigHubRebootCombo),"reboot",REBOOT_LABEL); gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->ConfigHubRebootCombo),"shutdown",SHUTDOWN_LABEL); char *finish_string = config(finish_parameter); @@ -282,7 +283,6 @@ void yon_configuration_hub_init(main_window *widgets){ } else { gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ConfigHubRebootCombo),0); } - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ConfigHubRebootCombo),0); yon_flow_box_clear(GTK_FLOW_BOX(widgets->HubPersonalListBox)); yon_flow_box_clear(GTK_FLOW_BOX(widgets->HubSystemListBox)); yon_flow_box_clear(GTK_FLOW_BOX(widgets->HubPackagesListBox)); diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 593c093..217e898 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -513,6 +513,7 @@ void yon_main_window_create(main_window *widgets){ widgets->KeyboardNumLockCombo = yon_gtk_builder_get_widget(builder,"KeyboardNumLockCombo"); widgets->AdditionalComponentsList = yon_gtk_builder_get_widget(builder,"AdditionalComponentsList"); + widgets->AdditionalComponentsOverallSizeLabel = yon_gtk_builder_get_widget(builder,"AdditionalComponentsOverallSizeLabel"); widgets->InstallationProgress = yon_gtk_builder_get_widget(builder,"InstallationProgress"); widgets->InstallationLabel = yon_gtk_builder_get_widget(builder,"InstallationLabel"); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 66eecc6..7f72aaf 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -616,6 +616,7 @@ typedef struct GtkWidget *DocumentationMenuItem; GtkWidget *AdditionalComponentsList; + GtkWidget *AdditionalComponentsOverallSizeLabel; GtkWidget *GrubInstallRadio; GtkWidget *GrubUpdateRadio; @@ -1556,4 +1557,5 @@ void yon_advanced_part_save(main_window *widgets); void yon_advanced_part_clean_config(); void yon_advanced_part_to_data(advanced_part_widgets *part, advanced_part_data *data); void yon_advanced_part_save_part(advanced_part_data *data); -void yon_advanced_part_remove_for_part(const char *part_name, main_window *widgets); \ No newline at end of file +void yon_advanced_part_remove_for_part(const char *part_name, main_window *widgets); +int yon_software_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 881f0f1..8d41492 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -286,6 +286,7 @@ NULL) #define LOAD_GLOBAL_LABEL yon_char_get_localised_from_lib("Load global configuration") #define LOAD_LABEL yon_char_get_localised_from_lib("Load") +#define CLOSE_INSTALLER_LABEL _("Close installer") #define REBOOT_LABEL _("Reboot") #define SHUTDOWN_LABEL _("Shudown") #define FINISH_ACTION_LABEL _("After successful installation:") diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index ae9113c..c4c84be 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -3290,6 +3290,60 @@ Select a different installation source. 1 + + + True + False + 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 + + 9