aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-client
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-09-28 04:23:20 +0800
committerDan Winship <danw@src.gnome.org>2002-09-28 04:23:20 +0800
commitfc2c499f8bc737190309484a96e13dccd3cefbdf (patch)
tree00a346afe0e783978d6c684ebabc7de25eff9fe8 /calendar/cal-client
parent7ed66fac42704097175f778660e391e86cc6d55d (diff)
downloadgsoc2013-evolution-fc2c499f8bc737190309484a96e13dccd3cefbdf.tar
gsoc2013-evolution-fc2c499f8bc737190309484a96e13dccd3cefbdf.tar.gz
gsoc2013-evolution-fc2c499f8bc737190309484a96e13dccd3cefbdf.tar.bz2
gsoc2013-evolution-fc2c499f8bc737190309484a96e13dccd3cefbdf.tar.lz
gsoc2013-evolution-fc2c499f8bc737190309484a96e13dccd3cefbdf.tar.xz
gsoc2013-evolution-fc2c499f8bc737190309484a96e13dccd3cefbdf.tar.zst
gsoc2013-evolution-fc2c499f8bc737190309484a96e13dccd3cefbdf.zip
Non-Connector part of #29334 (meeting created by a delegate in the
delegator's calendar should have the delegator as Organizer). * idl/evolution-calendar.idl: add Cal_getEmailAddress, to return the email address associated with a backend (if any). * pcs/cal-backend.c (cal_backend_get_email_address): New. * pcs/cal-backend-file.c (cal_backend_file_get_email_address): Return NULL (for now). * pcs/cal.c (impl_Cal_get_email_address): Implement this by calling cal_backend_get_email_address and returning a NotFound exception if it returns NULL. * cal-client/cal-client.c (cal_client_get_email_address): New. (cal_client_init, cal_client_destroy, etc): initialize/free email_address * gui/dialogs/event-editor.c (event_editor_construct): Split this out of event_editor_init. Take and set a CalClient. (event_editor_new): Take a CalClient. * gui/dialogs/task-editor.c (task_editor_construct, task_editor_new): Likewise. * gui/dialogs/meeting-page.c (meeting_page_new, meeting_page_construct): Take a CalClient and call cal_client_get_email_address to find the default organizer address. (Also fix a bug if the default account's name has non-ASCII characters.) * gui/itip-utils.c (comp_from): New. When sending a REQUEST or CANCEL, use the Organizer as the From address. (itip_send_comp): Call comp_from and pass the result to Composer_setHeaders. * gui/comp-editor-factory.c (edit_existing, edit_new): Pass the CalClient to event_editor_new/task_editor_new * gui/e-calendar-table.c (open_task): Likewise. * gui/e-tasks.c (e_tasks_new_task): Likewise. * gui/gnome-cal.c (gnome_calendar_edit_object, gnome_calendar_new_task): Likewise. svn path=/trunk/; revision=18253
Diffstat (limited to 'calendar/cal-client')
-rw-r--r--calendar/cal-client/cal-client.c46
-rw-r--r--calendar/cal-client/cal-client.h2
2 files changed, 48 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)
diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h
index ef42cdccd6..f636bf4896 100644
--- a/calendar/cal-client/cal-client.h
+++ b/calendar/cal-client/cal-client.h
@@ -143,6 +143,8 @@ CalClientLoadState cal_client_get_load_state (CalClient *client);
const char *cal_client_get_uri (CalClient *client);
+const char *cal_client_get_email_address (CalClient *client);
+
gboolean cal_client_set_mode (CalClient *client, CalMode mode);
int cal_client_get_n_objects (CalClient *client, CalObjType type);