[gnome-control-center/gnome-3-28] network: Remove dead code trying to use NMConnection as NMActiveConnection



commit 5c315ced172a1f411e4cf944016db02f03fa3131
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Mar 8 12:11:06 2018 +0100

    network: Remove dead code trying to use NMConnection as NMActiveConnection
    
    These code paths could never be hit as an NMConnection cannot be an
    NMVpnConnection which is a descendant of NMActiveConnection.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=794171
    
    
    (cherry picked from commit 729db872491c6443651e784fb09dbdcf64d11f6c)

 panels/network/net-vpn.c | 34 +++-------------------------------
 1 file changed, 3 insertions(+), 31 deletions(-)
---
diff --git a/panels/network/net-vpn.c b/panels/network/net-vpn.c
index 47b7391a9..bf653bad3 100644
--- a/panels/network/net-vpn.c
+++ b/panels/network/net-vpn.c
@@ -61,15 +61,6 @@ net_vpn_set_show_separator (NetVpn   *self,
         gtk_widget_set_visible (separator, show_separator);
 }
 
-static void
-connection_vpn_state_changed_cb (NMVpnConnection *connection,
-                                 NMVpnConnectionState state,
-                                 NMVpnConnectionStateReason reason,
-                                 NetVpn *vpn)
-{
-        net_object_emit_changed (NET_OBJECT (vpn));
-}
-
 static void
 connection_changed_cb (NMConnection *connection,
                        NetVpn *vpn)
@@ -127,25 +118,9 @@ net_vpn_set_connection (NetVpn *vpn, NMConnection *connection)
                           G_CALLBACK (connection_changed_cb),
                           vpn);
 
-        if (NM_IS_VPN_CONNECTION (priv->connection)) {
-                g_signal_connect (priv->connection,
-                                  NM_VPN_CONNECTION_VPN_STATE,
-                                  G_CALLBACK (connection_vpn_state_changed_cb),
-                                  vpn);
-        }
-
         priv->service_type = net_vpn_connection_to_type (priv->connection);
 }
 
-static NMVpnConnectionState
-net_vpn_get_state (NetVpn *vpn)
-{
-        NetVpnPrivate *priv = vpn->priv;
-        if (!NM_IS_VPN_CONNECTION (priv->connection))
-                return NM_VPN_CONNECTION_STATE_DISCONNECTED;
-        return nm_vpn_connection_get_vpn_state (NM_VPN_CONNECTION (priv->connection));
-}
-
 static void
 vpn_proxy_delete (NetObject *object)
 {
@@ -202,14 +177,14 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
         }
 
 
-        /* use status */
-        state = net_vpn_get_state (vpn);
+        /* Default to disconnected if there is no active connection */
+        state = NM_VPN_CONNECTION_STATE_DISCONNECTED;
         client = net_object_get_client (NET_OBJECT (vpn));
         acs = nm_client_get_active_connections (client);
         if (acs != NULL) {
                 const gchar *uuid;
-
                 uuid = nm_connection_get_uuid (vpn->priv->connection);
+
                 for (i = 0; i < acs->len; i++) {
                         const gchar *auuid;
 
@@ -406,9 +381,6 @@ net_vpn_finalize (GObject *object)
                 g_object_unref (priv->active_connection);
         }
 
-        g_signal_handlers_disconnect_by_func (priv->connection,
-                                              connection_vpn_state_changed_cb,
-                                              vpn);
         g_signal_handlers_disconnect_by_func (priv->connection,
                                               connection_removed_cb,
                                               vpn);


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