diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 9c1d055..71a7d60 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -95,19 +95,23 @@ void on_language_window_accept(GtkWidget *,dictionary *dict); void on_language_window_accept(GtkWidget *,dictionary *dict){ main_window *widgets= yon_dictionary_get_data(dict->first,main_window*); ubinstall_language_window *window = yon_dictionary_get_data(dict->first->next,ubinstall_language_window*); - yon_gtk_list_store_copy_full(widgets->LanguagesList,window->liststore1); - gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); - config_str parsed = NULL; - int size; - GtkTreeIter iter; - for_iter(GTK_TREE_MODEL(window->liststore1),&iter){ - char *current; - int status; - gtk_tree_model_get(GTK_TREE_MODEL(window->liststore1),&iter,0,&status,1,¤t,-1); - if (status) - yon_char_parsed_add_or_create_if_exists(parsed,&size,current); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultCheck))){ + gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); + } else { + yon_gtk_list_store_copy_full(widgets->LanguagesList,window->liststore1); + gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); + config_str parsed = NULL; + int size; + GtkTreeIter iter; + for_iter(GTK_TREE_MODEL(window->liststore1),&iter){ + char *current; + int status; + gtk_tree_model_get(GTK_TREE_MODEL(window->liststore1),&iter,0,&status,1,¤t,-1); + if (status) + yon_char_parsed_add_or_create_if_exists(parsed,&size,current); + } + gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),yon_char_parsed_to_string(parsed,size,", ")); } - gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),yon_char_parsed_to_string(parsed,size,", ")); on_subwindow_close(window->MainWindow); free(window); } @@ -312,11 +316,12 @@ void *yon_installation_progress_update(void *data){ config_str parsed = yon_char_parse(current_copy,&size," "); double fraction = atof(parsed[3])/100; gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress),fraction/100); - parsed = yon_char_parsed_rip(parsed,&size,3); gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel),yon_char_parsed_to_string(parsed,size," ")); - + yon_char_parsed_free(parsed,size); } last_time = current_time; + free(current_copy); + free(percentage); } break; } @@ -436,27 +441,26 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){ yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),ZONE_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(widgets->ZoneCombo); return; - } else if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->AvailableLanguagesEntry)))){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),LANGUAGES_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(widgets->AvailableLanguagesEntry); - return; - } else if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->LanguagesCombo))==-1){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),LOCALE_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(widgets->LanguagesCombo); - return; + } + char *languages = ""; + if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->AvailableLanguagesEntry)))){ + yon_config_remove_by_key(locale_parameter); + } else { + yon_config_register(locale_parameter,locale_parameter_command,languages); + } + if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->LanguagesCombo))==-1){ + yon_config_remove_by_key(lang_parameter); } char *region = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->RegionCombo)); char *zone = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->ZoneCombo)); GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(widgets->LanguagesFilter); - char *languages = ""; char *lang_code=NULL; for_iter(model,&iter){ gtk_tree_model_get(model,&iter,1,&lang_code,-1); - yon_char_unite(languages,",",lang_code,NULL); + languages = yon_char_unite(languages,",",lang_code,NULL); } char *language = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->LanguagesCombo)); - yon_config_register(locale_parameter,locale_parameter_command,languages); yon_config_register(lang_parameter,lang_parameter_command,language); yon_config_register(zone_parameter,zone_parameter_command,yon_char_unite(region,"/",zone,NULL)); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 2c71335..224e7a3 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -95,12 +95,12 @@ NULL #define xkboptions_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[xkboptions]" #define hostname_parameter "AUTOINSTALL[hostname]" #define hostname_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[hostname]" -#define zone_parameter "AUTOINSTALL[hostname]" -#define zone_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[hostname]" -#define lang_parameter "AUTOINSTALL[hostname]" -#define lang_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[hostname]" -#define locale_parameter "AUTOINSTALL[hostname]" -#define locale_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[hostname]" +#define zone_parameter "AUTOINSTALL[zone]" +#define zone_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[zone]" +#define lang_parameter "AUTOINSTALL[lang]" +#define lang_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[lang]" +#define locale_parameter "AUTOINSTALL[locale]" +#define locale_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[locale]" #define device_format_parameter "AUTOINSTALL[device_format]" #define device_format_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[device_format]" #define device_label_parameter "AUTOINSTALL[device_label]" @@ -110,7 +110,7 @@ NULL #define part_type_parameter "AUTOINSTALL[part_type]" #define part_type_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_type]" -#define save_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig set [autoinstall] ",parameters, ";ubinstall2 --test --config /etc/ublinux/autoinstall'", NULL) +#define save_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig set [autoinstall] ",parameters, ";ubinstall2 --config /etc/ublinux/autoinstall'", NULL) #define AUTOINSTALL_TYPE_INSTALL_command "ubconfig --source global get autoinstall AUTOINSTALL[install_type]" #define AUTOINSTALL_DEVICE_command "ubconfig --source global get autoinstall AUTOINSTALL[device]"