aboutsummaryrefslogtreecommitdiff
path: root/src/engine-eds.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-12-07 20:38:44 -0600
committerCharles Kerr <charles.kerr@canonical.com>2014-12-07 20:38:44 -0600
commit95bc85d108e3564d98f26b7ad17fcc72b2966371 (patch)
treead0d9724caab0b7badf49cd668ff22fce342b4ae /src/engine-eds.cpp
parent56e88207113e57eae7b24a718fa1ab177c6c9367 (diff)
downloadayatana-indicator-datetime-95bc85d108e3564d98f26b7ad17fcc72b2966371.tar.gz
ayatana-indicator-datetime-95bc85d108e3564d98f26b7ad17fcc72b2966371.tar.bz2
ayatana-indicator-datetime-95bc85d108e3564d98f26b7ad17fcc72b2966371.zip
ensure that disabled alarms aren't shown in indicator-datetime and that notifications aren't shown for them.
Diffstat (limited to 'src/engine-eds.cpp')
-rw-r--r--src/engine-eds.cpp22
1 files changed, 19 insertions, 3 deletions
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<Impl*>(gself)->set_dirty_soon();
}
-private:
-
typedef std::function<void(const std::vector<Appointment>&)> 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<const char*>(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<const char*>(walk->data));