From f726a0531eb5434e8b2113cfbbef260cad15ec7f Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 29 Apr 2025 12:37:12 +0600 Subject: [PATCH] Dialog window changes --- source/ubl-settings-usergroups-group.c | 36 ++++++++++++++++++++++++++ source/ubl-settings-usergroups-user.c | 32 +++++++++++------------ source/ubl-settings-usergroups.h | 2 ++ 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/source/ubl-settings-usergroups-group.c b/source/ubl-settings-usergroups-group.c index fb4ff76..5f6a2da 100644 --- a/source/ubl-settings-usergroups-group.c +++ b/source/ubl-settings-usergroups-group.c @@ -219,10 +219,45 @@ void on_group_save(GtkWidget *self, dictionary *dict){ on_subwindow_close(self); } +void on_group_delete_toggled(GtkWidget *,gchar* path,yon_confirmation_window *window){ + int found=0; + GtkTreeModel *model = GTK_TREE_MODEL(window->list); + GtkTreeIter iter; + char *target; + gtk_tree_model_get_iter_from_string(model,&iter,path); + gtk_tree_model_get(model,&iter,1,&target,-1); + char *parameter = config(GROUPADD(target)); + int size; + config_str parsed = yon_char_parse(parameter,&size,":"); + int users_size; + config_str users = yon_config_get_all_by_key(USERADD_SEARCH_macro,&users_size); + for (int i=0;iStatusBox),"group_occupied","",BACKGROUND_IMAGE_INFO_TYPE); + } + +} void yon_group_delete_confirmation_open(main_window *widgets){ yon_confirmation_window *window = yon_delete_confirmation_new(); gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window)); + // g_signal_connect(G_OBJECT(window->DeleteCell),"toggled",G_CALLBACK(on_group_delete_toggled),window); GtkTreeIter iter,itar; dictionary *dict = NULL; gtk_label_set_text(GTK_LABEL(window->TitleLabel),DELETE_GROUP_CONFIRMATION_CONFIRM_LABEL); @@ -250,6 +285,7 @@ void yon_group_delete_confirmation_open(main_window *widgets){ gtk_tree_model_get(GTK_TREE_MODEL(widgets->GroupsList),&iter,1,&name,-1); gtk_list_store_append(window->list,&itar); gtk_list_store_set(window->list,&itar,0,yon_char_parsed_check_exist(chosen,chosen_size,name)>-1?1:0,1,name,-1); + free(name); } gtk_widget_show(window->Window); diff --git a/source/ubl-settings-usergroups-user.c b/source/ubl-settings-usergroups-user.c index 3378695..fdaa763 100644 --- a/source/ubl-settings-usergroups-user.c +++ b/source/ubl-settings-usergroups-user.c @@ -591,17 +591,17 @@ void on_user_sync_with_config(GtkWidget *,main_window *widgets){ if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemTree)),&model,&iter)){ char *target; gtk_tree_model_get(model,&iter,2,&target,-1); - dialog_confirmation_data data; + dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); if (config(USERADD(target))){ - data.action_text = SYSTEM_USER_SYNC_CONFIRMATION_LABEL(target); - data.data=NULL; - data.function=NULL; + data->action_text = SYSTEM_USER_SYNC_CONFIRMATION_LABEL(target); + data->data=NULL; + data->function=NULL; } else { - data.action_text = SYSTEM_USER_ADD_CONFIRMATION_LABEL(target); - data.data=NULL; - data.function=NULL; + data->action_text = SYSTEM_USER_ADD_CONFIRMATION_LABEL(target); + data->data=NULL; + data->function=NULL; } - if (yon_confirmation_dialog_call(widgets->Window,&data)!=GTK_RESPONSE_ACCEPT){ + if (yon_confirmation_dialog_call(widgets->Window,data)!=GTK_RESPONSE_ACCEPT){ return; } @@ -647,17 +647,17 @@ void on_user_sync_with_config(GtkWidget *,main_window *widgets){ char *target; gtk_tree_model_get(model,&iter,1,&target,-1); - dialog_confirmation_data data; + dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); if (config(GROUPADD(target))){ - data.action_text = SYSTEM_GROUP_ADD_CONFIRMATION_LABEL(target); - data.data=NULL; - data.function=NULL; + data->action_text = SYSTEM_GROUP_ADD_CONFIRMATION_LABEL(target); + data->data=NULL; + data->function=NULL; } else { - data.action_text = SYSTEM_GROUP_SYNC_CONFIRMATION_LABEL(target); - data.data=NULL; - data.function=NULL; + data->action_text = SYSTEM_GROUP_SYNC_CONFIRMATION_LABEL(target); + data->data=NULL; + data->function=NULL; } - if (yon_confirmation_dialog_call(widgets->Window,&data)!=GTK_RESPONSE_ACCEPT){ + if (yon_confirmation_dialog_call(widgets->Window,data)!=GTK_RESPONSE_ACCEPT){ return; } char *group = yon_char_parsed_check_exist_begins_with(main_config.groups,main_config.groups_size,target); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index c2bc9f2..f58c439 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -67,6 +67,7 @@ #define uid_path "/etc/login.defs" #define password_limits_path "/etc/security/pwquiality.conf" #define get_user_info_command(target) yon_char_unite("getent passwd \"",target,"\"",NULL) +#define get_group_info_command(target) yon_char_unite("getent group \"",target,"\"",NULL) #define get_home_command(target) yon_char_unite("getent passwd \"",target,"\" | cut -d: -f6",NULL) #define remove_home_dirs_command(users_string) yon_char_append("/usr/lib/ublinux/functions remove_userhome ", users_string) #define default_home_initiator_path "/etc/default/useradd" @@ -564,4 +565,5 @@ void on_adiitional_settings_tree_selection_changed(GtkWidget *self, ubl_settings void on_useradd_sync_changed(ubl_settings_usergroups_additional_settings_window *window); void yon_gtk_login_block_symbols(GtkEntry *target); void on_login_insert_custom_restricted_check(GtkEditable *editable, const gchar *text, gint length, gint *position); +void on_group_delete_toggled(GtkWidget *,gchar* path,yon_confirmation_window *window); #endif \ No newline at end of file