static void google_backend_add_tasks (ECollectionBackend *backend) { ESource *source; ESource *collection_source; ESourceRegistryServer *server; ESourceExtension *extension; ESourceCollection *collection_extension; const gchar *backend_name; const gchar *extension_name; const gchar *resource_id; collection_source = e_backend_get_source (E_BACKEND (backend)); resource_id = GOOGLE_TASKS_RESOURCE_ID; source = e_collection_backend_new_child (backend, resource_id); e_source_set_display_name (source, _("Tasks")); collection_extension = e_source_get_extension ( collection_source, E_SOURCE_EXTENSION_COLLECTION); /* Configure the tasks source. */ backend_name = GOOGLE_TASKS_BACKEND_NAME; extension_name = E_SOURCE_EXTENSION_TASK_LIST; extension = e_source_get_extension (source, extension_name); e_source_backend_set_backend_name ( E_SOURCE_BACKEND (extension), backend_name); extension_name = E_SOURCE_EXTENSION_AUTHENTICATION; extension = e_source_get_extension (source, extension_name); g_object_bind_property ( collection_extension, "identity", extension, "user", G_BINDING_SYNC_CREATE); extension_name = E_SOURCE_EXTENSION_SECURITY; extension = e_source_get_extension (source, extension_name); e_source_security_set_secure ( E_SOURCE_SECURITY (extension), TRUE); server = e_collection_backend_ref_server (backend); e_source_registry_server_add_source (server, source); g_object_unref (server); g_object_unref (source); }
static void yahoo_backend_config_calendar_child (ECollectionBackend *backend, ESource *source) { EYahooBackend *yahoo_backend; ESource *collection_source; ESource *mail_identity_source; ESourceExtension *extension; ESourceCollection *collection_extension; const gchar *extension_name; const gchar *identity; gchar *display_name = NULL; /* FIXME As a future enhancement, we should query Yahoo! * for a list of user calendars and add them to the * collection with matching display names and colors. */ yahoo_backend = E_YAHOO_BACKEND (backend); collection_source = e_backend_get_source (E_BACKEND (backend)); collection_extension = e_source_get_extension ( collection_source, E_SOURCE_EXTENSION_COLLECTION); identity = e_source_collection_get_identity (collection_extension); /* XXX Assume the calendar's display name can be derived from * the user's mail identity. As mentioned above, we should * really just query Yahoo! for a list of user calendars. */ mail_identity_source = g_weak_ref_get (&yahoo_backend->mail_identity_source); if (mail_identity_source != NULL) { extension = e_source_get_extension ( mail_identity_source, E_SOURCE_EXTENSION_MAIL_IDENTITY); display_name = e_source_mail_identity_dup_name ( E_SOURCE_MAIL_IDENTITY (extension)); if (display_name != NULL) g_strdelimit (display_name, " ", '_'); g_object_unref (mail_identity_source); } extension_name = E_SOURCE_EXTENSION_AUTHENTICATION; extension = e_source_get_extension (source, extension_name); e_source_authentication_set_host ( E_SOURCE_AUTHENTICATION (extension), YAHOO_CALENDAR_HOST); e_binding_bind_property ( collection_extension, "identity", extension, "user", G_BINDING_SYNC_CREATE); extension_name = E_SOURCE_EXTENSION_SECURITY; extension = e_source_get_extension (source, extension_name); e_source_security_set_secure ( E_SOURCE_SECURITY (extension), TRUE); extension_name = E_SOURCE_EXTENSION_WEBDAV_BACKEND; extension = e_source_get_extension (source, extension_name); e_source_webdav_set_display_name ( E_SOURCE_WEBDAV (extension), display_name); if (identity != NULL && display_name != NULL) { gchar *resource_path; resource_path = g_strdup_printf ( YAHOO_CALENDAR_CALDAV_PATH, identity, display_name); e_source_webdav_set_resource_path ( E_SOURCE_WEBDAV (extension), resource_path); g_free (resource_path); } g_free (display_name); }
static void google_backend_add_calendar (ECollectionBackend *backend) { ESource *source; ESource *collection_source; ESourceRegistryServer *server; ESourceExtension *extension; ESourceCollection *collection_extension; const gchar *backend_name; const gchar *extension_name; const gchar *resource_id; /* FIXME As a future enhancement, we should query Google * for a list of user calendars and add them to the * collection with matching display names and colors. */ /* NOTE: Host name and WebDAV resource path are set in * google_backend_calendar_update_auth_method(), * since they depend on the auth method used. */ collection_source = e_backend_get_source (E_BACKEND (backend)); resource_id = GOOGLE_CALENDAR_RESOURCE_ID; source = e_collection_backend_new_child (backend, resource_id); e_source_set_display_name (source, _("Calendar")); collection_extension = e_source_get_extension ( collection_source, E_SOURCE_EXTENSION_COLLECTION); /* Configure the calendar source. */ backend_name = GOOGLE_CALENDAR_BACKEND_NAME; extension_name = E_SOURCE_EXTENSION_CALENDAR; extension = e_source_get_extension (source, extension_name); e_source_backend_set_backend_name ( E_SOURCE_BACKEND (extension), backend_name); extension_name = E_SOURCE_EXTENSION_AUTHENTICATION; extension = e_source_get_extension (source, extension_name); g_object_bind_property ( collection_extension, "identity", extension, "user", G_BINDING_SYNC_CREATE); /* Make sure the WebDAV resource path is up-to-date, since * it's built from the "user" property that we just set. */ google_backend_calendar_update_auth_method (source); extension_name = E_SOURCE_EXTENSION_SECURITY; extension = e_source_get_extension (source, extension_name); e_source_security_set_secure ( E_SOURCE_SECURITY (extension), TRUE); extension_name = E_SOURCE_EXTENSION_ALARMS; extension = e_source_get_extension (source, extension_name); if (!e_source_alarms_get_last_notified (E_SOURCE_ALARMS (extension))) { GTimeVal today_tv; gchar *today; g_get_current_time (&today_tv); today = g_time_val_to_iso8601 (&today_tv); e_source_alarms_set_last_notified ( E_SOURCE_ALARMS (extension), today); g_free (today); } server = e_collection_backend_ref_server (backend); e_source_registry_server_add_source (server, source); g_object_unref (server); g_object_unref (source); }