From fc2c499f8bc737190309484a96e13dccd3cefbdf Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 27 Sep 2002 20:23:20 +0000 Subject: 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 --- calendar/gui/dialogs/meeting-page.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'calendar/gui/dialogs/meeting-page.c') 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; } -- cgit v1.2.3