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 google_backend_add_contacts (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_CONTACTS_RESOURCE_ID; source = e_collection_backend_new_child (backend, resource_id); e_source_set_display_name (source, _("Contacts")); /* Add the address book source to the collection. */ collection_extension = e_source_get_extension ( collection_source, E_SOURCE_EXTENSION_COLLECTION); /* Configure the address book source. */ backend_name = GOOGLE_CONTACTS_BACKEND_NAME; extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK; 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); e_source_authentication_set_host ( E_SOURCE_AUTHENTICATION (extension), GOOGLE_CONTACTS_HOST); g_object_bind_property ( collection_extension, "identity", extension, "user", G_BINDING_SYNC_CREATE); 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_add_calendar (ECollectionBackend *backend) { ESource *source; ESourceBackend *extension; ESourceRegistryServer *server; const gchar *backend_name; const gchar *extension_name; const gchar *resource_id; /* XXX We could just stick a [Calendar] and [Task List] extension * into the same ESource since all other settings are exactly * the same. But it might be confusing if tweaking a setting * in your Yahoo! Calendar also gets applied to your Yahoo! * Task List in Evolution. */ backend_name = YAHOO_CALENDAR_BACKEND_NAME; server = e_collection_backend_ref_server (backend); /* Add Yahoo! Calendar */ resource_id = YAHOO_CALENDAR_RESOURCE_ID; source = e_collection_backend_new_child (backend, resource_id); e_source_set_display_name (source, _("Calendar")); extension_name = E_SOURCE_EXTENSION_CALENDAR; extension = e_source_get_extension (source, extension_name); e_source_backend_set_backend_name (extension, backend_name); 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); } yahoo_backend_config_calendar_child (backend, source); e_source_registry_server_add_source (server, source); g_object_unref (source); /* Add Yahoo! Tasks */ resource_id = YAHOO_TASKS_RESOURCE_ID; source = e_collection_backend_new_child (backend, resource_id); e_source_set_display_name (source, _("Tasks")); extension_name = E_SOURCE_EXTENSION_TASK_LIST; extension = e_source_get_extension (source, extension_name); e_source_backend_set_backend_name (extension, backend_name); yahoo_backend_config_calendar_child (backend, source); e_source_registry_server_add_source (server, source); g_object_unref (source); g_object_unref (server); }
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); }