diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2016-04-12 12:05:11 -0500 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2021-07-06 00:42:27 +0200 |
commit | 6c96dc57eff3f64155c913e1b011da5f5a6887fb (patch) | |
tree | a02b50a80464dbeef5fcb9055b7936e1d5f44640 | |
parent | ad95b394c94c9ba958d54c5243f376e7854683b8 (diff) | |
download | ayatana-indicator-datetime-6c96dc57eff3f64155c913e1b011da5f5a6887fb.tar.gz ayatana-indicator-datetime-6c96dc57eff3f64155c913e1b011da5f5a6887fb.tar.bz2 ayatana-indicator-datetime-6c96dc57eff3f64155c913e1b011da5f5a6887fb.zip |
in LiveTimezones, pass the primary timezone to it on construction. We used to create it implicitly but can't do that anymore now that TimedatedTimezone takes its own ctor argument.
-rw-r--r-- | include/datetime/timezones-live.h | 5 | ||||
-rw-r--r-- | src/timezones-live.cpp | 11 |
2 files changed, 9 insertions, 7 deletions
diff --git a/include/datetime/timezones-live.h b/include/datetime/timezones-live.h index e722576..8b8b5fa 100644 --- a/include/datetime/timezones-live.h +++ b/include/datetime/timezones-live.h @@ -23,7 +23,6 @@ #include <datetime/settings.h> #include <datetime/timezones.h> #include <datetime/timezone-geoclue.h> -#include <datetime/timezone-timedated.h> #include <memory> // shared_ptr<> @@ -38,13 +37,13 @@ namespace datetime { class LiveTimezones: public Timezones { public: - LiveTimezones(const std::shared_ptr<const Settings>& settings); + LiveTimezones(const std::shared_ptr<const Settings>& settings, const std::shared_ptr<Timezone>& primary_timezone); private: void update_geolocation(); void update_timezones(); - TimedatedTimezone m_file; + std::shared_ptr<Timezone> m_primary_timezone; std::shared_ptr<const Settings> m_settings; std::shared_ptr<GeoclueTimezone> m_geo; }; diff --git a/src/timezones-live.cpp b/src/timezones-live.cpp index 2979036..f3bd02d 100644 --- a/src/timezones-live.cpp +++ b/src/timezones-live.cpp @@ -25,11 +25,14 @@ namespace ayatana { namespace indicator { namespace datetime { -LiveTimezones::LiveTimezones(const std::shared_ptr<const Settings>& settings): - m_file(), +LiveTimezones::LiveTimezones( + const std::shared_ptr<const Settings>& settings, + const std::shared_ptr<Timezone>& primary_timezone +): + m_primary_timezone(primary_timezone), m_settings(settings) { - m_file.timezone.changed().connect([this](const std::string&){update_timezones();}); + m_primary_timezone->timezone.changed().connect([this](const std::string&){update_timezones();}); m_settings->show_detected_location.changed().connect([this](bool){update_geolocation();}); update_geolocation(); @@ -53,7 +56,7 @@ void LiveTimezones::update_geolocation() void LiveTimezones::update_timezones() { - const auto a = m_file.timezone.get(); + const auto a = m_primary_timezone->timezone.get(); const auto b = m_geo ? m_geo->timezone.get() : ""; timezone.set(a.empty() ? b : a); |