From 76b102e4038c63e29e4b427e4bdfe4db720970f2 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 27 Apr 2011 08:14:15 -0400 Subject: Add itip_get_fallback_identity(). Convenience function returns a name + address string from the default mail identity, to be used as a fallback for organizers. --- calendar/gui/itip-utils.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'calendar/gui/itip-utils.c') diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 4ab53de115..8c7c72f2f6 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -103,6 +103,33 @@ itip_get_user_identities (void) return identities; } +/** + * itip_get_fallback_identity: + * + * Returns a name + address string taken from the default mail identity, + * but only if the corresponding account is enabled. If the account is + * disabled, the function returns %NULL. This is meant to be used as a + * fallback identity for organizers. Free the returned string with + * g_free(). + * + * Returns: a fallback mail identity, or %NULL + **/ +gchar * +itip_get_fallback_identity (void) +{ + EAccount *account; + gchar *identity = NULL; + + account = e_get_default_account (); + if (account != NULL && account->enabled) + identity = g_strdup_printf ( + "%s <%s>", + account->id->name, + account->id->address); + + return identity; +} + /** * itip_address_is_user: * @address: an email address -- cgit v1.2.3