You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ubinstall-gtk/source/ubinstall-gtk-region.c

43 lines
2.2 KiB

#include "ubinstall-gtk.h"
int yon_region_save(main_window *widgets){
if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->RegionCombo))==-1){
yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),REGION_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(widgets->RegionCombo);
return 0;
} else if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->ZoneCombo))==-1){
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 0;
}
char *languages = "";
GtkTreeIter iter;
GtkTreeModel *model = GTK_TREE_MODEL(widgets->LanguagesFilter);
char *lang_code=NULL;
for_iter(model,&iter){
gtk_tree_model_get(model,&iter,2,&lang_code,-1);
languages = yon_char_unite(languages,!yon_char_is_empty(languages)?",":"",lang_code,NULL);
}
if (yon_char_is_empty(languages)||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->MainLanguageSensitiveCheck))){
yon_config_remove_by_key(locale_parameter);
} else {
yon_config_register(locale_parameter,locale_parameter_command,languages);
free(languages);
}
if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->LanguagesCombo))==-1||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck))){
yon_config_remove_by_key(lang_parameter);
} else {
char *language = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->LanguagesCombo));
yon_config_register(lang_parameter,lang_parameter_command,language);
}
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck))){
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));
yon_debug_output("%s",region);
yon_debug_output("/%s\n\n",zone);
yon_config_register(zone_parameter,zone_parameter_command,yon_char_unite(region,"/",zone,NULL));
} else {
yon_config_remove_by_key(zone_parameter);
}
return 1;
}