From 11de5957071524b03bf422d516723f458d329c44 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 17 Jan 2025 12:47:37 +0600 Subject: [PATCH] Confirmation windows rename --- source/ubl-settings-usergroups-system.c | 2 +- source/ubl-settings-usergroups.c | 56 ++++++++++--------------- 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/source/ubl-settings-usergroups-system.c b/source/ubl-settings-usergroups-system.c index 7f7ff2c..06f59c4 100644 --- a/source/ubl-settings-usergroups-system.c +++ b/source/ubl-settings-usergroups-system.c @@ -75,7 +75,7 @@ void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *d } gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->MainNotebook),0); yon_delete_confirmation_open(widgets); - } else { + } else if (self == window->AcceptButton || self == window->SystemAcceptButton) { GtkTreeIter iter, itar; GtkTreeModel *model; char *target; diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index c373ca9..99d1f0b 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -2169,9 +2169,6 @@ void on_main_edit_activate(GtkWidget *self, GtkTreePath *, GtkTreeViewColumn *, } void on_main_delete(GtkWidget *, main_window *widgets){ - dialog_confirmation_data *data=malloc(sizeof(dialog_confirmation_data)); - data->function=NULL; - data->data=NULL; int active = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook)); switch(active){ case 0: @@ -2187,30 +2184,25 @@ void on_main_delete(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); - if (config(USERADD(target))){ system_remove_confirmation_window *window = yon_system_remove_confirmation_window_new(); - yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),DELETE_CONFIRMATION_TITLE_LABEL,icon_path,"user-deletion-window"); - gtk_label_set_markup(GTK_LABEL(window->HeaderLabel),DELETE_CONFIRMATION_TITLE_LABEL); - gtk_label_set_markup(GTK_LABEL(window->TitleLabel),SYSTEM_USER_CONFIG_REMOVE_CONFIRMATION_LABEL(target)); dictionary *dict = NULL; yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); + if (config(USERADD(target))){ + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),DELETE_CONFIRMATION_TITLE_LABEL,icon_path,"user-deletion-window"); + gtk_label_set_markup(GTK_LABEL(window->HeaderLabel),DELETE_CONFIRMATION_TITLE_LABEL); + gtk_label_set_markup(GTK_LABEL(window->TitleLabel),SYSTEM_USER_CONFIG_REMOVE_CONFIRMATION_LABEL(target)); g_signal_connect(G_OBJECT(window->ConfigAcceptButton),"clicked",G_CALLBACK(yon_remove_confirmation_window_accept_clicked),dict); g_signal_connect(G_OBJECT(window->SystemAcceptButton),"clicked",G_CALLBACK(yon_remove_confirmation_window_accept_clicked),dict); - gtk_widget_show(window->Window); } else { - dialog_confirmation_data data; - data.action_text = SYSTEM_USER_SYSTEM_REMOVE_CONFIRMATION_LABEL(target); - data.function=NULL; - data.data=NULL; - template_app_information.app_title = DELETE_CONFIRMATION_TITLE_LABEL; - - if (yon_confirmation_dialog_call(widgets->Window,&data)!=GTK_RESPONSE_ACCEPT){ - return; - } - template_app_information.app_title = TITLE_LABEL; - yon_system_delete_confirmation_open(widgets); + gtk_label_set_markup(GTK_LABEL(window->HeaderLabel),DELETE_CONFIRMATION_TITLE_LABEL); + gtk_label_set_markup(GTK_LABEL(window->TitleLabel),SYSTEM_USER_SYSTEM_REMOVE_CONFIRMATION_LABEL(target)); + gtk_widget_show(window->AcceptButton); + gtk_widget_hide(window->ConfigAcceptButton); + gtk_widget_hide(window->SystemAcceptButton); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(yon_remove_confirmation_window_accept_clicked),dict); } + gtk_widget_show(window->Window); } }break; case 3:{ @@ -2219,30 +2211,24 @@ void on_main_delete(GtkWidget *, main_window *widgets){ if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemGroupsTree)),&model,&iter)){ char *target; gtk_tree_model_get(model,&iter,1,&target,-1); - if (config(GROUPADD(target))){ system_remove_confirmation_window *window = yon_system_remove_confirmation_window_new(); - yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),DELETE_CONFIRMATION_TITLE_LABEL,icon_path,"group-deletion-window"); - gtk_label_set_markup(GTK_LABEL(window->HeaderLabel),DELETE_GROUP_CONFIRMATION_TITLE_LABEL); - gtk_label_set_markup(GTK_LABEL(window->TitleLabel),SYSTEM_GROUP_CONFIG_REMOVE_CONFIRMATION_LABEL(target)); dictionary *dict = NULL; yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); + gtk_label_set_markup(GTK_LABEL(window->HeaderLabel),DELETE_GROUP_CONFIRMATION_TITLE_LABEL); + if (config(GROUPADD(target))){ + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),DELETE_GROUP_CONFIRMATION_TITLE_LABEL,icon_path,"user-deletion-window"); + gtk_label_set_markup(GTK_LABEL(window->TitleLabel),SYSTEM_GROUP_CONFIG_REMOVE_CONFIRMATION_LABEL(target)); g_signal_connect(G_OBJECT(window->ConfigAcceptButton),"clicked",G_CALLBACK(yon_remove_confirmation_window_accept_clicked),dict); g_signal_connect(G_OBJECT(window->SystemAcceptButton),"clicked",G_CALLBACK(yon_remove_confirmation_window_accept_clicked),dict); - gtk_widget_show(window->Window); } else { - dialog_confirmation_data data; - template_app_information.app_title = DELETE_GROUP_CONFIRMATION_TITLE_LABEL; - data.action_text = SYSTEM_GROUP_SYSTEM_REMOVE_CONFIRMATION_LABEL(target); - data.function=NULL; - data.data=NULL; - - if (yon_confirmation_dialog_call(widgets->Window,&data)!=GTK_RESPONSE_ACCEPT){ - return; - } - template_app_information.app_title = TITLE_LABEL; - yon_system_delete_confirmation_open(widgets); + gtk_label_set_markup(GTK_LABEL(window->TitleLabel),SYSTEM_GROUP_SYSTEM_REMOVE_CONFIRMATION_LABEL(target)); + gtk_widget_show(window->AcceptButton); + gtk_widget_hide(window->ConfigAcceptButton); + gtk_widget_hide(window->SystemAcceptButton); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(yon_remove_confirmation_window_accept_clicked),dict); } + gtk_widget_show(window->Window); } }break; }