save timestamp for non-existent menu file, in case user creates one

This commit is contained in:
Mark Tiefenbruck 2008-05-01 01:22:16 -07:00
parent 2c3f266c74
commit 50024d32bc
3 changed files with 11 additions and 10 deletions

View file

@ -1,5 +1,8 @@
(Format: Year/Month/Day)
Changes for 1.0.1:
*08/04/31:
* Notice when user replaces a non-existent menu file (Mark)
fluxbox.cc Screen.cc
*08/04/30:
* Don't allow empty root menu (Mark)
Screen.cc

View file

@ -1536,6 +1536,9 @@ void BScreen::initMenu() {
restart_fb);
m_rootmenu->insert(_FB_XTEXT(Menu, Exit, "Exit", "Exit command"),
exit_fb);
// still save the menu filename, in case it becomes valid later
if (!fb->getMenuFilename().empty())
fb->saveMenuFilename(fb->getMenuFilename().c_str());
}
m_rootmenu->updateMenu();

View file

@ -1476,10 +1476,7 @@ bool Fluxbox::menuTimestampsChanged() const {
time_t timestamp = FbTk::FileUtil::getLastStatusChangeTimestamp((*it)->filename.c_str());
if (timestamp >= 0) {
if (timestamp != (*it)->timestamp)
return true;
} else
if (timestamp != (*it)->timestamp)
return true;
}
@ -1529,14 +1526,12 @@ void Fluxbox::saveMenuFilename(const char *filename) {
if (! found) {
time_t timestamp = FbTk::FileUtil::getLastStatusChangeTimestamp(filename);
if (timestamp >= 0) {
MenuTimestamp *ts = new MenuTimestamp;
MenuTimestamp *ts = new MenuTimestamp;
ts->filename = filename;
ts->timestamp = timestamp;
ts->filename = filename;
ts->timestamp = timestamp;
m_menu_timestamps.push_back(ts);
}
m_menu_timestamps.push_back(ts);
}
}