diff options
author | fluxgen <fluxgen> | 2003-05-13 00:20:49 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-05-13 00:20:49 (GMT) |
commit | 2014d60ef394006ea916907226643200bbc86dc6 (patch) | |
tree | 4fc6db3df9277650ab4848b19bc8d10ef609fc66 /src/fluxbox.cc | |
parent | cffa01d79bc4b4c4e5bdb8a306b4cd22147533ac (diff) | |
download | fluxbox-2014d60ef394006ea916907226643200bbc86dc6.zip fluxbox-2014d60ef394006ea916907226643200bbc86dc6.tar.bz2 |
fixed menu timestamps stuff
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r-- | src/fluxbox.cc | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index ab35aff..c26f766 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: fluxbox.cc,v 1.142 2003/05/12 11:14:47 fluxgen Exp $ | 25 | // $Id: fluxbox.cc,v 1.143 2003/05/13 00:20:49 fluxgen Exp $ |
26 | 26 | ||
27 | #include "fluxbox.hh" | 27 | #include "fluxbox.hh" |
28 | 28 | ||
@@ -559,12 +559,8 @@ Fluxbox::~Fluxbox() { | |||
559 | delete m_atomhandler.back(); | 559 | delete m_atomhandler.back(); |
560 | m_atomhandler.pop_back(); | 560 | m_atomhandler.pop_back(); |
561 | } | 561 | } |
562 | 562 | ||
563 | std::list<MenuTimestamp *>::iterator it = m_menu_timestamps.begin(); | 563 | clearMenuFilenames(); |
564 | std::list<MenuTimestamp *>::iterator it_end = m_menu_timestamps.end(); | ||
565 | for (; it != it_end; ++it) | ||
566 | delete *it; | ||
567 | |||
568 | } | 564 | } |
569 | 565 | ||
570 | void Fluxbox::eventLoop() { | 566 | void Fluxbox::eventLoop() { |
@@ -2227,18 +2223,12 @@ void Fluxbox::real_reconfigure() { | |||
2227 | if (old_blackboxrc) | 2223 | if (old_blackboxrc) |
2228 | XrmDestroyDatabase(old_blackboxrc); | 2224 | XrmDestroyDatabase(old_blackboxrc); |
2229 | 2225 | ||
2230 | std::list<MenuTimestamp *>::iterator it = m_menu_timestamps.begin(); | ||
2231 | std::list<MenuTimestamp *>::iterator it_end = m_menu_timestamps.end(); | ||
2232 | for (; it != it_end; ++it) | ||
2233 | delete *it; | ||
2234 | |||
2235 | m_menu_timestamps.erase(m_menu_timestamps.begin(), m_menu_timestamps.end()); | ||
2236 | 2226 | ||
2237 | ScreenList::iterator sit = m_screen_list.begin(); | 2227 | ScreenList::iterator sit = m_screen_list.begin(); |
2238 | ScreenList::iterator sit_end = m_screen_list.end(); | 2228 | ScreenList::iterator sit_end = m_screen_list.end(); |
2239 | for (; sit != sit_end; ++sit) | 2229 | for (; sit != sit_end; ++sit) |
2240 | (*sit)->reconfigure(); | 2230 | (*sit)->reconfigure(); |
2241 | 2231 | ||
2242 | //reconfigure keys | 2232 | //reconfigure keys |
2243 | m_key->reconfigure(StringUtil::expandFilename(*m_rc_keyfile).c_str()); | 2233 | m_key->reconfigure(StringUtil::expandFilename(*m_rc_keyfile).c_str()); |
2244 | 2234 | ||
@@ -2246,21 +2236,26 @@ void Fluxbox::real_reconfigure() { | |||
2246 | } | 2236 | } |
2247 | 2237 | ||
2248 | 2238 | ||
2249 | void Fluxbox::checkMenu() { | 2239 | bool Fluxbox::menuTimestampsChanged() const { |
2250 | bool reread = false; | 2240 | std::list<MenuTimestamp *>::const_iterator it = m_menu_timestamps.begin(); |
2251 | std::list<MenuTimestamp *>::iterator it = m_menu_timestamps.begin(); | 2241 | std::list<MenuTimestamp *>::const_iterator it_end = m_menu_timestamps.end(); |
2252 | std::list<MenuTimestamp *>::iterator it_end = m_menu_timestamps.end(); | 2242 | for (; it != it_end; ++it) { |
2253 | for (; it != it_end && (! reread); ++it) { | ||
2254 | struct stat buf; | 2243 | struct stat buf; |
2255 | 2244 | ||
2256 | if (! stat((*it)->filename.c_str(), &buf)) { | 2245 | if (! stat((*it)->filename.c_str(), &buf)) { |
2257 | if ((*it)->timestamp != buf.st_ctime) | 2246 | if ((*it)->timestamp != buf.st_ctime) |
2258 | reread = true; | 2247 | return true; |
2259 | } else | 2248 | } else |
2260 | reread = true; | 2249 | return true; |
2261 | } | 2250 | } |
2262 | 2251 | ||
2263 | if (reread) rereadMenu(); | 2252 | // no timestamp changed |
2253 | return false; | ||
2254 | } | ||
2255 | |||
2256 | void Fluxbox::checkMenu() { | ||
2257 | if (menuTimestampsChanged()) | ||
2258 | rereadMenu(); | ||
2264 | } | 2259 | } |
2265 | 2260 | ||
2266 | 2261 | ||
@@ -2316,6 +2311,14 @@ void Fluxbox::saveMenuFilename(const char *filename) { | |||
2316 | } | 2311 | } |
2317 | } | 2312 | } |
2318 | 2313 | ||
2314 | void Fluxbox::clearMenuFilenames() { | ||
2315 | std::list<MenuTimestamp *>::iterator it = m_menu_timestamps.begin(); | ||
2316 | std::list<MenuTimestamp *>::iterator it_end = m_menu_timestamps.end(); | ||
2317 | for (; it != it_end; ++it) | ||
2318 | delete *it; | ||
2319 | |||
2320 | m_menu_timestamps.erase(m_menu_timestamps.begin(), m_menu_timestamps.end()); | ||
2321 | } | ||
2319 | 2322 | ||
2320 | void Fluxbox::timeout() { | 2323 | void Fluxbox::timeout() { |
2321 | if (m_reconfigure_wait) | 2324 | if (m_reconfigure_wait) |