network: Fix Bluetooth panel showing up after connection removal

The test to check whether the Bluetooth (simple section) contains
elements was testing for NetObjectSimple. However, ethernet connections
are a subclass and check would count these. This causes issue when the
code is run after net object removal.

The fix is to check for the exact object type rather than also allowing
subclasses.
This commit is contained in:
Benjamin Berg 2018-05-24 18:06:23 +02:00
parent 4aee26cc77
commit a51dbcd8ca

View file

@ -415,7 +415,8 @@ update_simple_section (CcNetworkPanel *self)
for (i = 0, n_simple = 0; i < self->devices->len; i++) {
NetObject *net_object = g_ptr_array_index (self->devices, i);
if (!NET_IS_DEVICE_SIMPLE (net_object))
/* NetDeviceSimple but none of the subclasses */
if (G_OBJECT_TYPE (net_object) != NET_TYPE_DEVICE_SIMPLE)
continue;
net_device_simple_set_show_separator (NET_DEVICE_SIMPLE (net_object), n_simple > 0);