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/event-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/event-editor.c')
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 79 |
1 files changed, 67 insertions, 12 deletions
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index f95f201883..ea73ba2abf 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -49,6 +49,7 @@ struct _EventEditorPrivate { EMeetingModel *model; gboolean meeting_shown; + gboolean updating; }; @@ -65,6 +66,9 @@ static void refresh_meeting_cmd (GtkWidget *widget, gpointer data); static void cancel_meeting_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 ("ActionScheduleMeeting", schedule_meeting_cmd), BONOBO_UI_UNSAFE_VERB ("ActionRefreshMeeting", refresh_meeting_cmd), @@ -147,6 +151,21 @@ set_menu_sens (EventEditor *ee) "sensitive", priv->meeting_shown ? "1" : "0"); } +static void +init_widgets (EventEditor *ee) +{ + EventEditorPrivate *priv; + + priv = ee->priv; + + gtk_signal_connect (GTK_OBJECT (priv->model), "model_row_changed", + GTK_SIGNAL_FUNC (model_row_changed_cb), ee); + gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_inserted", + GTK_SIGNAL_FUNC (row_count_changed_cb), ee); + gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_deleted", + GTK_SIGNAL_FUNC (row_count_changed_cb), ee); +} + /* Object initialization function for the event editor */ static void event_editor_init (EventEditor *ee) @@ -173,22 +192,25 @@ event_editor_init (EventEditor *ee) priv->model = E_MEETING_MODEL (e_meeting_model_new ()); - priv->meet_page = meeting_page_new (priv->model); - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->meet_page), - _("Meeting")); - priv->sched_page = schedule_page_new (priv->model); comp_editor_append_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->sched_page), _("Scheduling")); + priv->meet_page = meeting_page_new (priv->model); + comp_editor_append_page (COMP_EDITOR (ee), + COMP_EDITOR_PAGE (priv->meet_page), + _("Meeting")); + comp_editor_merge_ui (COMP_EDITOR (ee), EVOLUTION_DATADIR "/gnome/ui/evolution-event-editor.xml", verbs); - + priv->meeting_shown = TRUE; - set_menu_sens (ee); + priv->updating = FALSE; + + init_widgets (ee); + set_menu_sens (ee); } static void @@ -216,15 +238,17 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp) ee = EVENT_EDITOR (editor); priv = ee->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)); comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->sched_page)); e_meeting_model_remove_all_attendees (priv->model); priv->meeting_shown = FALSE; - set_menu_sens (ee); } 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)); @@ -232,9 +256,15 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp) 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 (ee); + comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown); + + priv->updating = FALSE; + if (parent_class->edit_comp) parent_class->edit_comp (editor, comp); } @@ -311,13 +341,15 @@ schedule_meeting_cmd (GtkWidget *widget, gpointer data) if (!priv->meeting_shown) { comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->meet_page), - _("Meeting")); - comp_editor_append_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->sched_page), _("Scheduling")); + comp_editor_append_page (COMP_EDITOR (ee), + COMP_EDITOR_PAGE (priv->meet_page), + _("Meeting")); priv->meeting_shown = TRUE; + set_menu_sens (ee); + comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown); } comp_editor_show_page (COMP_EDITOR (ee), @@ -355,3 +387,26 @@ forward_cmd (GtkWidget *widget, gpointer data) comp_editor_send_comp (COMP_EDITOR (ee), CAL_COMPONENT_METHOD_PUBLISH); } +static void +model_row_changed_cb (ETableModel *etm, int row, gpointer data) +{ + EventEditor *ee = EVENT_EDITOR (data); + EventEditorPrivate *priv; + + priv = ee->priv; + + if (!priv->updating) + comp_editor_set_changed (COMP_EDITOR (ee), TRUE); +} + +static void +row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data) +{ + EventEditor *ee = EVENT_EDITOR (data); + EventEditorPrivate *priv; + + priv = ee->priv; + + if (!priv->updating) + comp_editor_set_changed (COMP_EDITOR (ee), TRUE); +} |