event: Receive and operate on GcalCalendar
Instead of receiving an ESource, receive a GcalCalendar and operate on it. Many places needed to be adjusted for that. Tests need to be rethinked.
This commit is contained in:
@@ -77,14 +77,14 @@ gcal_search_hit_event_get_icon_surface (DzlSuggestion *suggestion,
|
||||
{
|
||||
GcalSearchHitEvent *self;
|
||||
cairo_surface_t *surface;
|
||||
ESource *source;
|
||||
GdkRGBA color;
|
||||
const GdkRGBA *color;
|
||||
GcalCalendar *calendar;
|
||||
|
||||
self = GCAL_SEARCH_HIT_EVENT (suggestion);
|
||||
source = gcal_event_get_source (self->event);
|
||||
calendar = gcal_event_get_calendar (self->event);
|
||||
|
||||
get_color_name_from_source (source, &color);
|
||||
surface = get_circle_surface_from_color (&color, 16);
|
||||
color = gcal_calendar_get_color (calendar);
|
||||
surface = get_circle_surface_from_color (color, 16);
|
||||
|
||||
/* Inject our custom style class into the given widget */
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "calendar-color-image");
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#define G_LOG_DOMAIN "GcalSearchModel"
|
||||
|
||||
#include "e-cal-data-model.h"
|
||||
#include "gcal-application.h"
|
||||
#include "gcal-context.h"
|
||||
#include "gcal-debug.h"
|
||||
#include "gcal-search-hit.h"
|
||||
#include "gcal-search-hit-event.h"
|
||||
@@ -98,6 +100,8 @@ gcal_search_model_component_added (ECalDataModelSubscriber *subscriber,
|
||||
g_autoptr (GcalEvent) event = NULL;
|
||||
g_autoptr (GError) error = NULL;
|
||||
GcalSearchModel *self;
|
||||
GcalCalendar *calendar;
|
||||
GcalContext *context;
|
||||
ESource *source;
|
||||
|
||||
self = GCAL_SEARCH_MODEL (subscriber);
|
||||
@@ -105,8 +109,11 @@ gcal_search_model_component_added (ECalDataModelSubscriber *subscriber,
|
||||
if (g_list_model_get_n_items (self->model) > self->max_results)
|
||||
return;
|
||||
|
||||
/* FIXME: propagate context to the model properly */
|
||||
context = gcal_application_get_context (GCAL_APPLICATION (g_application_get_default ()));
|
||||
source = e_client_get_source (E_CLIENT (client));
|
||||
event = gcal_event_new (source, component, &error);
|
||||
calendar = gcal_manager_get_calendar_from_source (gcal_context_get_manager (context), source);
|
||||
event = gcal_event_new (calendar, component, &error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user