aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-10-06 12:39:49 -0500
committerRobert Tari <robert@tari.in>2021-07-08 04:19:18 +0200
commit0e7d17165316c373dcf936bc5b56fb39f17283a4 (patch)
tree49a596d2cf51a5c27846cd26007420ad89507f01
parent34f44f959b63d64f0eec2f16e322796a5bea7c3a (diff)
downloadayatana-indicator-datetime-0e7d17165316c373dcf936bc5b56fb39f17283a4.tar.gz
ayatana-indicator-datetime-0e7d17165316c373dcf936bc5b56fb39f17283a4.tar.bz2
ayatana-indicator-datetime-0e7d17165316c373dcf936bc5b56fb39f17283a4.zip
In main.cpp and tests where Snap is instantiated, provide the system_bus to Snap's constructor
-rw-r--r--src/main.cpp4
-rw-r--r--src/settings-live.cpp26
-rw-r--r--tests/manual-test-snap.cpp4
-rw-r--r--tests/notification-fixture.h2
4 files changed, 21 insertions, 15 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 9defed0..6cad190 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -151,9 +151,9 @@ main(int /*argc*/, char** /*argv*/)
// set up the snap decisions
auto snooze_planner = std::make_shared<SnoozePlanner>(state->settings, state->clock);
auto notification_engine = std::make_shared<ain::Engine>("ayatana-indicator-datetime-service");
- std::unique_ptr<Snap> snap (new Snap(notification_engine, state->settings));
- auto alarm_queue = create_simple_alarm_queue(state->clock, snooze_planner, engine, timezone_);
auto sound_builder = std::make_shared<uin::DefaultSoundBuilder>();
+ std::unique_ptr<Snap> snap (new Snap(notification_engine, sound_builder, state->settings, system_bus));
+ auto alarm_queue = create_simple_alarm_queue(state->clock, snooze_planner, engine, timezone_);
auto on_response = [snooze_planner, actions](const Appointment& appointment, const Alarm& alarm, const Snap::Response& response) {
switch(response) {
case Snap::Response::Snooze:
diff --git a/src/settings-live.cpp b/src/settings-live.cpp
index 66590e0..59c133f 100644
--- a/src/settings-live.cpp
+++ b/src/settings-live.cpp
@@ -40,13 +40,9 @@ LiveSettings::~LiveSettings()
}
LiveSettings::LiveSettings():
- m_settings(g_settings_new(SETTINGS_INTERFACE)),
- m_settings_cal_notification(g_settings_new_with_path(SETTINGS_NOTIFY_SCHEMA_ID, SETTINGS_NOTIFY_CALENDAR_PATH)),
- m_settings_general_notification(g_settings_new(SETTINGS_NOTIFY_APPS_SCHEMA_ID))
+ m_settings(g_settings_new(SETTINGS_INTERFACE))
{
g_signal_connect (m_settings, "changed", G_CALLBACK(on_changed_ccid), this);
- g_signal_connect (m_settings_cal_notification, "changed", G_CALLBACK(on_changed_cal_notification), this);
- g_signal_connect (m_settings_general_notification, "changed", G_CALLBACK(on_changed_general_notification), this);
// init the Properties from the GSettings backend
update_custom_time_format();
@@ -68,12 +64,20 @@ LiveSettings::LiveSettings():
update_alarm_duration();
update_alarm_haptic();
update_snooze_duration();
- update_cal_notification_enabled();
- update_cal_notification_sounds();
- update_cal_notification_vibrations();
- update_cal_notification_bubbles();
- update_cal_notification_list();
- update_vibrate_silent_mode();
+
+ if (ayatana_common_utils_is_lomiri())
+ {
+ m_settings_cal_notification = g_settings_new_with_path(SETTINGS_NOTIFY_SCHEMA_ID, SETTINGS_NOTIFY_CALENDAR_PATH);
+ m_settings_general_notification = g_settings_new(SETTINGS_NOTIFY_APPS_SCHEMA_ID);
+ g_signal_connect (m_settings_cal_notification, "changed", G_CALLBACK(on_changed_cal_notification), this);
+ g_signal_connect (m_settings_general_notification, "changed", G_CALLBACK(on_changed_general_notification), this);
+ update_cal_notification_enabled();
+ update_cal_notification_sounds();
+ update_cal_notification_vibrations();
+ update_cal_notification_bubbles();
+ update_cal_notification_list();
+ update_vibrate_silent_mode();
+ }
// now listen for clients to change the properties s.t. we can sync update GSettings
diff --git a/tests/manual-test-snap.cpp b/tests/manual-test-snap.cpp
index 02cbb9f..72fd374 100644
--- a/tests/manual-test-snap.cpp
+++ b/tests/manual-test-snap.cpp
@@ -95,10 +95,12 @@ int main(int argc, const char* argv[])
auto notification_engine = std::make_shared<ain::Engine>("ayatana-indicator-datetime-service");
auto sound_builder = std::make_shared<ain::DefaultSoundBuilder>();
- Snap snap (notification_engine, settings);
+ auto system_bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, nullptr);
+ Snap snap (notification_engine, sound_builder, settings, system_bus);
snap(a, a.alarms.front(), on_response);
g_main_loop_run(loop);
g_main_loop_unref(loop);
+ g_clear_object(&system_bus);
return 0;
}
diff --git a/tests/notification-fixture.h b/tests/notification-fixture.h
index 0c24843..cbce9ff 100644
--- a/tests/notification-fixture.h
+++ b/tests/notification-fixture.h
@@ -334,7 +334,7 @@ protected:
const std::shared_ptr<ayatana::indicator::notifications::SoundBuilder>& sb,
const std::shared_ptr<ayatana::indicator::datetime::Settings>& settings)
{
- auto snap = std::make_shared<ayatana::indicator::datetime::Snap>(ne, sb, settings);
+ auto snap = std::make_shared<ayatana::indicator::datetime::Snap>(ne, sb, settings, system_bus);
wait_msec(100); // wait a moment for the Snap to finish its async dbus bootstrapping
return snap;
}