From a6dc1e2e0f56a98fcc06360633bb0413d51357d9 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 8 Apr 2025 12:31:35 +0600 Subject: [PATCH 1/4] Changed language combo box --- source/ubl-settings-system.c | 14 ++++++++++---- source/ubl-settings-system.h | 4 +++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/source/ubl-settings-system.c b/source/ubl-settings-system.c index b46d564..3f6dd54 100644 --- a/source/ubl-settings-system.c +++ b/source/ubl-settings-system.c @@ -270,6 +270,7 @@ void on_locale_accept(GtkWidget *self, dictionary *dict){ yon_config_register(locale_parameter,LOCALE_get_command,final_ids); gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),final_string); } + gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(main_config.localefilter)); on_subwindow_close(self); } @@ -381,10 +382,12 @@ void on_console_font_changed(GtkComboBox *self, main_window *widgets){ } void on_language_changed(GtkComboBox *self, main_window *widgets){ - GtkTreeIter iter; + GtkTreeIter iter, child; gtk_combo_box_get_active_iter(self,&iter); char *code; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->languagelist),&iter,1,&code,-1); + + gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(main_config.localefilter),&child,&iter); + gtk_tree_model_get(GTK_TREE_MODEL(widgets->languagelist),&child,1,&code,-1); if (code) if (yon_config_get_by_key(language_parameter)){ yon_config_set(language_parameter,code); @@ -449,7 +452,7 @@ void on_domain_connect(GtkWidget *self, dictionary *dict){ gtk_window_set_title(GTK_WINDOW(dialog->Window),DOMAIN_CONNECTING_LABEL); yon_terminal_integrated_start(dialog->ExecuteTerminal,domain_connect_command(adress,login,password,final)); gtk_widget_show(dialog->Window); - gtk_entry_set_text(GTK_ENTRY(widgets->DomainEntry),adress); + gtk_entry_set_text(GTK_ENTRY(widgets->DomainEntry),adress); gtk_widget_destroy(window->Window); free(window); @@ -764,13 +767,16 @@ main_window *yon_main_window_complete(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->DomainEntry),"focus-out-event",G_CALLBACK(on_domain_address_save),NULL); g_signal_connect(G_OBJECT(widgets->FindButton),"clicked",G_CALLBACK(on_find_domains_clicked),widgets); + gtk_widget_set_size_request(widgets->Window,800,440); // g_timeout_add(1000,(GSourceFunc)on_check_domain_connected,widgets); on_check_domain_connected(NULL, widgets); - main_config.localeslist = gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_BOOLEAN); + main_config.localefilter = gtk_tree_model_filter_new(GTK_TREE_MODEL(widgets->languagelist),NULL); + gtk_combo_box_set_model(GTK_COMBO_BOX(widgets->LanguageCombo),main_config.localefilter); + gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(main_config.localefilter),2); int size; config_str locales = yon_file_open(get_locales_command,&size); GtkTreeIter iter; diff --git a/source/ubl-settings-system.h b/source/ubl-settings-system.h index 0f168ba..2c97244 100644 --- a/source/ubl-settings-system.h +++ b/source/ubl-settings-system.h @@ -98,6 +98,7 @@ char *local; typedef struct { template_config_fields GtkListStore *localeslist; + GtkTreeModel *localefilter; int save_config; int domain_connected; GMutex ThreadMutex; @@ -205,4 +206,5 @@ void yon_interface_update(main_window *widgets); void on_hostname_changed(GtkEntry *self, main_window *widgets); void on_language_changed(GtkComboBox *self, main_window *widgets); void on_console_font_changed(GtkComboBox *self, main_window *widgets); -void on_hostname_changed(GtkEntry *self, main_window *widgets); \ No newline at end of file +void on_hostname_changed(GtkEntry *self, main_window *widgets); +void on_locale_window_closed(); \ No newline at end of file From 66b7c6359e224eafe85a32ca53c63d8d52192da0 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 8 Apr 2025 14:46:05 +0600 Subject: [PATCH 2/4] Fixed crash --- source/ubl-settings-system.c | 20 +++++++++++--------- source/ubl-strings.h | 2 ++ ubl-settings-system-connection.glade | 2 ++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/source/ubl-settings-system.c b/source/ubl-settings-system.c index 3f6dd54..5b30f2a 100644 --- a/source/ubl-settings-system.c +++ b/source/ubl-settings-system.c @@ -383,16 +383,18 @@ void on_console_font_changed(GtkComboBox *self, main_window *widgets){ void on_language_changed(GtkComboBox *self, main_window *widgets){ GtkTreeIter iter, child; - gtk_combo_box_get_active_iter(self,&iter); - char *code; + if (gtk_combo_box_get_active_iter(self,&iter)){ + char *code; - gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(main_config.localefilter),&child,&iter); - gtk_tree_model_get(GTK_TREE_MODEL(widgets->languagelist),&child,1,&code,-1); - if (code) - if (yon_config_get_by_key(language_parameter)){ - yon_config_set(language_parameter,code); - } else { - yon_config_register(language_parameter,LANG_get_command,code); + gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(main_config.localefilter),&child,&iter); + gtk_tree_model_get(GTK_TREE_MODEL(widgets->languagelist),&child,1,&code,-1); + if (code){ + if (yon_config_get_by_key(language_parameter)){ + yon_config_set(language_parameter,code); + } else { + yon_config_register(language_parameter,LANG_get_command,code); + } + } } } diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 475adde..068b7f5 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -48,6 +48,8 @@ #define OFF_AUTOMATICALLY_LABEL _("Switch client off or automatically") #define INFO_LABEL _("Domain information") #define INFO_TITLE_LABEL _("Current domain information") +#define KERBEROS_TOOLTIP_LABEL _("DNS server that resolves the Kerberos/AD server name") +#define DNS_TOOLTIP_LABEL _("Full DNS name or IP address") #define CONNECTION_LABEL _("Connect to domain") #define DDISCONNECTION_LABEL _("Disconnect from domain") #define CHECK_NAME_LABEL _("Check domain name") diff --git a/ubl-settings-system-connection.glade b/ubl-settings-system-connection.glade index 0e03510..6c3d0fc 100644 --- a/ubl-settings-system-connection.glade +++ b/ubl-settings-system-connection.glade @@ -255,6 +255,7 @@ True True + DNS server that resolves the Kerberos/AD server name True @@ -290,6 +291,7 @@ True True + Full DNS name or IP address True From 3cbee3d7c06fbce2d0c44c7c9495918b60066bc0 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 8 Apr 2025 14:51:44 +0600 Subject: [PATCH 3/4] Localisation update --- ubl-settings-system.pot | 33 +++++++++++++++++++-------------- ubl-settings-system_ru.po | 36 ++++++++++++++++++++++-------------- 2 files changed, 41 insertions(+), 28 deletions(-) diff --git a/ubl-settings-system.pot b/ubl-settings-system.pot index 7c0d2c3..9c14dd5 100644 --- a/ubl-settings-system.pot +++ b/ubl-settings-system.pot @@ -182,50 +182,58 @@ msgid "Current domain information" msgstr "" #: source/ubl-strings.h:51 -msgid "Connect to domain" +msgid "DNS server that resolves the Kerberos/AD server name" msgstr "" #: source/ubl-strings.h:52 -msgid "Disconnect from domain" +msgid "Full DNS name or IP address" msgstr "" #: source/ubl-strings.h:53 -msgid "Check domain name" +msgid "Connect to domain" msgstr "" #: source/ubl-strings.h:54 -msgid "List all domains" +msgid "Disconnect from domain" +msgstr "" + +#: source/ubl-strings.h:55 +msgid "Check domain name" msgstr "" #: source/ubl-strings.h:56 +msgid "List all domains" +msgstr "" + +#: source/ubl-strings.h:58 msgid "Connecting to domain" msgstr "" -#: source/ubl-strings.h:57 +#: source/ubl-strings.h:59 msgid "Disconnecting from domain" msgstr "" -#: source/ubl-strings.h:58 +#: source/ubl-strings.h:60 msgid "Join" msgstr "" -#: source/ubl-strings.h:59 +#: source/ubl-strings.h:61 msgid "Leave" msgstr "" -#: source/ubl-strings.h:61 +#: source/ubl-strings.h:63 msgid "Connected to domain" msgstr "" -#: source/ubl-strings.h:62 +#: source/ubl-strings.h:64 msgid "Disconnected from domain" msgstr "" -#: source/ubl-strings.h:64 +#: source/ubl-strings.h:66 msgid "Loading..." msgstr "" -#: source/ubl-strings.h:65 +#: source/ubl-strings.h:67 msgid "Check" msgstr "" @@ -586,9 +594,6 @@ msgstr "" msgid "Serbian, Serbia (Latin)" msgstr "" -msgid "" -msgstr "" - msgid "Tamil, India" msgstr "" diff --git a/ubl-settings-system_ru.po b/ubl-settings-system_ru.po index 729b34a..97edb06 100644 --- a/ubl-settings-system_ru.po +++ b/ubl-settings-system_ru.po @@ -183,50 +183,58 @@ msgid "Current domain information" msgstr "Информация о подключенном домене" #: source/ubl-strings.h:51 +msgid "DNS server that resolves the Kerberos/AD server name" +msgstr "DNS сервер, который опознает имя сервере Kerberos/AD" + +#: source/ubl-strings.h:52 +msgid "Full DNS name or IP address" +msgstr "Полное имя DNS или IP-адрес" + +#: source/ubl-strings.h:53 msgid "Connect to domain" msgstr "Присоединиться к домену" -#: source/ubl-strings.h:52 +#: source/ubl-strings.h:54 msgid "Disconnect from domain" msgstr "Отсоединиться от домена" -#: source/ubl-strings.h:53 +#: source/ubl-strings.h:55 msgid "Check domain name" msgstr "Проверить домен" -#: source/ubl-strings.h:54 +#: source/ubl-strings.h:56 msgid "List all domains" msgstr "Показать все домены" -#: source/ubl-strings.h:56 +#: source/ubl-strings.h:58 msgid "Connecting to domain" msgstr "Подключение к домену" -#: source/ubl-strings.h:57 +#: source/ubl-strings.h:59 msgid "Disconnecting from domain" msgstr "Отключение от домена" -#: source/ubl-strings.h:58 +#: source/ubl-strings.h:60 msgid "Join" msgstr "Присоединиться" -#: source/ubl-strings.h:59 +#: source/ubl-strings.h:61 msgid "Leave" msgstr "Отсоединиться" -#: source/ubl-strings.h:61 +#: source/ubl-strings.h:63 msgid "Connected to domain" msgstr "Подключен к домену" -#: source/ubl-strings.h:62 +#: source/ubl-strings.h:64 msgid "Disconnected from domain" msgstr "Не подключен к домену" -#: source/ubl-strings.h:64 +#: source/ubl-strings.h:66 msgid "Loading..." msgstr "Загрузка..." -#: source/ubl-strings.h:65 +#: source/ubl-strings.h:67 msgid "Check" msgstr "Проверка" @@ -587,9 +595,6 @@ msgstr "Сербский, Сербия" msgid "Serbian, Serbia (Latin)" msgstr "Сербский, Сербия" -msgid "Swedish, Sweden" -msgstr "Шведский, Швеция" - msgid "Tamil, India" msgstr "Тамильский, Индия" @@ -619,3 +624,6 @@ msgstr "Китайский, Сингапур" msgid "Traditional Chinese, Taiwan" msgstr "Традиционный Китайский, Тайвань" + +msgid "Swedish, Sweden" +msgstr "Шведский, Швеция" From 48fc1bb68dd55bf6577fe2b29ccad95909aacdb7 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 8 Apr 2025 16:57:44 +0600 Subject: [PATCH 4/4] Fixed language loading --- source/ubl-settings-system.c | 24 +++++++++++++++++++++--- source/ubl-settings-system.h | 4 ++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/source/ubl-settings-system.c b/source/ubl-settings-system.c index 5b30f2a..ec8df05 100644 --- a/source/ubl-settings-system.c +++ b/source/ubl-settings-system.c @@ -30,6 +30,14 @@ void on_save_done(main_window *widgets, config_str output, int size){ } +void on_config_reload(GtkWidget *,main_window *widgets){ + if (main_config.load_mode==0){ + yon_config_global_load(NULL,widgets); + } else if (main_config.load_mode==1){ + yon_config_local_load(NULL,widgets); + } +} + int yon_load_proceed(YON_CONFIG_TYPE type){ if (type!=YON_CONFIG_CUSTOM){ yon_config_clean(); @@ -163,13 +171,21 @@ void yon_interface_update(main_window *widgets){ int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->languagelist),&iter); for(;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->languagelist),&iter)){ gtk_tree_model_get(GTK_TREE_MODEL(widgets->languagelist),&iter,0,&loc_name,1,&code,2,&is_active,-1); - if (code&&!strcmp(code,lang)) gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widgets->LanguageCombo),&iter); - if (avlocale) - for (int i=0;ilanguagelist,&iter,2,1,-1); locale_string = yon_char_unite(strcmp(locale_string,"") ? yon_char_append(locale_string,"; ") : locale_string, loc_name,NULL); } + } + } + if (code&&!strcmp(code,lang)) { + GtkTreeIter filter_iter; + gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(main_config.localefilter)); + while(gtk_events_pending()) gtk_main_iteration(); + gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(main_config.localefilter),&filter_iter,&iter); + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widgets->LanguageCombo),&filter_iter); + } } if (strcmp(locale_string,"")) gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),locale_string); } @@ -458,6 +474,7 @@ void on_domain_connect(GtkWidget *self, dictionary *dict){ gtk_widget_destroy(window->Window); free(window); + on_config_reload(NULL,widgets); } void on_status_clicked(GtkWidget *self, connection_window *window){ @@ -576,6 +593,7 @@ void on_domain_disconnect(GtkWidget *self, dictionary *dict){ gtk_widget_show(dialog->Window); gtk_widget_destroy(window->Window); free(window); + on_config_reload(NULL,widgets); } domain_window *yon_domain_window_new(){ diff --git a/source/ubl-settings-system.h b/source/ubl-settings-system.h index 2c97244..d389ec1 100644 --- a/source/ubl-settings-system.h +++ b/source/ubl-settings-system.h @@ -197,6 +197,10 @@ typedef struct { GtkWidget *TerminalScroll; } domain_info_window; +void yon_config_local_load(GtkWidget *self, main_window *widgets); +void yon_config_global_load(GtkWidget *self, main_window *widgets); +void yon_config_custom_load(GtkWidget *self, main_window *widgets); + main_window *setup_window(); void on_id_changed(GtkEntry *self, main_window *widgets);