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;
|
GoaClient *goa_client;
|
||||||
|
|
||||||
|
GcalClock *clock;
|
||||||
|
|
||||||
/* state flags */
|
/* state flags */
|
||||||
gboolean goa_client_ready;
|
gboolean goa_client_ready;
|
||||||
gint sources_at_launch;
|
gint sources_at_launch;
|
||||||
@@ -107,6 +109,7 @@ G_DEFINE_TYPE (GcalManager, gcal_manager, G_TYPE_OBJECT)
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
PROP_CLOCK,
|
||||||
PROP_DEFAULT_CALENDAR,
|
PROP_DEFAULT_CALENDAR,
|
||||||
PROP_LOADING,
|
PROP_LOADING,
|
||||||
PROP_SETTINGS,
|
PROP_SETTINGS,
|
||||||
@@ -899,6 +902,7 @@ gcal_manager_finalize (GObject *object)
|
|||||||
|
|
||||||
GCAL_ENTRY;
|
GCAL_ENTRY;
|
||||||
|
|
||||||
|
g_clear_object (&manager->clock);
|
||||||
g_clear_object (&manager->settings);
|
g_clear_object (&manager->settings);
|
||||||
g_clear_object (&manager->goa_client);
|
g_clear_object (&manager->goa_client);
|
||||||
g_clear_object (&manager->e_data_model);
|
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->set_property = gcal_manager_set_property;
|
||||||
object_class->get_property = gcal_manager_get_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:
|
* GcalManager:default-calendar:
|
||||||
*
|
*
|
||||||
@@ -1081,7 +1096,7 @@ gcal_manager_class_init (GcalManagerClass *klass)
|
|||||||
static void
|
static void
|
||||||
gcal_manager_init (GcalManager *self)
|
gcal_manager_init (GcalManager *self)
|
||||||
{
|
{
|
||||||
;
|
self->clock = gcal_clock_new ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Public API */
|
/* Public API */
|
||||||
@@ -1950,6 +1965,22 @@ gcal_manager_get_loading (GcalManager *self)
|
|||||||
return !self->goa_client_ready || self->sources_at_launch > 0;
|
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:
|
* gcal_manager_get_event_from_shell_search:
|
||||||
* @manager: a #GcalManager
|
* @manager: a #GcalManager
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#define __GCAL_MANAGER_H__
|
#define __GCAL_MANAGER_H__
|
||||||
|
|
||||||
#include "e-cal-data-model.h"
|
#include "e-cal-data-model.h"
|
||||||
|
#include "gcal-clock.h"
|
||||||
#include "gcal-event.h"
|
#include "gcal-event.h"
|
||||||
|
|
||||||
#include <libical/icaltime.h>
|
#include <libical/icaltime.h>
|
||||||
@@ -103,6 +104,9 @@ GList* gcal_manager_get_events (GcalManager
|
|||||||
|
|
||||||
gboolean gcal_manager_get_loading (GcalManager *self);
|
gboolean gcal_manager_get_loading (GcalManager *self);
|
||||||
|
|
||||||
|
/* Clock */
|
||||||
|
GcalClock* gcal_manager_get_clock (GcalManager *self);
|
||||||
|
|
||||||
/* Online Accounts */
|
/* Online Accounts */
|
||||||
GoaClient* gcal_manager_get_goa_client (GcalManager *manager);
|
GoaClient* gcal_manager_get_goa_client (GcalManager *manager);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user