diff options
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/e-meeting-edit.c | 64 | ||||
-rw-r--r-- | calendar/gui/e-meeting-edit.h | 4 | ||||
-rw-r--r-- | calendar/gui/event-editor.c | 2 |
3 files changed, 67 insertions, 3 deletions
diff --git a/calendar/gui/e-meeting-edit.c b/calendar/gui/e-meeting-edit.c index 06fc070204..5564a3affb 100644 --- a/calendar/gui/e-meeting-edit.c +++ b/calendar/gui/e-meeting-edit.c @@ -51,6 +51,7 @@ struct _EMeetingEditorPrivate { CalComponent *comp; CalClient *client; icalcomponent *icalcomp, *vevent; + EventEditor *ee; gint numentries; /* How many attendees are there? */ gboolean dirty; /* Has anything changed? */ @@ -432,6 +433,66 @@ schedule_button_clicked_cb (GtkWidget *widget, gpointer data) if (button_num == 0) { /* The user clicked "Set Time". */ + CalComponentDateTime dtstart, dtend; + gint start_year, start_month, start_day, start_hour, start_minute, + end_year, end_month, end_day, end_hour, end_minute; + CalComponentDateTime cal_dtstart, cal_dtend; + struct tm tmstart, tmend; + time_t timet, timet_start, timet_end; + + + e_meeting_time_selector_get_meeting_time (mts, + &start_year, + &start_month, + &start_day, + &start_hour, + &start_minute, + &end_year, + &end_month, + &end_day, + &end_hour, + &end_minute); + + cal_component_get_dtstart (priv->comp, &cal_dtstart); + cal_component_get_dtend (priv->comp, &cal_dtend); + + + timet = time (NULL); + tmstart = tmend = *(localtime (&timet)); + tmstart.tm_sec = 0; + tmstart.tm_min = start_minute; + tmstart.tm_hour = start_hour; + tmstart.tm_mday = start_day; + tmstart.tm_year = start_year; + /* It seems that we can leave the rest of the struct tm fields + as they are, because in probing through the mktime.c sources, + I think that they go unused in that function. */ + + tmend.tm_sec = 0; + tmend.tm_min = end_minute; + tmend.tm_hour = end_hour; + tmend.tm_mday = end_day; + tmend.tm_year = end_year; + + /* Now we must convert the meeting time selector format into + the iCal format, and then convert that into the CalComponent + format; finally, we need to set a new time for the CalComponent, + and tell the meeting editor widget to reload its child widgets. */ + + + timet_start = mktime (&tmstart); + timet_end = mktime (&tmend); + + *(cal_dtstart.value) = icaltime_from_timet (timet_start, TRUE, FALSE); + *(cal_dtend.value) = icaltime_from_timet (timet_end, TRUE, FALSE); + + cal_component_set_dtstart (priv->comp, &cal_dtstart); + cal_component_set_dtend (priv->comp, &cal_dtend); + + cal_component_free_datetime (&cal_dtstart); + cal_component_free_datetime (&cal_dtend); + + event_editor_update_widgets (priv->ee); } gtk_widget_destroy (GTK_WIDGET (dialog)); @@ -599,7 +660,7 @@ organizer_changed_cb (GtkWidget *widget, gpointer data) /* ------------------------------------------------------------ */ EMeetingEditor * -e_meeting_editor_new (CalComponent *comp, CalClient *client) +e_meeting_editor_new (CalComponent *comp, CalClient *client, EventEditor *ee) { EMeetingEditor *object; EMeetingEditorPrivate *priv; @@ -611,6 +672,7 @@ e_meeting_editor_new (CalComponent *comp, CalClient *client) priv->comp = comp; priv->client = client; priv->icalcomp = cal_component_get_icalcomponent (comp); + priv->ee = ee; object->priv = priv; diff --git a/calendar/gui/e-meeting-edit.h b/calendar/gui/e-meeting-edit.h index 783a9c6b34..953dd23428 100644 --- a/calendar/gui/e-meeting-edit.h +++ b/calendar/gui/e-meeting-edit.h @@ -27,6 +27,7 @@ #include <glade/glade.h> #include <cal-util/cal-component.h> #include <cal-client/cal-client.h> +#include "event-editor.h" typedef struct _EMeetingEditor EMeetingEditor; @@ -35,7 +36,8 @@ struct _EMeetingEditor { }; -EMeetingEditor * e_meeting_editor_new (CalComponent *comp, CalClient *client); +EMeetingEditor * e_meeting_editor_new (CalComponent *comp, CalClient *client, + EventEditor *ee); void e_meeting_edit (EMeetingEditor *editor); void e_meeting_editor_free (EMeetingEditor *editor); diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c index 97e98db1b4..dc90309fe5 100644 --- a/calendar/gui/event-editor.c +++ b/calendar/gui/event-editor.c @@ -1183,7 +1183,7 @@ schedule_meeting_cb (GtkWidget *widget, gpointer data) priv = (EventEditorPrivate *)ee->priv; - editor = e_meeting_editor_new (priv->comp, priv->client); + editor = e_meeting_editor_new (priv->comp, priv->client, ee); e_meeting_edit (editor); e_meeting_editor_free (editor); } |