/** * e_cal_backend_mail_account_get_default: * @registry: an #ESourceRegistry * @address: placeholder for default address * @name: placeholder for name * * Retrieve the default mail account as stored in Evolution configuration. * * Returns: TRUE if there is a default account, FALSE otherwise. */ gboolean e_cal_backend_mail_account_get_default (ESourceRegistry *registry, gchar **address, gchar **name) { ESource *source; ESourceMailIdentity *extension; const gchar *extension_name; g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE); source = e_source_registry_ref_default_mail_identity (registry); if (source == NULL) return FALSE; extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY; extension = e_source_get_extension (source, extension_name); if (address != NULL) *address = e_source_mail_identity_dup_address (extension); if (name != NULL) *name = e_source_mail_identity_dup_name (extension); g_object_unref (source); return TRUE; }
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); }