[network-manager-applet] all: drop some more libnm-glib vestiges



commit 0b58efdd2e5aab68843cd354d921580bc3b5b514
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Fri Nov 29 09:16:42 2019 +0100

    all: drop some more libnm-glib vestiges
    
    [thaller redhat com: cherry-picked this patch from a larger
      merge request and trivial conflict resolution]
    
    https://gitlab.gnome.org/GNOME/network-manager-applet/merge_requests/73

 shared/nm-default.h                     | 19 +------------------
 src/utils/utils.c                       | 14 ++------------
 src/utils/utils.h                       |  8 --------
 src/wireless-security/eap-method-peap.c | 13 -------------
 src/wireless-security/eap-method-tls.c  | 20 --------------------
 src/wireless-security/eap-method-ttls.c | 15 ---------------
 src/wireless-security/eap-method.c      |  6 ------
 src/wireless-security/eap-method.h      | 14 --------------
 8 files changed, 3 insertions(+), 106 deletions(-)
---
diff --git a/shared/nm-default.h b/shared/nm-default.h
index bb510210..39d8188e 100644
--- a/shared/nm-default.h
+++ b/shared/nm-default.h
@@ -25,7 +25,6 @@
  * Depending on which parts are compiled, different values are set. */
 #define NM_NETWORKMANAGER_COMPILATION_DEFAULT             0x0001
 #define NM_NETWORKMANAGER_COMPILATION_LIB                 0x0002
-#define NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY          0x0004
 
 #ifndef NETWORKMANAGER_COMPILATION
 /* For convenience, we don't require our Makefile.am to define
@@ -52,30 +51,14 @@
 
 #include <gtk/gtk.h>
 
-/*****************************************************************************/
-
-#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY)
-#define LIBNM_BUILD 1
-#else
-#define LIBNM_BUILD 0
-#endif
-
-
-#if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_LIB) || ((NETWORKMANAGER_COMPILATION) & 
NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY)
+#if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_LIB)
 #include <glib/gi18n-lib.h>
 #else
 #include <glib/gi18n.h>
 #endif
 
-
-#if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY)
-#include <nm-connection.h>
-#else
 #include <NetworkManager.h>
-#endif /* NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY */
 
 #include "nm-libnm-compat.h"
 
-/*****************************************************************************/
-
 #endif /* __NM_DEFAULT_H__ */
diff --git a/src/utils/utils.c b/src/utils/utils.c
index 3a6f07e0..c33c7bcd 100644
--- a/src/utils/utils.c
+++ b/src/utils/utils.c
@@ -54,12 +54,7 @@ utils_ether_addr_valid (const struct ether_addr *test_addr)
 }
 
 char *
-utils_hash_ap (
-#if LIBNM_BUILD
-               GBytes *ssid,
-#else
-               const GByteArray *ssid,
-#endif
+utils_hash_ap (GBytes *ssid,
                NM80211Mode mode,
                guint32 flags,
                guint32 wpa_flags,
@@ -69,13 +64,8 @@ utils_hash_ap (
 
        memset (&input[0], 0, sizeof (input));
 
-       if (ssid) {
-#if LIBNM_BUILD
+       if (ssid)
                memcpy (input, g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid));
-#else
-               memcpy (input, ssid->data, ssid->len);
-#endif
-       }
 
        if (mode == NM_802_11_MODE_INFRA)
                input[32] |= (1 << 0);
diff --git a/src/utils/utils.h b/src/utils/utils.h
index d57f3a15..3192ea45 100644
--- a/src/utils/utils.h
+++ b/src/utils/utils.h
@@ -13,19 +13,11 @@
 
 gboolean utils_ether_addr_valid (const struct ether_addr *test_addr);
 
-#if LIBNM_BUILD
 char *utils_hash_ap (GBytes *ssid,
                      NM80211Mode mode,
                      guint32 flags,
                      guint32 wpa_flags,
                      guint32 rsn_flags);
-#else
-char *utils_hash_ap (const GByteArray *ssid,
-                     NM80211Mode mode,
-                     guint32 flags,
-                     guint32 wpa_flags,
-                     guint32 rsn_flags);
-#endif
 
 char *utils_escape_notify_message (const char *src);
 
diff --git a/src/wireless-security/eap-method-peap.c b/src/wireless-security/eap-method-peap.c
index 4c765dbc..8b51f11b 100644
--- a/src/wireless-security/eap-method-peap.c
+++ b/src/wireless-security/eap-method-peap.c
@@ -131,9 +131,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
        GError *error = NULL;
        gboolean ca_cert_error = FALSE;
        NMSetting8021xCKScheme scheme = NM_SETTING_802_1X_CK_SCHEME_UNKNOWN;
-#if LIBNM_BUILD
        NMSettingSecretFlags secret_flags;
-#endif
 
        s_8021x = nm_connection_get_setting_802_1x (connection);
        g_assert (s_8021x);
@@ -146,16 +144,12 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
        if (text && strlen (text))
                g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, text, NULL);
 
-#if LIBNM_BUILD
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_domain_entry"));
        g_assert (widget);
        text = gtk_entry_get_text (GTK_ENTRY (widget));
        if (text && strlen (text))
                g_object_set (s_8021x, NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH, text, NULL);
-#endif
 
-#if LIBNM_BUILD
-/* libnm-glib doesn't support this. */
        /* Save CA certificate PIN and its flags to the connection */
        secret_flags = nma_cert_chooser_get_cert_password_flags (NMA_CERT_CHOOSER (method->ca_cert_chooser));
        nm_setting_set_secret_flags (NM_SETTING (s_8021x), NM_SETTING_802_1X_CA_CERT_PASSWORD,
@@ -169,7 +163,6 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
                              nma_cert_chooser_get_cert_password (NMA_CERT_CHOOSER (method->ca_cert_chooser)),
                              NULL);
        }
