[gnome-control-center] network: Don't show modems supported by cellular panel



commit 169f537e4b31bf5c119a5fc262bb3e3c708d1ba1
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Fri Oct 4 16:02:23 2019 +0530

    network: Don't show modems supported by cellular panel
    
    Cellular panel is already handling it

 panels/network/cc-network-panel.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 01b164ea0..bd4e55df8 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -382,6 +382,27 @@ update_bluetooth_section (CcNetworkPanel *self)
         gtk_widget_set_visible (self->container_bluetooth, self->bluetooth_devices->len > 0);
 }
 
+static gboolean
+wwan_panel_supports_modem (GDBusObject *object)
+{
+        MMObject *mm_object;
+        MMModem *modem;
+        MMModemCapability capability, supported_capabilities;
+
+        g_assert (G_IS_DBUS_OBJECT (object));
+
+        supported_capabilities = MM_MODEM_CAPABILITY_GSM_UMTS | MM_MODEM_CAPABILITY_LTE;
+#if MM_CHECK_VERSION (1,14,0)
+        supported_capabilities |= MM_MODEM_CAPABILITY_5GNR;
+#endif
+
+        mm_object = MM_OBJECT (object);
+        modem = mm_object_get_modem (mm_object);
+        capability = mm_modem_get_current_capabilities (modem);
+
+        return capability & supported_capabilities;
+}
+
 static void
 panel_add_device (CcNetworkPanel *self, NMDevice *device)
 {
@@ -425,6 +446,10 @@ panel_add_device (CcNetworkPanel *self, NMDevice *device)
                                            nm_device_get_udi (device));
                                 return;
                         }
+
+                        /* This will be handled by cellular panel */
+                        if (wwan_panel_supports_modem (modem_object))
+                                return;
                 }
 
                 device_mobile = net_device_mobile_new (self->client, device, modem_object);


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