aboutsummaryrefslogtreecommitdiff
path: root/include/datetime/clock.h
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-01-14 23:07:10 -0600
committerCharles Kerr <charles.kerr@canonical.com>2014-01-14 23:07:10 -0600
commitee64bb2698adfe27e55615a8856b0e2c78ad8469 (patch)
treeb8fb6e1440ac700f7f51e5c765303abb315c6399 /include/datetime/clock.h
parent3b8833efe6ab21387b6f73b4a4ef757445801623 (diff)
downloadayatana-indicator-datetime-ee64bb2698adfe27e55615a8856b0e2c78ad8469.tar.gz
ayatana-indicator-datetime-ee64bb2698adfe27e55615a8856b0e2c78ad8469.tar.bz2
ayatana-indicator-datetime-ee64bb2698adfe27e55615a8856b0e2c78ad8469.zip
Function: add fully-tested ActionGroups, per-profile Menus, state object.
Form: Add code annotations/comments. Remove dead code. Use Mir style guide. Todo: GSettings toggles, sync with new dbus-test-runner API, get GNOME Panel building again
Diffstat (limited to 'include/datetime/clock.h')
-rw-r--r--include/datetime/clock.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/include/datetime/clock.h b/include/datetime/clock.h
index 978be27..c8e6c16 100644
--- a/include/datetime/clock.h
+++ b/include/datetime/clock.h
@@ -20,12 +20,12 @@
#ifndef INDICATOR_DATETIME_CLOCK_H
#define INDICATOR_DATETIME_CLOCK_H
+#include <datetime/date-time.h>
#include <datetime/timezones.h>
#include <core/property.h>
#include <core/signal.h>
-#include <glib.h>
#include <gio/gio.h>
#include <set>
@@ -45,9 +45,10 @@ class Clock
{
public:
virtual ~Clock();
- virtual GDateTime* localtime() const = 0;
- core::Property<std::set<std::string> > timezones;
+ virtual DateTime localtime() const =0;
+ core::Property<std::set<std::string>> timezones;
core::Signal<> skewDetected;
+ core::Signal<> dateChanged;
protected:
Clock();
@@ -56,12 +57,13 @@ private:
static void onSystemBusReady(GObject*, GAsyncResult*, gpointer);
static void onPrepareForSleep(GDBusConnection*, const gchar*, const gchar*, const gchar*, const gchar*, GVariant*, gpointer);
+ GCancellable * m_cancellable = nullptr;
+ GDBusConnection * m_system_bus = nullptr;
+ unsigned int m_sleep_subscription_id = 0;
+
+ // we've got raw pointers in here, so disable copying
Clock(const Clock&) =delete;
Clock& operator=(const Clock&) =delete;
-
- GCancellable * cancellable_ = nullptr;
- GDBusConnection * system_bus_ = nullptr;
- unsigned int sleep_subscription_id_ = 0;
};
/***
@@ -71,16 +73,17 @@ private:
/**
* \brief A live clock that provides the actual system time.
*
- * Adds another clock skew detection test: wakes up every
- * skewTestIntervalSec seconds to see how much time has passed
- * since the last time it checked.
+ * This subclass also adds another clock skew detection test:
+ * it wakes up every skewTestIntervalSec seconds to see how
+ * much time has passed since the last wakeup. If the answer
+ * isn't what it expected, the skewDetected signal is triggered.
*/
class LiveClock: public Clock
{
public:
LiveClock (const std::shared_ptr<Timezones>& zones);
virtual ~LiveClock();
- virtual GDateTime* localtime() const;
+ virtual DateTime localtime() const;
core::Property<unsigned int> skewTestIntervalSec;
private: