[gnome-calendar/gnome-3-24] manager: create and keep an internal clock
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/gnome-3-24] manager: create and keep an internal clock
- Date: Tue, 16 May 2017 18:04:48 +0000 (UTC)
commit b9ce9c9950a9db47e1398eee87cf0bc9fb7ceb14
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue May 16 14:34:12 2017 -0300
manager: create and keep an internal clock
This clock will be used in the future by other classes
to update stuff.
src/gcal-manager.c | 33 ++++++++++++++++++++++++++++++++-
src/gcal-manager.h | 4 ++++
2 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index d0c4c54..350678d 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -80,6 +80,8 @@ struct _GcalManager
GoaClient *goa_client;
+ GcalClock *clock;
+
/* state flags */
gboolean goa_client_ready;
gint sources_at_launch;
@@ -96,6 +98,7 @@ G_DEFINE_TYPE (GcalManager, gcal_manager, G_TYPE_OBJECT)
enum
{
PROP_0,
+ PROP_CLOCK,
PROP_DEFAULT_CALENDAR,
PROP_LOADING,
PROP_SETTINGS,
@@ -888,6 +891,7 @@ gcal_manager_finalize (GObject *object)
GCAL_ENTRY;
+ g_clear_object (&manager->clock);
g_clear_object (&manager->settings);
g_clear_object (&manager->goa_client);
g_clear_object (&manager->e_data_model);
@@ -989,6 +993,17 @@ gcal_manager_class_init (GcalManagerClass *klass)
object_class->get_property = gcal_manager_get_property;
/**
+ * GcalManager:clock:
+ *
+ * The internal clock of Calendar.
+ */
+ properties[PROP_CLOCK] = g_param_spec_object ("clock",
+ "Clock",
+ "The internal clock of Calendar",
+ GCAL_TYPE_CLOCK,
+ G_PARAM_READWRITE);
+
+ /**
* GcalManager:default-calendar:
*
* The default calendar.
@@ -1070,7 +1085,7 @@ gcal_manager_class_init (GcalManagerClass *klass)
static void
gcal_manager_init (GcalManager *self)
{
- ;
+ self->clock = gcal_clock_new ();
}
/* Public API */
@@ -1766,6 +1781,22 @@ gcal_manager_get_loading (GcalManager *self)
return !self->goa_client_ready || self->sources_at_launch > 0;
}
+/**
+ * gcal_manager_get_clock:
+ * @self: a #GcalManager
+ *
+ * Retrieves the internal #GcalClock of @self.
+ *
+ * Returns: (transfer none): a #GcalClock.
+ */
+GcalClock*
+gcal_manager_get_clock (GcalManager *self)
+{
+ g_return_val_if_fail (GCAL_IS_MANAGER (self), NULL);
+
+ return self->clock;
+}
+
GcalEvent*
gcal_manager_get_event_from_shell_search (GcalManager *manager,
const gchar *uuid)
diff --git a/src/gcal-manager.h b/src/gcal-manager.h
index 5633ef3..1d016dc 100644
--- a/src/gcal-manager.h
+++ b/src/gcal-manager.h
@@ -21,6 +21,7 @@
#define __GCAL_MANAGER_H__
#include "e-cal-data-model.h"
+#include "gcal-clock.h"
#include "gcal-event.h"
#include <libical/icaltime.h>
@@ -103,6 +104,9 @@ GList* gcal_manager_get_events (GcalManager
gboolean gcal_manager_get_loading (GcalManager *self);
+/* Clock */
+GcalClock* gcal_manager_get_clock (GcalManager *self);
+
/* Online Accounts */
GoaClient* gcal_manager_get_goa_client (GcalManager *manager);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]