[network-manager-applet/lr/gtk4: 7/9] nma/tests: add GTK4 support
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/lr/gtk4: 7/9] nma/tests: add GTK4 support
- Date: Mon, 18 Feb 2019 14:33:53 +0000 (UTC)
commit ae0c0fe5fec9dac73f464f5631888ca43b3ab44f
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Fri Feb 15 11:47:00 2019 +0100
nma/tests: add GTK4 support
Just paint over the differencies with a few ifdefs.
src/libnma/tests/cert-chooser.c | 35 ++++++++++++++++++++++++++++++++++
src/libnma/tests/mobile-wizard.c | 4 ++++
src/libnma/tests/run-vpn.c | 5 +++++
src/libnma/tests/vpn-password-dialog.c | 4 ++++
src/libnma/tests/wifi-dialog-secrets.c | 4 ++++
src/libnma/tests/wifi-dialog.c | 4 ++++
6 files changed, 56 insertions(+)
---
diff --git a/src/libnma/tests/cert-chooser.c b/src/libnma/tests/cert-chooser.c
index 9ba22ded..569af5b9 100644
--- a/src/libnma/tests/cert-chooser.c
+++ b/src/libnma/tests/cert-chooser.c
@@ -28,21 +28,36 @@ main (int argc, char *argv[])
GtkBox *content;
GtkWidget *widget;
+#if GTK_CHECK_VERSION(3,90,0)
+ gtk_init ();
+#else
gtk_init (&argc, &argv);
+#endif
dialog = gtk_dialog_new_with_buttons ("NMACertChooser test",
NULL, GTK_DIALOG_MODAL,
"Dismiss", GTK_RESPONSE_DELETE_EVENT,
NULL);
content = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
+#if GTK_CHECK_VERSION(3,90,0)
+ gtk_box_set_spacing (content, 6);
+#endif
widget = nma_cert_chooser_new ("Any", 0);
gtk_widget_show (widget);
+#if GTK_CHECK_VERSION(3,90,0)
+ gtk_box_pack_start (content, widget);
+#else
gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+#endif
widget = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_show (widget);
+#if GTK_CHECK_VERSION(3,90,0)
+ gtk_box_pack_start (content, widget);
+#else
gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+#endif
widget = nma_cert_chooser_new ("FLAG_PASSWORDS", NMA_CERT_CHOOSER_FLAG_PASSWORDS);
nma_cert_chooser_set_cert (NMA_CERT_CHOOSER (widget),
@@ -51,23 +66,43 @@ main (int argc, char *argv[])
nma_cert_chooser_set_key_uri (NMA_CERT_CHOOSER (widget),
"pkcs11:object=worship;type=doom");
gtk_widget_show (widget);
+#if GTK_CHECK_VERSION(3,90,0)
+ gtk_box_pack_start (content, widget);
+#else
gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+#endif
widget = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_show (widget);
+#if GTK_CHECK_VERSION(3,90,0)
+ gtk_box_pack_start (content, widget);
+#else
gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+#endif
widget = nma_cert_chooser_new ("FLAG_CERT", NMA_CERT_CHOOSER_FLAG_CERT);
gtk_widget_show (widget);
+#if GTK_CHECK_VERSION(3,90,0)
+ gtk_box_pack_start (content, widget);
+#else
gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+#endif
widget = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_show (widget);
+#if GTK_CHECK_VERSION(3,90,0)
+ gtk_box_pack_start (content, widget);
+#else
gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+#endif
widget = nma_cert_chooser_new ("FLAG_PEM", NMA_CERT_CHOOSER_FLAG_PEM);
gtk_widget_show (widget);
+#if GTK_CHECK_VERSION(3,90,0)
+ gtk_box_pack_start (content, widget);
+#else
gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+#endif
gtk_dialog_run (GTK_DIALOG (dialog));
}
diff --git a/src/libnma/tests/mobile-wizard.c b/src/libnma/tests/mobile-wizard.c
index 52a4ffb0..d73bf105 100644
--- a/src/libnma/tests/mobile-wizard.c
+++ b/src/libnma/tests/mobile-wizard.c
@@ -32,7 +32,11 @@ main (int argc, char *argv[])
{
NMAMobileWizard *wizard;
+#if GTK_CHECK_VERSION(3,90,0)
+ gtk_init ();
+#else
gtk_init (&argc, &argv);
+#endif
wizard = nma_mobile_wizard_new (NULL, NULL, NM_DEVICE_MODEM_CAPABILITY_NONE, TRUE, wizard_cb, NULL);
diff --git a/src/libnma/tests/run-vpn.c b/src/libnma/tests/run-vpn.c
index ca936ab2..2f281cf0 100644
--- a/src/libnma/tests/run-vpn.c
+++ b/src/libnma/tests/run-vpn.c
@@ -46,7 +46,12 @@ main (int argc, char *argv[])
GtkWidget *widget;
gs_free_error GError *error = NULL;
+#if GTK_CHECK_VERSION(3,90,0)
+ gtk_init ();
+#else
gtk_init (&argc, &argv);
+#endif
+
if (argc != 2) {
g_printerr ("Usage: %s libnm-vpn-plugin-<name>.so\n", argv[0]);
return EXIT_FAILURE;
diff --git a/src/libnma/tests/vpn-password-dialog.c b/src/libnma/tests/vpn-password-dialog.c
index d3e58175..f117dba4 100644
--- a/src/libnma/tests/vpn-password-dialog.c
+++ b/src/libnma/tests/vpn-password-dialog.c
@@ -26,7 +26,11 @@ main (int argc, char *argv[])
{
GtkWidget *widget;
+#if GTK_CHECK_VERSION(3,90,0)
+ gtk_init ();
+#else
gtk_init (&argc, &argv);
+#endif
widget = nma_vpn_password_dialog_new ("Title", "Message", "Password");
diff --git a/src/libnma/tests/wifi-dialog-secrets.c b/src/libnma/tests/wifi-dialog-secrets.c
index cd528599..4b4e0caa 100644
--- a/src/libnma/tests/wifi-dialog-secrets.c
+++ b/src/libnma/tests/wifi-dialog-secrets.c
@@ -67,7 +67,11 @@ 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 ();
diff --git a/src/libnma/tests/wifi-dialog.c b/src/libnma/tests/wifi-dialog.c
index 8763b59f..f7cb3fc7 100644
--- a/src/libnma/tests/wifi-dialog.c
+++ b/src/libnma/tests/wifi-dialog.c
@@ -33,7 +33,11 @@ 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 ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]