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/task-editor.c | 81 +++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 24 deletions(-) (limited to 'calendar/gui/dialogs/task-editor.c') 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); + } } -- cgit v1.2.3