don't save rc in SetStyle command if loading the style fails

This commit is contained in:
Matteo Galiazzo 2008-05-14 01:40:53 -07:00 committed by Mark Tiefenbruck
parent 7f45bae462
commit af0f241954
2 changed files with 7 additions and 4 deletions

View file

@ -274,10 +274,11 @@ SetStyleCmd::SetStyleCmd(const string &filename):m_filename(filename) {
} }
void SetStyleCmd::execute() { void SetStyleCmd::execute() {
Fluxbox::instance()->saveStyleFilename(m_filename.c_str()); if (FbTk::ThemeManager::instance().load(m_filename,
Fluxbox::instance()->save_rc(); Fluxbox::instance()->getStyleOverlayFilename())) {
FbTk::ThemeManager::instance().load(m_filename, Fluxbox::instance()->saveStyleFilename(m_filename.c_str());
Fluxbox::instance()->getStyleOverlayFilename()); Fluxbox::instance()->save_rc();
}
} }
REGISTER_COMMAND_WITH_ARGS(keymode, FbCommands::KeyModeCmd, void); REGISTER_COMMAND_WITH_ARGS(keymode, FbCommands::KeyModeCmd, void);

View file

@ -117,6 +117,8 @@ bool ThemeManager::unregisterTheme(Theme &tm) {
bool ThemeManager::load(const string &filename, bool ThemeManager::load(const string &filename,
const string &overlay_filename, int screen_num) { const string &overlay_filename, int screen_num) {
string location = FbTk::StringUtil::expandFilename(filename); string location = FbTk::StringUtil::expandFilename(filename);
StringUtil::removeTrailingWhitespace(location);
StringUtil::removeFirstWhitespace(location);
string prefix = ""; string prefix = "";
if (FileUtil::isDirectory(filename.c_str())) { if (FileUtil::isDirectory(filename.c_str())) {