⛏️ index : haiku.git

author nipos <ni.pos@yandex.com> 2025-06-14 13:18:41.0 +02:00:00
committer Adrien Destugues <pulkomandy@pulkomandy.tk> 2025-11-30 21:28:53.0 +00:00:00
commit
7ad0bd3735dd066a808ebd136df1cf4df83f6b67 [patch]
tree
50ca0194174950495242d515afa16525b1c080ef
parent
99b68e8d3621477b494b419102cd39dc7bea6a1c
download
7ad0bd3735dd066a808ebd136df1cf4df83f6b67.tar.gz

Network: Use statuses from NetworkStatus rather than just 'connected' and 'disconnected'

Fixes #15261

Change-Id: I782abf970521a13eabfe74d103e39d69618306a2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9341
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>

Diff

 src/apps/networkstatus/NetworkStatusView.cpp |  2 +-
 src/preferences/network/InterfaceView.cpp    | 12 +++++++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/apps/networkstatus/NetworkStatusView.cpp b/src/apps/networkstatus/NetworkStatusView.cpp
index 8addc4c..9b82585 100644
--- a/src/apps/networkstatus/NetworkStatusView.cpp
+++ b/src/apps/networkstatus/NetworkStatusView.cpp
@@ -61,7 +61,7 @@
	B_TRANSLATE("No link"),
	B_TRANSLATE("No stateful configuration"),
	B_TRANSLATE("Configuring"),
	B_TRANSLATE("Ready")
	B_TRANSLATE("Connected")
};

extern "C" _EXPORT BView *instantiate_deskbar_item(float maxWidth, float maxHeight);
diff --git a/src/preferences/network/InterfaceView.cpp b/src/preferences/network/InterfaceView.cpp
index 2c0ab8d..5267f6d 100644
--- a/src/preferences/network/InterfaceView.cpp
+++ b/src/preferences/network/InterfaceView.cpp
@@ -194,10 +194,18 @@
	bool isWireless = device.IsWireless();
	bool disabled = (fInterface.Flags() & IFF_UP) == 0;

	if (fInterface.HasLink())
	uint32 flags = fInterface.Flags();

	if ((flags & IFF_LINK) == 0)
		fStatusField->SetText(B_TRANSLATE("no link"));
	else if ((flags & (IFF_UP | IFF_CONFIGURING)) == 0)
		fStatusField->SetText(B_TRANSLATE("no stateful configuration"));
	else if ((flags & IFF_CONFIGURING) == IFF_CONFIGURING)
		fStatusField->SetText(B_TRANSLATE("configuring"));
	else if ((flags & IFF_UP) == IFF_UP)
		fStatusField->SetText(B_TRANSLATE("connected"));
	else
		fStatusField->SetText(B_TRANSLATE("disconnected"));
		fStatusField->SetText(B_TRANSLATE("unknown"));

	BNetworkAddress hardwareAddress;
	if (device.GetHardwareAddress(hardwareAddress) == B_OK)