status/network: Use wwan settings panel for GSM/LTE Modems

GSM/UMTS/LTE modems now have better support with wwan panel in GNOME
Settings.  So, if the modem supports, open wwan panel, otherwise
fallback to opening network panel when "Mobile Broadband Settings"
item is clicked.

See https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/583

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1942>
This commit is contained in:
Mohammed Sadiq 2021-08-10 15:22:30 +05:30 committed by Marge Bot
parent 4b4d422c1e
commit 3495873c90

View File

@ -543,7 +543,11 @@ var NMDeviceModem = class extends NMConnectionDevice {
constructor(client, device) { constructor(client, device) {
super(client, device); super(client, device);
this.item.menu.addSettingsAction(_("Mobile Broadband Settings"), 'gnome-network-panel.desktop'); const settingsPanel = this._useWwanPanel()
? 'gnome-wwan-panel.desktop'
: 'gnome-network-panel.desktop';
this.item.menu.addSettingsAction(_('Mobile Broadband Settings'), settingsPanel);
this._mobileDevice = null; this._mobileDevice = null;
@ -573,7 +577,18 @@ var NMDeviceModem = class extends NMConnectionDevice {
return NMConnectionCategory.WWAN; return NMConnectionCategory.WWAN;
} }
_useWwanPanel() {
// Currently, wwan panel doesn't support CDMA_EVDO modems
const supportedCaps =
NM.DeviceModemCapabilities.GSM_UMTS |
NM.DeviceModemCapabilities.LTE;
return this._device.current_capabilities & supportedCaps;
}
_autoConnect() { _autoConnect() {
if (this._useWwanPanel())
launchSettingsPanel('wwan', 'show-device', this._device.udi);
else
launchSettingsPanel('network', 'connect-3g', this._device.get_path()); launchSettingsPanel('network', 'connect-3g', this._device.get_path());
} }