-#endif
 
        /* TLS CA certificate */
        if (gtk_widget_get_sensitive (method->ca_cert_chooser))
@@ -461,17 +454,11 @@ eap_method_peap_new (WirelessSecurity *ws_parent,
                          ws_parent);
 
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_domain_entry"));
-#if LIBNM_BUILD
        if (s_8021x && nm_setting_802_1x_get_domain_suffix_match (s_8021x))
                gtk_entry_set_text (GTK_ENTRY (widget), nm_setting_802_1x_get_domain_suffix_match (s_8021x));
        g_signal_connect (G_OBJECT (widget), "changed",
                          (GCallback) wireless_security_changed_cb,
                          ws_parent);
-#else
-       gtk_widget_hide (widget);
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_domain_label"));
-       gtk_widget_hide (widget);
-#endif
 
        if (secrets_only) {
                widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, 
"eap_peap_anon_identity_label"));
diff --git a/src/wireless-security/eap-method-tls.c b/src/wireless-security/eap-method-tls.c
index 12374e87..bd8b57a8 100644
--- a/src/wireless-security/eap-method-tls.c
+++ b/src/wireless-security/eap-method-tls.c
@@ -22,11 +22,8 @@
 struct _EAPMethodTLS {
        EAPMethod parent;
 
-#if LIBNM_BUILD
-/* libnm-glib doesn't support these. */
        const char *ca_cert_password_flags_name;
        const char *client_cert_password_flags_name;
-#endif
        const char *client_key_password_flags_name;
 
        gboolean editing_connection;
@@ -116,13 +113,11 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
        g_assert (widget);
        g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_entry_get_text (GTK_ENTRY (widget)), NULL);
 
-#if LIBNM_BUILD
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_domain_entry"));
        g_assert (widget);
        g_object_set (s_8021x,
                      parent->phase2 ? NM_SETTING_802_1X_PHASE2_DOMAIN_SUFFIX_MATCH : 
NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH,
                      gtk_entry_get_text (GTK_ENTRY (widget)), NULL);
-#endif
 
        /* TLS private key */
        password = nma_cert_chooser_get_key_password (NMA_CERT_CHOOSER (method->client_cert_chooser));
@@ -141,8 +136,6 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
        }
        g_free (value);
 
-#if LIBNM_BUILD
-/* libnm-glib doesn't support these. */
        /* Save CA certificate PIN and its flags to the connection */
        secret_flags = nma_cert_chooser_get_cert_password_flags (NMA_CERT_CHOOSER (method->ca_cert_chooser));
        nm_setting_set_secret_flags (NM_SETTING (s_8021x), method->ca_cert_password_flags_name,
@@ -169,7 +162,6 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
                              nma_cert_chooser_get_cert_password (NMA_CERT_CHOOSER 
(method->client_cert_chooser)),
                              NULL);
        }
