From ad063dfa550a504f85af13c9240fc3f037a2bed5 Mon Sep 17 00:00:00 2001 From: Gotam Gorabh Date: Mon, 27 Feb 2023 01:10:13 +0530 Subject: wi-fi:Updated Forget Connection dialog of saved networks with AdwMessageDialog This changes update the Forget Connection dialog of saved networks using AdwMessageDialog instead of GtkMessageDialog. And set Cancel as a default responce instead of Forget to overcome accidental forget. --- panels/network/net-device-wifi.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c index 74004e5db..92927ecb3 100644 --- a/panels/network/net-device-wifi.c +++ b/panels/network/net-device-wifi.c @@ -820,7 +820,9 @@ really_forgotten (GObject *source_object, } static void -really_forget (GtkDialog *dialog, gint response, gpointer data) +really_forget (AdwMessageDialog* dialog, + gchar* response, + gpointer data) { GtkWidget *forget = data; CcWifiConnectionRow *row; @@ -829,9 +831,7 @@ really_forget (GtkDialog *dialog, gint response, gpointer data) NMRemoteConnection *connection; NetDeviceWifi *self; - gtk_window_destroy (GTK_WINDOW (dialog)); - - if (response != GTK_RESPONSE_OK) + if (g_strcmp0 (response, "cancel") == 0) return; self = NET_DEVICE_WIFI (g_object_get_data (G_OBJECT (forget), "net")); @@ -852,18 +852,21 @@ forget_selected (GtkButton *forget, CcWifiConnectionList *list) GtkWidget *dialog; native = gtk_widget_get_native (GTK_WIDGET (forget)); - dialog = gtk_message_dialog_new (GTK_WINDOW (native), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_OTHER, - GTK_BUTTONS_NONE, - NULL); - gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), - _("Network details for the selected networks, including passwords and any custom configuration will be lost.")); - - gtk_dialog_add_buttons (GTK_DIALOG (dialog), - _("_Cancel"), GTK_RESPONSE_CANCEL, - _("_Forget"), GTK_RESPONSE_OK, - NULL); + + dialog = adw_message_dialog_new (GTK_WINDOW (native), + NULL, + _("Network details for the selected networks, including passwords and any custom configuration will be lost.")); + + adw_message_dialog_format_heading (ADW_MESSAGE_DIALOG (dialog), _("Forget Connection?")); + + adw_message_dialog_add_responses (ADW_MESSAGE_DIALOG (dialog), + "cancel", _("_Cancel"), + "forget", _("_Forget"), + NULL); + + adw_message_dialog_set_response_appearance (ADW_MESSAGE_DIALOG (dialog), "forget", ADW_RESPONSE_DESTRUCTIVE); + adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG (dialog), "cancel"); + g_signal_connect (dialog, "response", G_CALLBACK (really_forget), list); gtk_window_present (GTK_WINDOW (dialog)); -- cgit v1.2.1