From 43157db11b0b9d59261e04a54c95f0d671234a51 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 12 Aug 2025 17:58:03 +0600 Subject: [PATCH 1/3] Sync window fixes --- locale/ubl-settings-usergroups_ru.po | 6 ++-- source/ubl-settings-usergroups-settings.c | 37 +++++++++++++++++++++++ source/ubl-settings-usergroups.h | 17 ++++++----- source/ubl-strings.h | 4 +-- 4 files changed, 51 insertions(+), 13 deletions(-) diff --git a/locale/ubl-settings-usergroups_ru.po b/locale/ubl-settings-usergroups_ru.po index 4ad87bc..9f604e0 100644 --- a/locale/ubl-settings-usergroups_ru.po +++ b/locale/ubl-settings-usergroups_ru.po @@ -897,11 +897,11 @@ msgstr "Группы конфигурации" #: source/ubl-strings.h:238 source/ubl-strings.h:253 source/ubl-strings.h:266 msgid "System users" -msgstr "Пользователи системы" +msgstr "Системные пользователи" #: source/ubl-strings.h:239 source/ubl-strings.h:262 -msgid "System groups" -msgstr "Группы системы" +msgid "System Groups" +msgstr "Системные Группы" #: source/ubl-strings.h:240 source/ubl-strings.h:249 msgid "Remove from system" diff --git a/source/ubl-settings-usergroups-settings.c b/source/ubl-settings-usergroups-settings.c index 370ba94..5be7820 100644 --- a/source/ubl-settings-usergroups-settings.c +++ b/source/ubl-settings-usergroups-settings.c @@ -215,6 +215,40 @@ GtkTreeIter iter; // on_useradd_sync_changed(window); } +void yon_shutdown_toggled(GtkWidget *self,ubl_settings_usergroups_additional_settings_window *window){ + if (self == window->UsersShutdownCheck){ + int active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); + gtk_widget_set_sensitive(window->UserAddButton,!active); + gtk_widget_set_sensitive(window->UsersTree,!active); + gtk_widget_set_sensitive(window->UserRemoveButton,!active); + if (active){ + GtkTreeIter iter; + for_iter(GTK_TREE_MODEL(window->UsersShutdownList),&iter){ + gtk_list_store_set(window->UsersShutdownList,&iter,0,0,-1); + } + gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->UsersShutdownList),&iter,"1"); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,-1); + gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->UsersShutdownList),&iter,"2"); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,-1); + } + } else { + int active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); + gtk_widget_set_sensitive(window->GroupAddButton,!active); + gtk_widget_set_sensitive(window->GroupsTree,!active); + gtk_widget_set_sensitive(window->GroupRemoveButton,!active); + if (active){ + GtkTreeIter iter; + for_iter(GTK_TREE_MODEL(window->GroupsShutdownList),&iter){ + gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); + } + gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->GroupsShutdownList),&iter,"1"); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,-1); + gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->GroupsShutdownList),&iter,"2"); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,-1); + } + } +} + void on_adiitional_settings_tree_selection_changed(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window){ GtkTreeModel *model; GtkTreeIter iter; @@ -601,6 +635,9 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ g_signal_connect(G_OBJECT(window->UsersTree),"cursor-changed",G_CALLBACK(on_adiitional_settings_tree_selection_changed),window); g_signal_connect(G_OBJECT(window->GroupsTree),"cursor-changed",G_CALLBACK(on_adiitional_settings_tree_selection_changed),window); + + g_signal_connect(G_OBJECT(window->UsersShutdownCheck),"toggled",G_CALLBACK(yon_shutdown_toggled),window); + g_signal_connect(G_OBJECT(window->GroupsShutdownCheck),"toggled",G_CALLBACK(yon_shutdown_toggled),window); yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"AdditionalSettingsWindow"); gtk_window_set_title(GTK_WINDOW(window->Window),ADDITIONAL_SETTINGS_TITLE_LABEL); { diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index b93b8c4..02be420 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -93,11 +93,11 @@ #define check_box_icon_name "com.ublinux.libublsettingsui-gtk3.checkbox-symbolic" #define check_checked_icon_name "com.ublinux.libublsettingsui-gtk3.checkbox-checked-symbolic" #define check_attention_icon_name "com.ublinux.libublsettingsui-gtk3.checkbox-attention-symbolic" -#define add_icon_name "com.ublinux.ubl-settings-usergroups.increase-symbolic" -#define edit_icon_name "com.ublinux.ubl-settings-usergroups.edit-symbolic" -#define delete_icon_name "com.ublinux.ubl-settings-usergroups.trash-symbolic" -#define sync_icon_name "com.ublinux.ubl-settings-usergroups.user-add-symbolic" -#define update_icon_name "com.ublinux.ubl-settings-usergroups.sync-symbolic" +#define add_icon_name "com.ublinux.libublsettingsui-gtk3.increase-symbolic" +#define edit_icon_name "com.ublinux.libublsettingsui-gtk3.edit-symbolic" +#define delete_icon_name "com.ublinux.libublsettingsui-gtk3.trash-symbolic" +#define sync_icon_name "com.ublinux.libublsettingsui-gtk3.move-in-symbolic" +#define update_icon_name "com.ublinux.libublsettingsui-gtk3.sync-symbolic" #define password_hash_get_command(passwd) yon_char_append("mkpasswd2 ",passwd) @@ -105,10 +105,10 @@ #define user_info_pdf_command(target,path) yon_char_unite("echo ",target,path,NULL) #define user_info_txt_command(target,path) yon_char_unite("echo ",target,path,NULL) -#define config_get_command(source) yon_char_unite("ubconfig --source ",source," get users DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERADD_SYNC USERADD_SYNC[*] USERSHADOW[*] USERSHADOW_SYNC[*] GROUPADD[*] GROUPADD_SYNC[*] GROUPADD_SYNC",NULL),yon_char_unite("ubconfig --source ",source," get [system] SYSTEMBOOT_STATEMODE",NULL),yon_char_unite("ubconfig --source ",source," get [save] SAVE_ROOTCOPY_CHANGES",NULL) -#define config_get_default_command "ubconfig --source default get users DEFAULTPASSWD DEFAULTROOTPASSWD USERGROUPS DEFAULTUSER HASHPASSWD ADDADM" +#define config_get_command(source) yon_char_unite("ubconfig --source ",source," -ea get [users] DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERADD_SYNC USERADD_SYNC[*] USERSHADOW[*] USERSHADOW_SYNC[*] GROUPADD[*] GROUPADD_SYNC[*] GROUPADD_SYNC"," -- [system] SYSTEMBOOT_STATEMODE"," -- [save] SAVE_ROOTCOPY_CHANGES",NULL) +#define config_get_default_command "ubconfig --source default -ea get users DEFAULTPASSWD DEFAULTROOTPASSWD USERGROUPS DEFAULTUSER HASHPASSWD ADDADM" -#define config_get_global_only_parameters "ubconfig --source global get users DEFAULTPASSWD DEFAULTROOTPASSWD" +#define config_get_global_only_parameters "ubconfig --source global -ea get users DEFAULTPASSWD DEFAULTROOTPASSWD" #define config_get_local_only_parameters "" #define SAVE_ROOTCOPY_CHANGES_get_command "ubconfig --source global get [save] SAVE_ROOTCOPY_CHANGES" @@ -617,4 +617,5 @@ void on_user_info(GtkWidget *,main_window *widgets); yon_user_info_window *yon_user_info_window_new(); void on_user_info_save(GtkWidget *,yon_user_info_window *window); void on_user_info_print(GtkWidget *,yon_user_info_window *window); +void yon_shutdown_toggled(GtkWidget *self,ubl_settings_usergroups_additional_settings_window *window); #endif \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 58b7ca2..5926e3f 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -238,8 +238,8 @@ #define CONFIG_USERS_TAB_LABEL _("Configuration users") #define CONFIG_GROUPS_TAB_LABEL _("Configuration groups") -#define SYSTEM_USERS_TAB_LABEL _("System users") -#define SYSTEM_GROUPS_TAB_LABEL _("System groups") +#define SYSTEM_USERS_TAB_LABEL _("System Users") +#define SYSTEM_GROUPS_TAB_LABEL _("System Groups") #define SYSTEM_REMOVE_FROM_CONFIG_LABEL _("Remove from system") #define SYSTEM_REMOVE_FROM_SYSTEM_LABEL _("Remove from configuration") From d78dbaff1e6f2c988f5eb6fcca3130ee247335e4 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 19 Aug 2025 16:09:52 +0600 Subject: [PATCH 2/3] Localisation fix --- locale/ubl-settings-usergroups_ru.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/ubl-settings-usergroups_ru.po b/locale/ubl-settings-usergroups_ru.po index 9f604e0..8d5947f 100644 --- a/locale/ubl-settings-usergroups_ru.po +++ b/locale/ubl-settings-usergroups_ru.po @@ -900,7 +900,7 @@ msgid "System users" msgstr "Системные пользователи" #: source/ubl-strings.h:239 source/ubl-strings.h:262 -msgid "System Groups" +msgid "System groups" msgstr "Системные Группы" #: source/ubl-strings.h:240 source/ubl-strings.h:249 From 7ccc8b2491d5ba202baac2b3c2255227b00b9e2b Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 21 Aug 2025 13:36:48 +0600 Subject: [PATCH 3/3] Fixed shutdown config checking --- source/ubl-settings-usergroups.c | 14 +++++++++++--- source/ubl-settings-usergroups.h | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 844901d..5483012 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -324,6 +324,12 @@ void yon_hide_passwords(template_saving_window *window){ char *new_value; gtk_tree_model_get(model,&iter,1,&name,2,&old_value,3,&new_value,-1); if (strstr(name,USERADD_SEARCH_macro)){ + if (!yon_char_is_empty(new_value)&&!yon_char_is_empty(old_value)&&strstr(new_value,old_value)){ + GtkTreeIter *iter_cur = gtk_tree_iter_copy(&iter); + gtk_list_store_remove(window->list,iter_cur); + gtk_tree_model_get_iter_first(model,&iter); + continue; + } char *old=NULL; char *newv=NULL; int size = 0; @@ -2283,7 +2289,7 @@ gboolean on_system_menu_open(GtkWidget *self,GdkEventButton *event, rmb_menu_win * [RU] * Функция настройки основного окна приложения. [widgets] - структура со стандартным интерфейсом. */ -main_window *yon_main_window_complete(main_window *widgets){ +template_main_window *yon_main_window_complete(main_window *widgets){ widgets = yon_remalloc(widgets,sizeof(main_window)); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path); gtk_box_pack_start(GTK_BOX(widgets->InterfaceBox),yon_gtk_builder_get_widget(builder,"PlugBox"),1,1,0); @@ -2423,7 +2429,7 @@ main_window *yon_main_window_complete(main_window *widgets){ yon_save_window_set_postsave_function(on_save_done,widgets); yon_save_window_set_postsave_failure_function(on_save_failed,widgets); -return widgets; +return (template_main_window*)widgets; } int main(int argc, char *argv[]){ @@ -2437,7 +2443,9 @@ int main(int argc, char *argv[]){ yon_ubl_setup_arguments(argc,argv,&unfound,&size,NULL); gtk_init(&argc,&argv); template_main_window *widgets = yon_ubl_window_setup(); - yon_main_window_complete((main_window*)widgets); + widgets = yon_main_window_complete((main_window*)widgets); + yon_window_remove_exit_config_check(widgets); + yon_window_set_exit_config_check(widgets,G_CALLBACK(yon_hide_passwords)); main_config.launch_arguments=yon_char_parsed_copy(argv,argc); main_config.launch_size=argc; gtk_main(); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index 02be420..afc4406 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -587,7 +587,7 @@ void on_selection_changed(GtkWidget *self, main_window *widgets); void on_notebook_page_changed(GtkWidget *self, GtkWidget *page, int num, main_window *widgets); gboolean on_menu_open(GtkWidget *self,GdkEventButton *event, rmb_menu_window *window); gboolean on_system_menu_open(GtkWidget *self,GdkEventButton *event, rmb_menu_window *window); -main_window *yon_main_window_complete(main_window *widgets); +template_main_window *yon_main_window_complete(main_window *widgets); void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *dict); system_remove_confirmation_window *yon_system_remove_confirmation_window_new(); void on_delete_system_user(GtkWidget *, dictionary *dict);