-#endif
 
        /* Save user private key password flags to the connection */
        secret_flags = nma_cert_chooser_get_key_password_flags (NMA_CERT_CHOOSER 
(method->client_cert_chooser));
@@ -366,15 +358,12 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
                return NULL;
 
        method = (EAPMethodTLS *) parent;
-#if LIBNM_BUILD
-/* libnm-glib doesn't support these. */
        method->ca_cert_password_flags_name = phase2
                                              ? NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD
                                              : NM_SETTING_802_1X_CA_CERT_PASSWORD;
        method->client_cert_password_flags_name = phase2
                                                  ? NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD
                                                  : NM_SETTING_802_1X_CLIENT_CERT_PASSWORD;
-#endif
        method->client_key_password_flags_name = phase2
                                                 ? NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD
                                                 : NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD;
@@ -402,7 +391,6 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
 
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_domain_entry"));
        g_assert (widget);
-#if LIBNM_BUILD
        g_signal_connect (G_OBJECT (widget), "changed",
                          (GCallback) wireless_security_changed_cb,
                          ws_parent);
@@ -413,11 +401,6 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
                if (s_8021x && nm_setting_802_1x_get_domain_suffix_match (s_8021x))
                        gtk_entry_set_text (GTK_ENTRY (widget), nm_setting_802_1x_get_domain_suffix_match 
(s_8021x));
        }
-#else
-       gtk_widget_hide (widget);
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_domain_label"));
-       gtk_widget_hide (widget);
-#endif
 
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_grid"));
        g_assert (widget);
@@ -500,15 +483,12 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), ca_not_required);
 
        /* Create password-storage popup menus for password entries under their secondary icon */
-#if LIBNM_BUILD
-/* libnm-glib doesn't support these. */
        nma_cert_chooser_setup_cert_password_storage (NMA_CERT_CHOOSER (method->ca_cert_chooser),
                                                      0, (NMSetting *) s_8021x, 
method->ca_cert_password_flags_name,
                                                      FALSE, secrets_only);
        nma_cert_chooser_setup_cert_password_storage (NMA_CERT_CHOOSER (method->client_cert_chooser),
                                                      0, (NMSetting *) s_8021x, 
method->client_cert_password_flags_name,
                                                      FALSE, secrets_only);
-#endif
        nma_cert_chooser_setup_key_password_storage (NMA_CERT_CHOOSER (method->client_cert_chooser),
                                                     0, (NMSetting *) s_8021x, 
method->client_key_password_flags_name,
                                                     FALSE, secrets_only);
diff --git a/src/wireless-security/eap-method-ttls.c b/src/wireless-security/eap-method-ttls.c
index c94a9deb..1cad3a53 100644
--- a/src/wireless-security/eap-method-ttls.c
+++ b/src/wireless-security/eap-method-ttls.c
@@ -118,9 +118,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
        EAPMethodTTLS *method = (EAPMethodTTLS *) parent;
        NMSetting8021x *s_8021x;
        NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
-#if LIBNM_BUILD
        NMSettingSecretFlags secret_flags;
-#endif
        GtkWidget *widget;
        const char *text;
        char *value = NULL;
@@ -142,16 +140,12 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
        if (text && strlen (text))
                g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, text, NULL);
 
-#if LIBNM_BUILD
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_domain_entry"));
        g_assert (widget);
        text = gtk_entry_get_text (GTK_ENTRY (widget));
        if (text && strlen (text))
                g_object_set (s_8021x, NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH, text, NULL);
-#endif
 
-#if LIBNM_BUILD
-/* libnm-glib doesn't support this. */
        /* Save CA certificate PIN and its flags to the connection */
        secret_flags = nma_cert_chooser_get_cert_password_flags (NMA_CERT_CHOOSER (method->ca_cert_chooser));
        nm_setting_set_secret_flags (NM_SETTING (s_8021x), NM_SETTING_802_1X_CA_CERT_PASSWORD,
@@ -165,7 +159,6 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
                              nma_cert_chooser_get_cert_password (NMA_CERT_CHOOSER (method->ca_cert_chooser)),
                              NULL);
        }
-#endif
 
        /* TLS CA certificate */
        if (gtk_widget_get_sensitive (method->ca_cert_chooser))
