App Server now saves/restores ui_color settings.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24225 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2008-03-04 01:19:04 +00:00
parent e58b9cf283
commit 676308a602
2 changed files with 29 additions and 1 deletions

View File

@ -20,6 +20,8 @@ struct server_read_only_memory {
};
// NOTE: these functions must be kept in sync with InterfaceDefs.h color_which!
static inline int32
color_which_to_index(color_which which)
{
@ -32,4 +34,17 @@ color_which_to_index(color_which which)
return -1;
}
static inline color_which
index_to_color_which(int32 index)
{
if (index >= 0 && index < kNumColors) {
if ((color_which)index < B_WINDOW_INACTIVE_TEXT_COLOR)
return (color_which)(index + 1);
else
return (color_which)(index + B_SUCCESS_COLOR - B_WINDOW_INACTIVE_TEXT_COLOR);
}
return (color_which)-1;
}
#endif /* SERVER_READ_ONLY_MEMORY_H */

View File

@ -216,6 +216,13 @@ DesktopSettingsPrivate::_Load()
bool triggersAlwaysShown;
if (settings.FindBool("triggers always shown", &triggersAlwaysShown) == B_OK)
fMenuInfo.triggers_always_shown = triggersAlwaysShown;
char colorName[12];
for (int32 i = 0; i < kNumColors; i++) {
snprintf(colorName, sizeof(colorName), "color%ld", index_to_color_which(i));
settings.FindInt32(colorName, (int32*)&fShared.colors[i]);
}
}
}
@ -313,7 +320,13 @@ DesktopSettingsPrivate::Save(uint32 mask)
settings.AddInt32("separator", fMenuInfo.separator);
settings.AddBool("click to open", fMenuInfo.click_to_open);
settings.AddBool("triggers always shown", fMenuInfo.triggers_always_shown);
// TODO: more appearance settings
char colorName[12];
for (int32 i = 0; i < kNumColors; i++) {
snprintf(colorName, sizeof(colorName), "color%ld", index_to_color_which(i));
settings.AddInt32(colorName, (const int32&)fShared.colors[i]);
}
BFile file;
status = file.SetTo(path.Path(), B_CREATE_FILE | B_ERASE_FILE | B_READ_WRITE);