[libnma/lr/gtk-4.0: 4/23] all: destroy windows with gtk_window_destroy()
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libnma/lr/gtk-4.0: 4/23] all: destroy windows with gtk_window_destroy()
- Date: Mon, 25 Oct 2021 13:06:08 +0000 (UTC)
commit 7ba54e48afea99c4cd133560bf34c330fa1f25e9
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Thu Oct 14 09:57:33 2021 +0200
all: destroy windows with gtk_window_destroy()
In Gtk4, only the windows can be destroyed explicitly and they in turn
take care of their children. Let's use the Gtk4 API we provide a compat
shim for.
src/nma-cert-chooser-button.c | 8 +++++---
src/nma-mobile-wizard.c | 2 +-
src/nma-pkcs11-cert-chooser-dialog.c | 4 ++--
src/nma-wifi-dialog.c | 4 ++--
src/tests/vpn-password-dialog.c | 29 +++++++++++++----------------
src/tests/wifi-dialog-secrets.c | 9 +++------
src/tests/wifi-dialog.c | 7 ++-----
7 files changed, 28 insertions(+), 35 deletions(-)
---
diff --git a/src/nma-cert-chooser-button.c b/src/nma-cert-chooser-button.c
index 391c822c..e4d57773 100644
--- a/src/nma-cert-chooser-button.c
+++ b/src/nma-cert-chooser-button.c
@@ -3,10 +3,12 @@
*
* Lubomir Rintel <lkundrak v3 sk>
*
- * Copyright (C) 2016,2017 Red Hat, Inc.
+ * Copyright (C) 2016 - 2021 Red Hat, Inc.
*/
#include "nm-default.h"
+#include "nma-private.h"
+
#include "nma-cert-chooser-button.h"
#include "nma-pkcs11-cert-chooser-dialog.h"
#include "utils.h"
@@ -213,7 +215,7 @@ select_from_token (NMACertChooserButton *button, GckSlot *slot)
priv->remember_pin = nma_pkcs11_cert_chooser_dialog_get_remember_pin
(NMA_PKCS11_CERT_CHOOSER_DIALOG (dialog));
update_title (button);
}
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
@@ -253,7 +255,7 @@ select_from_file (NMACertChooserButton *button)
priv->remember_pin = FALSE;
update_title (button);
}
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
diff --git a/src/nma-mobile-wizard.c b/src/nma-mobile-wizard.c
index 64728230..3416f849 100644
--- a/src/nma-mobile-wizard.c
+++ b/src/nma-mobile-wizard.c
@@ -1563,5 +1563,5 @@ nma_mobile_wizard_destroy (NMAMobileWizard *self)
{
NMAMobileWizardPrivate *priv = NMA_MOBILE_WIZARD_GET_PRIVATE (self);
- gtk_widget_destroy (GTK_WIDGET (priv->assistant));
+ gtk_window_destroy (GTK_WINDOW (priv->assistant));
}
diff --git a/src/nma-pkcs11-cert-chooser-dialog.c b/src/nma-pkcs11-cert-chooser-dialog.c
index 128b72f9..f77a3886 100644
--- a/src/nma-pkcs11-cert-chooser-dialog.c
+++ b/src/nma-pkcs11-cert-chooser-dialog.c
@@ -3,7 +3,7 @@
*
* Lubomir Rintel <lkundrak v3 sk>
*
- * Copyright (C) 2016,2017 Red Hat, Inc.
+ * Copyright (C) 2016 - 2021 Red Hat, Inc.
*/
#include "nm-default.h"
@@ -349,7 +349,7 @@ login_clicked (GtkButton *button, gpointer user_data)
gck_slot_open_session_async (priv->slot, GCK_SESSION_READ_ONLY, NULL, session_opened, self);
}
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
diff --git a/src/nma-wifi-dialog.c b/src/nma-wifi-dialog.c
index 5c27c9b4..60f718f5 100644
--- a/src/nma-wifi-dialog.c
+++ b/src/nma-wifi-dialog.c
@@ -1343,7 +1343,7 @@ internal_new_dialog (NMClient *client,
if (!internal_init (self, connection, device, secrets_only, secrets_setting_name,
secrets_hints)) {
g_warning ("Couldn't create Wi-Fi security dialog.");
- gtk_widget_destroy (GTK_WIDGET (self));
+ gtk_window_destroy (GTK_WINDOW (self));
self = NULL;
}
}
@@ -1453,7 +1453,7 @@ internal_new_operation (NMClient *client,
if (!internal_init (self, NULL, NULL, FALSE, NULL, NULL)) {
g_warning ("Couldn't create Wi-Fi security dialog.");
- gtk_widget_destroy (GTK_WIDGET (self));
+ gtk_window_destroy (GTK_WINDOW (self));
return NULL;
}
diff --git a/src/tests/vpn-password-dialog.c b/src/tests/vpn-password-dialog.c
index 2a65b432..4cb0f521 100644
--- a/src/tests/vpn-password-dialog.c
+++ b/src/tests/vpn-password-dialog.c
@@ -1,9 +1,10 @@
// SPDX-License-Identifier: GPL-2.0+
/*
- * Copyright 2018 Red Hat, Inc.
+ * Copyright (C) 2018 - 2021 Red Hat, Inc.
*/
#include "nm-default.h"
+#include "nma-private.h"
#include <gtk/gtk.h>
#include "nma-vpn-password-dialog.h"
@@ -11,26 +12,22 @@
int
main (int argc, char *argv[])
{
- GtkWidget *widget;
+ GtkWidget *dialog;
-#if GTK_CHECK_VERSION(3,90,0)
gtk_init ();
-#else
- gtk_init (&argc, &argv);
-#endif
- widget = nma_vpn_password_dialog_new ("Title", "Message", "Password");
+ dialog = nma_vpn_password_dialog_new ("Title", "Message", "Password");
- nma_vpn_password_dialog_set_password (NMA_VPN_PASSWORD_DIALOG (widget), "Password One");
- nma_vpn_password_dialog_set_password_label (NMA_VPN_PASSWORD_DIALOG (widget), "First _Label");
+ nma_vpn_password_dialog_set_password (NMA_VPN_PASSWORD_DIALOG (dialog), "Password One");
+ nma_vpn_password_dialog_set_password_label (NMA_VPN_PASSWORD_DIALOG (dialog), "First _Label");
- nma_vpn_password_dialog_set_password_secondary (NMA_VPN_PASSWORD_DIALOG (widget), "");
- nma_vpn_password_dialog_set_password_secondary_label (NMA_VPN_PASSWORD_DIALOG (widget), "_Second
Label");
- nma_vpn_password_dialog_set_show_password_secondary (NMA_VPN_PASSWORD_DIALOG (widget), TRUE);
+ nma_vpn_password_dialog_set_password_secondary (NMA_VPN_PASSWORD_DIALOG (dialog), "");
+ nma_vpn_password_dialog_set_password_secondary_label (NMA_VPN_PASSWORD_DIALOG (dialog), "_Second
Label");
+ nma_vpn_password_dialog_set_show_password_secondary (NMA_VPN_PASSWORD_DIALOG (dialog), TRUE);
- nma_vpn_password_dialog_set_password_ternary_label (NMA_VPN_PASSWORD_DIALOG (widget), "_Third Label");
- nma_vpn_password_dialog_set_show_password_ternary (NMA_VPN_PASSWORD_DIALOG (widget), TRUE);
+ nma_vpn_password_dialog_set_password_ternary_label (NMA_VPN_PASSWORD_DIALOG (dialog), "_Third Label");
+ nma_vpn_password_dialog_set_show_password_ternary (NMA_VPN_PASSWORD_DIALOG (dialog), TRUE);
- nma_vpn_password_dialog_run_and_block (NMA_VPN_PASSWORD_DIALOG (widget));
- gtk_widget_destroy (widget);
+ nma_vpn_password_dialog_run_and_block (NMA_VPN_PASSWORD_DIALOG (dialog));
+ gtk_window_destroy (GTK_WINDOW (dialog));
}
diff --git a/src/tests/wifi-dialog-secrets.c b/src/tests/wifi-dialog-secrets.c
index f6d9ef95..2cf85c6b 100644
--- a/src/tests/wifi-dialog-secrets.c
+++ b/src/tests/wifi-dialog-secrets.c
@@ -1,9 +1,10 @@
// SPDX-License-Identifier: GPL-2.0+
/*
- * Copyright 2018 Red Hat, Inc.
+ * Copyright (C) 2018 - 2021 Red Hat, Inc.
*/
#include "nm-default.h"
+#include "nma-private.h"
#include <gtk/gtk.h>
#include <NetworkManager.h>
@@ -54,11 +55,7 @@ main (int argc, char *argv[])
NULL
};
-#if GTK_CHECK_VERSION(3,90,0)
gtk_init ();
-#else
- gtk_init (&argc, &argv);
-#endif
client = nm_client_new (NULL, NULL);
connection = nm_simple_connection_new ();
@@ -94,7 +91,7 @@ main (int argc, char *argv[])
hints);
g_signal_connect (dialog, "response", G_CALLBACK (response_cb), connection);
gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
g_object_unref (connection);
}
diff --git a/src/tests/wifi-dialog.c b/src/tests/wifi-dialog.c
index 1f8219ae..978908a1 100644
--- a/src/tests/wifi-dialog.c
+++ b/src/tests/wifi-dialog.c
@@ -4,6 +4,7 @@
*/
#include "nm-default.h"
+#include "nma-private.h"
#include <gtk/gtk.h>
#include "nma-wifi-dialog.h"
@@ -20,11 +21,7 @@ main (int argc, char *argv[])
GError *error = NULL;
gs_unref_bytes GBytes *ssid = g_bytes_new_static ("<Maj Vaj Faj>", 13);
-#if GTK_CHECK_VERSION(3,90,0)
gtk_init ();
-#else
- gtk_init (&argc, &argv);
-#endif
client = nm_client_new (NULL, NULL);
connection = nm_simple_connection_new ();
@@ -56,5 +53,5 @@ main (int argc, char *argv[])
dialog = nma_wifi_dialog_new (client, connection, device, ap, secrets_only);
gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]