diff options
author | Robert Tari <robert@tari.in> | 2020-07-26 19:01:02 +0200 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2020-07-26 19:13:08 +0200 |
commit | e7f2629167e523c5124d1f3e1ff1e8a481b5f210 (patch) | |
tree | ac3804d1e42d93ed0d97bed70a5c836de161ee93 | |
parent | d75484963ae648ffdb0f36a9cc1f225e5129c5c7 (diff) | |
download | ayatana-indicator-datetime-e7f2629167e523c5124d1f3e1ff1e8a481b5f210.tar.gz ayatana-indicator-datetime-e7f2629167e523c5124d1f3e1ff1e8a481b5f210.tar.bz2 ayatana-indicator-datetime-e7f2629167e523c5124d1f3e1ff1e8a481b5f210.zip |
Fix calendar going into update loop
-rw-r--r-- | include/datetime/actions.h | 2 | ||||
-rw-r--r-- | src/actions.cpp | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/include/datetime/actions.h b/include/datetime/actions.h index 4780990..47931ac 100644 --- a/include/datetime/actions.h +++ b/include/datetime/actions.h @@ -56,7 +56,7 @@ public: virtual void set_location(const std::string& zone, const std::string& name)=0; - void set_calendar_date(const DateTime&); + void set_calendar_date(const DateTime&, bool bUpdateCalendar); GActionGroup* action_group(); const std::shared_ptr<State> state() const; diff --git a/src/actions.cpp b/src/actions.cpp index 663812c..93629a0 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -130,7 +130,7 @@ void on_calendar_active_changed(GSimpleAction * /*action*/, { auto self = static_cast<Actions*>(gself); - self->set_calendar_date(self->state()->clock->localtime()); + self->set_calendar_date(self->state()->clock->localtime(), true); } } @@ -143,7 +143,7 @@ void on_calendar_activated(GSimpleAction * /*action*/, g_return_if_fail(t != 0); auto dt = DateTime::Local(t).start_of_day(); - static_cast<Actions*>(gself)->set_calendar_date(dt); + static_cast<Actions*>(gself)->set_calendar_date(dt, false); } GVariant* create_default_header_state() @@ -272,9 +272,13 @@ void Actions::update_calendar_state() create_calendar_state(m_state)); } -void Actions::set_calendar_date(const DateTime& date) +void Actions::set_calendar_date(const DateTime& date, bool bUpdateCalendar) { - m_state->calendar_month->month().set(date); + if (bUpdateCalendar) + { + m_state->calendar_month->month().set(date); + } + m_state->calendar_upcoming->date().set(date); } |