diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/actions-live.cpp | 5 | ||||
-rw-r--r-- | src/actions.cpp | 17 | ||||
-rw-r--r-- | src/appointment.cpp (renamed from src/state-live.cpp) | 40 | ||||
-rw-r--r-- | src/clock-live.cpp | 12 | ||||
-rw-r--r-- | src/clock.cpp | 22 | ||||
-rw-r--r-- | src/date-time.cpp | 17 | ||||
-rw-r--r-- | src/exporter.cpp | 4 | ||||
-rw-r--r-- | src/formatter-desktop.cpp | 8 | ||||
-rw-r--r-- | src/formatter.cpp | 18 | ||||
-rw-r--r-- | src/locations-settings.cpp | 4 | ||||
-rw-r--r-- | src/locations.cpp | 41 | ||||
-rw-r--r-- | src/main.cpp | 21 | ||||
-rw-r--r-- | src/menu.cpp | 84 | ||||
-rw-r--r-- | src/planner-eds.cpp | 2 | ||||
-rw-r--r-- | src/timezone-file.cpp | 14 | ||||
-rw-r--r-- | src/timezones-live.cpp | 3 |
17 files changed, 200 insertions, 114 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eb716d4..810e299 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,6 +15,7 @@ endif () add_library (${SERVICE_LIB} STATIC actions.cpp actions-live.cpp + appointment.cpp clock.cpp clock-live.cpp date-time.cpp @@ -26,7 +27,6 @@ add_library (${SERVICE_LIB} STATIC menu.cpp planner-eds.cpp settings-live.cpp - state-live.cpp timezone-file.cpp timezone-geoclue.cpp timezones-live.cpp diff --git a/src/actions-live.cpp b/src/actions-live.cpp index afd83f4..c0fd8ff 100644 --- a/src/actions-live.cpp +++ b/src/actions-live.cpp @@ -31,6 +31,11 @@ namespace datetime { **** ***/ +LiveActions::LiveActions(const std::shared_ptr<State>& state_in): + Actions(state_in) +{ +} + void LiveActions::execute_command(const std::string& cmdstr) { const auto cmd = cmdstr.c_str(); diff --git a/src/actions.cpp b/src/actions.cpp index acf8fd4..d6fa698 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -65,7 +65,7 @@ void on_activate_appointment(GSimpleAction * /*action*/, g_return_if_fail(uid && *uid); // find url of the upcoming appointment with this uid - for (auto& appt : self->state()->planner->upcoming.get()) + for (const auto& appt : self->state()->planner->upcoming.get()) { if (appt.uid == uid) { @@ -146,7 +146,7 @@ GVariant* create_default_header_state() GVariant* create_calendar_state(const std::shared_ptr<State>& state) { gboolean days[32] = { 0 }; - for(const auto& appt : state->planner->thisMonth.get()) + for (const auto& appt : state->planner->this_month.get()) days[appt.begin.day_of_month()] = true; GVariantBuilder day_builder; @@ -222,7 +222,7 @@ Actions::Actions(const std::shared_ptr<State>& state): m_state->planner->time.changed().connect([this](const DateTime&){ update_calendar_state(); }); - m_state->planner->thisMonth.changed().connect([this](const std::vector<Appointment>&){ + m_state->planner->this_month.changed().connect([this](const std::vector<Appointment>&){ update_calendar_state(); }); m_state->settings->show_week_numbers.changed().connect([this](bool){ @@ -249,6 +249,17 @@ void Actions::set_calendar_date(const DateTime& date) m_state->planner->time.set(date); } +GActionGroup* Actions::action_group() +{ + return G_ACTION_GROUP(m_actions); +} + +const std::shared_ptr<State> Actions::state() const +{ + return m_state; +} + + } // namespace datetime } // namespace indicator diff --git a/src/state-live.cpp b/src/appointment.cpp index fe1e6cd..6e742c3 100644 --- a/src/state-live.cpp +++ b/src/appointment.cpp @@ -17,39 +17,31 @@ * Charles Kerr <charles.kerr@canonical.com> */ -#include <datetime/state-live.h> - -#include <datetime/clock.h> -#include <datetime/locations-settings.h> -#include <datetime/planner-eds.h> -#include <datetime/settings-live.h> -#include <datetime/state.h> -#include <datetime/timezones-live.h> +#include <datetime/appointment.h> namespace unity { namespace indicator { namespace datetime { -/*** -**** -***/ +/**** +***** +****/ -LiveState::LiveState() +bool Appointment::operator==(const Appointment& that) const { - std::shared_ptr<Settings> live_settings(new LiveSettings); - std::shared_ptr<Timezones> live_timezones(new LiveTimezones(live_settings, TIMEZONE_FILE)); - std::shared_ptr<Clock> live_clock(new LiveClock(live_timezones)); - - settings = live_settings; - clock = live_clock; - locations.reset(new SettingsLocations(live_settings, live_timezones)); - planner.reset(new PlannerEds); - planner->time = clock->localtime(); + return (color==that.color) + && (summary==that.summary) + && (url==that.url) + && (uid==that.uid) + && (is_event==that.is_event) + && (has_alarms==that.has_alarms) + && (begin==that.begin) + && (end==that.end); } -/*** -**** -***/ +/**** +***** +****/ } // namespace datetime } // namespace indicator diff --git a/src/clock-live.cpp b/src/clock-live.cpp index 69ebda7..21a18a3 100644 --- a/src/clock-live.cpp +++ b/src/clock-live.cpp @@ -59,7 +59,7 @@ class LiveClock::Impl { public: - Impl(LiveClock& owner, const std::shared_ptr<Timezones>& tzd): + Impl(LiveClock& owner, const std::shared_ptr<const Timezones>& tzd): m_owner(owner), m_timezones(tzd) { @@ -95,7 +95,7 @@ private: { g_clear_pointer(&m_timezone, g_time_zone_unref); m_timezone = g_time_zone_new(str.c_str()); - m_owner.minuteChanged(); + m_owner.minute_changed(); } /*** @@ -109,9 +109,9 @@ private: // maybe emit change signals const auto now = localtime(); if (!DateTime::is_same_minute(m_prev_datetime, now)) - m_owner.minuteChanged(); + m_owner.minute_changed(); if (!DateTime::is_same_day(m_prev_datetime, now)) - m_owner.dateChanged(); + m_owner.date_changed(); // queue up a timer to fire at the next minute m_prev_datetime = now; @@ -135,13 +135,13 @@ protected: LiveClock& m_owner; GTimeZone* m_timezone = nullptr; - std::shared_ptr<Timezones> m_timezones; + std::shared_ptr<const Timezones> m_timezones; DateTime m_prev_datetime; unsigned int m_timer = 0; }; -LiveClock::LiveClock(const std::shared_ptr<Timezones>& tzd): +LiveClock::LiveClock(const std::shared_ptr<const Timezones>& tzd): p(new Impl(*this, tzd)) { } diff --git a/src/clock.cpp b/src/clock.cpp index d5293cc..f41a0cc 100644 --- a/src/clock.cpp +++ b/src/clock.cpp @@ -33,7 +33,7 @@ namespace datetime { Clock::Clock(): m_cancellable(g_cancellable_new()) { - g_bus_get(G_BUS_TYPE_SYSTEM, m_cancellable, onSystemBusReady, this); + g_bus_get(G_BUS_TYPE_SYSTEM, m_cancellable, on_system_bus_ready, this); } Clock::~Clock() @@ -48,7 +48,7 @@ Clock::~Clock() } void -Clock::onSystemBusReady(GObject*, GAsyncResult * res, gpointer gself) +Clock::on_system_bus_ready(GObject*, GAsyncResult * res, gpointer gself) { GDBusConnection * system_bus; @@ -66,22 +66,22 @@ Clock::onSystemBusReady(GObject*, GAsyncResult * res, gpointer gself) "/org/freedesktop/login1", // object path nullptr, // arg0 G_DBUS_SIGNAL_FLAGS_NONE, - onPrepareForSleep, + on_prepare_for_sleep, self, nullptr); } } void -Clock::onPrepareForSleep(GDBusConnection* /*connection*/, - const gchar* /*sender_name*/, - const gchar* /*object_path*/, - const gchar* /*interface_name*/, - const gchar* /*signal_name*/, - GVariant* /*parameters*/, - gpointer gself) +Clock::on_prepare_for_sleep(GDBusConnection* /*connection*/, + const gchar* /*sender_name*/, + const gchar* /*object_path*/, + const gchar* /*interface_name*/, + const gchar* /*signal_name*/, + GVariant* /*parameters*/, + gpointer gself) { - static_cast<Clock*>(gself)->minuteChanged(); + static_cast<Clock*>(gself)->minute_changed(); } /*** diff --git a/src/date-time.cpp b/src/date-time.cpp index 40c638f..a634c5e 100644 --- a/src/date-time.cpp +++ b/src/date-time.cpp @@ -27,6 +27,23 @@ namespace datetime { **** ***/ +DateTime::DateTime(GDateTime* gdt) +{ + reset(gdt); +} + +DateTime& DateTime::operator=(GDateTime* gdt) +{ + reset(gdt); + return *this; +} + +DateTime& DateTime::operator=(const DateTime& that) +{ + m_dt = that.m_dt; + return *this; +} + DateTime::DateTime(time_t t) { GDateTime * gdt = g_date_time_new_from_unix_local(t); diff --git a/src/exporter.cpp b/src/exporter.cpp index 86e3670..ccd6e5c 100644 --- a/src/exporter.cpp +++ b/src/exporter.cpp @@ -120,8 +120,8 @@ Exporter::on_name_lost(GDBusConnection* /*connection*/, const gchar* /*name*/) ***/ void -Exporter::publish(std::shared_ptr<Actions>& actions, - std::vector<std::shared_ptr<Menu>>& menus) +Exporter::publish(const std::shared_ptr<Actions>& actions, + const std::vector<std::shared_ptr<Menu>>& menus) { m_actions = actions; m_menus = menus; diff --git a/src/formatter-desktop.cpp b/src/formatter-desktop.cpp index d542ec4..336d2d3 100644 --- a/src/formatter-desktop.cpp +++ b/src/formatter-desktop.cpp @@ -64,8 +64,8 @@ std::string joinDateAndTimeFormatStrings(const char* date_string, **** ***/ -DesktopFormatter::DesktopFormatter(const std::shared_ptr<Clock>& clock_in, - const std::shared_ptr<Settings>& settings_in): +DesktopFormatter::DesktopFormatter(const std::shared_ptr<const Clock>& clock_in, + const std::shared_ptr<const Settings>& settings_in): Formatter(clock_in), m_settings(settings_in) { @@ -81,7 +81,7 @@ DesktopFormatter::DesktopFormatter(const std::shared_ptr<Clock>& clock_in, void DesktopFormatter::rebuildHeaderFormat() { - headerFormat.set(getHeaderLabelFormatString()); + header_format.set(getHeaderLabelFormatString()); } std::string DesktopFormatter::getHeaderLabelFormatString() const @@ -126,7 +126,7 @@ const gchar* DesktopFormatter::getFullTimeFormatString() const break; } - return getDefaultHeaderTimeFormat(twelvehour, show_seconds); + return default_header_time_format(twelvehour, show_seconds); } const gchar* DesktopFormatter::getDateFormat(bool show_day, bool show_date, bool show_year) const diff --git a/src/formatter.cpp b/src/formatter.cpp index a15c7f8..9aa9bbb 100644 --- a/src/formatter.cpp +++ b/src/formatter.cpp @@ -118,12 +118,12 @@ class Formatter::Impl { public: - Impl(Formatter* owner, const std::shared_ptr<Clock>& clock): + Impl(Formatter* owner, const std::shared_ptr<const Clock>& clock): m_owner(owner), m_clock(clock) { - m_owner->headerFormat.changed().connect([this](const std::string& /*fmt*/){update_header();}); - m_clock->minuteChanged.connect([this](){update_header();}); + m_owner->header_format.changed().connect([this](const std::string& /*fmt*/){update_header();}); + m_clock->minute_changed.connect([this](){update_header();}); update_header(); restartRelativeTimer(); @@ -149,7 +149,7 @@ private: void update_header() { // update the header property - const auto fmt = m_owner->headerFormat.get(); + const auto fmt = m_owner->header_format.get(); const auto str = m_clock->localtime().format(fmt); m_owner->header.set(str); @@ -197,7 +197,7 @@ private: static gboolean onRelativeTimer(gpointer gself) { auto self = static_cast<Formatter::Impl*>(gself); - self->m_owner->relativeFormatChanged(); + self->m_owner->relative_format_changed(); self->restartRelativeTimer(); return G_SOURCE_REMOVE; } @@ -208,14 +208,14 @@ private: guint m_relative_timer = 0; public: - std::shared_ptr<Clock> m_clock; + std::shared_ptr<const Clock> m_clock; }; /*** **** ***/ -Formatter::Formatter(const std::shared_ptr<Clock>& clock): +Formatter::Formatter(const std::shared_ptr<const Clock>& clock): p(new Formatter::Impl(this, clock)) { } @@ -225,7 +225,7 @@ Formatter::~Formatter() } const char* -Formatter::getDefaultHeaderTimeFormat(bool twelvehour, bool show_seconds) +Formatter::default_header_time_format(bool twelvehour, bool show_seconds) { const char* fmt; @@ -250,7 +250,7 @@ Formatter::getDefaultHeaderTimeFormat(bool twelvehour, bool show_seconds) ***/ std::string -Formatter::getRelativeFormat(GDateTime* then_begin, GDateTime* then_end) const +Formatter::relative_format(GDateTime* then_begin, GDateTime* then_end) const { auto cstr = generate_full_format_string_at_time (p->m_clock->localtime().get(), then_begin, then_end); const std::string ret = cstr; diff --git a/src/locations-settings.cpp b/src/locations-settings.cpp index 9b90bc0..ef3085f 100644 --- a/src/locations-settings.cpp +++ b/src/locations-settings.cpp @@ -29,8 +29,8 @@ namespace unity { namespace indicator { namespace datetime { -SettingsLocations::SettingsLocations(const std::shared_ptr<Settings>& settings, - const std::shared_ptr<Timezones>& timezones): +SettingsLocations::SettingsLocations(const std::shared_ptr<const Settings>& settings, + const std::shared_ptr<const Timezones>& timezones): m_settings(settings), m_timezones(timezones) { diff --git a/src/locations.cpp b/src/locations.cpp index d6ab73a..0690acd 100644 --- a/src/locations.cpp +++ b/src/locations.cpp @@ -25,6 +25,24 @@ namespace unity { namespace indicator { namespace datetime { +const std::string& Location::zone() const +{ + return m_zone; +} + +const std::string& Location::name() const +{ + return m_name; +} + +bool Location::operator== (const Location& that) const +{ + return (m_name == that.m_name) + && (m_zone == that.m_zone) + && (m_offset == that.m_offset); +} + + Location::Location(const std::string& zone_, const std::string& name_): m_zone(zone_), m_name(name_) @@ -36,29 +54,6 @@ Location::Location(const std::string& zone_, const std::string& name_): g_time_zone_unref (gzone); } -#if 0 -DateTime Location::localtime(const DateTime& reference_point) const -{ -GDateTime * g_date_time_to_timezone (GDateTime *datetime, - GTimeZone *tz); - auto gzone = g_time_zone_new(zone().c_str()); - const auto gtime = reference_point.get(); - auto glocal = g_date_time_new (gzone, - g_date_time_get_year(gtime), - g_date_time_get_month(gtime), - g_date_time_get_day_of_month(gtime), - g_date_time_get_hour(gtime), - g_date_time_get_minute(gtime), - g_date_time_get_seconds(gtime)); - DateTime local(glocal); - g_date_time_unref(glocal); - g_message("reference: %zu", (size_t)reference_point.to_unix(), (size_t)local.to_unix()); - //g_date_time_unref(gtime); - g_time_zone_unref(gzone); - return local; -} -#endif - } // namespace datetime } // namespace indicator } // namespace unity diff --git a/src/main.cpp b/src/main.cpp index 2c4f160..1534777 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,10 +17,17 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ + + #include <datetime/actions-live.h> +#include <datetime/clock.h> #include <datetime/exporter.h> +#include <datetime/locations-settings.h> #include <datetime/menu.h> -#include <datetime/state-live.h> +#include <datetime/planner-eds.h> +#include <datetime/settings-live.h> +#include <datetime/state.h> +#include <datetime/timezones-live.h> #include <glib/gi18n.h> // bindtextdomain() #include <gio/gio.h> @@ -47,8 +54,16 @@ main(int /*argc*/, char** /*argv*/) if(!notify_init("indicator-datetime-service")) g_critical("libnotify initialization failed"); - // build the state and actions for the MenuFactory to use - std::shared_ptr<State> state(new LiveState); + // build the state, actions, and menufactory + std::shared_ptr<State> state(new State); + std::shared_ptr<Settings> live_settings(new LiveSettings); + std::shared_ptr<Timezones> live_timezones(new LiveTimezones(live_settings, TIMEZONE_FILE)); + std::shared_ptr<Clock> live_clock(new LiveClock(live_timezones)); + state->settings = live_settings; + state->clock = live_clock; + state->locations.reset(new SettingsLocations(live_settings, live_timezones)); + state->planner.reset(new PlannerEds); + state->planner->time = live_clock->localtime(); std::shared_ptr<Actions> actions(new LiveActions(state)); MenuFactory factory(actions, state); diff --git a/src/menu.cpp b/src/menu.cpp index 4ed0a03..bdf92c3 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -35,6 +35,33 @@ namespace datetime { ***** ****/ +Menu::Menu (Profile profile_in, const std::string& name_in): + m_profile(profile_in), + m_name(name_in) +{ +} + +const std::string& Menu::name() const +{ + return m_name; +} + +Menu::Profile Menu::profile() const +{ + return m_profile; +} + +GMenuModel* Menu::menu_model() +{ + return G_MENU_MODEL(m_menu); +} + + +/**** +***** +****/ + + #define FALLBACK_ALARM_CLOCK_ICON_NAME "clock" #define CALENDAR_ICON_NAME "calendar" @@ -43,9 +70,9 @@ class MenuImpl: public Menu protected: MenuImpl(const Menu::Profile profile_in, const std::string& name_in, - std::shared_ptr<State>& state, + std::shared_ptr<const State>& state, std::shared_ptr<Actions>& actions, - std::shared_ptr<Formatter> formatter): + std::shared_ptr<const Formatter> formatter): Menu(profile_in, name_in), m_state(state), m_actions(actions), @@ -60,12 +87,12 @@ protected: m_formatter->header.changed().connect([this](const std::string&){ update_header(); }); - m_formatter->headerFormat.changed().connect([this](const std::string&){ + m_formatter->header_format.changed().connect([this](const std::string&){ update_section(Locations); // need to update x-canonical-time-format }); - m_formatter->relativeFormatChanged.connect([this](){ - update_section(Appointments); // uses formatter.getRelativeFormat() - update_section(Locations); // uses formatter.getRelativeFormat() + m_formatter->relative_format_changed.connect([this](){ + update_section(Appointments); // uses formatter.relative_format() + update_section(Locations); // uses formatter.relative_format() }); m_state->settings->show_clock.changed().connect([this](bool){ update_header(); // update header's label @@ -80,7 +107,7 @@ protected: m_state->planner->upcoming.changed().connect([this](const std::vector<Appointment>&){ update_section(Appointments); // "upcoming" is the list of Appointments we show }); - m_state->clock->dateChanged.connect([this](){ + m_state->clock->date_changed.connect([this](){ update_section(Calendar); // need to update the Date menuitem update_section(Locations); // locations' relative time may have changed }); @@ -106,9 +133,9 @@ protected: g_action_group_change_action_state(action_group, action_name.c_str(), state); } - std::shared_ptr<State> m_state; + std::shared_ptr<const State> m_state; std::shared_ptr<Actions> m_actions; - std::shared_ptr<Formatter> m_formatter; + std::shared_ptr<const Formatter> m_formatter; GMenu* m_submenu = nullptr; GVariant* get_serialized_alarm_icon() @@ -281,7 +308,7 @@ private: GDateTime* begin = appt.begin(); GDateTime* end = appt.end(); - auto fmt = m_formatter->getRelativeFormat(begin, end); + auto fmt = m_formatter->relative_format(begin, end); auto unix_time = g_date_time_to_unix(begin); auto menu_item = g_menu_item_new (appt.summary.c_str(), nullptr); @@ -296,10 +323,10 @@ private: else { g_menu_item_set_attribute (menu_item, "x-canonical-type", "s", "com.canonical.indicator.appointment"); - - if (!appt.color.empty()) - g_menu_item_set_attribute (menu_item, "x-canonical-color", "s", appt.color.c_str()); } + + if (!appt.color.empty()) + g_menu_item_set_attribute (menu_item, "x-canonical-color", "s", appt.color.c_str()); if (profile == Phone) g_menu_item_set_action_and_target_value (menu_item, @@ -318,7 +345,7 @@ private: { auto menu = g_menu_new(); - if (((profile==Phone) || (profile==Desktop)) && m_state->settings->show_events.get()) + if ((profile==Desktop) && m_state->settings->show_events.get()) { add_appointments (menu, profile); @@ -330,6 +357,15 @@ private: g_menu_append_item(menu, menu_item); g_object_unref(menu_item); } + else if (profile==Phone) + { + auto menu_item = g_menu_item_new (_("Clock"), "indicator.activate-phone-clock-app"); + g_menu_item_set_attribute_value (menu_item, G_MENU_ATTRIBUTE_ICON, get_serialized_alarm_icon()); + g_menu_append_item (menu, menu_item); + g_object_unref (menu_item); + + add_appointments (menu, profile); + } return G_MENU_MODEL(menu); } @@ -347,7 +383,7 @@ private: const auto& zone = location.zone(); const auto& name = location.name(); const auto zone_now = now.to_timezone(zone); - const auto fmt = m_formatter->getRelativeFormat(zone_now.get()); + const auto fmt = m_formatter->relative_format(zone_now.get()); auto detailed_action = g_strdup_printf("indicator.set-location::%s %s", zone.c_str(), name.c_str()); auto i = g_menu_item_new (name.c_str(), detailed_action); g_menu_item_set_attribute(i, "x-canonical-type", "s", "com.canonical.indicator.location"); @@ -417,10 +453,10 @@ class DesktopBaseMenu: public MenuImpl protected: DesktopBaseMenu(Menu::Profile profile_, const std::string& name_, - std::shared_ptr<State>& state_, + std::shared_ptr<const State>& state_, std::shared_ptr<Actions>& actions_): MenuImpl(profile_, name_, state_, actions_, - std::shared_ptr<Formatter>(new DesktopFormatter(state_->clock, state_->settings))) + std::shared_ptr<const Formatter>(new DesktopFormatter(state_->clock, state_->settings))) { update_header(); } @@ -444,14 +480,14 @@ protected: class DesktopMenu: public DesktopBaseMenu { public: - DesktopMenu(std::shared_ptr<State>& state_, std::shared_ptr<Actions>& actions_): + DesktopMenu(std::shared_ptr<const State>& state_, std::shared_ptr<Actions>& actions_): DesktopBaseMenu(Desktop,"desktop", state_, actions_) {} }; class DesktopGreeterMenu: public DesktopBaseMenu { public: - DesktopGreeterMenu(std::shared_ptr<State>& state_, std::shared_ptr<Actions>& actions_): + DesktopGreeterMenu(std::shared_ptr<const State>& state_, std::shared_ptr<Actions>& actions_): DesktopBaseMenu(DesktopGreeter,"desktop_greeter", state_, actions_) {} }; @@ -460,7 +496,7 @@ class PhoneBaseMenu: public MenuImpl protected: PhoneBaseMenu(Menu::Profile profile_, const std::string& name_, - std::shared_ptr<State>& state_, + std::shared_ptr<const State>& state_, std::shared_ptr<Actions>& actions_): MenuImpl(profile_, name_, state_, actions_, std::shared_ptr<Formatter>(new PhoneFormatter(state_->clock))) @@ -501,7 +537,7 @@ protected: class PhoneMenu: public PhoneBaseMenu { public: - PhoneMenu(std::shared_ptr<State>& state_, + PhoneMenu(std::shared_ptr<const State>& state_, std::shared_ptr<Actions>& actions_): PhoneBaseMenu(Phone, "phone", state_, actions_) {} }; @@ -509,7 +545,7 @@ public: class PhoneGreeterMenu: public PhoneBaseMenu { public: - PhoneGreeterMenu(std::shared_ptr<State>& state_, + PhoneGreeterMenu(std::shared_ptr<const State>& state_, std::shared_ptr<Actions>& actions_): PhoneBaseMenu(PhoneGreeter, "phone_greeter", state_, actions_) {} }; @@ -518,8 +554,8 @@ public: ***** ****/ -MenuFactory::MenuFactory(std::shared_ptr<Actions>& actions_, - std::shared_ptr<State>& state_): +MenuFactory::MenuFactory(const std::shared_ptr<Actions>& actions_, + const std::shared_ptr<const State>& state_): m_actions(actions_), m_state(state_) { diff --git a/src/planner-eds.cpp b/src/planner-eds.cpp index 98cfe0a..cb42d6e 100644 --- a/src/planner-eds.cpp +++ b/src/planner-eds.cpp @@ -227,7 +227,7 @@ private: { getAppointments(begin, end, [this](const std::vector<Appointment>& appointments) { g_debug("got %d appointments in this calendar month", (int)appointments.size()); - m_owner.thisMonth.set(appointments); + m_owner.this_month.set(appointments); }); } g_clear_pointer(&begin, g_date_time_unref); diff --git a/src/timezone-file.cpp b/src/timezone-file.cpp index 3a0c240..76737b4 100644 --- a/src/timezone-file.cpp +++ b/src/timezone-file.cpp @@ -23,6 +23,20 @@ namespace unity { namespace indicator { namespace datetime { +FileTimezone::FileTimezone() +{ +} + +FileTimezone::FileTimezone(const std::string& filename) +{ + setFilename(filename); +} + +FileTimezone::~FileTimezone() +{ + clear(); +} + void FileTimezone::clear() { diff --git a/src/timezones-live.cpp b/src/timezones-live.cpp index baac05d..4902b76 100644 --- a/src/timezones-live.cpp +++ b/src/timezones-live.cpp @@ -25,7 +25,8 @@ namespace unity { namespace indicator { namespace datetime { -LiveTimezones::LiveTimezones(std::shared_ptr<Settings>& settings, const std::string& filename): +LiveTimezones::LiveTimezones(const std::shared_ptr<const Settings>& settings, + const std::string& filename): m_file(filename), m_settings(settings) { |