diff options
author | JP Rosevear <jpr@ximian.com> | 2001-09-20 02:46:34 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2001-09-20 02:46:34 +0800 |
commit | e5c7ee01fd8892709c7c6d7e925fdbaa37ff406e (patch) | |
tree | 052f060da4f34303224dddbda7fce90cedac66c9 /calendar/gui/dialogs/task-editor.c | |
parent | 982c014bffdcf15207e8a778689d1156ffc5161e (diff) | |
download | gsoc2013-evolution-e5c7ee01fd8892709c7c6d7e925fdbaa37ff406e.tar.gz gsoc2013-evolution-e5c7ee01fd8892709c7c6d7e925fdbaa37ff406e.tar.zst gsoc2013-evolution-e5c7ee01fd8892709c7c6d7e925fdbaa37ff406e.zip |
listen for model changes (task_editor_edit_comp): add the attendees to the
2001-09-19 JP Rosevear <jpr@ximian.com>
* gui/dialogs/task-editor.c (init_widgets): listen for model
changes
(task_editor_edit_comp): add the attendees to the model and notify
of need send
(row_count_changed_cb): mark as changed when row added/deleted
(model_row_changed_cb): mark as changed when row changes
* gui/dialogs/event-editor.c (init_widgets): listen for model
changes
(event_editor_init): flip page order
(event_editor_edit_comp): set needs send value
(schedule_meeting_cmd): flip page order
(row_count_changed_cb): mark as changed when row added/deleted
(model_row_changed_cb): mark as changed when row changes
* gui/dialogs/schedule-page.c: remove model change notification
stuff
(schedule_page_fill_widgets): no need to do the needs_send here
because the editor handles this since it owns the model
* gui/dialogs/event-editor.c (init_widgets): listen for model
changes
(event_editor_init): flip page order
(event_editor_edit_comp): set needs send value
(schedule_meeting_cmd): flip page order
(row_count_changed_cb): mark as changed when row added/deleted
(model_row_changed_cb): mark as changed when row changes
* gui/dialogs/meeting-page.c (meeting_page_fill_widgets): no need
to do the needs_send here because the editor handles this since it
owns the model
(invite_entry_changed): ditto
* gui/dialogs/comp-editor.c (comp_editor_set_changed): new
accessor
(comp_editor_get_changed): ditto
(comp_editor_set_needs_send): ditto
(comp_editor_get_needs_send): ditto
* gui/dialogs/comp-editor.h: new protos
* gui/itip-utils.c (itip_addresses_get): reflect configuration
path changes in the mailer
* gui/e-meeting-model.c: remove commented out code, ifdef one
section for later
svn path=/trunk/; revision=12983
Diffstat (limited to 'calendar/gui/dialogs/task-editor.c')
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index c7879a1986..3c09dece79 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -44,6 +44,7 @@ struct _TaskEditorPrivate { EMeetingModel *model; gboolean meeting_shown; + gboolean updating; }; @@ -58,6 +59,9 @@ static void refresh_task_cmd (GtkWidget *widget, gpointer data); static void cancel_task_cmd (GtkWidget *widget, gpointer data); static void forward_cmd (GtkWidget *widget, gpointer data); +static void model_row_changed_cb (ETableModel *etm, int row, gpointer data); +static void row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data); + static BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("ActionAssignTask", assign_task_cmd), BONOBO_UI_UNSAFE_VERB ("ActionRefreshTask", refresh_task_cmd), @@ -138,7 +142,22 @@ set_menu_sens (TaskEditor *te) "sensitive", priv->meeting_shown ? "1" : "0"); } -/* Object initialization function for the event editor */ +static void +init_widgets (TaskEditor *te) +{ + TaskEditorPrivate *priv; + + priv = te->priv; + + gtk_signal_connect (GTK_OBJECT (priv->model), "model_row_changed", + GTK_SIGNAL_FUNC (model_row_changed_cb), te); + gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_inserted", + GTK_SIGNAL_FUNC (row_count_changed_cb), te); + gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_deleted", + GTK_SIGNAL_FUNC (row_count_changed_cb), te); +} + +/* Object initialization function for the task editor */ static void task_editor_init (TaskEditor *te) { @@ -169,6 +188,9 @@ task_editor_init (TaskEditor *te) verbs); priv->meeting_shown = TRUE; + priv->updating = FALSE; + + init_widgets (te); set_menu_sens (te); } @@ -182,14 +204,32 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp) te = TASK_EDITOR (editor); priv = te->priv; + priv->updating = TRUE; + cal_component_get_attendee_list (comp, &attendees); if (attendees == NULL) { comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page)); priv->meeting_shown = FALSE; set_menu_sens (te); + } else { + GSList *l; + + for (l = attendees; l != NULL; l = l->next) { + CalComponentAttendee *ca = l->data; + EMeetingAttendee *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)); + } + priv->meeting_shown = TRUE; } cal_component_free_attendee_list (attendees); + set_menu_sens (te); + comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown); + + priv->updating = FALSE; + if (parent_class->edit_comp) parent_class->edit_comp (editor, comp); } @@ -244,7 +284,9 @@ assign_task_cmd (GtkWidget *widget, gpointer data) COMP_EDITOR_PAGE (priv->meet_page), _("Assignment")); priv->meeting_shown = TRUE; + set_menu_sens (te); + comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown); } comp_editor_show_page (COMP_EDITOR (te), @@ -282,4 +324,26 @@ forward_cmd (GtkWidget *widget, gpointer data) comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_PUBLISH); } +static void +model_row_changed_cb (ETableModel *etm, int row, gpointer data) +{ + TaskEditor *te = TASK_EDITOR (data); + TaskEditorPrivate *priv; + + priv = te->priv; + + if (!priv->updating) + comp_editor_set_changed (COMP_EDITOR (te), TRUE); +} +static void +row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data) +{ + TaskEditor *te = TASK_EDITOR (data); + TaskEditorPrivate *priv; + + priv = te->priv; + + if (!priv->updating) + comp_editor_set_changed (COMP_EDITOR (te), TRUE); +} |