diff options
Diffstat (limited to 'src/menu.cpp')
-rw-r--r-- | src/menu.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/menu.cpp b/src/menu.cpp index 7f41b22..50a0087 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -239,16 +239,23 @@ private: { int n = 0; const int MAX_APPTS = 5; + const auto now = m_state->clock->localtime(); std::set<std::string> added; for (const auto& appt : m_state->planner->upcoming.get()) { + // don't show too many if (n++ >= MAX_APPTS) break; + // don't show duplicates if (added.count(appt.uid)) continue; + // don't show appointments that have already started + if ((appt.begin<now) || DateTime::is_same_minute(now,appt.begin)) + continue; + added.insert(appt.uid); GDateTime* begin = appt.begin(); |