diff options
-rw-r--r-- | calendar/ChangeLog | 76 | ||||
-rw-r--r-- | calendar/cal-util/cal-component.c | 28 | ||||
-rw-r--r-- | calendar/cal-util/cal-component.h | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-page.c | 25 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-page.h | 1 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 109 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.h | 6 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 59 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.c | 162 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.glade | 82 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 81 | ||||
-rw-r--r-- | calendar/gui/e-meeting-model.c | 119 | ||||
-rw-r--r-- | calendar/gui/e-meeting-model.h | 5 | ||||
-rw-r--r-- | calendar/gui/e-meeting-time-sel.c | 19 | ||||
-rw-r--r-- | calendar/gui/itip-utils.c | 83 | ||||
-rw-r--r-- | calendar/gui/itip-utils.h | 3 |
16 files changed, 625 insertions, 235 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index c1216e5154..794bd25a1d 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,79 @@ +2002-06-25 JP Rosevear <jpr@ximian.com> + + * gui/dialogs/comp-editor-page.h: add back proto + + * gui/dialogs/comp-editor-page.c + (comp_editor_page_notify_needs_send): add page needs_send signal + + * gui/e-meeting-time-sel.c + (e_meeting_time_selector_on_invite_others_button_draw): check to + see if the button should be sensitive when drawing + (e_meeting_time_selector_construct): listen for the button draw + signal + + * cal-util/cal-component.c (cal_component_strip_errors): remove + X-LIC-ERROR x properties + + * cal-util/cal-component.h: new proto + + * gui/dialogs/meeting-page.c (change_clicked_cb): set needs_send + to true + (meeting_page_fill_widgets): set up gui based on if the user or + someone else is the organizer + (meeting_page_construct): read the addresses here for the combo + box + (get_widgets): explicitly set the value in list values + + * gui/dialogs/event-editor.c (set_menu_sens): base this on the + exist org and user org values of the comp editor + (event_editor_edit_comp): set up editable row restrictions on the + meeting model if the user is not an organizer, and don't set needs + send if we aren't the organizer initially + (model_row_changed_cb): set needs_send to true + (row_count_changed_cb): ditto + + * gui/dialogs/meeting-page.glade: update gui + + * gui/dialogs/comp-editor.c (save_comp_with_send): if the user is + not the organizer, REPLY rather than REQUEST + (comp_editor_set_existing_org): accessor + (comp_editor_get_existing_org): ditto + (comp_editor_set_user_org): ditto + (comp_editor_get_user_org): ditto + (real_edit_comp): determine if there is an existing organizer and + if the organizers is a user + (page_changed_cb): warn the user that changes may be discarded + (page_summary_changed_cb): ditto + (page_dates_changed_cb): ditto + + * gui/dialogs/comp-editor.h: new protos + + * gui/itip-utils.c (itip_organizer_is_user): determine if the + organizer of a component is a user + (itip_sentby_is_user): same for sentby field of organizer + (comp_sentby): use above routines instead + (comp_compliant): strip all X-LIC-ERROR fields generated by + libical + + * gui/e-meeting-model.c (is_cell_editable): if there is a list of + editable rows, allow only the status column of those rows to be + edited + (init): init edit_rows + (e_meeting_model_restricted_add): add an editable row to the model + (e_meeting_model_restricted_remove): remove an editable row + (e_meeting_model_restricted_clear): clear all editable rows + (e_meeting_model_etable_click_to_add): set the click to add arg on + all tables + (e_meeting_model_etable_from_model): track the tables + (table_destroy_list_cb): remove the table being destroyed from the + list + (table_destroy_state_cb): remove the table being destroyed from + the list + + * gui/e-meeting-model.h: new protos + + * gui/e-itip-control.c (update_attendee_status): kill warning + 2002-06-18 JP Rosevear <jpr@ximian.com> * zones.h: update for new zones diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c index a618e0ef4b..6101c3cd63 100644 --- a/calendar/cal-util/cal-component.c +++ b/calendar/cal-util/cal-component.c @@ -1090,6 +1090,20 @@ cal_component_rescan (CalComponent *comp) ensure_mandatory_properties (comp); } +void +cal_component_strip_errors (CalComponent *comp) +{ + CalComponentPrivate *priv; + icalproperty *prop; + + g_return_if_fail (comp != NULL); + g_return_if_fail (IS_CAL_COMPONENT (comp)); + + priv = comp->priv; + + icalcomponent_strip_errors (priv->icalcomp); +} + /** * cal_component_get_vtype: * @comp: A calendar component object. @@ -1276,6 +1290,19 @@ cal_component_commit_sequence (CalComponent *comp) priv->need_sequence_inc = FALSE; } +void +cal_component_abort_sequence (CalComponent *comp) +{ + CalComponentPrivate *priv; + + g_return_if_fail (comp != NULL); + g_return_if_fail (IS_CAL_COMPONENT (comp)); + + priv = comp->priv; + + priv->need_sequence_inc = FALSE; +} + /** * cal_component_get_uid: * @comp: A calendar component object. @@ -5212,3 +5239,4 @@ cal_component_event_dates_match (CalComponent *comp1, return retval; } + diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h index 4961c504e4..888f65ccbe 100644 --- a/calendar/cal-util/cal-component.h +++ b/calendar/cal-util/cal-component.h @@ -209,12 +209,14 @@ void cal_component_set_new_vtype (CalComponent *comp, CalComponentVType type); gboolean cal_component_set_icalcomponent (CalComponent *comp, icalcomponent *icalcomp); icalcomponent *cal_component_get_icalcomponent (CalComponent *comp); void cal_component_rescan (CalComponent *comp); +void cal_component_strip_errors (CalComponent *comp); CalComponentVType cal_component_get_vtype (CalComponent *comp); char *cal_component_get_as_string (CalComponent *comp); void cal_component_commit_sequence (CalComponent *comp); +void cal_component_abort_sequence (CalComponent *comp); void cal_component_get_uid (CalComponent *comp, const char **uid); void cal_component_set_uid (CalComponent *comp, const char *uid); diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c index 0d7f315837..b1fabf28be 100644 --- a/calendar/gui/dialogs/comp-editor-page.c +++ b/calendar/gui/dialogs/comp-editor-page.c @@ -37,6 +37,7 @@ static GtkObjectClass *parent_class = NULL; enum { CHANGED, + NEEDS_SEND, SUMMARY_CHANGED, DATES_CHANGED, LAST_SIGNAL @@ -100,6 +101,15 @@ comp_editor_page_class_init (CompEditorPageClass *class) gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); + comp_editor_page_signals[NEEDS_SEND] = + gtk_signal_new ("needs_send", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (CompEditorPageClass, + needs_send), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + comp_editor_page_signals[SUMMARY_CHANGED] = gtk_signal_new ("summary_changed", GTK_RUN_FIRST, @@ -322,6 +332,21 @@ comp_editor_page_notify_changed (CompEditorPage *page) } /** + * comp_editor_page_notify_needs_send: + * @page: + * + * + **/ +void +comp_editor_page_notify_needs_send (CompEditorPage *page) +{ + g_return_if_fail (page != NULL); + g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); + + gtk_signal_emit (GTK_OBJECT (page), comp_editor_page_signals[NEEDS_SEND]); +} + +/** * comp_editor_page_notify_summary_changed: * @page: An editor page. * diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h index 6ef5549219..1b84cb16b7 100644 --- a/calendar/gui/dialogs/comp-editor-page.h +++ b/calendar/gui/dialogs/comp-editor-page.h @@ -95,6 +95,7 @@ void comp_editor_page_set_summary (CompEditorPage *page, void comp_editor_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); void comp_editor_page_notify_changed (CompEditorPage *page); +void comp_editor_page_notify_needs_send (CompEditorPage *page); void comp_editor_page_notify_summary_changed (CompEditorPage *page, const char *summary); void comp_editor_page_notify_dates_changed (CompEditorPage *page, diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 3e245a0c98..1179453aff 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -35,9 +35,11 @@ #include <libgnomeui/gnome-dialog-util.h> #include <libgnomeui/gnome-stock.h> #include <libgnomeui/gnome-window-icon.h> +#include <libgnomeui/gnome-messagebox.h> #include <bonobo/bonobo-ui-container.h> #include <bonobo/bonobo-ui-util.h> #include <gal/widgets/e-unicode.h> +#include <gal/widgets/e-gui-utils.h> #include <e-util/e-dialog-utils.h> #include <evolution-shell-component-utils.h> #include "../print.h" @@ -70,7 +72,12 @@ struct _CompEditorPrivate { gboolean changed; gboolean needs_send; - gboolean needs_send_new; + + gboolean existing_org; + gboolean user_org; + + gboolean warned; + gboolean updating; }; @@ -240,7 +247,9 @@ comp_editor_init (CompEditor *editor) priv->pages = NULL; priv->changed = FALSE; priv->needs_send = FALSE; - priv->needs_send_new = FALSE; + priv->existing_org = FALSE; + priv->user_org = FALSE; + priv->warned = FALSE; } @@ -311,7 +320,13 @@ save_comp (CompEditor *editor) return FALSE; } } - cal_component_commit_sequence (clone); + + /* If we are not the organizer, we don't update the sequence number */ + if (!cal_component_has_organizer (clone) || itip_organizer_is_user (clone)) + cal_component_commit_sequence (clone); + else + cal_component_abort_sequence (clone); + gtk_object_unref (GTK_OBJECT (priv->comp)); priv->comp = clone; @@ -364,8 +379,12 @@ save_comp_with_send (CompEditor *editor) if (!save_comp (editor)) return FALSE; - if (send && send_component_dialog (priv->comp, priv->needs_send_new)) - comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST); + if (send && send_component_dialog (priv->comp, priv->existing_org)) { + if (itip_organizer_is_user (priv->comp)) + comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST); + else + comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REPLY); + } return TRUE; } @@ -437,6 +456,59 @@ close_dialog (CompEditor *editor) +void +comp_editor_set_existing_org (CompEditor *editor, gboolean existing_org) +{ + CompEditorPrivate *priv; + + g_return_if_fail (editor != NULL); + g_return_if_fail (IS_COMP_EDITOR (editor)); + + priv = editor->priv; + + priv->existing_org = existing_org; +} + +gboolean +comp_editor_get_existing_org (CompEditor *editor) +{ + CompEditorPrivate *priv; + + g_return_val_if_fail (editor != NULL, FALSE); + g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); + + priv = editor->priv; + + return priv->existing_org; +} + +void +comp_editor_set_user_org (CompEditor *editor, gboolean user_org) +{ + CompEditorPrivate *priv; + + g_return_if_fail (editor != NULL); + g_return_if_fail (IS_COMP_EDITOR (editor)); + + priv = editor->priv; + + priv->user_org = user_org; +} + +gboolean +comp_editor_get_user_org (CompEditor *editor) +{ + CompEditorPrivate *priv; + + g_return_val_if_fail (editor != NULL, FALSE); + g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); + + priv = editor->priv; + + return priv->user_org; +} + + /** * comp_editor_set_changed: * @editor: A component editor @@ -853,7 +925,7 @@ static void real_edit_comp (CompEditor *editor, CalComponent *comp) { CompEditorPrivate *priv; - + g_return_if_fail (editor != NULL); g_return_if_fail (IS_COMP_EDITOR (editor)); @@ -867,8 +939,10 @@ real_edit_comp (CompEditor *editor, CalComponent *comp) if (comp) priv->comp = cal_component_clone (comp); - priv->needs_send_new = !priv->needs_send; - + priv->existing_org = cal_component_has_organizer (comp); + priv->user_org = itip_organizer_is_user (comp); + priv->warned = FALSE; + set_title_from_comp (editor); set_icon_from_comp (editor); fill_widgets (editor); @@ -1219,6 +1293,13 @@ page_changed_cb (GtkObject *obj, gpointer data) priv = editor->priv; priv->changed = TRUE; + + if (!priv->warned && priv->existing_org && !priv->user_org) { + e_notice (NULL, GNOME_MESSAGE_BOX_INFO, + _("Changes made to this item may be discarded if an update arrives via email")); + priv->warned = TRUE; + } + } /* Page signal callbacks */ @@ -1236,6 +1317,12 @@ page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data) comp_editor_page_set_summary (l->data, summary); priv->changed = TRUE; + + if (!priv->warned && priv->existing_org && !priv->user_org) { + e_notice (NULL, GNOME_MESSAGE_BOX_INFO, + _("Changes made to this item may be discarded if an update arrives via email")); + priv->warned = TRUE; + } } static void @@ -1254,6 +1341,12 @@ page_dates_changed_cb (GtkObject *obj, comp_editor_page_set_dates (l->data, dates); priv->changed = TRUE; + + if (!priv->warned && priv->existing_org && !priv->user_org) { + e_notice (NULL, GNOME_MESSAGE_BOX_INFO, + _("Changes made to this item may be discarded if an update arrives via email")); + priv->warned = TRUE; + } } static void diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 6772f135e8..18fcd473b7 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -65,6 +65,12 @@ gboolean comp_editor_get_changed (CompEditor *editor); void comp_editor_set_needs_send (CompEditor *editor, gboolean needs_send); gboolean comp_editor_get_needs_send (CompEditor *editor); +void comp_editor_set_existing_org (CompEditor *editor, + gboolean existing_org); +gboolean comp_editor_get_existing_org (CompEditor *editor); +void comp_editor_set_user_org (CompEditor *editor, + gboolean user_org); +gboolean comp_editor_get_user_org (CompEditor *editor); void comp_editor_append_page (CompEditor *editor, CompEditorPage *page, const char *label); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 08c98dfaba..7c020caff0 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -48,7 +48,6 @@ struct _EventEditorPrivate { EMeetingModel *model; gboolean meeting_shown; - gboolean existing_org; gboolean updating; }; @@ -142,19 +141,24 @@ static void set_menu_sens (EventEditor *ee) { EventEditorPrivate *priv; - gboolean sens; + gboolean sens, existing, user; priv = ee->priv; + existing = comp_editor_get_existing_org (COMP_EDITOR (ee)); + user = comp_editor_get_user_org (COMP_EDITOR (ee)); + sens = priv->meeting_shown; comp_editor_set_ui_prop (COMP_EDITOR (ee), "/commands/ActionScheduleMeeting", "sensitive", sens ? "0" : "1"); - sens = sens && priv->existing_org; + sens = priv->meeting_shown && existing && !user; comp_editor_set_ui_prop (COMP_EDITOR (ee), "/commands/ActionRefreshMeeting", "sensitive", sens ? "1" : "0"); + + sens = priv->meeting_shown && existing && user; comp_editor_set_ui_prop (COMP_EDITOR (ee), "/commands/ActionCancelMeeting", "sensitive", sens ? "1" : "0"); @@ -214,7 +218,6 @@ event_editor_init (EventEditor *ee) comp_editor_merge_ui (COMP_EDITOR (ee), "evolution-event-editor.xml", verbs, pixmaps); priv->meeting_shown = TRUE; - priv->existing_org = FALSE; priv->updating = FALSE; init_widgets (ee); @@ -241,17 +244,26 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp) { EventEditor *ee; EventEditorPrivate *priv; + CalComponentOrganizer organizer; GSList *attendees = NULL; ee = EVENT_EDITOR (editor); priv = ee->priv; priv->updating = TRUE; + + if (parent_class->edit_comp) + parent_class->edit_comp (editor, comp); - priv->existing_org = cal_component_has_organizer (comp); + /* Get meeting related stuff */ + cal_component_get_organizer (comp, &organizer); cal_component_get_attendee_list (comp, &attendees); + /* Clear things up */ + e_meeting_model_restricted_clear (priv->model); e_meeting_model_remove_all_attendees (priv->model); + + /* Set up the attendees */ if (attendees == NULL) { comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page)); comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->sched_page)); @@ -267,26 +279,45 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp) COMP_EDITOR_PAGE (priv->meet_page), _("Meeting")); } - + for (l = attendees; l != NULL; l = l->next) { CalComponentAttendee *ca = l->data; EMeetingAttendee *ia; ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_cal_component_attendee (ca)); e_meeting_model_add_attendee (priv->model, ia); + gtk_object_unref (GTK_OBJECT (ia)); } + + if (organizer.value != NULL) { + GList *addresses, *l; + const char *strip; + int row; + + strip = itip_strip_mailto (organizer.value); + + addresses = itip_addresses_get (); + for (l = addresses; l != NULL; l = l->next) { + ItipAddress *a = l->data; + + if (e_meeting_model_find_attendee (priv->model, a->address, &row)) + e_meeting_model_restricted_add (priv->model, row); + } + itip_addresses_free (addresses); + } + + if (comp_editor_get_user_org (editor)) + e_meeting_model_restricted_clear (priv->model); + priv->meeting_shown = TRUE; } cal_component_free_attendee_list (attendees); set_menu_sens (ee); - comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown); + comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown && itip_organizer_is_user (comp)); priv->updating = FALSE; - - if (parent_class->edit_comp) - parent_class->edit_comp (editor, comp); } static void @@ -438,8 +469,10 @@ model_row_changed_cb (ETableModel *etm, int row, gpointer data) priv = ee->priv; - if (!priv->updating) + if (!priv->updating) { comp_editor_set_changed (COMP_EDITOR (ee), TRUE); + comp_editor_set_needs_send (COMP_EDITOR (ee), TRUE); + } } static void @@ -450,6 +483,8 @@ row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data) priv = ee->priv; - if (!priv->updating) + if (!priv->updating) { comp_editor_set_changed (COMP_EDITOR (ee), TRUE); + comp_editor_set_needs_send (COMP_EDITOR (ee), TRUE); + } } diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c index 2504ed3993..554afd2ecd 100644 --- a/calendar/gui/dialogs/meeting-page.c +++ b/calendar/gui/dialogs/meeting-page.c @@ -26,6 +26,7 @@ #endif #include <glib.h> +#include <gtk/gtkcombo.h> #include <gtk/gtksignal.h> #include <gtk/gtktogglebutton.h> #include <gtk/gtkvbox.h> @@ -87,10 +88,6 @@ struct _MeetingPagePrivate { GtkWidget *main; GtkWidget *organizer_table; GtkWidget *organizer; - GtkWidget *organizer_lbl; - GtkWidget *other_organizer; - GtkWidget *other_organizer_lbl; - GtkWidget *other_organizer_btn; GtkWidget *existing_organizer_table; GtkWidget *existing_organizer; GtkWidget *existing_organizer_btn; @@ -102,8 +99,8 @@ struct _MeetingPagePrivate { gint row; /* For handling who the organizer is */ - gboolean other; gboolean existing; + gboolean updating; }; @@ -184,13 +181,16 @@ static void meeting_page_init (MeetingPage *mpage) { MeetingPagePrivate *priv; - + priv = g_new0 (MeetingPagePrivate, 1); mpage->priv = priv; - + priv->deleted_attendees = g_ptr_array_new (); priv->comp = NULL; + + priv->addresses = NULL; + priv->address_strings = NULL; priv->xml = NULL; priv->main = NULL; @@ -254,8 +254,6 @@ meeting_page_destroy (GtkObject *object) g_ptr_array_free (priv->deleted_attendees, FALSE); itip_addresses_free (priv->addresses); - g_list_foreach (priv->address_strings, (GFunc) g_free, NULL); - g_list_free (priv->address_strings); gtk_object_unref (GTK_OBJECT (priv->model)); @@ -308,17 +306,12 @@ clear_widgets (MeetingPage *mpage) priv = mpage->priv; gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry), ""); - gtk_entry_set_text (GTK_ENTRY (priv->other_organizer), ""); gtk_label_set_text (GTK_LABEL (priv->existing_organizer), _("None")); gtk_widget_show (priv->organizer_table); gtk_widget_hide (priv->existing_organizer_table); - gtk_widget_hide (priv->other_organizer_lbl); - gtk_widget_hide (priv->other_organizer); - priv->existing = FALSE; - priv->other = FALSE; } /* fill_widgets handler for the meeting page */ @@ -328,7 +321,6 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp) MeetingPage *mpage; MeetingPagePrivate *priv; CalComponentOrganizer organizer; - GList *l; mpage = MEETING_PAGE (page); priv = mpage->priv; @@ -348,45 +340,41 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp) /* Component for cancellation */ priv->comp = cal_component_clone (comp); - /* Organizer */ - cal_component_get_organizer (comp, &organizer); - priv->addresses = itip_addresses_get (); - for (l = priv->addresses; l != NULL; l = l->next) { - ItipAddress *a = l->data; - char *s; - - 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; - } + /* List the user identities for default organizers */ gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), priv->address_strings); - if (organizer.value != NULL) { - const gchar *strip = itip_strip_mailto (organizer.value); - gchar *s, *string; - - gtk_widget_hide (priv->organizer_table); - gtk_widget_show (priv->existing_organizer_table); - gtk_widget_hide (priv->invite); - - if (organizer.cn != NULL) - string = g_strdup_printf ("%s <%s>", organizer.cn, strip); - else - string = g_strdup (strip); - s = e_utf8_to_gtk_string (priv->existing_organizer, string); - gtk_label_set_text (GTK_LABEL (priv->existing_organizer), s); - g_free (s); - g_free (string); - - priv->existing = TRUE; + /* If there is an existing organizer show it properly */ + if (cal_component_has_organizer (comp)) { + cal_component_get_organizer (comp, &organizer); + if (organizer.value != NULL) { + const gchar *strip = itip_strip_mailto (organizer.value); + gchar *s, *string; + + gtk_widget_hide (priv->organizer_table); + gtk_widget_show (priv->existing_organizer_table); + if (itip_organizer_is_user (comp)) { + gtk_widget_show (priv->invite); + e_meeting_model_etable_click_to_add (priv->model, TRUE); + } else { + gtk_widget_hide (priv->invite); + e_meeting_model_etable_click_to_add (priv->model, FALSE); + } + + if (organizer.cn != NULL) + string = g_strdup_printf ("%s <%s>", organizer.cn, strip); + else + string = g_strdup (strip); + s = e_utf8_to_gtk_string (priv->existing_organizer, string); + gtk_label_set_text (GTK_LABEL (priv->existing_organizer), s); + g_free (s); + g_free (string); + + priv->existing = TRUE; + } } else { - gtk_widget_hide (priv->other_organizer_lbl); - gtk_widget_hide (priv->other_organizer); - e_dialog_editable_set (GTK_COMBO (priv->organizer)->entry, priv->default_address); } - + priv->updating = FALSE; } @@ -402,24 +390,24 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp) priv = mpage->priv; if (!priv->existing) { - gchar *addr = NULL, *cn = NULL; + gchar *addr = NULL, *cn = NULL, *sentby = NULL, *str; GList *l; + + str = e_dialog_editable_get (GTK_COMBO (priv->organizer)->entry); - if (priv->other) { - addr = e_dialog_editable_get (priv->other_organizer); - } else { - gchar *str = e_dialog_editable_get (GTK_COMBO (priv->organizer)->entry); - for (l = priv->addresses; l != NULL; l = l->next) { - ItipAddress *a = l->data; + /* Find the identity for the organizer or sentby field */ + for (l = priv->addresses; l != NULL; l = l->next) { + ItipAddress *a = l->data; - if (!strcmp (a->full, str)) { + if (!strcmp (a->full, str)) { addr = g_strdup (a->address); cn = g_strdup (a->name); - } } - g_free (str); } + + g_free (str); + /* Sanity Check */ if (addr == NULL || strlen (addr) == 0) { e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("An organizer is required.")); @@ -436,9 +424,12 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp) organizer.value = addr; organizer.cn = cn; + organizer.sentby = sentby; cal_component_set_organizer (comp, &organizer); + g_free (addr); g_free (cn); + g_free (sentby); } if (e_meeting_model_count_actual_attendees (priv->model) < 1) { @@ -482,12 +473,12 @@ get_widgets (MeetingPage *mpage) gtk_widget_ref (priv->main); gtk_widget_unparent (priv->main); + /* For making the user the organizer */ priv->organizer_table = GW ("organizer-table"); priv->organizer = GW ("organizer"); - priv->organizer_lbl = GW ("organizer-label"); - priv->other_organizer = GW ("other-organizer"); - priv->other_organizer_lbl = GW ("other-organizer-label"); - priv->other_organizer_btn = GW ("other-organizer-button"); + gtk_combo_set_value_in_list (GTK_COMBO (priv->organizer), TRUE, FALSE); + + /* For showing existing organizers */ priv->existing_organizer_table = GW ("existing-organizer-table"); priv->existing_organizer = GW ("existing-organizer"); priv->existing_organizer_btn = GW ("existing-organizer-button"); @@ -498,10 +489,6 @@ get_widgets (MeetingPage *mpage) return (priv->invite && priv->organizer_table && priv->organizer - && priv->organizer_lbl - && priv->other_organizer - && priv->other_organizer_lbl - && priv->other_organizer_btn && priv->existing_organizer_table && priv->existing_organizer && priv->existing_organizer_btn); @@ -517,29 +504,10 @@ field_changed_cb (GtkWidget *widget, gpointer data) mpage = MEETING_PAGE (data); priv = mpage->priv; - if (!priv->updating) + if (!priv->updating) comp_editor_page_notify_changed (COMP_EDITOR_PAGE (mpage)); } -/* Function called to make the organizer other than the user */ -static void -other_clicked_cb (GtkWidget *widget, gpointer data) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - - mpage = MEETING_PAGE (data); - priv = mpage->priv; - - gtk_widget_hide (priv->organizer_lbl); - gtk_widget_hide (priv->organizer); - gtk_widget_hide (priv->other_organizer_btn); - gtk_widget_show (priv->other_organizer_lbl); - gtk_widget_show (priv->other_organizer); - - priv->other = TRUE; -} - /* Function called to change the organizer */ static void change_clicked_cb (GtkWidget *widget, gpointer data) @@ -553,10 +521,11 @@ change_clicked_cb (GtkWidget *widget, gpointer data) gtk_widget_show (priv->organizer_table); gtk_widget_hide (priv->existing_organizer_table); gtk_widget_show (priv->invite); + e_meeting_model_etable_click_to_add (priv->model, TRUE); - gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), priv->address_strings); e_dialog_editable_set (GTK_COMBO (priv->organizer)->entry, priv->default_address); - + comp_editor_page_notify_needs_send (COMP_EDITOR_PAGE (mpage)); + priv->existing = FALSE; } @@ -585,8 +554,6 @@ init_widgets (MeetingPage *mpage) gtk_signal_connect (GTK_OBJECT (GTK_COMBO (priv->organizer)->entry), "changed", GTK_SIGNAL_FUNC (field_changed_cb), mpage); - gtk_signal_connect (GTK_OBJECT (priv->other_organizer_btn), "clicked", - GTK_SIGNAL_FUNC (other_clicked_cb), mpage); gtk_signal_connect (GTK_OBJECT (priv->existing_organizer_btn), "clicked", GTK_SIGNAL_FUNC (change_clicked_cb), mpage); @@ -770,6 +737,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm) MeetingPagePrivate *priv; ETable *real_table; gchar *filename; + GList *l; priv = mpage->priv; @@ -786,6 +754,18 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm) "Could not find all widgets in the XML file!"); return NULL; } + + /* Address information */ + priv->addresses = itip_addresses_get (); + for (l = priv->addresses; l != NULL; l = l->next) { + ItipAddress *a = l->data; + char *s; + + 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; + } /* The etable displaying attendees and their status */ gtk_object_ref (GTK_OBJECT (emm)); diff --git a/calendar/gui/dialogs/meeting-page.glade b/calendar/gui/dialogs/meeting-page.glade index f06f457d16..7a4b53dd5d 100644 --- a/calendar/gui/dialogs/meeting-page.glade +++ b/calendar/gui/dialogs/meeting-page.glade @@ -46,15 +46,15 @@ <class>GtkTable</class> <name>organizer-table</name> <border_width>4</border_width> - <rows>2</rows> + <rows>1</rows> <columns>3</columns> <homogeneous>False</homogeneous> <row_spacing>0</row_spacing> <column_spacing>4</column_spacing> <child> <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <expand>False</expand> + <fill>False</fill> </child> <widget> @@ -94,52 +94,6 @@ </widget> <widget> - <class>GtkButton</class> - <name>other-organizer-button</name> - <can_focus>True</can_focus> - <label>_Other Organizer</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>other-organizer</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> <class>GtkLabel</class> <name>organizer-label</name> <label>Organizer:</label> @@ -164,32 +118,6 @@ <yfill>False</yfill> </child> </widget> - - <widget> - <class>GtkLabel</class> - <name>other-organizer-label</name> - <label>Organizer:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> </widget> <widget> @@ -203,8 +131,8 @@ <column_spacing>4</column_spacing> <child> <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <expand>False</expand> + <fill>False</fill> </child> <widget> diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index e3acaaf13a..b712e07135 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -43,7 +43,6 @@ struct _TaskEditorPrivate { EMeetingModel *model; gboolean assignment_shown; - gboolean existing_org; gboolean updating; }; @@ -130,22 +129,27 @@ static void set_menu_sens (TaskEditor *te) { TaskEditorPrivate *priv; - gboolean sens; + gboolean sens, existing, user; priv = te->priv; - sens = priv->assignment_shown; - comp_editor_set_ui_prop (COMP_EDITOR (te), - "/commands/ActionAssignTask", - "sensitive", sens ? "0" : "1"); - - sens = sens && priv->existing_org; - comp_editor_set_ui_prop (COMP_EDITOR (te), - "/commands/ActionRefreshTask", - "sensitive", sens ? "1" : "0"); - comp_editor_set_ui_prop (COMP_EDITOR (te), - "/commands/ActionCancelTask", - "sensitive", sens ? "1" : "0"); + existing = comp_editor_get_existing_org (COMP_EDITOR (te)); + user = comp_editor_get_user_org (COMP_EDITOR (te)); + + sens = priv->assignment_shown; + comp_editor_set_ui_prop (COMP_EDITOR (te), + "/commands/ActionAssignTask", + "sensitive", sens ? "0" : "1"); + + sens = priv->assignment_shown && existing && !user; + comp_editor_set_ui_prop (COMP_EDITOR (te), + "/commands/ActionRefreshTask", + "sensitive", sens ? "1" : "0"); + + sens = priv->assignment_shown && existing && user; + comp_editor_set_ui_prop (COMP_EDITOR (te), + "/commands/ActionCancelTask", + "sensitive", sens ? "1" : "0"); } static void @@ -192,7 +196,6 @@ task_editor_init (TaskEditor *te) comp_editor_merge_ui (COMP_EDITOR (te), "evolution-task-editor.xml", verbs, NULL); priv->assignment_shown = TRUE; - priv->existing_org = FALSE; priv->updating = FALSE; init_widgets (te); @@ -204,6 +207,7 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp) { TaskEditor *te; TaskEditorPrivate *priv; + CalComponentOrganizer organizer; GSList *attendees = NULL; te = TASK_EDITOR (editor); @@ -211,10 +215,17 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp) priv->updating = TRUE; - priv->existing_org = cal_component_has_organizer (comp); + if (parent_class->edit_comp) + parent_class->edit_comp (editor, comp); + + /* Get meeting related stuff */ + cal_component_get_organizer (comp, &organizer); cal_component_get_attendee_list (comp, &attendees); + /* Clear things up */ + e_meeting_model_restricted_clear (priv->model); e_meeting_model_remove_all_attendees (priv->model); + if (attendees == NULL) { comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page)); priv->assignment_shown = FALSE; @@ -233,17 +244,35 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp) e_meeting_model_add_attendee (priv->model, ia); gtk_object_unref (GTK_OBJECT (ia)); } + + if (organizer.value != NULL) { + GList *addresses, *l; + const char *strip; + int row; + + strip = itip_strip_mailto (organizer.value); + + addresses = itip_addresses_get (); + for (l = addresses; l != NULL; l = l->next) { + ItipAddress *a = l->data; + + if (e_meeting_model_find_attendee (priv->model, a->address, &row)) + e_meeting_model_restricted_add (priv->model, row); + } + itip_addresses_free (addresses); + } + + if (comp_editor_get_user_org (editor)) + e_meeting_model_restricted_clear (priv->model); + priv->assignment_shown = TRUE; } cal_component_free_attendee_list (attendees); set_menu_sens (te); - comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown); + comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown && itip_organizer_is_user (comp)); priv->updating = FALSE; - - if (parent_class->edit_comp) - parent_class->edit_comp (editor, comp); } static void @@ -387,9 +416,11 @@ model_row_changed_cb (ETableModel *etm, int row, gpointer data) TaskEditorPrivate *priv; priv = te->priv; - - if (!priv->updating) + + if (!priv->updating) { comp_editor_set_changed (COMP_EDITOR (te), TRUE); + comp_editor_set_needs_send (COMP_EDITOR (te), TRUE); + } } static void @@ -399,7 +430,9 @@ row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data) TaskEditorPrivate *priv; priv = te->priv; - - if (!priv->updating) + + if (!priv->updating) { comp_editor_set_changed (COMP_EDITOR (te), TRUE); + comp_editor_set_needs_send (COMP_EDITOR (te), TRUE); + } } diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c index 6adfb9c1c9..7f1479f452 100644 --- a/calendar/gui/e-meeting-model.c +++ b/calendar/gui/e-meeting-model.c @@ -59,7 +59,10 @@ struct _EMeetingModelPrivate { GPtrArray *attendees; + GList *edit_rows; + ETableWithout *without; + GList *tables; CalClient *client; icaltimezone *zone; @@ -127,7 +130,8 @@ static void select_names_ok_cb (BonoboListener *listener, CORBA_Environment *ev, gpointer data); -static void table_destroy_cb (ETableScrolled *etable, gpointer data); +static void table_destroy_state_cb (ETableScrolled *etable, gpointer data); +static void table_destroy_list_cb (ETableScrolled *etable, gpointer data); static ETableModelClass *parent_class = NULL; @@ -498,6 +502,25 @@ set_value_at (ETableModel *etm, int col, int row, const void *val) static gboolean is_cell_editable (ETableModel *etm, int col, int row) { + EMeetingModel *im; + EMeetingModelPrivate *priv; + GList *l; + + im = E_MEETING_MODEL (etm); + priv = im->priv; + + if (priv->edit_rows != NULL) { + if (col != E_MEETING_MODEL_STATUS_COL) + return FALSE; + + for (l = priv->edit_rows; l != NULL; l = l->next) { + if (GPOINTER_TO_INT (l->data) == row) + return TRUE; + } + + return FALSE; + } + switch (col) { case E_MEETING_MODEL_DELTO_COL: case E_MEETING_MODEL_DELFROM_COL: @@ -648,6 +671,7 @@ init (EMeetingModel *im) im->priv = priv; priv->attendees = g_ptr_array_new (); + priv->edit_rows = NULL; priv->without = E_TABLE_WITHOUT (e_table_without_new (E_TABLE_MODEL (im), g_str_hash, @@ -658,7 +682,8 @@ init (EMeetingModel *im) free_duplicated_key, NULL)); e_table_without_hide (priv->without, g_strdup ("delegator")); - + priv->tables = NULL; + priv->client = NULL; priv->zone = icaltimezone_get_builtin_timezone (calendar_config_get_timezone ()); @@ -686,6 +711,8 @@ destroy (GtkObject *obj) gtk_object_unref (GTK_OBJECT (g_ptr_array_index (priv->attendees, i))); g_ptr_array_free (priv->attendees, TRUE); + g_list_free (priv->tables); + if (priv->client != NULL) gtk_object_unref (GTK_OBJECT (priv->client)); @@ -851,7 +878,7 @@ build_etable (ETableModel *model, const gchar *spec_file, const gchar *state_fil #endif gtk_signal_connect (GTK_OBJECT (etable), "destroy", - GTK_SIGNAL_FUNC (table_destroy_cb), g_strdup (state_file)); + GTK_SIGNAL_FUNC (table_destroy_state_cb), g_strdup (state_file)); gtk_object_unref (GTK_OBJECT (extras)); @@ -1022,6 +1049,47 @@ e_meeting_model_get_attendees (EMeetingModel *im) return priv->attendees; } +void +e_meeting_model_restricted_add (EMeetingModel *im, int row) +{ + EMeetingModelPrivate *priv; + + g_return_if_fail (im != NULL); + g_return_if_fail (E_IS_MEETING_MODEL (im)); + + priv = im->priv; + + priv->edit_rows = g_list_append (priv->edit_rows, GINT_TO_POINTER (row)); +} + +void +e_meeting_model_restricted_remove (EMeetingModel *im, int row) +{ + EMeetingModelPrivate *priv; + + g_return_if_fail (im != NULL); + g_return_if_fail (E_IS_MEETING_MODEL (im)); + + priv = im->priv; + + priv->edit_rows = g_list_remove (priv->edit_rows, GINT_TO_POINTER (row)); +} + +void +e_meeting_model_restricted_clear (EMeetingModel *im) +{ + EMeetingModelPrivate *priv; + + g_return_if_fail (im != NULL); + g_return_if_fail (E_IS_MEETING_MODEL (im)); + + priv = im->priv; + + if (priv->edit_rows) + g_list_free (priv->edit_rows); + priv->edit_rows = NULL; +} + static icaltimezone * find_zone (icalproperty *ip, icalcomponent *tz_top_level) { @@ -1518,13 +1586,43 @@ ETableScrolled * e_meeting_model_etable_from_model (EMeetingModel *im, const gchar *spec_file, const gchar *state_file) { EMeetingModelPrivate *priv; + ETableScrolled *ets; g_return_val_if_fail (im != NULL, NULL); g_return_val_if_fail (E_IS_MEETING_MODEL (im), NULL); priv = im->priv; - return build_etable (E_TABLE_MODEL (priv->without), spec_file, state_file); + ets = build_etable (E_TABLE_MODEL (priv->without), spec_file, state_file); + + priv->tables = g_list_prepend (priv->tables, ets); + + gtk_signal_connect (GTK_OBJECT (ets), "destroy", + GTK_SIGNAL_FUNC (table_destroy_list_cb), im); + + return ets; +} + +void +e_meeting_model_etable_click_to_add (EMeetingModel *im, gboolean click_to_add) +{ + EMeetingModelPrivate *priv; + GList *l; + + g_return_if_fail (im != NULL); + g_return_if_fail (E_IS_MEETING_MODEL (im)); + + priv = im->priv; + + for (l = priv->tables; l != NULL; l = l->next) { + ETableScrolled *ets; + ETable *real_table; + + ets = l->data; + real_table = e_table_scrolled_get_table (ets); + + gtk_object_set (GTK_OBJECT (real_table), "use_click_to_add", click_to_add, NULL); + } } int @@ -1735,7 +1833,7 @@ attendee_changed_cb (EMeetingAttendee *ia, gpointer data) } static void -table_destroy_cb (ETableScrolled *etable, gpointer data) +table_destroy_state_cb (ETableScrolled *etable, gpointer data) { ETable *real_table; char *filename = data; @@ -1746,3 +1844,14 @@ table_destroy_cb (ETableScrolled *etable, gpointer data) g_free (data); } +static void +table_destroy_list_cb (ETableScrolled *etable, gpointer data) +{ + EMeetingModel *im = E_MEETING_MODEL (data); + EMeetingModelPrivate *priv; + + priv = im->priv; + + priv->tables = g_list_remove (priv->tables, etable); +} + diff --git a/calendar/gui/e-meeting-model.h b/calendar/gui/e-meeting-model.h index 7e1aa0758b..aea86c6509 100644 --- a/calendar/gui/e-meeting-model.h +++ b/calendar/gui/e-meeting-model.h @@ -97,6 +97,10 @@ EMeetingAttendee *e_meeting_model_find_attendee_at_row (EMeetingModel *im, gint gint e_meeting_model_count_actual_attendees (EMeetingModel *im); const GPtrArray *e_meeting_model_get_attendees (EMeetingModel *im); +void e_meeting_model_restricted_add (EMeetingModel *im, int row); +void e_meeting_model_restricted_remove (EMeetingModel *im, int row); +void e_meeting_model_restricted_clear (EMeetingModel *im); + void e_meeting_model_refresh_all_busy_periods (EMeetingModel *im, EMeetingTime *start, EMeetingTime *end, @@ -112,6 +116,7 @@ void e_meeting_model_refresh_busy_periods (EMeetingModel *im, /* Helpful functions */ ETableScrolled *e_meeting_model_etable_from_model (EMeetingModel *im, const gchar *spec_file, const gchar *state_file); +void e_meeting_model_etable_click_to_add (EMeetingModel *im, gboolean click_to_add); int e_meeting_model_etable_model_to_view_row (ETable *et, EMeetingModel *im, int model_row); int e_meeting_model_etable_view_to_model_row (ETable *et, EMeetingModel *im, int view_row); diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index 50ba2af777..dbe8a58c6d 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -150,6 +150,9 @@ static void e_meeting_time_selector_on_zoomed_out_toggled (GtkWidget *button, EMeetingTimeSelector *mts); static void e_meeting_time_selector_on_working_hours_toggled (GtkWidget *button, EMeetingTimeSelector *mts); +static void e_meeting_time_selector_on_invite_others_button_draw (GtkWidget *button, + GdkRectangle *area, + EMeetingTimeSelector *mts); static void e_meeting_time_selector_on_invite_others_button_clicked (GtkWidget *button, EMeetingTimeSelector *mts); static void e_meeting_time_selector_on_update_free_busy (GtkWidget *button, @@ -457,6 +460,8 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingModel *em accel_key, GDK_MOD1_MASK, 0); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (e_meeting_time_selector_on_invite_others_button_clicked), mts); + gtk_signal_connect (GTK_OBJECT (button), "draw", + GTK_SIGNAL_FUNC (e_meeting_time_selector_on_invite_others_button_draw), mts); mts->options_button = gtk_button_new (); gtk_box_pack_start (GTK_BOX (hbox), mts->options_button, TRUE, TRUE, 0); @@ -1401,6 +1406,20 @@ e_meeting_time_selector_dump_date (GDate *date) static void +e_meeting_time_selector_on_invite_others_button_draw (GtkWidget *button, + GdkRectangle *area, + EMeetingTimeSelector *mts) +{ + ETable *real_table; + gboolean click_to_add = TRUE; + + real_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (mts->etable)); + gtk_object_get (GTK_OBJECT (real_table), "use_click_to_add", &click_to_add, NULL); + + gtk_widget_set_sensitive (button, click_to_add); +} + +static void e_meeting_time_selector_on_invite_others_button_clicked (GtkWidget *button, EMeetingTimeSelector *mts) { diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 7e9efdbb57..db070c8a4f 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -182,6 +182,66 @@ itip_addresses_free (GList *addresses) g_list_free (addresses); } +gboolean +itip_organizer_is_user (CalComponent *comp) +{ + CalComponentOrganizer organizer; + GList *addresses, *l; + const char *strip; + gboolean user_org = FALSE; + + if (!cal_component_has_organizer (comp)) + return FALSE; + + cal_component_get_organizer (comp, &organizer); + if (organizer.value != NULL) { + strip = itip_strip_mailto (organizer.value); + + addresses = itip_addresses_get (); + for (l = addresses; l != NULL; l = l->next) { + ItipAddress *a = l->data; + + if (!g_strcasecmp (a->address, strip)) { + user_org = TRUE; + break; + } + } + itip_addresses_free (addresses); + } + + return user_org; +} + +gboolean +itip_sentby_is_user (CalComponent *comp) +{ + CalComponentOrganizer organizer; + GList *addresses, *l; + const char *strip; + gboolean user_sentby = FALSE; + + if (!cal_component_has_organizer (comp)) + return FALSE; + + cal_component_get_organizer (comp, &organizer); + if (organizer.sentby != NULL) { + strip = itip_strip_mailto (organizer.sentby); + + addresses = itip_addresses_get (); + for (l = addresses; l != NULL; l = l->next) { + ItipAddress *a = l->data; + + if (!g_strcasecmp (a->address, strip)) { + user_sentby = TRUE; + break; + } + } + itip_addresses_free (addresses); + } + + return user_sentby; +} + const gchar * itip_strip_mailto (const gchar *address) { @@ -283,7 +343,6 @@ comp_subject (CalComponentItipMethod method, CalComponent *comp) CalComponentText caltext; const char *description, *prefix = NULL; GSList *alist; - int *sequence; CORBA_char *subject; cal_component_get_summary (comp, &caltext); @@ -541,9 +600,6 @@ static void comp_sentby (CalComponent *comp) { CalComponentOrganizer organizer; - GList *addresses, *l; - const char *strip; - gboolean is_user = FALSE; cal_component_get_organizer (comp, &organizer); if (!organizer.value) { @@ -560,19 +616,8 @@ comp_sentby (CalComponent *comp) return; } - - strip = itip_strip_mailto (organizer.value); - addresses = itip_addresses_get (); - for (l = addresses; l != NULL; l = l->next) { - ItipAddress *a = l->data; - - if (!strcmp (a->address, strip)) { - is_user = TRUE; - break; - } - } - if (!is_user) { + if (!itip_organizer_is_user (comp) && !itip_sentby_is_user (comp)) { ItipAddress *a = itip_addresses_get_default (); organizer.value = g_strdup (organizer.value); @@ -588,8 +633,6 @@ comp_sentby (CalComponent *comp) g_free ((char *)organizer.language); itip_address_free (a); } - - itip_addresses_free (addresses); } static CalComponent * comp_minimal (CalComponent *comp, gboolean attendee) @@ -682,6 +725,9 @@ comp_compliant (CalComponentItipMethod method, CalComponent *comp) /* We delete incoming alarms anyhow, and this helps with outlook */ cal_component_remove_all_alarms (clone); + /* Strip X-LIC-ERROR stuff */ + cal_component_strip_errors (clone); + /* Comply with itip spec */ switch (method) { case CAL_COMPONENT_METHOD_PUBLISH: @@ -695,6 +741,7 @@ comp_compliant (CalComponentItipMethod method, CalComponent *comp) comp_sentby (clone); break; case CAL_COMPONENT_METHOD_REPLY: + comp_minimal (clone, TRUE); break; case CAL_COMPONENT_METHOD_ADD: break; diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h index 2863d871e2..6a3e318762 100644 --- a/calendar/gui/itip-utils.h +++ b/calendar/gui/itip-utils.h @@ -32,6 +32,9 @@ ItipAddress *itip_addresses_get_default (void); void itip_address_free (ItipAddress *address); void itip_addresses_free (GList *addresses); +gboolean itip_organizer_is_user (CalComponent *comp); +gboolean itip_sentby_is_user (CalComponent *comp); + const gchar *itip_strip_mailto (const gchar *address); void itip_send_comp (CalComponentItipMethod method, CalComponent *comp, |