aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/itip-utils.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-04-27 20:14:15 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:42:03 +0800
commit76b102e4038c63e29e4b427e4bdfe4db720970f2 (patch)
tree12551ca631f4aca4d51102e80f4872653e43e617 /calendar/gui/itip-utils.c
parent698e3476e392ea52f95fcea1c899d1dfa6354e8d (diff)
downloadgsoc2013-evolution-76b102e4038c63e29e4b427e4bdfe4db720970f2.tar.gz
gsoc2013-evolution-76b102e4038c63e29e4b427e4bdfe4db720970f2.tar.zst
gsoc2013-evolution-76b102e4038c63e29e4b427e4bdfe4db720970f2.zip
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.
Diffstat (limited to 'calendar/gui/itip-utils.c')
-rw-r--r--calendar/gui/itip-utils.c27
1 files changed, 27 insertions, 0 deletions
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
@@ -104,6 +104,33 @@ itip_get_user_identities (void)
}
/**
+ * 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
*