static int start_calendar_server (EMemoConduitContext *ctxt) { g_return_val_if_fail (ctxt != NULL, -2); if (ctxt->cfg->source) { ctxt->client = e_cal_new (ctxt->cfg->source, E_CAL_SOURCE_TYPE_JOURNAL); if (!e_cal_open (ctxt->client, TRUE, NULL)) return -1; } else if (!e_cal_open_default (&ctxt->client, E_CAL_SOURCE_TYPE_JOURNAL, NULL, NULL, NULL)) { return -1; } return 0; }
ECal * evo_cal_source_open_source(const char *uri, ECalSourceType type) { ESourceList *sources = NULL; ESource *source = NULL; ECal *cal = NULL; GError *gerror = NULL; g_debug("Opening calendar source uri: %s\n", uri); if (strcmp(uri, "default")) { if (!e_cal_get_sources(&sources, type, &gerror)) { g_warning("Unable to get sources for calendar (type %u): %s", type, gerror && gerror->message ? gerror->message : "None"); g_clear_error(&gerror); return NULL; } source = evo_environment_find_source(sources, uri); if (!source) { g_warning("Unable to find source for calendar (type %u)", type); return NULL; } cal = e_cal_new(source, type); if(!cal) { g_warning("Failed to create new calendar (type %u)", type); return NULL; } if(!e_cal_open(cal, FALSE, &gerror)) { g_warning("Failed to open calendar (type %u): %s", type, gerror && gerror->message? gerror->message : "None"); g_object_unref(cal); g_clear_error(&gerror); return NULL; } } else { if (!e_cal_open_default (&cal, type, NULL, NULL, &gerror)) { g_warning("Failed to open default calendar: %s", gerror && gerror->message ? gerror->message : "None"); g_clear_error(&gerror); return NULL; } } return cal; }