diff --git a/headers/private/app/ServerReadOnlyMemory.h b/headers/private/app/ServerReadOnlyMemory.h index 534d6c67ff..e0bb817085 100644 --- a/headers/private/app/ServerReadOnlyMemory.h +++ b/headers/private/app/ServerReadOnlyMemory.h @@ -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 */ diff --git a/src/servers/app/DesktopSettings.cpp b/src/servers/app/DesktopSettings.cpp index 5657d6a9e3..9f13aa5505 100644 --- a/src/servers/app/DesktopSettings.cpp +++ b/src/servers/app/DesktopSettings.cpp @@ -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);