aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-02-25 16:58:25 +0000
committerCI bot <ps-jenkins@lists.canonical.com>2014-02-25 16:58:25 +0000
commit653c7072de11219f4f6081a6bee71158602d01ab (patch)
treeef92c6494b7b9308cf51e65eb10bb1870f21d726
parentd31981afaf5f38cb3c07e1d4bc60a3c5b93104d0 (diff)
parent936cd1a7c4d3bee2e53f8aa15f585b9446816c26 (diff)
downloadayatana-indicator-datetime-653c7072de11219f4f6081a6bee71158602d01ab.tar.gz
ayatana-indicator-datetime-653c7072de11219f4f6081a6bee71158602d01ab.tar.bz2
ayatana-indicator-datetime-653c7072de11219f4f6081a6bee71158602d01ab.zip
In the alarms menu, don't let iterations of recurring events drown out everything else.
-rw-r--r--src/menu.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/menu.cpp b/src/menu.cpp
index b2562db..797757f 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -261,20 +261,19 @@ private:
void add_appointments(GMenu* menu, Profile profile)
{
- int n = 0;
const int MAX_APPTS = 5;
std::set<std::string> added;
for (const auto& appt : m_upcoming)
{
- // don't show too many
- if (n++ >= MAX_APPTS)
- break;
-
// don't show duplicates
if (added.count(appt.uid))
continue;
+ // don't show too many
+ if (g_menu_model_get_n_items (G_MENU_MODEL(menu)) >= MAX_APPTS)
+ break;
+
added.insert(appt.uid);
GDateTime* begin = appt.begin();