summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGotam Gorabh <gautamy672@gmail.com>2023-02-27 01:10:13 +0530
committerFelipe Borges <felipeborges@gnome.org>2023-04-11 11:56:05 +0000
commitad063dfa550a504f85af13c9240fc3f037a2bed5 (patch)
treeaa829225e093c5f55dc5121346f540483bc20da3
parent27d5e7dd2634cf78b7caa4e436d27de905a523a2 (diff)
downloadgnome-control-center-ad063dfa550a504f85af13c9240fc3f037a2bed5.tar.gz
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.
-rw-r--r--panels/network/net-device-wifi.c35
1 files 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));