[network-manager-applet/lr/gtk4-part1: 6/6] xhacks



commit 8ac7c11c5e36a29df26310a1c34b93dca03e02d9
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Fri Feb 15 11:47:00 2019 +0100

    xhacks

 src/libnma/nma-file-cert-chooser.c     | 20 ++++++++++++-------
 src/libnma/nma-ui-utils.c              |  2 +-
 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 ++++
 8 files changed, 70 insertions(+), 8 deletions(-)
---
diff --git a/src/libnma/nma-file-cert-chooser.c b/src/libnma/nma-file-cert-chooser.c
index faf83a07..ecc0310f 100644
--- a/src/libnma/nma-file-cert-chooser.c
+++ b/src/libnma/nma-file-cert-chooser.c
@@ -32,6 +32,12 @@
 
 #define NMA_FILE_CERT_CHOOSER_GET_PRIVATE(self) (&(_NM_GET_PRIVATE (self, NMACertChooser, 
NMA_IS_CERT_CHOOSER)->_sub.file))
 
+#if GTK_CHECK_VERSION(3,90,0)
+#define gtk3_widget_set_no_show_all(widget, show)
+#else
+#define gtk3_widget_set_no_show_all(widget, show) gtk_widget_set_no_show_all (widget, show);
+#endif
+
 static void
 set_key_password (NMACertChooser *cert_chooser, const gchar *password)
 {
@@ -307,7 +313,7 @@ init (NMACertChooser *cert_chooser)
        gtk_widget_set_hexpand (priv->key_button, TRUE);
        gtk_widget_set_sensitive (priv->key_button, FALSE);
        gtk_widget_show (priv->key_button);
-       gtk_widget_set_no_show_all (priv->key_button, TRUE);
+       gtk3_widget_set_no_show_all (priv->key_button, TRUE);
 
        g_signal_connect (priv->key_button, "selection-changed",
                          G_CALLBACK (key_changed_cb), cert_chooser);
@@ -318,7 +324,7 @@ init (NMACertChooser *cert_chooser)
        gtk_grid_attach (GTK_GRID (cert_chooser), priv->key_button_label, 0, 0, 1, 1);
        gtk_widget_set_sensitive (priv->key_button_label, FALSE);
        gtk_widget_show (priv->key_button_label);
-       gtk_widget_set_no_show_all (priv->key_button_label, TRUE);
+       gtk3_widget_set_no_show_all (priv->key_button_label, TRUE);
 
        /* The key password entry */
        gtk_grid_insert_row (GTK_GRID (cert_chooser), 1);
@@ -329,7 +335,7 @@ init (NMACertChooser *cert_chooser)
        gtk_widget_set_hexpand (priv->key_password, TRUE);
        gtk_widget_set_sensitive (priv->key_password, FALSE);
        gtk_widget_show (priv->key_password);
-       gtk_widget_set_no_show_all (priv->key_password, TRUE);
+       gtk3_widget_set_no_show_all (priv->key_password, TRUE);
 
        g_signal_connect (priv->key_password, "changed",
                          G_CALLBACK (key_password_changed_cb), cert_chooser);
@@ -340,14 +346,14 @@ init (NMACertChooser *cert_chooser)
        gtk_grid_attach (GTK_GRID (cert_chooser), priv->key_password_label, 0, 1, 1, 1);
        gtk_widget_set_sensitive (priv->key_password_label, FALSE);
        gtk_widget_show (priv->key_password_label);
-       gtk_widget_set_no_show_all (priv->key_password_label, TRUE);
+       gtk3_widget_set_no_show_all (priv->key_password_label, TRUE);
 
        /* Show password */
        gtk_grid_insert_row (GTK_GRID (cert_chooser), 2);
        priv->show_password = gtk_check_button_new_with_mnemonic _("Sho_w password");
        gtk_grid_attach (GTK_GRID (cert_chooser), priv->show_password, 1, 2, 1, 1);
        gtk_widget_show (priv->show_password);
-       gtk_widget_set_no_show_all (priv->show_password, TRUE);
+       gtk3_widget_set_no_show_all (priv->show_password, TRUE);
        g_signal_connect (priv->show_password, "toggled",
                          G_CALLBACK (show_toggled_cb), cert_chooser);
 
@@ -363,7 +369,7 @@ init (NMACertChooser *cert_chooser)
        gtk_grid_attach (GTK_GRID (cert_chooser), priv->cert_button, 1, 0, 1, 1);
        gtk_widget_set_hexpand (priv->cert_button, TRUE);
        gtk_widget_show (priv->cert_button);
-       gtk_widget_set_no_show_all (priv->cert_button, TRUE);
+       gtk3_widget_set_no_show_all (priv->cert_button, TRUE);
 
        /* For some reason, GTK+ calls set_current_filter (..., NULL) from
         * gtkfilechooserdefault.c::show_and_select_files_finished_loading() on our
@@ -381,7 +387,7 @@ init (NMACertChooser *cert_chooser)
        gtk_label_set_mnemonic_widget (GTK_LABEL (priv->cert_button_label), priv->cert_button);
        gtk_grid_attach (GTK_GRID (cert_chooser), priv->cert_button_label, 0, 0, 1, 1);
        gtk_widget_show (priv->cert_button_label);
-       gtk_widget_set_no_show_all (priv->cert_button_label, TRUE);
+       gtk3_widget_set_no_show_all (priv->cert_button_label, TRUE);
 }
 
 const NMACertChooserVtable nma_cert_chooser_vtable_file = {
diff --git a/src/libnma/nma-ui-utils.c b/src/libnma/nma-ui-utils.c
index 73877b3b..9316d057 100644
--- a/src/libnma/nma-ui-utils.c
+++ b/src/libnma/nma-ui-utils.c
@@ -228,7 +228,7 @@ icon_release_cb (GtkEntry *entry,
                  gpointer data)
 {
        GtkMenu *menu = GTK_MENU (data);
-       GdkRectangle icon_area;
+       //GdkRectangle icon_area;
 
        if (position == GTK_ENTRY_ICON_SECONDARY) {
                gtk_widget_show (GTK_WIDGET (data));
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]