From 39827e0e42090347b724f788100caad7a028a8f8 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 14 Jan 2025 17:37:53 +0600 Subject: [PATCH] Fixed update adter deleting user or group from system --- source/ubl-settings-usergroups-system.c | 17 +++++++++++++---- source/ubl-settings-usergroups.h | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/source/ubl-settings-usergroups-system.c b/source/ubl-settings-usergroups-system.c index 03e97e2..9bbe361 100644 --- a/source/ubl-settings-usergroups-system.c +++ b/source/ubl-settings-usergroups-system.c @@ -1,6 +1,8 @@ #include "ubl-settings-usergroups.h" -void on_delete_system_user(GtkWidget *, yon_confirmation_window *dialog){ +void on_delete_system_user(GtkWidget *, dictionary *dict){ + main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); + yon_confirmation_window *dialog = yon_dictionary_get_data(dict->first->next,yon_confirmation_window*); GtkTreeModel *model = GTK_TREE_MODEL(dialog->list); GtkTreeIter iter; char *command=NULL; @@ -15,9 +17,12 @@ void on_delete_system_user(GtkWidget *, yon_confirmation_window *dialog){ yon_launch(yon_debug_output("%s\n",command)); } on_subwindow_close(dialog->Window); + yon_system_load(widgets); } -void on_delete_system_group(GtkWidget *, yon_confirmation_window *dialog){ +void on_delete_system_group(GtkWidget *, dictionary *dict){ + main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); + yon_confirmation_window *dialog = yon_dictionary_get_data(dict->first->next,yon_confirmation_window*); GtkTreeModel *model = GTK_TREE_MODEL(dialog->list); GtkTreeIter iter; char *command=NULL; @@ -32,6 +37,7 @@ void on_delete_system_group(GtkWidget *, yon_confirmation_window *dialog){ yon_launch(yon_debug_output("%s\n",command)); } on_subwindow_close(dialog->Window); + yon_system_load(widgets); } void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *dict){ @@ -75,9 +81,12 @@ void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *d } } else { yon_confirmation_window *dialog = yon_delete_confirmation_new(); + dictionary *dact = NULL; + yon_dictionary_add_or_create_if_exists_with_data(dact,"widgets",widgets); + yon_dictionary_add_or_create_if_exists_with_data(dact,"dialog",dialog); gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window)); if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==2){ - g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_user),dialog); + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_user),dact); GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(widgets->SystemTree)); GtkTreeIter iter; if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemTree)),&model,&iter)){ @@ -94,7 +103,7 @@ void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *d if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemGroupsTree)),&model,&iter)){ yon_confirmation_window *dialog = yon_delete_confirmation_new(); gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window)); - g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_group),dialog); + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_group),dact); gtk_widget_show(window->AcceptButton); gtk_widget_hide(window->ConfigAcceptButton); gtk_widget_hide(window->SystemAcceptButton); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index b3c8478..8a45c00 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -505,6 +505,6 @@ gboolean on_menu_open(GtkWidget *self,GdkEventButton *event, rmb_menu_window *wi 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 *, yon_confirmation_window *dialog); -void on_delete_system_group(GtkWidget *, yon_confirmation_window *dialog); +void on_delete_system_user(GtkWidget *, dictionary *dict); +void on_delete_system_group(GtkWidget *, dictionary *dict); #endif \ No newline at end of file