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
committerMatthew Barnes <mbarnes@redhat.com>2011-04-28 09:48:06 +0800
commit521caf8b6cbe648e8f5c5d6104cc58bb8446e0e3 (patch)
tree5fb5b0de92cfd294f88f8c370d9745533ce3b631 /calendar/gui/itip-utils.c
parentc814aa614c78a6e6350f2380eb2e23dab6e0989e (diff)
downloadgsoc2013-evolution-521caf8b6cbe648e8f5c5d6104cc58bb8446e0e3.tar.gz
gsoc2013-evolution-521caf8b6cbe648e8f5c5d6104cc58bb8446e0e3.tar.zst
gsoc2013-evolution-521caf8b6cbe648e8f5c5d6104cc58bb8446e0e3.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
*