From 5ab2df3c08cfc14b0388e5042fa4221f81ac54a5 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 25 Jun 2002 13:11:47 +0000 Subject: add back proto 2002-06-25 JP Rosevear * 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 svn path=/trunk/; revision=17274 --- calendar/gui/dialogs/event-editor.c | 59 +++++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 12 deletions(-) (limited to 'calendar/gui/dialogs/event-editor.c') 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); + } } -- cgit v1.2.3