aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-10-28 06:06:45 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-10-28 08:19:49 +0200
commit0492e95dbf6a1f6285a4701379adb6b7d8553d6b (patch)
treed35fc8583d82f4825a5da9fd0ebc4a7dc9e6bb70 /src
parent2a52d61b410b9d294c479ad53a06fb6f830b9605 (diff)
downloadayatana-indicator-datetime-0492e95dbf6a1f6285a4701379adb6b7d8553d6b.tar.gz
ayatana-indicator-datetime-0492e95dbf6a1f6285a4701379adb6b7d8553d6b.tar.bz2
ayatana-indicator-datetime-0492e95dbf6a1f6285a4701379adb6b7d8553d6b.zip
Drop the 'ubuntu' prefix from the alarm types and functions
Diffstat (limited to 'src')
-rw-r--r--src/actions-live.cpp4
-rw-r--r--src/engine-eds.cpp12
-rw-r--r--src/main.cpp4
-rw-r--r--src/menu.cpp10
-rw-r--r--src/snap.cpp30
5 files changed, 34 insertions, 26 deletions
diff --git a/src/actions-live.cpp b/src/actions-live.cpp
index 50add68..81bdb70 100644
--- a/src/actions-live.cpp
+++ b/src/actions-live.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,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <datetime/dbus-shared.h>
@@ -155,7 +157,7 @@ std::string LiveActions::open_appointment(const Appointment& appt, const DateTim
}
else switch (appt.type)
{
- case Appointment::UBUNTU_ALARM:
+ case Appointment::ALARM:
sReturn = open_alarm_app();
break;
diff --git a/src/engine-eds.cpp b/src/engine-eds.cpp
index af11f7f..b0a1a0d 100644
--- a/src/engine-eds.cpp
+++ b/src/engine-eds.cpp
@@ -139,9 +139,9 @@ public:
}
}
- void disable_ubuntu_alarm(const Appointment& appointment)
+ void disable_alarm(const Appointment& appointment)
{
- if (appointment.is_ubuntu_alarm())
+ if (appointment.is_alarm())
{
for (auto& kv : m_clients) // find the matching icalcomponent
{
@@ -1081,7 +1081,7 @@ private:
for (GSList * l=categ_list; l!=nullptr; l=l->next) {
auto tag = static_cast<const char*>(l->data);
if (!g_strcmp0(tag, TAG_ALARM))
- baseline.type = Appointment::UBUNTU_ALARM;
+ baseline.type = Appointment::ALARM;
}
g_slist_free_full(categ_list, g_free);
@@ -1141,7 +1141,7 @@ private:
alarm.text = get_alarm_text(a);
if (alarm.audio_url.empty())
- alarm.audio_url = get_alarm_sound_url(a, (baseline.is_ubuntu_alarm() ?
+ alarm.audio_url = get_alarm_sound_url(a, (baseline.is_alarm() ?
"file://" ALARM_DEFAULT_SOUND :
"file://" CALENDAR_DEFAULT_SOUND));
@@ -1280,9 +1280,9 @@ void EdsEngine::get_appointments(const DateTime& begin,
p->get_appointments(begin, end, tz, func);
}
-void EdsEngine::disable_ubuntu_alarm(const Appointment& appointment)
+void EdsEngine::disable_alarm(const Appointment& appointment)
{
- p->disable_ubuntu_alarm(appointment);
+ p->disable_alarm(appointment);
}
/***
diff --git a/src/main.cpp b/src/main.cpp
index 255b62c..279d7be 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,8 +1,10 @@
/*
* Copyright 2013 Canonical Ltd.
+ * Copyright 2021 Robert Tari
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*
* 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
@@ -168,7 +170,7 @@ main(int /*argc*/, char** /*argv*/)
};
auto on_alarm_reached = [&engine, &snap, &on_response](const Appointment& appointment, const Alarm& alarm) {
(*snap)(appointment, alarm, on_response);
- engine->disable_ubuntu_alarm(appointment);
+ engine->disable_alarm(appointment);
};
alarm_queue->alarm_reached().connect(on_alarm_reached);
#endif
diff --git a/src/menu.cpp b/src/menu.cpp
index b1ac75c..ab0bd71 100644
--- a/src/menu.cpp
+++ b/src/menu.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,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <datetime/menu.h>
@@ -401,7 +403,7 @@ private:
g_menu_item_set_attribute (menu_item, "x-ayatana-time", "x", unix_time);
g_menu_item_set_attribute (menu_item, "x-ayatana-time-format", "s", fmt.c_str());
- if (appt.is_ubuntu_alarm())
+ if (appt.is_alarm())
{
g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.alarm");
g_menu_item_set_attribute_value(menu_item, G_MENU_ATTRIBUTE_ICON, get_serialized_alarm_icon());
@@ -598,16 +600,16 @@ protected:
GVariant* create_header_state()
{
// are there alarms?
- bool has_ubuntu_alarms = false;
+ bool has_alarms = false;
for(const auto& appointment : m_upcoming)
- if((has_ubuntu_alarms = appointment.is_ubuntu_alarm()))
+ if((has_alarms = appointment.is_alarm()))
break;
GVariantBuilder b;
g_variant_builder_init(&b, G_VARIANT_TYPE_VARDICT);
g_variant_builder_add(&b, "{sv}", "title", g_variant_new_string (_("Time and Date")));
g_variant_builder_add(&b, "{sv}", "visible", g_variant_new_boolean (TRUE));
- if (has_ubuntu_alarms)
+ if (has_alarms)
{
auto label = m_formatter->header.get();
auto a11y = g_strdup_printf(_("%s (has alarms)"), label.c_str());
diff --git a/src/snap.cpp b/src/snap.cpp
index 0507cc7..eb82b37 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2014 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,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#ifdef HAVE_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS
@@ -91,7 +93,7 @@ public:
response_func on_response)
{
// If calendar notifications are disabled, don't show them
- if (!appointment.is_ubuntu_alarm() && !calendar_notifications_are_enabled()) {
+ if (!appointment.is_alarm() && !calendar_notifications_are_enabled()) {
g_debug("Skipping disabled calendar event '%s' notification", appointment.summary.c_str());
return;
}
@@ -100,19 +102,19 @@ public:
Alarms should require manual intervention to dismiss.
Calendar events are less urgent and shouldn't require manual
intervention and shouldn't loop the sound. */
- const bool interactive = appointment.is_ubuntu_alarm() && m_engine->supports_actions();
+ const bool interactive = appointment.is_alarm() && m_engine->supports_actions();
// force the system to stay awake
std::shared_ptr<ain::Awake> awake;
- if (appointment.is_ubuntu_alarm() || calendar_bubbles_enabled() || calendar_list_enabled()) {
+ if (appointment.is_alarm() || calendar_bubbles_enabled() || calendar_list_enabled()) {
awake = std::make_shared<ain::Awake>(m_system_bus, m_engine->app_name());
}
// calendar events are muted in silent mode; alarm clocks never are
std::shared_ptr<ain::Sound> sound;
- if (appointment.is_ubuntu_alarm() || (calendar_sounds_enabled() && !silent_mode())) {
+ if (appointment.is_alarm() || (calendar_sounds_enabled() && !silent_mode())) {
// create the sound.
- const auto role = appointment.is_ubuntu_alarm() ? "alarm" : "alert";
+ const auto role = appointment.is_alarm() ? "alarm" : "alert";
const auto uri = get_alarm_uri(appointment, alarm, m_settings);
const auto volume = m_settings->alarm_volume.get();
const bool loop = interactive;
@@ -121,12 +123,12 @@ public:
// create the haptic feedback...
std::shared_ptr<ain::Haptic> haptic;
- if (should_vibrate() && (appointment.is_ubuntu_alarm() || calendar_vibrations_enabled())) {
+ if (should_vibrate() && (appointment.is_alarm() || calendar_vibrations_enabled())) {
// when in silent mode should only vibrate if user defined so
if (!silent_mode() || vibrate_in_silent_mode_enabled()) {
const auto haptic_mode = m_settings->alarm_haptic.get();
if (haptic_mode == "pulse")
- haptic = std::make_shared<ain::Haptic>(ain::Haptic::MODE_PULSE, appointment.is_ubuntu_alarm());
+ haptic = std::make_shared<ain::Haptic>(ain::Haptic::MODE_PULSE, appointment.is_alarm());
}
}
@@ -134,7 +136,7 @@ public:
const auto minutes = std::chrono::minutes(m_settings->alarm_duration.get());
ain::Builder b;
b.set_body (appointment.summary);
- b.set_icon_name (appointment.is_ubuntu_alarm() ? "alarm-clock" : "calendar-app");
+ b.set_icon_name (appointment.is_alarm() ? "alarm-clock" : "calendar-app");
b.add_hint (ain::Builder::HINT_NONSHAPED_ICON);
b.set_start_time (appointment.begin.to_unix());
@@ -151,7 +153,7 @@ public:
const auto timestr = appointment.begin.format(timefmt);
const char * titlefmt;
- if (appointment.is_ubuntu_alarm()) {
+ if (appointment.is_alarm()) {
titlefmt = _("Alarm %s");
} else {
titlefmt = _("Event %s");
@@ -176,7 +178,7 @@ public:
b.set_closed_callback([appointment, alarm, on_response, sound, awake, haptic]
(const std::string& action){
Snap::Response response;
- if ((action == ACTION_SNOOZE) || (appointment.is_ubuntu_alarm() && action.empty()))
+ if ((action == ACTION_SNOOZE) || (appointment.is_alarm() && action.empty()))
response = Snap::Response::Snooze;
else if (action == ACTION_SHOW_APP)
response = Snap::Response::ShowApp;
@@ -187,14 +189,14 @@ public:
});
//TODO: we need to extend it to support alarms appointments
- if (!appointment.is_ubuntu_alarm()) {
+ if (!appointment.is_alarm()) {
b.set_timeout_callback([appointment, alarm, on_response](){
on_response(appointment, alarm, Snap::Response::ShowApp);
});
}
- b.set_show_notification_bubble(appointment.is_ubuntu_alarm() || calendar_bubbles_enabled());
- b.set_post_to_messaging_menu(appointment.is_ubuntu_alarm() || calendar_list_enabled());
+ b.set_show_notification_bubble(appointment.is_alarm() || calendar_bubbles_enabled());
+ b.set_post_to_messaging_menu(appointment.is_alarm() || calendar_list_enabled());
const auto key = m_engine->show(b);
if (key)
@@ -268,7 +270,7 @@ private:
const Alarm& alarm,
const std::shared_ptr<const Settings>& settings) const
{
- const auto is_alarm = appointment.is_ubuntu_alarm();
+ const auto is_alarm = appointment.is_alarm();
const std::string candidates[] = {
alarm.audio_url,
is_alarm ? settings->alarm_sound.get() : settings->calendar_sound.get(),