aboutsummaryrefslogtreecommitdiff
path: root/src/actions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions.cpp')
-rw-r--r--src/actions.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/actions.cpp b/src/actions.cpp
index 315340a..18b99e8 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Canonical Ltd.
+ * Copyright 2021 Robert Tari
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
@@ -15,11 +16,12 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <datetime/actions.h>
#include <datetime/utils.h> // split_settings_location()
-
+#include <algorithm>
#include <glib.h>
#include <gio/gio.h>
@@ -50,16 +52,18 @@ DateTime datetime_from_timet_variant(GVariant* v)
bool lookup_appointment_by_uid(const std::shared_ptr<State>& state, const gchar* uid, Appointment& setme)
{
- for(const auto& appt : state->calendar_upcoming->appointments().get())
+ bool bRet = false;
+
+ std::for_each(state->calendar_upcoming->appointments().get().begin(), state->calendar_upcoming->appointments().get().end(), [uid, &setme, &bRet](const Appointment& appt)
{
if (appt.uid == uid)
{
setme = appt;
- return true;
+ bRet = true;
}
- }
+ });
- return false;
+ return bRet;
}
void on_appointment_activated (GSimpleAction*, GVariant *vdata, gpointer gself)
@@ -138,7 +142,10 @@ GVariant* create_calendar_state(const std::shared_ptr<State>& state)
{
gboolean days[32] = { 0 };
for (const auto& appt : state->calendar_month->appointments().get())
- days[appt.begin.day_of_month()] = true;
+ if (!appt.is_alarm() || state->settings->show_alarms.get())
+ {
+ days[appt.begin.day_of_month()] = true;
+ }
GVariantBuilder day_builder;
g_variant_builder_init(&day_builder, G_VARIANT_TYPE("ai"));