network status: Add notifications for major network events
* Add a notification if the network interface monitored by the system tray icon has a major state change. * This gives users a little feedback on connection state. * User is only prompted once on each state change. * TODO: change system tray icons to vector so we can scale them up better.
This commit is contained in:
parent
935af17a2f
commit
b44d24c0ad
@ -546,8 +546,29 @@ NetworkStatusView::_Update(bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if (fStatus != oldStatus)
|
||||
if (fStatus != oldStatus) {
|
||||
// A little notification on major status changes for primary interface
|
||||
BNotification notification(B_INFORMATION_NOTIFICATION);
|
||||
notification.SetGroup(B_TRANSLATE("Network Status"));
|
||||
notification.SetTitle(interface.Name());
|
||||
notification.SetMessageID(interface.Name());
|
||||
notification.SetIcon(fBitmaps[fStatus]);
|
||||
if (fStatus == kStatusConnecting) {
|
||||
notification.SetContent(B_TRANSLATE("Connecting..."));
|
||||
notification.Send();
|
||||
} else if (fStatus == kStatusReady && oldStatus == kStatusConnecting) {
|
||||
notification.SetContent(B_TRANSLATE("Connection Established"));
|
||||
notification.Send();
|
||||
} else if (fStatus == kStatusNoLink && oldStatus == kStatusConnecting) {
|
||||
notification.SetContent(B_TRANSLATE("Connection Failed"));
|
||||
notification.Send();
|
||||
} else if (fStatus == kStatusNoLink && oldStatus == kStatusReady) {
|
||||
notification.SetContent(B_TRANSLATE("Disconnected"));
|
||||
notification.Send();
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#define NETWORK_STATUS_VIEW_H
|
||||
|
||||
|
||||
#include <Notification.h>
|
||||
#include <ObjectList.h>
|
||||
#include <View.h>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user