manager: Add GcalTimelineSubscribers to GcalTimeline
Instead of subscribing to the ECalDataModel's API, use the new API.
This commit is contained in:
+13
-4
@@ -22,6 +22,8 @@
|
|||||||
#include "gcal-context.h"
|
#include "gcal-context.h"
|
||||||
#include "gcal-debug.h"
|
#include "gcal-debug.h"
|
||||||
#include "gcal-manager.h"
|
#include "gcal-manager.h"
|
||||||
|
#include "gcal-timeline.h"
|
||||||
|
#include "gcal-timeline-subscriber.h"
|
||||||
#include "gcal-utils.h"
|
#include "gcal-utils.h"
|
||||||
|
|
||||||
#include <libedataserverui/libedataserverui.h>
|
#include <libedataserverui/libedataserverui.h>
|
||||||
@@ -91,6 +93,8 @@ struct _GcalManager
|
|||||||
|
|
||||||
gint clients_synchronizing;
|
gint clients_synchronizing;
|
||||||
|
|
||||||
|
GcalTimeline *timeline;
|
||||||
|
|
||||||
GcalContext *context;
|
GcalContext *context;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -179,6 +183,7 @@ remove_source (GcalManager *self,
|
|||||||
e_cal_data_model_remove_client (self->e_data_model,
|
e_cal_data_model_remove_client (self->e_data_model,
|
||||||
e_source_get_uid (source));
|
e_source_get_uid (source));
|
||||||
|
|
||||||
|
gcal_timeline_remove_calendar (self->timeline, calendar);
|
||||||
g_hash_table_remove (self->clients, source);
|
g_hash_table_remove (self->clients, source);
|
||||||
g_signal_emit (self, signals[CALENDAR_REMOVED], 0, calendar);
|
g_signal_emit (self, signals[CALENDAR_REMOVED], 0, calendar);
|
||||||
|
|
||||||
@@ -286,6 +291,8 @@ on_calendar_created_cb (GObject *source_object,
|
|||||||
|
|
||||||
g_hash_table_insert (self->clients, g_object_ref (source), calendar);
|
g_hash_table_insert (self->clients, g_object_ref (source), calendar);
|
||||||
|
|
||||||
|
gcal_timeline_add_calendar (self->timeline, calendar);
|
||||||
|
|
||||||
if (visible)
|
if (visible)
|
||||||
{
|
{
|
||||||
e_cal_data_model_add_client (self->e_data_model, client);
|
e_cal_data_model_add_client (self->e_data_model, client);
|
||||||
@@ -653,6 +660,7 @@ gcal_manager_finalize (GObject *object)
|
|||||||
|
|
||||||
GCAL_ENTRY;
|
GCAL_ENTRY;
|
||||||
|
|
||||||
|
g_clear_object (&self->timeline);
|
||||||
g_clear_object (&self->e_data_model);
|
g_clear_object (&self->e_data_model);
|
||||||
g_clear_object (&self->shell_search_data_model);
|
g_clear_object (&self->shell_search_data_model);
|
||||||
|
|
||||||
@@ -1064,10 +1072,10 @@ gcal_manager_set_subscriber (GcalManager *self,
|
|||||||
|
|
||||||
g_return_if_fail (GCAL_IS_MANAGER (self));
|
g_return_if_fail (GCAL_IS_MANAGER (self));
|
||||||
|
|
||||||
e_cal_data_model_subscribe (self->e_data_model,
|
if (GCAL_IS_TIMELINE_SUBSCRIBER (subscriber))
|
||||||
subscriber,
|
gcal_timeline_add_subscriber (self->timeline, GCAL_TIMELINE_SUBSCRIBER (subscriber));
|
||||||
range_start,
|
else
|
||||||
range_end);
|
e_cal_data_model_subscribe (self->e_data_model, subscriber, range_start, range_end);
|
||||||
|
|
||||||
GCAL_EXIT;
|
GCAL_EXIT;
|
||||||
}
|
}
|
||||||
@@ -1580,6 +1588,7 @@ gcal_manager_startup (GcalManager *self)
|
|||||||
|
|
||||||
GCAL_ENTRY;
|
GCAL_ENTRY;
|
||||||
|
|
||||||
|
self->timeline = gcal_timeline_new (self->context);
|
||||||
self->clients = g_hash_table_new_full ((GHashFunc) e_source_hash,
|
self->clients = g_hash_table_new_full ((GHashFunc) e_source_hash,
|
||||||
(GEqualFunc) e_source_equal,
|
(GEqualFunc) e_source_equal,
|
||||||
g_object_unref,
|
g_object_unref,
|
||||||
|
|||||||
Reference in New Issue
Block a user