aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-client/cal-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/cal-client/cal-client.c')
-rw-r--r--calendar/cal-client/cal-client.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index 6d9deacde8..21932ed464 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -47,6 +47,9 @@ struct _CalClientPrivate {
*/
char *uri;
+ /* Email address associated with this calendar, or NULL */
+ char *email_address;
+
/* The calendar factories we are contacting */
GList *factories;
@@ -232,6 +235,7 @@ cal_client_init (CalClient *client)
priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED;
priv->uri = NULL;
+ priv->email_address = NULL;
priv->factories = NULL;
priv->timezones = g_hash_table_new (g_str_hash, g_str_equal);
priv->w_client = NULL;
@@ -363,6 +367,11 @@ cal_client_destroy (GtkObject *object)
priv->uri = NULL;
}
+ if (priv->email_address) {
+ g_free (priv->email_address);
+ priv->email_address = NULL;
+ }
+
g_hash_table_foreach (priv->timezones, free_timezone, NULL);
g_hash_table_destroy (priv->timezones);
priv->timezones = NULL;
@@ -1009,6 +1018,43 @@ cal_client_get_uri (CalClient *client)
return priv->uri;
}
+/**
+ * cal_client_get_email_address:
+ * @client: A calendar client.
+ *
+ * Queries the email address associated with a calendar client.
+ *
+ * Return value: The email address associated with the calendar that
+ * is loaded or being loaded, or %NULL if the client has not started a
+ * load request yet or the calendar has no associated email address.
+ **/
+const char *
+cal_client_get_email_address (CalClient *client)
+{
+ CalClientPrivate *priv;
+
+ g_return_val_if_fail (client != NULL, NULL);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), NULL);
+
+ priv = client->priv;
+ g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, NULL);
+
+ if (priv->email_address == NULL) {
+ CORBA_Environment ev;
+ CORBA_char *email_address;
+
+ CORBA_exception_init (&ev);
+ email_address = GNOME_Evolution_Calendar_Cal_getEmailAddress (priv->cal, &ev);
+ if (!BONOBO_EX (&ev)) {
+ priv->email_address = g_strdup (email_address);
+ CORBA_free (email_address);
+ }
+ CORBA_exception_free (&ev);
+ }
+
+ return priv->email_address;
+}
+
/* Converts our representation of a calendar component type into its CORBA representation */
static GNOME_Evolution_Calendar_CalObjType
corba_obj_type (CalObjType type)