Network: added notify settings updated method.
* And call it from the DNS client -- this is the only add-on that does not trigger a configuration or settings update, so we have to notify the changes manually.
This commit is contained in:
@@ -27,10 +27,6 @@ enum BNetworkSettingsType {
|
||||
B_NETWORK_SETTINGS_TYPE_OTHER = 'othr'
|
||||
};
|
||||
|
||||
enum {
|
||||
kMsgSettingsItemUpdated = 'SIup'
|
||||
};
|
||||
|
||||
class BNetworkProfile;
|
||||
class BNetworkSettings;
|
||||
|
||||
@@ -70,6 +66,8 @@ public:
|
||||
virtual void SettingsUpdated(uint32 type);
|
||||
virtual void ConfigurationUpdated(const BMessage& message);
|
||||
|
||||
virtual void NotifySettingsUpdated();
|
||||
|
||||
private:
|
||||
const BNetworkProfile*
|
||||
fProfile;
|
||||
|
||||
@@ -94,7 +94,7 @@ BView*
|
||||
DNSClientServiceItem::View()
|
||||
{
|
||||
if (fView == NULL)
|
||||
fView = new DNSSettingsView();
|
||||
fView = new DNSSettingsView(this);
|
||||
|
||||
return fView;
|
||||
}
|
||||
|
||||
@@ -41,9 +41,10 @@ static const int32 kMsgApply = 'aply';
|
||||
#define B_TRANSLATION_CONTEXT "DNSSettingsView"
|
||||
|
||||
|
||||
DNSSettingsView::DNSSettingsView()
|
||||
DNSSettingsView::DNSSettingsView(BNetworkSettingsItem* item)
|
||||
:
|
||||
BView("dns", 0)
|
||||
BView("dns", 0),
|
||||
fItem(item)
|
||||
{
|
||||
fServerListView = new BListView("nameservers");
|
||||
fTextControl = new IPAddressControl(AF_UNSPEC, "server", "");
|
||||
@@ -158,7 +159,8 @@ DNSSettingsView::MessageReceived(BMessage* message)
|
||||
break;
|
||||
}
|
||||
case kMsgApply:
|
||||
_SaveDNSConfiguration();
|
||||
if (_SaveDNSConfiguration() == B_OK)
|
||||
fItem->NotifySettingsUpdated();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -9,10 +9,13 @@
|
||||
#define DNS_SETTINGS_VIEW_H
|
||||
|
||||
|
||||
#include <NetworkSettingsAddOn.h>
|
||||
#include <StringList.h>
|
||||
#include <View.h>
|
||||
|
||||
|
||||
using namespace BNetworkKit;
|
||||
|
||||
class BButton;
|
||||
class BListView;
|
||||
class BTextControl;
|
||||
@@ -20,7 +23,7 @@ class BTextControl;
|
||||
|
||||
class DNSSettingsView : public BView {
|
||||
public:
|
||||
DNSSettingsView();
|
||||
DNSSettingsView(BNetworkSettingsItem* item);
|
||||
~DNSSettingsView();
|
||||
|
||||
status_t Revert();
|
||||
@@ -33,6 +36,8 @@ private:
|
||||
status_t _SaveDNSConfiguration();
|
||||
|
||||
private:
|
||||
BNetworkSettingsItem*
|
||||
fItem;
|
||||
BListView* fServerListView;
|
||||
BStringList fRevertList;
|
||||
BTextControl* fTextControl;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <NetworkInterface.h>
|
||||
#include <NetworkSettings.h>
|
||||
|
||||
#include "NetworkWindow.h"
|
||||
|
||||
|
||||
using namespace BNetworkKit;
|
||||
|
||||
@@ -57,6 +59,16 @@ BNetworkSettingsItem::ConfigurationUpdated(const BMessage& message)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BNetworkSettingsItem::NotifySettingsUpdated()
|
||||
{
|
||||
// TODO: post to network window
|
||||
BMessage updated(kMsgSettingsItemUpdated);
|
||||
updated.AddPointer("item", this);
|
||||
gNetworkWindow.SendMessage(&updated);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ static const uint32 kMsgRevert = 'rvrt';
|
||||
static const uint32 kMsgToggleReplicant = 'trep';
|
||||
static const uint32 kMsgItemSelected = 'ItSl';
|
||||
|
||||
BMessenger gNetworkWindow;
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "NetworkWindow"
|
||||
@@ -152,6 +154,8 @@ NetworkWindow::NetworkWindow()
|
||||
.AddGlue()
|
||||
.End();
|
||||
|
||||
gNetworkWindow = this;
|
||||
|
||||
_ScanInterfaces();
|
||||
_ScanAddOns();
|
||||
|
||||
|
||||
@@ -27,6 +27,11 @@ class InterfaceListItem;
|
||||
class InterfaceView;
|
||||
|
||||
|
||||
enum {
|
||||
kMsgSettingsItemUpdated = 'SIup'
|
||||
};
|
||||
|
||||
|
||||
class NetworkWindow : public BWindow {
|
||||
public:
|
||||
NetworkWindow();
|
||||
@@ -62,7 +67,6 @@ private:
|
||||
|
||||
private:
|
||||
typedef BObjectList<BNetworkSettingsAddOn> AddOnList;
|
||||
typedef BObjectList<BNetworkSettingsItem> ItemList;
|
||||
typedef std::map<BString, BListItem*> ItemMap;
|
||||
typedef std::map<BListItem*, BNetworkSettingsItem*> SettingsMap;
|
||||
|
||||
@@ -84,4 +88,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
extern BMessenger gNetworkWindow;
|
||||
|
||||
|
||||
#endif // NETWORK_WINDOW_H
|
||||
|
||||
Reference in New Issue
Block a user