From c03af969ddd070f01b09d35a469e469d3b5f94ad Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 27 Sep 2024 16:18:18 +0600 Subject: [PATCH] Fixed --shell loading at user editing window --- source/ubl-settings-usergroups.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 9153e51..bbbba4c 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -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)); 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); - 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); - } + 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); + } else user_shell=""; 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'; int parsed_size=0; 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); } } - 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); gtk_combo_box_set_active(GTK_COMBO_BOX(window->userShellCombo),0); 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); i++; } 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 (!active){ + if (!gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->userShellCombo),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"); }