From 95bc85d108e3564d98f26b7ad17fcc72b2966371 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 7 Dec 2014 20:38:44 -0600 Subject: ensure that disabled alarms aren't shown in indicator-datetime and that notifications aren't shown for them. --- src/engine-eds.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/engine-eds.cpp') diff --git a/src/engine-eds.cpp b/src/engine-eds.cpp index c282a5c..23e2883 100644 --- a/src/engine-eds.cpp +++ b/src/engine-eds.cpp @@ -33,6 +33,9 @@ namespace unity { namespace indicator { namespace datetime { +static constexpr char const * TAG_ALARM {"x-canonical-alarm"}; +static constexpr char const * TAG_DISABLED {"x-canonical-disabled"}; + /**** ***** ****/ @@ -375,8 +378,6 @@ private: static_cast(gself)->set_dirty_soon(); } -private: - typedef std::function&)> appointment_func; struct Task @@ -425,7 +426,22 @@ private: uid, (int)status); + // look for the in-house tags + bool disabled = false; + Appointment::Type type = Appointment::EVENT; + GSList * categ_list = nullptr; + e_cal_component_get_categories_list (component, &categ_list); + for (GSList * l=categ_list; l!=nullptr; l=l->next) { + auto tag = static_cast(l->data); + if (!g_strcmp0(tag, TAG_ALARM)) + type = Appointment::UBUNTU_ALARM; + if (!g_strcmp0(tag, TAG_DISABLED)) + disabled = true; + } + e_cal_component_free_categories_list(categ_list); + if ((uid != nullptr) && + (!disabled) && (status != ICAL_STATUS_COMPLETED) && (status != ICAL_STATUS_CANCELLED)) { @@ -441,12 +457,12 @@ private: appointment.end = end_dt; appointment.color = subtask->color; appointment.uid = uid; + appointment.type = type; // Look through all of this component's alarms // for DISPLAY or AUDIO url attachments. // If we find any, use them for appointment.url and audio_sound auto alarm_uids = e_cal_component_get_alarm_uids(component); - appointment.has_alarms = alarm_uids != nullptr; for(auto walk=alarm_uids; appointment.url.empty() && walk!=nullptr; walk=walk->next) { auto alarm = e_cal_component_get_alarm(component, static_cast(walk->data)); -- cgit v1.2.3