[network-manager-applet] applet: drop bond, bridge, infiniband, team, and vlan support



commit 4b8eade73dbfce2090fd09de1048adf4782d547a
Author: Dan Winship <danw redhat com>
Date:   Fri Aug 7 16:29:03 2015 -0400

    applet: drop bond, bridge, infiniband, team, and vlan support
    
    At one point we thought people would want/need to control their
    "enterprisey" devices via nm-applet, but nmcli (or static
    autoconnect=true configuration) turns out to be a better answer
    generally.
    
    Additionally, probably the most common case of bridges currently is
    when you are using virtualization or containers, and in that case the
    bridge is handled entirely by the virt/container system, and showing
    it in nm-applet just clutters things up, pushing Wi-Fi and VPN down to
    the bottom of the menu.
    
    So drop support for those devices.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753369

 po/POTFILES.in                 |    5 -
 src/Makefile.am                |   10 --
 src/applet-device-bond.c       |  158 -----------------------
 src/applet-device-bond.h       |   31 -----
 src/applet-device-bridge.c     |  157 -----------------------
 src/applet-device-bridge.h     |   31 -----
 src/applet-device-infiniband.c |  205 ------------------------------
 src/applet-device-infiniband.h |   30 -----
 src/applet-device-team.c       |  155 -----------------------
 src/applet-device-team.h       |   27 ----
 src/applet-device-vlan.c       |  271 ----------------------------------------
 src/applet-device-vlan.h       |   31 -----
 src/applet.c                   |  167 ------------------------
 src/applet.h                   |    5 -
 14 files changed, 0 insertions(+), 1283 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c817307..f3f9ddf 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -8,14 +8,9 @@ org.gnome.nm-connection-editor.appdata.xml.in
 [type: gettext/glade]src/8021x.ui
 src/ap-menu-item.c
 src/applet.c
-src/applet-device-bond.c
-src/applet-device-bridge.c
 src/applet-device-broadband.c
 src/applet-device-bt.c
 src/applet-device-ethernet.c
-src/applet-device-infiniband.c
-src/applet-device-team.c
-src/applet-device-vlan.c
 src/applet-device-wifi.c
 src/applet-dialogs.c
 src/applet.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 7803e63..6b91259 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -55,16 +55,6 @@ nm_applet_SOURCES = \
        mobile-helpers.h \
        applet-device-bt.h \
        applet-device-bt.c \
-       applet-device-vlan.h \
-       applet-device-vlan.c \
-       applet-device-bond.h \
-       applet-device-bond.c \
-       applet-device-team.h \
-       applet-device-team.c \
-       applet-device-bridge.h \
-       applet-device-bridge.c \
-       applet-device-infiniband.h \
-       applet-device-infiniband.c \
        fallback-icon.h
 
 if WITH_WWAN
diff --git a/src/applet.c b/src/applet.c
index c38e890..d65e612 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -47,13 +47,8 @@
 #include <libnotify/notify.h>
 
 #include "applet.h"
-#include "applet-device-bond.h"
-#include "applet-device-team.h"
-#include "applet-device-bridge.h"
 #include "applet-device-bt.h"
 #include "applet-device-ethernet.h"
-#include "applet-device-infiniband.h"
-#include "applet-device-vlan.h"
 #include "applet-device-wifi.h"
 #include "applet-dialogs.h"
 #include "nma-wifi-dialog.h"
@@ -215,16 +210,6 @@ get_device_class (NMDevice *device, NMApplet *applet)
 #endif
        } else if (NM_IS_DEVICE_BT (device))
                return applet->bt_class;
-       else if (NM_IS_DEVICE_VLAN (device))
-               return applet->vlan_class;
-       else if (NM_IS_DEVICE_BOND (device))
-               return applet->bond_class;
-       else if (NM_IS_DEVICE_TEAM (device))
-               return applet->team_class;
-       else if (NM_IS_DEVICE_BRIDGE (device))
-               return applet->bridge_class;
-       else if (NM_IS_DEVICE_INFINIBAND (device))
-               return applet->infiniband_class;
        else
                g_debug ("%s: Unknown device type '%s'", __func__, G_OBJECT_TYPE_NAME (device));
        return NULL;
