* Cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37094 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-06-11 07:29:16 +00:00
parent fc0d49483e
commit be816234e8
2 changed files with 53 additions and 47 deletions

View File

@ -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:
@ -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;

View File

@ -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:
@ -23,8 +23,10 @@ class Settings {
Settings();
~Settings();
status_t GetNextInterface(uint32& cookie, BMessage& interface);
status_t GetNextService(uint32& cookie, BMessage& service);
status_t GetNextInterface(uint32& cookie,
BMessage& interface);
status_t GetNextService(uint32& cookie,
BMessage& service);
const BMessage& Services() const;
status_t StartMonitoring(const BMessenger& target);
@ -33,34 +35,47 @@ class Settings {
status_t Update(BMessage* message);
private:
status_t _Load(const char* name = NULL, uint32* _type = NULL);
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);
status_t _StartWatching(const char* name,
const BMessenger& target);
const settings_template* _FindSettingsTemplate(
const settings_template* settingsTemplate, const char* name);
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);
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 _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);
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(); }
private:
BMessenger fListener;
BMessage fInterfaces;
BMessage fServices;
bool fUpdated;
};
static const uint32 kMsgInterfaceSettingsUpdated = 'SUif';
static const uint32 kMsgServiceSettingsUpdated = 'SUsv';
#endif // SETTINGS_H