Fixed --shell loading at user editing window

pull/182/head
parent 77d1b260e5
commit c03af969dd

@ -2280,10 +2280,8 @@ void on_parameter_changed(GtkWidget *self,ubl_settings_usergroups_user_window *w
int user_shell_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo)); int user_shell_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo));
if (user_shell_active>0){ if (user_shell_active>0){
user_shell = yon_char_unite("--shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL); user_shell = yon_char_unite("--shell ",!strcmp(gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->userShellCombo)),"Set")?(char*)gtk_entry_get_text(GTK_ENTRY(window->userShellEntry)):(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL);
if (!strcmp(user_shell,SET_LABEL)){
user_shell = yon_char_unite("--shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL);
}
} else user_shell=""; } else user_shell="";
int user_home_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userHomeCombo)); int user_home_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userHomeCombo));
@ -2401,11 +2399,11 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
if (shells[i][strlen(shells[i])-1]=='\n') shells[i][strlen(shells[i])-1]='\0'; if (shells[i][strlen(shells[i])-1]=='\n') shells[i][strlen(shells[i])-1]='\0';
int parsed_size=0; int parsed_size=0;
config_str parsed = yon_char_parse(shells[i],&parsed_size,";"); config_str parsed = yon_char_parse(shells[i],&parsed_size,";");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(window->userShellCombo),parsed[0]); gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->userShellCombo),parsed[0],parsed[0]);
yon_char_parsed_free(parsed,parsed_size); yon_char_parsed_free(parsed,parsed_size);
} }
} }
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(window->userShellCombo),SET_LABEL); gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->userShellCombo),"Set",SET_LABEL);
yon_char_parsed_free(shells,shell_size); yon_char_parsed_free(shells,shell_size);
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userShellCombo),0); gtk_combo_box_set_active(GTK_COMBO_BOX(window->userShellCombo),0);
window->old_password=NULL; window->old_password=NULL;
@ -2556,8 +2554,7 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userHomeCombo),2); gtk_combo_box_set_active(GTK_COMBO_BOX(window->userHomeCombo),2);
i++; i++;
} else if (!strcmp(parameters_substring[i],"--shell")||!strcmp(parameters_substring[i],"-s")){ } else if (!strcmp(parameters_substring[i],"--shell")||!strcmp(parameters_substring[i],"-s")){
int active = yon_gtk_combo_box_text_find(window->userShellCombo,parameters_substring[i+1]); if (!gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->userShellCombo),parameters_substring[i+1])){
if (!active){
gtk_entry_set_text(GTK_ENTRY(window->userShellEntry),parameters_substring[i+1]); gtk_entry_set_text(GTK_ENTRY(window->userShellEntry),parameters_substring[i+1]);
gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->userShellCombo),"Set"); gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->userShellCombo),"Set");
} }

Loading…
Cancel
Save