@@ -255,14 +240,6 @@ get_device_class_from_connection (NMConnection *connection, NMApplet *applet)
 #endif
        else if (!strcmp (ctype, NM_SETTING_BLUETOOTH_SETTING_NAME))
                return applet->bt_class;
-       else if (!strcmp (ctype, NM_SETTING_BOND_SETTING_NAME))
-               return applet->bond_class;
-       else if (!strcmp (ctype, NM_SETTING_TEAM_SETTING_NAME))
-               return applet->team_class;
-       else if (!strcmp (ctype, NM_SETTING_BRIDGE_SETTING_NAME))
-               return applet->bridge_class;
-       else if (!strcmp (ctype, NM_SETTING_VLAN_SETTING_NAME))
-               return applet->vlan_class;
        else
                g_warning ("%s: unhandled connection type '%s'", __func__, ctype);
        return NULL;
@@ -1382,40 +1359,6 @@ applet_find_active_connection_for_device (NMDevice *device,
        return NULL;
 }
 
-static NMConnection *
-applet_find_active_connection_for_virtual_device (const char *iface,
-                                                  NMApplet *applet,
-                                                  NMActiveConnection **out_active)
-{
-       const GPtrArray *active_connections;
-       int i;
-
-       g_return_val_if_fail (iface != NULL, NULL);
-       g_return_val_if_fail (NM_IS_APPLET (applet), NULL);
-       if (out_active)
-               g_return_val_if_fail (*out_active == NULL, NULL);
-
-       active_connections = nm_client_get_active_connections (applet->nm_client);
-       for (i = 0; i < active_connections->len; i++) {
-               NMRemoteConnection *conn;
-               NMActiveConnection *active;
-
-               active = NM_ACTIVE_CONNECTION (g_ptr_array_index (active_connections, i));
-               conn = nm_active_connection_get_connection (active);
-
-               if (!conn)
-                       continue;
-
-               if (!g_strcmp0 (nm_connection_get_interface_name (NM_CONNECTION (conn)), iface)) {
-                       if (out_active)
-                               *out_active = active;
-                       return NM_CONNECTION (conn);
-               }
-       }
-
-       return NULL;
-}
-
 gboolean
 nma_menu_device_check_unusable (NMDevice *device)
 {
@@ -1555,86 +1498,6 @@ add_device_items (NMDeviceType type, const GPtrArray *all_devices,
        return n_devices;
 }
 
-static gint
-sort_connections_by_ifname (gconstpointer a, gconstpointer b)
-{
-       NMConnection *aa =  *(NMConnection **)a;
-       NMConnection *bb =  *(NMConnection **)b;
-
-       return strcmp (nm_connection_get_interface_name (aa),
-                      nm_connection_get_interface_name (bb));
-}
-
-static int
-add_virtual_items (const char *type, const GPtrArray *all_devices,
-                   const GPtrArray *all_connections, GtkWidget *menu, NMApplet *applet)
-{
-       GPtrArray *connections;
-       int i, n_devices = 0;
-
-       connections = g_ptr_array_sized_new (5);
-       for (i = 0; i < all_connections->len; i++) {
-               NMConnection *connection = all_connections->pdata[i];
-
-               if (!nm_connection_get_interface_name (connection))
-                       continue;
-
-               if (nm_connection_is_type (connection, type))
-                       g_ptr_array_add (connections, connection);
-       }
-
-       g_ptr_array_sort (connections, sort_connections_by_ifname);
-       /* Count the number of unique interface names */
-       for (i = 0; i < connections->len; i++) {
-               NMConnection *connection = connections->pdata[i];
-
-               n_devices++;
-
-               /* Skip ahead until we find a connection with a different ifname
-                * (or reach the end of the list).
-                */
-               while (   i < connections->len
-                      && sort_connections_by_ifname (&connection, &connections->pdata[i]) == 0)
-                       i++;
-       }
-
-       for (i = 0; i < connections->len; i++) {
-               NMConnection *connection = connections->pdata[i];
-               NMDevice *device = NULL;
-               const char *iface = nm_connection_get_interface_name (connection);
-               GPtrArray *iface_connections;
-               NMADeviceClass *dclass;
-               NMConnection *active;
-               int d;
-
-               for (d = 0; d < all_devices->len; d++) {
-                       NMDevice *candidate = all_devices->pdata[d];
-
-                       if (!strcmp (nm_device_get_iface (candidate), iface)) {
-                               device = candidate;
-                               break;
-                       }
-               }
-
-               iface_connections = g_ptr_array_sized_new (5);
-               while (   i < connections->len
-                      && sort_connections_by_ifname (&connection, &connections->pdata[i]) == 0) {
-                       g_ptr_array_add (iface_connections, connections->pdata[i]);
-                       i++;
-               }
-
-               active = applet_find_active_connection_for_virtual_device (iface, applet, NULL);
-
-               dclass = get_device_class_from_connection (connection, applet);
-               dclass->add_menu_item (device, n_devices > 1, iface_connections, active, menu, applet);
-
-               g_ptr_array_unref (iface_connections);
-       }
-
-       g_ptr_array_unref (connections);
-       return n_devices;
-}
-
 static void
 nma_menu_add_devices (GtkWidget *menu, NMApplet *applet)
 {
@@ -1646,18 +1509,8 @@ nma_menu_add_devices (GtkWidget *menu, NMApplet *applet)
        all_devices = nm_client_get_devices (applet->nm_client);
 
        n_items = 0;
-       n_items += add_virtual_items (NM_SETTING_BRIDGE_SETTING_NAME,
-                                     all_devices, all_connections, menu, applet);
-       n_items += add_virtual_items (NM_SETTING_BOND_SETTING_NAME,
-                                     all_devices, all_connections, menu, applet);
-       n_items += add_virtual_items (NM_SETTING_TEAM_SETTING_NAME,
-                                     all_devices, all_connections, menu, applet);
        n_items += add_device_items  (NM_DEVICE_TYPE_ETHERNET,
                                      all_devices, all_connections, menu, applet);
-       n_items += add_device_items  (NM_DEVICE_TYPE_INFINIBAND,
-                                     all_devices, all_connections, menu, applet);
-       n_items += add_virtual_items (NM_SETTING_VLAN_SETTING_NAME,
-                                     all_devices, all_connections, menu, applet);
        n_items += add_device_items  (NM_DEVICE_TYPE_WIFI,
                                      all_devices, all_connections, menu, applet);
        n_items += add_device_items  (NM_DEVICE_TYPE_MODEM,
@@ -3578,21 +3431,6 @@ initable_init (GInitable *initable, GCancellable *cancellable, GError **error)
        applet->bt_class = applet_device_bt_get_class (applet);
        g_assert (applet->bt_class);
 
-       applet->vlan_class = applet_device_vlan_get_class (applet);
-       g_assert (applet->vlan_class);
-
-       applet->bond_class = applet_device_bond_get_class (applet);
-       g_assert (applet->bond_class);
-
-       applet->team_class = applet_device_team_get_class (applet);
-       g_assert (applet->team_class);
-
-       applet->bridge_class = applet_device_bridge_get_class (applet);
-       g_assert (applet->bridge_class);
-
-       applet->infiniband_class = applet_device_infiniband_get_class (applet);
-       g_assert (applet->infiniband_class);
-
 #if WITH_WWAN
        mm1_client_setup (applet);
 #endif
@@ -3622,11 +3460,6 @@ static void finalize (GObject *object)
        g_slice_free (NMADeviceClass, applet->broadband_class);
 #endif
        g_slice_free (NMADeviceClass, applet->bt_class);
-       g_slice_free (NMADeviceClass, applet->vlan_class);
-       g_slice_free (NMADeviceClass, applet->bond_class);
-       g_slice_free (NMADeviceClass, applet->team_class);
-       g_slice_free (NMADeviceClass, applet->bridge_class);
-       g_slice_free (NMADeviceClass, applet->infiniband_class);
 
        if (applet->update_icon_id)
                g_source_remove (applet->update_icon_id);
diff --git a/src/applet.h b/src/applet.h
index 66e2e5c..f4e58e1 100644
--- a/src/applet.h
+++ b/src/applet.h
@@ -106,11 +106,6 @@ typedef struct
        NMADeviceClass *broadband_class;
 #endif
        NMADeviceClass *bt_class;
-       NMADeviceClass *vlan_class;
-       NMADeviceClass *bond_class;
-       NMADeviceClass *team_class;
-       NMADeviceClass *bridge_class;
-       NMADeviceClass *infiniband_class;
 
        /* Data model elements */
        guint                   update_icon_id;


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