@@ -493,17 +486,11 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
                          ws_parent);
 
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_domain_entry"));
-#if LIBNM_BUILD
        if (s_8021x && nm_setting_802_1x_get_domain_suffix_match (s_8021x))
                gtk_entry_set_text (GTK_ENTRY (widget), nm_setting_802_1x_get_domain_suffix_match (s_8021x));
        g_signal_connect (G_OBJECT (widget), "changed",
                          (GCallback) wireless_security_changed_cb,
                          ws_parent);
-#else
-       gtk_widget_hide (widget);
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_domain_label"));
-       gtk_widget_hide (widget);
-#endif
 
        widget = inner_auth_combo_init (method, connection, s_8021x, secrets_only);
        inner_auth_combo_changed_cb (widget, (gpointer) method);
@@ -525,11 +512,9 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
                gtk_widget_hide (widget);
        }
 
-#if LIBNM_BUILD
        nma_cert_chooser_setup_cert_password_storage (NMA_CERT_CHOOSER (method->ca_cert_chooser),
                                                      0, (NMSetting *) s_8021x, 
NM_SETTING_802_1X_CA_CERT_PASSWORD,
                                                      FALSE, secrets_only);
-#endif
 
        return method;
 }
diff --git a/src/wireless-security/eap-method.c b/src/wireless-security/eap-method.c
index 8e774e10..b7c1a82e 100644
--- a/src/wireless-security/eap-method.c
+++ b/src/wireless-security/eap-method.c
@@ -386,15 +386,12 @@ eap_method_setup_cert_chooser (NMACertChooser *cert_chooser,
                case NM_SETTING_802_1X_CK_SCHEME_PATH:
                        value = cert_path_func (s_8021x);
                        break;
-#if LIBNM_BUILD
-/* Not available in libnm-glib */
                case NM_SETTING_802_1X_CK_SCHEME_PKCS11:
                        value = cert_uri_func (s_8021x);
                        password = cert_password_func ? cert_password_func (s_8021x) : NULL;
                        if (password)
                                nma_cert_chooser_set_cert_password (cert_chooser, password);
                        break;
-#endif
                case NM_SETTING_802_1X_CK_SCHEME_UNKNOWN:
                        /* No CA set. */
                        break;
@@ -411,12 +408,9 @@ eap_method_setup_cert_chooser (NMACertChooser *cert_chooser,
                case NM_SETTING_802_1X_CK_SCHEME_PATH:
                        value = key_path_func (s_8021x);
                        break;
-#if LIBNM_BUILD
-/* Not available in libnm-glib */
                case NM_SETTING_802_1X_CK_SCHEME_PKCS11:
                        value = key_uri_func (s_8021x);
                        break;
-#endif
                case NM_SETTING_802_1X_CK_SCHEME_UNKNOWN:
                        /* No certificate set. */
                        break;
diff --git a/src/wireless-security/eap-method.h b/src/wireless-security/eap-method.h
index 24f8ef38..ed9e1ac8 100644
--- a/src/wireless-security/eap-method.h
+++ b/src/wireless-security/eap-method.h
@@ -93,20 +93,6 @@ void eap_method_ca_cert_ignore_load (NMConnection *connection);
 
 GError *eap_method_ca_cert_validate_cb (NMACertChooser *cert_chooser, gpointer user_data);
 
-#if !LIBNM_BUILD
-/* For mere convenience. These are not available in libnm-glib. */
-#define nm_setting_802_1x_get_ca_cert_password             NULL
-#define nm_setting_802_1x_get_ca_cert_uri                  NULL
-#define nm_setting_802_1x_get_client_cert_password         NULL
-#define nm_setting_802_1x_get_client_cert_uri              NULL
-#define nm_setting_802_1x_get_private_key_uri              NULL
-#define nm_setting_802_1x_get_phase2_ca_cert_password      NULL
-#define nm_setting_802_1x_get_phase2_ca_cert_uri           NULL
-#define nm_setting_802_1x_get_phase2_client_cert_password  NULL
-#define nm_setting_802_1x_get_phase2_client_cert_uri       NULL
-#define nm_setting_802_1x_get_phase2_private_key_uri       NULL
-#endif
-
 void eap_method_setup_cert_chooser (NMACertChooser *cert_chooser,
                                     NMSetting8021x *s_8021x,
                                     NMSetting8021xCKScheme (*cert_scheme_func) (NMSetting8021x *setting),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]