[gnome-control-center/wip/hadess/wifi-freqs: 194/194] wifi: Show the frequency used by the Wi-Fi network
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/hadess/wifi-freqs: 194/194] wifi: Show the frequency used by the Wi-Fi network
- Date: Sat, 17 Nov 2018 16:15:07 +0000 (UTC)
commit 11efef162fd1bb7fadcf269bd1e8befdb72e8863
Author: Bastien Nocera <hadess hadess net>
Date: Fri Aug 10 16:05:09 2018 +0200
wifi: Show the frequency used by the Wi-Fi network
https://bugzilla.gnome.org/show_bug.cgi?id=722550
panels/network/connection-editor/ce-page-details.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-details.c
b/panels/network/connection-editor/ce-page-details.c
index 1aff91c44..0932a2e68 100644
--- a/panels/network/connection-editor/ce-page-details.c
+++ b/panels/network/connection-editor/ce-page-details.c
@@ -184,6 +184,7 @@ connect_details_page (CEPageDetails *page)
GtkWidget *widget;
guint speed;
NMDeviceWifiCapabilities wifi_caps;
+ guint frequency;
guint strength;
NMDeviceState state;
NMAccessPoint *active_ap;
@@ -198,10 +199,13 @@ connect_details_page (CEPageDetails *page)
sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
type = nm_setting_connection_get_connection_type (sc);
- if (NM_IS_DEVICE_WIFI (page->device))
+ if (NM_IS_DEVICE_WIFI (page->device)) {
active_ap = nm_device_wifi_get_active_access_point (NM_DEVICE_WIFI (page->device));
- else
+ frequency = nm_access_point_get_frequency (active_ap);
+ } else {
active_ap = NULL;
+ frequency = 0;
+ }
state = page->device ? nm_device_get_state (page->device) : NM_DEVICE_STATE_DISCONNECTED;
@@ -230,8 +234,13 @@ connect_details_page (CEPageDetails *page)
speed = nm_device_ethernet_get_speed (NM_DEVICE_ETHERNET (page->device));
}
}
- if (speed > 0)
+
+ if (speed > 0 && frequency > 0)
+ speed_label = g_strdup_printf (_("%d Mb/s (%1.1f GHz)"), speed, (float) (frequency) /
1000.0);
+ else if (speed > 0)
speed_label = g_strdup_printf (_("%d Mb/s"), speed);
+ else
+ speed_label = NULL;
panel_set_device_widget_details (CE_PAGE (page)->builder, "speed", speed_label);
if (NM_IS_DEVICE_WIFI (page->device))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]