From bb64efad14e1e7721ecf50f8a01efd01b9507b1c Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 9 Jun 2025 11:26:45 +0000 Subject: [PATCH] Key creation window fixes --- source/ubl-settings-repomanager.c | 10 ++++++++-- source/ubl-strings.h | 4 +++- ubl-settings-repomanager-key.glade | 2 ++ ubl-settings-repomanager_ru.po | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/source/ubl-settings-repomanager.c b/source/ubl-settings-repomanager.c index 59558f3..7b1ebf7 100644 --- a/source/ubl-settings-repomanager.c +++ b/source/ubl-settings-repomanager.c @@ -873,6 +873,11 @@ void on_key_generate_accept(GtkWidget *self, key_creation_window* window){ const char *email = gtk_entry_get_text(GTK_ENTRY(window->EmailEntry)); char *strength = yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->KeyStrengthSpin))); const char *comment = gtk_entry_get_text(GTK_ENTRY(window->CommentsEntry)); + if (!yon_char_is_empty(name)&&strlen(name)<5){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),NAME_SHORT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->NameEntry); + return; + } GtkWidget *highlight_target=NULL; if (yon_char_is_empty(name)){ highlight_target=window->NameEntry; @@ -882,8 +887,6 @@ void on_key_generate_accept(GtkWidget *self, key_creation_window* window){ highlight_target=window->EmailEntry; } else if (yon_char_is_empty(strength)){ highlight_target=window->KeyStrengthSpin; - } else if (yon_char_is_empty(comment)){ - highlight_target=window->CommentsEntry; } if (highlight_target){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); @@ -939,6 +942,8 @@ key_creation_window *yon_key_creation_window_new(){ yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(window->PasswordConfirmationEntry)); yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(window->PasswordEntry)); + g_signal_connect(G_OBJECT(window->ExpireCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),window->ExpireButton); + g_signal_connect(G_OBJECT(window->ExpireCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),window->ExpireEntry); g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); g_signal_connect(G_OBJECT(window->ExpireButton),"clicked",G_CALLBACK(on_calendar_open),window); g_signal_connect(G_OBJECT(window->AddButton),"clicked",G_CALLBACK(on_key_generate_accept),window); @@ -954,6 +959,7 @@ key_creation_window *yon_key_creation_window_new(){ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->EncryptionCombo),parsed[2],parsed[0]); yon_char_parsed_free(parsed,parsed_size); } + gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->EncryptionCombo),"RSA"); return window; } diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 5f3c6d2..0699111 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -164,4 +164,6 @@ #define EMPTY_FOLDER_LABEL _("Folder must contain repositories") -#define FILES_EXIST_LABEL _("Folder must not be empty") \ No newline at end of file +#define FILES_EXIST_LABEL _("Folder must not be empty") + +#define NAME_SHORT_LABEL _("Name must be 5 or more symbols") \ No newline at end of file diff --git a/ubl-settings-repomanager-key.glade b/ubl-settings-repomanager-key.glade index 07621c5..49ffe95 100644 --- a/ubl-settings-repomanager-key.glade +++ b/ubl-settings-repomanager-key.glade @@ -288,6 +288,7 @@ True + False True @@ -299,6 +300,7 @@ True + False True True image1 diff --git a/ubl-settings-repomanager_ru.po b/ubl-settings-repomanager_ru.po index f7624f4..1703bbe 100644 --- a/ubl-settings-repomanager_ru.po +++ b/ubl-settings-repomanager_ru.po @@ -407,7 +407,7 @@ msgstr "Выберите репозиторий или пакет для под #: source/ubl-strings.h:117 msgid "Name:" -msgstr "Название:" +msgstr "Имя:" #: source/ubl-strings.h:118 msgid "Branches:"