manager: create and keep an internal clock
This clock will be used in the future by other classes to update stuff.
This commit is contained in:
+32
-1
@@ -91,6 +91,8 @@ struct _GcalManager
|
||||
|
||||
GoaClient *goa_client;
|
||||
|
||||
GcalClock *clock;
|
||||
|
||||
/* state flags */
|
||||
gboolean goa_client_ready;
|
||||
gint sources_at_launch;
|
||||
@@ -107,6 +109,7 @@ G_DEFINE_TYPE (GcalManager, gcal_manager, G_TYPE_OBJECT)
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_CLOCK,
|
||||
PROP_DEFAULT_CALENDAR,
|
||||
PROP_LOADING,
|
||||
PROP_SETTINGS,
|
||||
@@ -899,6 +902,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);
|
||||
@@ -999,6 +1003,17 @@ gcal_manager_class_init (GcalManagerClass *klass)
|
||||
object_class->set_property = gcal_manager_set_property;
|
||||
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:
|
||||
*
|
||||
@@ -1081,7 +1096,7 @@ gcal_manager_class_init (GcalManagerClass *klass)
|
||||
static void
|
||||
gcal_manager_init (GcalManager *self)
|
||||
{
|
||||
;
|
||||
self->clock = gcal_clock_new ();
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
@@ -1950,6 +1965,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;
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_manager_get_event_from_shell_search:
|
||||
* @manager: a #GcalManager
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user