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-users.c

89 lines
4.1 KiB

#include "ubinstall-gtk.h"
int yon_users_save(main_window *widgets){
if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UsernameSensitiveCheck))){
yon_config_remove_by_key(user_gecos_parameter);
} else {
char *username = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry));
if (username){};
yon_config_register(user_gecos_parameter,user_gecos_parameter_command,username);
}
if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck))){
yon_config_remove_by_key(user_name_parameter);
} else {
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck))){
yon_config_register(user_name_parameter,user_name_parameter_command,"root");
} else {
char *login = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry));
if (login){};
yon_config_register(user_name_parameter,user_name_parameter_command,login);
}
}
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->PasswordSensitiveCheck))){
if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->PasswordCombo))==1){
if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->PasswordEntry)))){
yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(widgets->PasswordEntry);
return 0;
} else {
char *password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->PasswordEntry));
if (password){};
yon_config_register(user_password_parameter,user_password_parameter_command,password);
}
} else {
yon_config_remove_by_key(user_password_parameter);
}
}else {
yon_config_remove_by_key(user_password_parameter);
}
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->RootPasswordSensitiveCheck))){
if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo))==1){
if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->AdminPasswordEntry)))){
yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(widgets->AdminPasswordEntry);
return 0;
} else {
char *root_password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->AdminPasswordEntry));
if (root_password){};
yon_config_register(root_password_parameter,root_password_parameter_command,root_password);
}
} else {
yon_config_remove_by_key(root_password_parameter);
}
} else {
yon_config_remove_by_key(root_password_parameter);
}
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck))){
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){
yon_config_register(hostname_parameter,hostname_parameter_command,"auto");
} else {
if (!yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->HotnameEntry)))){
char *hostname = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->HotnameEntry));
if (hostname){};
yon_config_register(hostname_parameter,hostname_parameter_command,hostname);
} else {
yon_config_remove_by_key(hostname_parameter);
}
}
} else {
yon_config_remove_by_key(hostname_parameter);
}
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutologinSensitiveCheck))){
char *autologin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck))?"yes":"no";
yon_config_register(autologin_parameter,autologin_parameter_command,autologin);
} else {
yon_config_remove_by_key(autologin_parameter);
}
return 1;
}