Add proper checks of flags for apply/save.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23732 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2f3f3d79b5
commit
24e3a405c4
@ -124,7 +124,9 @@ status_t BackgroundThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
ssize_t flatSize;
|
||||
char *pAttr;
|
||||
|
||||
(void)flags;
|
||||
if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL))
|
||||
return B_OK;
|
||||
|
||||
err = MyMessage(theme, backgrounds);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -99,7 +99,6 @@ status_t BeIDEThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
BPath beideSPath;
|
||||
rgb_color col;
|
||||
|
||||
(void)flags;
|
||||
err = theme.FindMessage(Z_THEME_UI_SETTINGS, &uisettings);
|
||||
if (err)
|
||||
return err;
|
||||
@ -118,11 +117,11 @@ status_t BeIDEThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
if (FindRGBColor(uisettings, B_UI_MENU_SELECTED_BACKGROUND_COLOR, 0, &col) >= B_OK)
|
||||
bp.selbg = col;
|
||||
|
||||
if (true/* || flags & UI_THEME_SETTINGS_SAVE*/) {
|
||||
if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) {
|
||||
err = beideSettings.WriteAttr("AppEditorPrefs", 'rPWM', 0LL, &bp,
|
||||
sizeof(struct beide_editor_pref));
|
||||
}
|
||||
if (true/* || flags & UI_THEME_SETTINGS_APPLY*/) {
|
||||
if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) {
|
||||
BList teamList;
|
||||
app_info ainfo;
|
||||
int32 count, i;
|
||||
|
@ -118,12 +118,20 @@ status_t UISettingsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
BMessage uisettings;
|
||||
BFont fnt;
|
||||
status_t err;
|
||||
uint32 uiflags = 0;
|
||||
|
||||
(void)flags;
|
||||
err = MyMessage(theme, uisettings);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE)
|
||||
uiflags |= B_SAVE_UI_SETTINGS;
|
||||
if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY)
|
||||
uiflags |= B_APPLY_UI_SETTINGS;
|
||||
if (!uiflags)
|
||||
return B_OK;
|
||||
|
||||
// hack for legacy fonts
|
||||
err = uisettings.FindFlat("be:f:be_plain_font", &fnt);
|
||||
uisettings.RemoveName("be:f:be_plain_font");
|
||||
@ -140,9 +148,7 @@ status_t UISettingsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
if (err == B_OK)
|
||||
BFont::SetStandardFont(B_FIXED_FONT, &fnt);
|
||||
|
||||
|
||||
update_ui_settings(uisettings);
|
||||
|
||||
update_ui_settings(uisettings, uiflags);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
@ -97,7 +97,9 @@ status_t DecorThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
BString decorName;
|
||||
status_t err;
|
||||
|
||||
(void)flags;
|
||||
if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL))
|
||||
return B_OK;
|
||||
|
||||
err = MyMessage(theme, window_decor);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -99,7 +99,9 @@ status_t DeskbarThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
bool expanded = true;
|
||||
BDeskbar db;
|
||||
|
||||
(void)flags;
|
||||
if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL))
|
||||
return B_OK;
|
||||
|
||||
err = MyMessage(theme, deskbar);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -110,12 +110,12 @@ status_t EddieThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
BFile EddieSettings(EddieSPath.Path(), B_WRITE_ONLY|B_OPEN_AT_END);
|
||||
if (EddieSettings.InitCheck() < B_OK)
|
||||
return EddieSettings.InitCheck();
|
||||
if (true/* || flags & UI_THEME_SETTINGS_SAVE*/) {
|
||||
if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) {
|
||||
if (EddieSettings.Write(text.String(), strlen(text.String())) < B_OK)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
if (true/* || flags & UI_THEME_SETTINGS_APPLY*/) {
|
||||
if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) {
|
||||
|
||||
}
|
||||
return B_OK;
|
||||
|
@ -187,7 +187,9 @@ status_t UISettingsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
int i;
|
||||
FENTRY;
|
||||
|
||||
(void)flags;
|
||||
if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL))
|
||||
return B_OK;
|
||||
|
||||
err = MyMessage(theme, uisettings);
|
||||
DERR(err);
|
||||
if (err)
|
||||
|
@ -124,7 +124,9 @@ status_t DecorThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
BString decorName;
|
||||
status_t err;
|
||||
|
||||
(void)flags;
|
||||
if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL))
|
||||
return B_OK;
|
||||
|
||||
err = MyMessage(theme, window_decor);
|
||||
DERR(err);
|
||||
if (err)
|
||||
|
6
3rdparty/mmu_man/themes/addons/PeAddon.cpp
vendored
6
3rdparty/mmu_man/themes/addons/PeAddon.cpp
vendored
@ -83,7 +83,6 @@ status_t PeThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
BString text;
|
||||
char buffer[10];
|
||||
|
||||
(void)flags;
|
||||
err = theme.FindMessage(Z_THEME_UI_SETTINGS, &uisettings);
|
||||
if (err)
|
||||
return err;
|
||||
@ -110,12 +109,13 @@ status_t PeThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
BFile PeSettings(PeSPath.Path(), B_WRITE_ONLY|B_OPEN_AT_END);
|
||||
if (PeSettings.InitCheck() < B_OK)
|
||||
return PeSettings.InitCheck();
|
||||
if (true/* || flags & UI_THEME_SETTINGS_SAVE*/) {
|
||||
|
||||
if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) {
|
||||
if (PeSettings.Write(text.String(), strlen(text.String())) < B_OK)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
if (true/* || flags & UI_THEME_SETTINGS_APPLY*/) {
|
||||
if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) {
|
||||
|
||||
}
|
||||
return B_OK;
|
||||
|
@ -104,7 +104,9 @@ status_t ScreensaverThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
BMessage settings;
|
||||
BMessage modsettings;
|
||||
|
||||
(void)flags;
|
||||
if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL))
|
||||
return B_OK;
|
||||
|
||||
err = MyMessage(theme, screensaver);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -76,7 +76,6 @@ status_t SoundplayThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
rgb_color panelcol;
|
||||
int32 wincnt = 1;
|
||||
|
||||
(void)flags;
|
||||
err = theme.FindMessage(Z_THEME_UI_SETTINGS, &uisettings);
|
||||
if (err)
|
||||
return err;
|
||||
@ -84,6 +83,11 @@ status_t SoundplayThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
if (FindRGBColor(uisettings, B_UI_PANEL_BACKGROUND_COLOR, 0, &panelcol) < B_OK)
|
||||
panelcol = make_color(216,216,216,255);
|
||||
|
||||
if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) {
|
||||
// WRITEME
|
||||
}
|
||||
|
||||
if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) {
|
||||
BMessenger msgr("application/x-vnd.marcone-soundplay");
|
||||
BMessage command(B_COUNT_PROPERTIES);
|
||||
BMessage answer;
|
||||
@ -102,6 +106,7 @@ status_t SoundplayThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
wmsg.AddSpecifier("Window", i);
|
||||
msgr.SendMessage(&wmsg, (BHandler *)NULL, 2000000LL);
|
||||
}
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
@ -112,7 +112,9 @@ status_t SoundsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
int32 field_count;
|
||||
BMessage msg;
|
||||
|
||||
(void)flags;
|
||||
if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL))
|
||||
return B_OK;
|
||||
|
||||
err = MyMessage(theme, sounds);
|
||||
if (err)
|
||||
return err;
|
||||
|
13
3rdparty/mmu_man/themes/addons/TerminalAddon.cpp
vendored
13
3rdparty/mmu_man/themes/addons/TerminalAddon.cpp
vendored
@ -258,7 +258,6 @@ status_t TerminalThemesAddon::ApplyThemeR5(BMessage &theme, uint32 flags)
|
||||
status_t err;
|
||||
struct termprefs tp;
|
||||
|
||||
(void)flags;
|
||||
err = MyMessage(theme, termpref);
|
||||
if (err)
|
||||
return err;
|
||||
@ -303,7 +302,7 @@ status_t TerminalThemesAddon::ApplyThemeR5(BMessage &theme, uint32 flags)
|
||||
if (termpref.FindInt32(TP_ENCODING, (int32 *)&tp.p.encoding) != B_OK)
|
||||
tp.p.encoding = 0; // UTF-8
|
||||
|
||||
if (flags & UI_THEME_SETTINGS_SAVE) {
|
||||
if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) {
|
||||
BPath pTermPref;
|
||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &pTermPref) < B_OK)
|
||||
return EINVAL;
|
||||
@ -317,7 +316,8 @@ status_t TerminalThemesAddon::ApplyThemeR5(BMessage &theme, uint32 flags)
|
||||
if (ni.InitCheck() == B_OK)
|
||||
ni.SetType("application/x-vnd.Be-pref");
|
||||
}
|
||||
if (flags & UI_THEME_SETTINGS_APPLY) {
|
||||
|
||||
if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) {
|
||||
BList teamList;
|
||||
app_info ainfo;
|
||||
int32 count, i;
|
||||
@ -404,7 +404,6 @@ status_t TerminalThemesAddon::ApplyThemeHaiku(BMessage &theme, uint32 flags)
|
||||
rgb_color color;
|
||||
BString s;
|
||||
|
||||
(void)flags;
|
||||
err = MyMessage(theme, termpref);
|
||||
if (err)
|
||||
return err;
|
||||
@ -489,11 +488,11 @@ status_t TerminalThemesAddon::ApplyThemeHaiku(BMessage &theme, uint32 flags)
|
||||
//XXX: shouldn't really be touched...
|
||||
//lines.AddString(, s.String());
|
||||
|
||||
|
||||
if (flags & UI_THEME_SETTINGS_SAVE) {
|
||||
if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) {
|
||||
SaveHaikuTerminalSettings(lines);
|
||||
}
|
||||
if (flags & UI_THEME_SETTINGS_APPLY) {
|
||||
|
||||
if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) {
|
||||
BList teamList;
|
||||
app_info ainfo;
|
||||
int32 count, i;
|
||||
|
@ -99,7 +99,9 @@ status_t WinampSkinThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
|
||||
BString name;
|
||||
status_t err;
|
||||
|
||||
(void)flags;
|
||||
if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL))
|
||||
return B_OK;
|
||||
|
||||
err = MyMessage(theme, skin);
|
||||
if (err)
|
||||
return err;
|
||||
|
Loading…
Reference in New Issue
Block a user