* Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37094 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
fc0d49483e
commit
be816234e8
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2006-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -42,7 +42,7 @@ const static settings_template kInterfaceAddressTemplate[] = {
|
||||
|
||||
const static settings_template kInterfaceTemplate[] = {
|
||||
{B_STRING_TYPE, "device", NULL, true},
|
||||
{B_BOOL_TYPE, "disabled", NULL},
|
||||
{B_BOOL_TYPE, "disabled", NULL},
|
||||
{B_MESSAGE_TYPE, "address", kInterfaceAddressTemplate},
|
||||
{B_INT32_TYPE, "flags", NULL},
|
||||
{B_INT32_TYPE, "metric", NULL},
|
||||
@ -87,8 +87,6 @@ const static settings_template kServicesTemplate[] = {
|
||||
|
||||
|
||||
Settings::Settings()
|
||||
:
|
||||
fUpdated(false)
|
||||
{
|
||||
_Load();
|
||||
}
|
||||
@ -96,15 +94,6 @@ Settings::Settings()
|
||||
|
||||
Settings::~Settings()
|
||||
{
|
||||
// only save the settings if something has changed
|
||||
if (!fUpdated)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
BFile file;
|
||||
if (_Open(&file, B_CREATE_FILE | B_WRITE_ONLY) != B_OK)
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -260,8 +249,10 @@ Settings::_ConvertFromDriverSettings(const char* name,
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
|
||||
const driver_settings* settings = get_driver_settings(handle);
|
||||
if (settings != NULL)
|
||||
status = _ConvertFromDriverSettings(*settings, settingsTemplate, message);
|
||||
if (settings != NULL) {
|
||||
status = _ConvertFromDriverSettings(*settings, settingsTemplate,
|
||||
message);
|
||||
}
|
||||
|
||||
unload_driver_settings(handle);
|
||||
return status;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2006-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -19,48 +19,63 @@ struct settings_template;
|
||||
|
||||
|
||||
class Settings {
|
||||
public:
|
||||
Settings();
|
||||
~Settings();
|
||||
public:
|
||||
Settings();
|
||||
~Settings();
|
||||
|
||||
status_t GetNextInterface(uint32& cookie, BMessage& interface);
|
||||
status_t GetNextService(uint32& cookie, BMessage& service);
|
||||
const BMessage& Services() const;
|
||||
status_t GetNextInterface(uint32& cookie,
|
||||
BMessage& interface);
|
||||
status_t GetNextService(uint32& cookie,
|
||||
BMessage& service);
|
||||
const BMessage& Services() const;
|
||||
|
||||
status_t StartMonitoring(const BMessenger& target);
|
||||
status_t StopMonitoring(const BMessenger& target);
|
||||
status_t StartMonitoring(const BMessenger& target);
|
||||
status_t StopMonitoring(const BMessenger& target);
|
||||
|
||||
status_t Update(BMessage* message);
|
||||
status_t Update(BMessage* message);
|
||||
|
||||
private:
|
||||
status_t _Load(const char* name = NULL, uint32* _type = NULL);
|
||||
status_t _GetPath(const char* name, BPath& path);
|
||||
private:
|
||||
status_t _Load(const char* name = NULL,
|
||||
uint32* _type = NULL);
|
||||
status_t _GetPath(const char* name, BPath& path);
|
||||
|
||||
status_t _StartWatching(const char* name, const BMessenger& target);
|
||||
const settings_template* _FindSettingsTemplate(
|
||||
const settings_template* settingsTemplate, const char* name);
|
||||
const settings_template* _FindParentValueTemplate(
|
||||
const settings_template* settingsTemplate);
|
||||
status_t _AddParameter(const driver_parameter& parameter,
|
||||
const char* name, uint32 type, BMessage& message);
|
||||
status_t _StartWatching(const char* name,
|
||||
const BMessenger& target);
|
||||
const settings_template* _FindSettingsTemplate(
|
||||
const settings_template* settingsTemplate,
|
||||
const char* name);
|
||||
const settings_template* _FindParentValueTemplate(
|
||||
const settings_template* settingsTemplate);
|
||||
status_t _AddParameter(const driver_parameter& parameter,
|
||||
const char* name, uint32 type,
|
||||
BMessage& message);
|
||||
|
||||
status_t _ConvertFromDriverParameter(const driver_parameter& parameter,
|
||||
const settings_template* settingsTemplate, BMessage& message);
|
||||
status_t _ConvertFromDriverSettings(const driver_settings& settings,
|
||||
const settings_template* settingsTemplate, BMessage& message);
|
||||
status_t _ConvertFromDriverSettings(const char* path,
|
||||
const settings_template* settingsTemplate, BMessage& message);
|
||||
status_t _ConvertFromDriverParameter(
|
||||
const driver_parameter& parameter,
|
||||
const settings_template* settingsTemplate,
|
||||
BMessage& message);
|
||||
status_t _ConvertFromDriverSettings(
|
||||
const driver_settings& settings,
|
||||
const settings_template* settingsTemplate,
|
||||
BMessage& message);
|
||||
status_t _ConvertFromDriverSettings(const char* path,
|
||||
const settings_template* settingsTemplate,
|
||||
BMessage& message);
|
||||
|
||||
bool _IsWatching(const BMessenger& target) const { return fListener == target; }
|
||||
bool _IsWatching() const { return fListener.IsValid(); }
|
||||
bool _IsWatching(const BMessenger& target) const
|
||||
{ return fListener == target; }
|
||||
bool _IsWatching() const
|
||||
{ return fListener.IsValid(); }
|
||||
|
||||
BMessenger fListener;
|
||||
BMessage fInterfaces;
|
||||
BMessage fServices;
|
||||
bool fUpdated;
|
||||
private:
|
||||
BMessenger fListener;
|
||||
BMessage fInterfaces;
|
||||
BMessage fServices;
|
||||
};
|
||||
|
||||
|
||||
static const uint32 kMsgInterfaceSettingsUpdated = 'SUif';
|
||||
static const uint32 kMsgServiceSettingsUpdated = 'SUsv';
|
||||
|
||||
|
||||
#endif // SETTINGS_H
|
||||
|
Loading…
Reference in New Issue
Block a user