From e353f5a3782a6e6beda2c616c03c8369c94e5f4d Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 15 Sep 2025 09:43:21 +0600 Subject: [PATCH 1/5] Fixed default LANG parameter setting --- source/ubl-settings-system.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/ubl-settings-system.c b/source/ubl-settings-system.c index f4531ea..432bbcc 100644 --- a/source/ubl-settings-system.c +++ b/source/ubl-settings-system.c @@ -258,6 +258,7 @@ void on_locale_accept(GtkWidget *self, dictionary *dict){ GtkTreeIter iter; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultCheck))){ yon_config_remove_by_key(locale_parameter); + yon_config_remove_by_key(language_parameter); gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),DEFAULT_LABEL); for_iter (GTK_TREE_MODEL(widgets->languagelist),&iter){ gtk_list_store_set(widgets->languagelist,&iter,2,0,-1); From 94408677cc3ef747929f636de04df519347bcf93 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 15 Sep 2025 10:49:58 +0600 Subject: [PATCH 2/5] Language combo box changes --- source/ubl-settings-system.c | 67 ++++++++++++++++++------------------ source/ubl-settings-system.h | 8 ++--- ubl-settings-system.glade | 30 ++++++---------- 3 files changed, 49 insertions(+), 56 deletions(-) diff --git a/source/ubl-settings-system.c b/source/ubl-settings-system.c index 432bbcc..afc06cc 100644 --- a/source/ubl-settings-system.c +++ b/source/ubl-settings-system.c @@ -69,8 +69,7 @@ void yon_load_proceed(YON_CONFIG_TYPE type){ } else { gtk_widget_destroy(dialog); } - char *command = yon_char_unite(config_get_command(path),NULL); - yon_debug_output("%s\n",command); + char *command = config_get_command(path); yon_config_load_config(type,command,NULL); } } @@ -98,6 +97,20 @@ void yon_config_custom_load(GtkWidget *, main_window *widgets){ yon_interface_update(widgets); } +void yon_language_update(main_window *widgets){ + gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->LanguageCombo)); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->LanguageCombo),DEFAULT_LABEL); + GtkTreeIter iter; + for_iter(GTK_TREE_MODEL(widgets->languagelist),&iter){ + char *target, *code; + int active; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->languagelist),&iter,0,&target,1,&code,2,&active,-1); + if (active){ + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->LanguageCombo),code,target); + } + } +} + void yon_interface_update(main_window *widgets){ g_signal_handlers_block_by_func(G_OBJECT(widgets->IDEntry),G_CALLBACK(on_id_changed),widgets); @@ -162,24 +175,24 @@ 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 (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); - } + for (int i=0;ilanguagelist,&iter,2,1,-1); + char *temp = yon_char_unite(yon_char_is_empty(locale_string)?"":locale_string,yon_char_is_empty(locale_string)?"":"; ",loc_name,NULL); + if (!yon_char_is_empty(locale_string)) free(locale_string); + locale_string = temp; + // locale_string = yon_char_unite(yon_char_is_empty(locale_string) ? yon_char_append(locale_string,"; ") : locale_string, loc_name,NULL); } } - if (!yon_char_is_empty(lang)&&!yon_char_is_empty(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); } + yon_language_update(widgets); + if (!yon_char_is_empty(lang)) { + gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LanguageCombo),lang); + } else { + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguageCombo),0); + } g_signal_handlers_unblock_by_func(G_OBJECT(widgets->IDEntry),G_CALLBACK(on_id_changed),widgets); g_signal_handlers_unblock_by_func(G_OBJECT(widgets->HostnameEntry),G_CALLBACK(on_hostname_changed),widgets); g_signal_handlers_unblock_by_func(G_OBJECT(widgets->ConsoleFontCombo),G_CALLBACK(on_console_font_changed),widgets); @@ -279,7 +292,6 @@ 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); } @@ -391,20 +403,11 @@ void on_console_font_changed(GtkComboBox *self, main_window *widgets){ } } -void on_language_changed(GtkComboBox *self, main_window *widgets){ - GtkTreeIter iter, child; - 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); - } - } +void on_language_changed(GtkComboBox *, main_window *widgets){ + const char *code; + code = gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->LanguageCombo)); + if (code){ + yon_config_register(language_parameter,LANG_get_command,(char*)code); } } @@ -785,9 +788,7 @@ main_window *yon_main_window_complete(main_window *widgets){ // g_timeout_add(1000,(GSourceFunc)on_check_domain_connected,widgets); on_check_domain_connected(NULL, widgets); - 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); + // gtk_combo_box_set_model(GTK_COMBO_BOX(widgets->LanguageCombo),main_config.localefilter); int size; config_str locales = yon_resource_open_file(get_locales_command,&size); GtkTreeIter iter; diff --git a/source/ubl-settings-system.h b/source/ubl-settings-system.h index 1e7c520..64d78a1 100644 --- a/source/ubl-settings-system.h +++ b/source/ubl-settings-system.h @@ -40,8 +40,8 @@ #define get_fonts_command "resource:///com/ublinux/csv/fonts.csv" #define get_id_command "/etc/machine-id" -#define config_get_command(source) yon_char_unite("ubconfig --source ", source, " -ea get system HOSTNAME MACHINEID -- get locale CONSOLE_FONT LOCALE LANG -- get [network] DOMAIN DOMAIN[admanger] DOMAIN[server] DOMAIN[dns] DOMAIN[client]",NULL) -#define config_get_default_command "" +#define config_get_command(source) yon_char_unite("ubconfig --source ", source, " -ea get [system] HOSTNAME MACHINEID -- get [locale] CONSOLE_FONT LOCALE LANG -- get [network] DOMAIN DOMAIN[admanger] DOMAIN[server] DOMAIN[dns] DOMAIN[client]",NULL) +#define config_get_default_command "ubconfig --source default -- get [locale] CONSOLE_FONT LOCALE LANG" #define config_get_global_only_parameters "" #define config_get_local_only_parameters "" @@ -97,7 +97,6 @@ char *local; typedef struct { template_config_fields GtkListStore *localeslist; - GtkTreeModel *localefilter; int save_config; int domain_connected; GMutex ThreadMutex; @@ -246,4 +245,5 @@ void on_domain_disconnect(GtkWidget *self, dictionary *dict); domain_window *yon_domain_window_new(); void on_domain_opened(GtkWidget *self, main_window *widgets); void on_check_domain_connected(GtkWidget *self, main_window *widgets); -main_window *yon_main_window_complete(main_window *widgets); \ No newline at end of file +main_window *yon_main_window_complete(main_window *widgets); +void yon_language_update(main_window *widgets); \ No newline at end of file diff --git a/ubl-settings-system.glade b/ubl-settings-system.glade index b1f8e8e..dc8771a 100644 --- a/ubl-settings-system.glade +++ b/ubl-settings-system.glade @@ -59,16 +59,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. False com.ublinux.libublsettingsui-gtk3.zoom-symbolic - - - - - - - - - - True False @@ -474,17 +464,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - + True False - languagelist - 0 - - - - 0 - - True @@ -529,6 +511,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + + + + + + + + + True False From 3478af61b1db2d8f21e95d37ac6d71f6f2d40ed3 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 15 Sep 2025 11:24:36 +0600 Subject: [PATCH 3/5] Wiki link change --- source/ubl-settings-system.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubl-settings-system.h b/source/ubl-settings-system.h index 64d78a1..d4f91eb 100644 --- a/source/ubl-settings-system.h +++ b/source/ubl-settings-system.h @@ -15,7 +15,7 @@ #endif #include "ubl-strings.h" -#define WIKI_LINK "https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-system" +#define WIKI_LINK "https://wiki.ublinux.ru/ru/Software/Programs_and_utilities/All/ubl-settings-system" #define _(String) gettext(String) From 13d20d180c589b34fd1479197ceb841368604af1 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 23 Sep 2025 17:59:39 +0600 Subject: [PATCH 4/5] Buttons minimum size --- ubl-settings-system.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ubl-settings-system.css b/ubl-settings-system.css index 88e8c57..d823273 100644 --- a/ubl-settings-system.css +++ b/ubl-settings-system.css @@ -111,4 +111,9 @@ background:transparent; .boxInfoMessOK{ background-color: #f3f0ac; +} + +button { + min-width: 26px; + min-height: 24px; } \ No newline at end of file From ec9a4e099e5e1a5bc4d002836c96e07f6fc837b9 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 6 Oct 2025 16:53:56 +0600 Subject: [PATCH 5/5] System language fix --- source/ubl-settings-system.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/ubl-settings-system.c b/source/ubl-settings-system.c index afc06cc..f1149e8 100644 --- a/source/ubl-settings-system.c +++ b/source/ubl-settings-system.c @@ -5,7 +5,7 @@ config main_config; //functions void on_save_done(main_window *, config_str output, int size){ - char *final_output = yon_char_parsed_to_string(output,size,""); + char *final_output = yon_char_parsed_to_string(output,size,"\n"); if (final_output){ printf("%s\n",final_output); free(final_output); @@ -100,6 +100,7 @@ void yon_config_custom_load(GtkWidget *, main_window *widgets){ void yon_language_update(main_window *widgets){ gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->LanguageCombo)); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->LanguageCombo),DEFAULT_LABEL); + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguageCombo),0); GtkTreeIter iter; for_iter(GTK_TREE_MODEL(widgets->languagelist),&iter){ char *target, *code; @@ -240,13 +241,13 @@ void yon_config_custom_save(){ template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_CUSTOM,config_get_command("system"),NULL); if (window){}; } - - void on_domain_address_save(GtkEntry *self){ + +void on_domain_address_save(GtkEntry *self){ char *adress = (char*)gtk_entry_get_text(self); if (!yon_char_is_empty(adress)){ yon_config_register(DOMAIN,DOMAIN_get_command,adress); } - } +} void yon_gtk_windget_set_sensitive_from_entry_emptiness(GtkEntry *self, GtkWidget *target){ if (yon_char_is_empty(gtk_entry_get_text(self))){ @@ -292,6 +293,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); } + yon_language_update(widgets); on_subwindow_close(self); } @@ -788,7 +790,6 @@ main_window *yon_main_window_complete(main_window *widgets){ // g_timeout_add(1000,(GSourceFunc)on_check_domain_connected,widgets); on_check_domain_connected(NULL, widgets); - // gtk_combo_box_set_model(GTK_COMBO_BOX(widgets->LanguageCombo),main_config.localefilter); int size; config_str locales = yon_resource_open_file(get_locales_command,&size); GtkTreeIter iter;