aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
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
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')
-rw-r--r--calendar/ChangeLog49
-rw-r--r--calendar/cal-client/cal-client.c46
-rw-r--r--calendar/cal-client/cal-client.h2
-rw-r--r--calendar/gui/comp-editor-factory.c14
-rw-r--r--calendar/gui/dialogs/event-editor.c31
-rw-r--r--calendar/gui/dialogs/event-editor.h5
-rw-r--r--calendar/gui/dialogs/meeting-page.c20
-rw-r--r--calendar/gui/dialogs/meeting-page.h6
-rw-r--r--calendar/gui/dialogs/task-editor.c32
-rw-r--r--calendar/gui/dialogs/task-editor.h5
-rw-r--r--calendar/gui/e-calendar-table.c3
-rw-r--r--calendar/gui/e-tasks.c3
-rw-r--r--calendar/gui/gnome-cal.c6
-rw-r--r--calendar/gui/itip-utils.c31
-rw-r--r--calendar/idl/evolution-calendar.idl5
-rw-r--r--calendar/pcs/cal-backend-file.c12
-rw-r--r--calendar/pcs/cal-backend.c20
-rw-r--r--calendar/pcs/cal-backend.h4
-rw-r--r--calendar/pcs/cal.c25
19 files changed, 274 insertions, 45 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 94f6faa2bd..63363ace19 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,52 @@
+2002-09-26 Dan Winship <danw@ximian.com>
+
+ 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.
+
2002-09-26 JP Rosevear <jpr@ximian.com>
* gui/e-meeting-model.c (set_value_at): only change the attendee
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);
diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c
index 8cba8baade..31746ae55b 100644
--- a/calendar/gui/comp-editor-factory.c
+++ b/calendar/gui/comp-editor-factory.c
@@ -272,11 +272,11 @@ edit_existing (OpenClient *oc, const char *uid)
switch (vtype) {
case CAL_COMPONENT_EVENT:
- editor = COMP_EDITOR (event_editor_new ());
+ editor = COMP_EDITOR (event_editor_new (oc->client));
break;
case CAL_COMPONENT_TODO:
- editor = COMP_EDITOR (task_editor_new ());
+ editor = COMP_EDITOR (task_editor_new (oc->client));
break;
default:
@@ -285,8 +285,7 @@ edit_existing (OpenClient *oc, const char *uid)
return;
}
- /* Set the client/object on the editor */
- comp_editor_set_cal_client (editor, oc->client);
+ /* Set the object on the editor */
comp_editor_edit_comp (editor, comp);
comp_editor_focus (editor);
@@ -360,15 +359,15 @@ edit_new (OpenClient *oc, const GNOME_Evolution_Calendar_CompEditorFactory_CompE
switch (type) {
case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT:
case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING:
- editor = COMP_EDITOR (event_editor_new ());
+ editor = COMP_EDITOR (event_editor_new (oc->client));
comp = get_default_event (FALSE);
break;
case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT:
- editor = COMP_EDITOR (event_editor_new ());
+ editor = COMP_EDITOR (event_editor_new (oc->client));
comp = get_default_event (TRUE);
break;
case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO:
- editor = COMP_EDITOR (task_editor_new ());
+ editor = COMP_EDITOR (task_editor_new (oc->client));
comp = get_default_task ();
break;
default:
@@ -376,7 +375,6 @@ edit_new (OpenClient *oc, const GNOME_Evolution_Calendar_CompEditorFactory_CompE
return;
}
- comp_editor_set_cal_client (editor, oc->client);
comp_editor_edit_comp (editor, comp);
if (type == GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING)
event_editor_show_meeting (EVENT_EDITOR (editor));
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 20b91475d4..4ee2556d97 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -188,6 +188,18 @@ event_editor_init (EventEditor *ee)
priv = g_new0 (EventEditorPrivate, 1);
ee->priv = priv;
+ priv->model = E_MEETING_MODEL (e_meeting_model_new ());
+ priv->meeting_shown = TRUE;
+ priv->updating = FALSE;
+}
+
+EventEditor *
+event_editor_construct (EventEditor *ee, CalClient *client)
+{
+ EventEditorPrivate *priv;
+
+ priv = ee->priv;
+
priv->event_page = event_page_new ();
comp_editor_append_page (COMP_EDITOR (ee),
COMP_EDITOR_PAGE (priv->event_page),
@@ -203,25 +215,24 @@ event_editor_init (EventEditor *ee)
COMP_EDITOR_PAGE (priv->recur_page),
_("Recurrence"));
- priv->model = E_MEETING_MODEL (e_meeting_model_new ());
-
priv->sched_page = schedule_page_new (priv->model);
comp_editor_append_page (COMP_EDITOR (ee),
COMP_EDITOR_PAGE (priv->sched_page),
_("Scheduling"));
- priv->meet_page = meeting_page_new (priv->model);
+ priv->meet_page = meeting_page_new (priv->model, client);
comp_editor_append_page (COMP_EDITOR (ee),
COMP_EDITOR_PAGE (priv->meet_page),
_("Meeting"));
- comp_editor_merge_ui (COMP_EDITOR (ee), "evolution-event-editor.xml", verbs, pixmaps);
+ comp_editor_set_cal_client (COMP_EDITOR (ee), client);
- priv->meeting_shown = TRUE;
- priv->updating = FALSE;
+ comp_editor_merge_ui (COMP_EDITOR (ee), "evolution-event-editor.xml", verbs, pixmaps);
init_widgets (ee);
set_menu_sens (ee);
+
+ return ee;
}
static void
@@ -382,6 +393,7 @@ event_editor_destroy (GtkObject *object)
/**
* event_editor_new:
+ * @client: a CalClient
*
* Creates a new event editor dialog.
*
@@ -389,9 +401,12 @@ event_editor_destroy (GtkObject *object)
* editor could not be created.
**/
EventEditor *
-event_editor_new (void)
+event_editor_new (CalClient *client)
{
- return EVENT_EDITOR (gtk_type_new (TYPE_EVENT_EDITOR));
+ EventEditor *ee;
+
+ ee = EVENT_EDITOR (gtk_type_new (TYPE_EVENT_EDITOR));
+ return event_editor_construct (ee, client);
}
static void
diff --git a/calendar/gui/dialogs/event-editor.h b/calendar/gui/dialogs/event-editor.h
index d27bb8e52d..1b6f72829a 100644
--- a/calendar/gui/dialogs/event-editor.h
+++ b/calendar/gui/dialogs/event-editor.h
@@ -52,8 +52,9 @@ struct _EventEditorClass {
};
GtkType event_editor_get_type (void);
-EventEditor *event_editor_construct (EventEditor *ee);
-EventEditor *event_editor_new (void);
+EventEditor *event_editor_construct (EventEditor *ee,
+ CalClient *client);
+EventEditor *event_editor_new (CalClient *client);
void event_editor_show_meeting (EventEditor *ee);
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index 011f1301af..44ff76eb08 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -733,11 +733,13 @@ table_canvas_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer dat
* be created.
**/
MeetingPage *
-meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm)
+meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm,
+ CalClient *client)
{
MeetingPagePrivate *priv;
ETable *real_table;
gchar *filename;
+ const char *backend_address;
GList *l;
priv = mpage->priv;
@@ -757,6 +759,8 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm)
}
/* Address information */
+ backend_address = cal_client_get_email_address (client);
+
priv->addresses = itip_addresses_get ();
for (l = priv->addresses; l != NULL; l = l->next) {
ItipAddress *a = l->data;
@@ -764,8 +768,14 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm)
s = e_utf8_to_gtk_string (GTK_COMBO (priv->organizer)->entry, a->full);
priv->address_strings = g_list_append (priv->address_strings, s);
- if (a->default_address)
- priv->default_address = s;
+
+ /* Note that the address specified by the backend gets
+ * precedence over the default mail address.
+ */
+ if (backend_address && !strcmp (backend_address, a->address))
+ priv->default_address = a->full;
+ else if (a->default_address && !priv->default_address)
+ priv->default_address = a->full;
}
/* The etable displaying attendees and their status */
@@ -803,12 +813,12 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm)
* not be created.
**/
MeetingPage *
-meeting_page_new (EMeetingModel *emm)
+meeting_page_new (EMeetingModel *emm, CalClient *client)
{
MeetingPage *mpage;
mpage = gtk_type_new (TYPE_MEETING_PAGE);
- if (!meeting_page_construct (mpage, emm)) {
+ if (!meeting_page_construct (mpage, emm, client)) {
gtk_object_unref (GTK_OBJECT (mpage));
return NULL;
}
diff --git a/calendar/gui/dialogs/meeting-page.h b/calendar/gui/dialogs/meeting-page.h
index b7c8571b44..be55aecf98 100644
--- a/calendar/gui/dialogs/meeting-page.h
+++ b/calendar/gui/dialogs/meeting-page.h
@@ -53,8 +53,10 @@ typedef struct {
GtkType meeting_page_get_type (void);
MeetingPage *meeting_page_construct (MeetingPage *mpage,
- EMeetingModel *emm);
-MeetingPage *meeting_page_new (EMeetingModel *emm);
+ EMeetingModel *emm,
+ CalClient *client);
+MeetingPage *meeting_page_new (EMeetingModel *emm,
+ CalClient *client);
CalComponent *meeting_page_get_cancel_comp (MeetingPage *mpage);
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 6261b8deda..e3c55ffe29 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -176,6 +176,19 @@ task_editor_init (TaskEditor *te)
priv = g_new0 (TaskEditorPrivate, 1);
te->priv = priv;
+ priv->model = E_MEETING_MODEL (e_meeting_model_new ());
+ priv->assignment_shown = TRUE;
+ priv->updating = FALSE;
+
+}
+
+TaskEditor *
+task_editor_construct (TaskEditor *te, CalClient *client)
+{
+ TaskEditorPrivate *priv;
+
+ priv = te->priv;
+
priv->task_page = task_page_new ();
comp_editor_append_page (COMP_EDITOR (te),
COMP_EDITOR_PAGE (priv->task_page),
@@ -186,20 +199,19 @@ task_editor_init (TaskEditor *te)
COMP_EDITOR_PAGE (priv->task_details_page),
_("Details"));
- priv->model = E_MEETING_MODEL (e_meeting_model_new ());
-
- priv->meet_page = meeting_page_new (priv->model);
+ priv->meet_page = meeting_page_new (priv->model, client);
comp_editor_append_page (COMP_EDITOR (te),
COMP_EDITOR_PAGE (priv->meet_page),
_("Assignment"));
- comp_editor_merge_ui (COMP_EDITOR (te), "evolution-task-editor.xml", verbs, NULL);
+ comp_editor_set_cal_client (COMP_EDITOR (te), client);
- priv->assignment_shown = TRUE;
- priv->updating = FALSE;
+ comp_editor_merge_ui (COMP_EDITOR (te), "evolution-task-editor.xml", verbs, NULL);
init_widgets (te);
set_menu_sens (te);
+
+ return te;
}
static void
@@ -334,6 +346,7 @@ task_editor_destroy (GtkObject *object)
/**
* task_editor_new:
+ * @client: a CalClient
*
* Creates a new event editor dialog.
*
@@ -341,9 +354,12 @@ task_editor_destroy (GtkObject *object)
* editor could not be created.
**/
TaskEditor *
-task_editor_new (void)
+task_editor_new (CalClient *client)
{
- return TASK_EDITOR (gtk_type_new (TYPE_TASK_EDITOR));
+ TaskEditor *te;
+
+ te = TASK_EDITOR (gtk_type_new (TYPE_TASK_EDITOR));
+ return task_editor_construct (te, client);
}
static void
diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h
index e9888f446a..070546bee0 100644
--- a/calendar/gui/dialogs/task-editor.h
+++ b/calendar/gui/dialogs/task-editor.h
@@ -53,8 +53,9 @@ struct _TaskEditorClass {
};
GtkType task_editor_get_type (void);
-TaskEditor *task_editor_construct (TaskEditor *te);
-TaskEditor *task_editor_new (void);
+TaskEditor *task_editor_construct (TaskEditor *te,
+ CalClient *client);
+TaskEditor *task_editor_new (CalClient *client);
void task_editor_show_assignment(TaskEditor *te);
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index f775b68f1a..91786ea389 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -910,9 +910,8 @@ open_task (ECalendarTable *cal_table, CalComponent *comp, gboolean assign)
tedit = e_comp_editor_registry_find (comp_editor_registry, uid);
if (tedit == NULL) {
- tedit = COMP_EDITOR (task_editor_new ());
+ tedit = COMP_EDITOR (task_editor_new (calendar_model_get_cal_client (cal_table->model)));
- comp_editor_set_cal_client (tedit, calendar_model_get_cal_client (cal_table->model));
comp_editor_edit_comp (tedit, comp);
if (assign)
task_editor_show_assignment (TASK_EDITOR (tedit));
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index 61c55e1598..d0097cc015 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -485,8 +485,7 @@ e_tasks_new_task (ETasks *tasks)
priv = tasks->priv;
- tedit = task_editor_new ();
- comp_editor_set_cal_client (COMP_EDITOR (tedit), priv->client);
+ tedit = task_editor_new (priv->client);
comp = cal_component_new ();
cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO);
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 1d694e7eae..32f6cd15ed 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -2208,14 +2208,13 @@ gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp,
if (!ce) {
EventEditor *ee;
- ee = event_editor_new ();
+ ee = event_editor_new (priv->client);
if (!ee) {
g_message ("gnome_calendar_edit_object(): Could not create the event editor");
return;
}
ce = COMP_EDITOR (ee);
- comp_editor_set_cal_client (ce, priv->client);
comp_editor_edit_comp (ce, comp);
if (meeting)
event_editor_show_meeting (ee);
@@ -2341,8 +2340,7 @@ gnome_calendar_new_task (GnomeCalendar *gcal)
priv = gcal->priv;
- tedit = task_editor_new ();
- comp_editor_set_cal_client (COMP_EDITOR (tedit), priv->task_pad_client);
+ tedit = task_editor_new (priv->task_pad_client);
comp = cal_component_new ();
cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO);
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 65634d9759..224d8b9d52 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -352,6 +352,28 @@ users_has_attendee (GList *users, const char *address)
return FALSE;
}
+static CORBA_char *
+comp_from (CalComponentItipMethod method, CalComponent *comp)
+{
+ CalComponentOrganizer organizer;
+
+ switch (method) {
+ case CAL_COMPONENT_METHOD_REQUEST:
+ case CAL_COMPONENT_METHOD_CANCEL:
+ cal_component_get_organizer (comp, &organizer);
+ if (organizer.value == NULL) {
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
+ _("An organizer must be set."));
+ return NULL;
+ }
+
+ return CORBA_string_dup (itip_strip_mailto (organizer.value));
+
+ default:
+ return CORBA_string_dup ("");
+ }
+}
+
static GNOME_Evolution_Composer_RecipientList *
comp_to_list (CalComponentItipMethod method, CalComponent *comp, GList *users)
{
@@ -862,7 +884,7 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp,
GNOME_Evolution_Composer_RecipientList *cc_list = NULL;
GNOME_Evolution_Composer_RecipientList *bcc_list = NULL;
CORBA_char *subject = NULL, *body = NULL, *content_type = NULL;
- CORBA_char *filename = NULL, *description = NULL;
+ CORBA_char *from = NULL, *filename = NULL, *description = NULL;
GNOME_Evolution_Composer_AttachmentData *attach_data = NULL;
char *ical_string;
CORBA_Environment ev;
@@ -904,8 +926,11 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp,
/* Subject information */
subject = comp_subject (method, comp);
+ /* From address */
+ from = comp_from (method, comp);
+
/* Set recipients, subject */
- GNOME_Evolution_Composer_setHeaders (composer_server, to_list, cc_list, bcc_list, subject, &ev);
+ GNOME_Evolution_Composer_setHeaders (composer_server, from, to_list, cc_list, bcc_list, subject, &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Unable to set composer headers while sending iTip message");
goto cleanup;
@@ -982,6 +1007,8 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp,
if (bcc_list != NULL)
CORBA_free (bcc_list);
+ if (from != NULL)
+ CORBA_free (from);
if (subject != NULL)
CORBA_free (subject);
if (body != NULL)
diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl
index abd3954dbd..e5a6e92c27 100644
--- a/calendar/idl/evolution-calendar.idl
+++ b/calendar/idl/evolution-calendar.idl
@@ -137,6 +137,11 @@ module Calendar {
/* A calendar is identified by its URI */
readonly attribute string uri;
+ /* Return the email address associated with this calendar,
+ if any. */
+ string getEmailAddress ()
+ raises (NotFound);
+
/* For going online/offline */
void setMode (in CalMode mode);
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 0e3c71c548..70b56be130 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -91,6 +91,7 @@ static void cal_backend_file_init (CalBackendFile *cbfile);
static void cal_backend_file_destroy (GtkObject *object);
static const char *cal_backend_file_get_uri (CalBackend *backend);
+static const char *cal_backend_file_get_email_address (CalBackend *backend);
static CalBackendOpenStatus cal_backend_file_open (CalBackend *backend,
const char *uristr,
gboolean only_if_exists);
@@ -187,6 +188,7 @@ cal_backend_file_class_init (CalBackendFileClass *class)
object_class->destroy = cal_backend_file_destroy;
backend_class->get_uri = cal_backend_file_get_uri;
+ backend_class->get_email_address = cal_backend_file_get_email_address;
backend_class->open = cal_backend_file_open;
backend_class->is_loaded = cal_backend_file_is_loaded;
backend_class->get_query = cal_backend_file_get_query;
@@ -449,6 +451,16 @@ cal_backend_file_get_uri (CalBackend *backend)
return (const char *) priv->uri;
}
+/* Get_email_address handler for the file backend */
+static const char *
+cal_backend_file_get_email_address (CalBackend *backend)
+{
+ /* A file backend has no particular email address associated
+ * with it (although that would be a useful feature some day).
+ */
+ return NULL;
+}
+
/* Used from g_hash_table_foreach(), adds a category name to the sequence */
static void
add_category_cb (gpointer key, gpointer value, gpointer data)
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index 0954c53472..19f8261797 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -141,6 +141,7 @@ cal_backend_class_init (CalBackendClass *class)
class->obj_removed = NULL;
class->get_uri = NULL;
+ class->get_email_address = NULL;
class->open = NULL;
class->is_loaded = NULL;
class->get_query = NULL;
@@ -182,6 +183,25 @@ cal_backend_get_uri (CalBackend *backend)
return (* CLASS (backend)->get_uri) (backend);
}
+/**
+ * cal_backend_get_email_address:
+ * @backend: A calendar backend.
+ *
+ * Queries the email address associated with a calendar backend, which
+ * must already have an open calendar.
+ *
+ * Return value: The email address associated with the calendar.
+ **/
+const char *
+cal_backend_get_email_address (CalBackend *backend)
+{
+ g_return_val_if_fail (backend != NULL, NULL);
+ g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL);
+
+ g_assert (CLASS (backend)->get_email_address != NULL);
+ return (* CLASS (backend)->get_email_address) (backend);
+}
+
/* Callback used when a Cal is destroyed */
static void
cal_destroy_cb (GtkObject *object, gpointer data)
diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h
index 737a1604e8..af11be14e8 100644
--- a/calendar/pcs/cal-backend.h
+++ b/calendar/pcs/cal-backend.h
@@ -93,6 +93,8 @@ struct _CalBackendClass {
/* Virtual methods */
const char *(* get_uri) (CalBackend *backend);
+ const char *(* get_email_address) (CalBackend *backend);
+
CalBackendOpenStatus (* open) (CalBackend *backend, const char *uristr,
gboolean only_if_exists);
@@ -146,6 +148,8 @@ GtkType cal_backend_get_type (void);
const char *cal_backend_get_uri (CalBackend *backend);
+const char *cal_backend_get_email_address (CalBackend *backend);
+
void cal_backend_add_cal (CalBackend *backend, Cal *cal);
CalBackendOpenStatus cal_backend_open (CalBackend *backend, const char *uristr,
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c
index a266977cbc..31580e62e4 100644
--- a/calendar/pcs/cal.c
+++ b/calendar/pcs/cal.c
@@ -64,6 +64,30 @@ impl_Cal_get_uri (PortableServer_Servant servant,
return str_uri_copy;
}
+/* Cal::get_email_address method */
+static CORBA_char *
+impl_Cal_get_email_address (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ Cal *cal;
+ CalPrivate *priv;
+ const char *str_email_address;
+ CORBA_char *str_email_address_copy;
+
+ cal = CAL (bonobo_object_from_servant (servant));
+ priv = cal->priv;
+
+ str_email_address = cal_backend_get_email_address (priv->backend);
+ if (str_email_address == NULL) {
+ bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_NotFound);
+ return CORBA_OBJECT_NIL;
+ }
+
+ str_email_address_copy = CORBA_string_dup (str_email_address);
+
+ return str_email_address_copy;
+}
+
/* Converts a calendar object type from its CORBA representation to our own
* representation.
*/
@@ -707,6 +731,7 @@ cal_class_init (CalClass *klass)
/* Epv methods */
epv->_get_uri = impl_Cal_get_uri;
+ epv->getEmailAddress = impl_Cal_get_email_address;
epv->setMode = impl_Cal_set_mode;
epv->countObjects = impl_Cal_get_n_objects;
epv->getObject = impl_Cal_get_object;