From b4e780fd75795ff4218a369075a3feb9bc2fb3ce Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Mon, 2 Jul 2001 19:21:49 +0000 Subject: implement 2001-07-02 JP Rosevear * gui/e-itip-control.c (send_freebusy): implement * cal-util/cal-component.c (set_attendee_list): add the delto property rather than the delfrom property twice * gui/dialogs/task-editor.c (task_editor_edit_comp): show delegation info if appropriate (delegate_task_cmd): delegate command (cancel_task_cmd): cancel command (refresh_task_cmd): refresh command * gui/dialogs/task-details-page.c: Load new widgets (task_details_page_show_delegation): show/hide delegation info widgets * gui/dialogs/task-details-page.h: new proto * gui/dialogs/event-editor.c (event_editor_edit_comp): free attendee list when finished * gui/dialogs/comp-editor.c (setup_widgets): explicitly show the widgets, update pixmaps after the verbs have been added (comp_editor_focus): don't do a show all svn path=/trunk/; revision=10697 --- calendar/gui/dialogs/comp-editor.c | 11 +- calendar/gui/dialogs/event-editor.c | 1 + calendar/gui/dialogs/task-details-page.c | 104 ++++++++++++++- calendar/gui/dialogs/task-details-page.glade | 182 ++++++++++++++++++++++++--- calendar/gui/dialogs/task-details-page.h | 8 +- calendar/gui/dialogs/task-editor.c | 77 +++++++++++- calendar/gui/e-itip-control.c | 19 ++- calendar/gui/itip-utils.c | 4 +- 8 files changed, 373 insertions(+), 33 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index d67ebc7919..08677260e7 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -104,8 +104,8 @@ static EPixmap pixmaps [] = E_PIXMAP ("/menu/File/FilePrint", "print.xpm"), E_PIXMAP ("/menu/File/FilePrintPreview", "print-preview.xpm"), - E_PIXMAP ("/Toolbar/Print", "print.xpm"), - E_PIXMAP ("/Toolbar/Print Preview", "print-preview.xpm"), + E_PIXMAP ("/Toolbar/FilePrint", "print.xpm"), + E_PIXMAP ("/Toolbar/FilePrintPreview", "print-preview.xpm"), E_PIXMAP_END }; @@ -188,18 +188,20 @@ setup_widgets (CompEditor *editor) bonobo_ui_component_set_container (priv->uic, BONOBO_OBJREF (container)); bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (BONOBO_WINDOW (priv->window)), "/evolution/UIConf/kvps"); - e_pixmaps_update (priv->uic, pixmaps); bonobo_ui_component_add_verb_list_with_data (priv->uic, verbs, editor); bonobo_ui_util_set_ui (priv->uic, EVOLUTION_DATADIR "/gnome/gui", "evolution-comp-editor.xml", "evolution-calendar"); + e_pixmaps_update (priv->uic, pixmaps); vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); + gtk_widget_show (vbox); gtk_container_set_border_width (GTK_CONTAINER (vbox), GNOME_PAD_SMALL); bonobo_window_set_contents (BONOBO_WINDOW (priv->window), vbox); /* Notebook */ priv->notebook = GTK_NOTEBOOK (gtk_notebook_new ()); + gtk_widget_show (priv->notebook); gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (priv->notebook), TRUE, TRUE, 0); } @@ -297,7 +299,6 @@ comp_editor_append_page (CompEditor *editor, GTK_SIGNAL_FUNC (page_summary_changed_cb), editor); gtk_signal_connect (GTK_OBJECT (page), "dates_changed", GTK_SIGNAL_FUNC (page_dates_changed_cb), editor); - } /** @@ -643,7 +644,7 @@ comp_editor_focus (CompEditor *editor) priv = editor->priv; - gtk_widget_show_all (priv->window); + gtk_widget_show (priv->window); raise_and_focus (priv->window); } diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 9a6bd134b4..4a69fcbe43 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -172,6 +172,7 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp) comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page)); priv->meeting_shown = FALSE; } + cal_component_free_attendee_list (attendees); if (parent_class->edit_comp) parent_class->edit_comp (editor, comp); diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 2e4a5ddab1..885fce3409 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -54,6 +54,13 @@ struct _TaskDetailsPagePrivate { GtkWidget *url; + GtkWidget *organizer; + GtkWidget *organizer_lbl; + GtkWidget *delegated_to; + GtkWidget *delegated_to_lbl; + GtkWidget *delegated_from; + GtkWidget *delegated_from_lbl; + gboolean updating; }; @@ -215,7 +222,9 @@ task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp) { TaskDetailsPage *tdpage; TaskDetailsPagePrivate *priv; + GSList *list; CalComponentText text; + CalComponentOrganizer organizer; const char *url; CompEditorPageDates dates; @@ -239,6 +248,23 @@ task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp) cal_component_get_url (comp, &url); e_dialog_editable_set (priv->url, url); + /* Delegation */ + cal_component_get_organizer (comp, &organizer); + if (organizer.value) + e_dialog_editable_set (priv->organizer, organizer.value); + + cal_component_get_attendee_list (comp, &list); + if (list != NULL) { + CalComponentAttendee *attendee; + + attendee = list->data; + if (attendee->delto) + e_dialog_editable_set (priv->delegated_to, attendee->delto); + if (attendee->delfrom) + e_dialog_editable_set (priv->delegated_from, attendee->delfrom); + } + cal_component_free_attendee_list (list); + priv->updating = FALSE; } @@ -248,7 +274,10 @@ task_details_page_fill_component (CompEditorPage *page, CalComponent *comp) { TaskDetailsPage *tdpage; TaskDetailsPagePrivate *priv; + GSList list; CalComponentDateTime date; + CalComponentOrganizer organizer; + CalComponentAttendee attendee; time_t t; char *url; @@ -274,6 +303,31 @@ task_details_page_fill_component (CompEditorPage *page, CalComponent *comp) cal_component_set_url (comp, url); if (url) g_free (url); + + /* Delegation */ + organizer.value = e_dialog_editable_get (priv->organizer); + organizer.sentby = NULL; + organizer.cn = NULL; + organizer.language = NULL; + cal_component_set_organizer (comp, &organizer); + attendee.value = e_dialog_editable_get (priv->delegated_to); + attendee.member = NULL; + attendee.cutype = CAL_COMPONENT_CUTYPE_INDIVIDUAL; + attendee.role = CAL_COMPONENT_ROLE_REQUIRED; + attendee.status = CAL_COMPONENT_PARTSTAT_NEEDSACTION; + attendee.rsvp = TRUE; + attendee.delto = e_dialog_editable_get (priv->delegated_to); + attendee.delfrom = NULL; + attendee.sentby = NULL; + attendee.cn = NULL; + attendee.language = NULL; + list.data = &attendee; + list.next = NULL; + cal_component_set_attendee_list (comp, &list); + g_free ((char *)organizer.value); + g_free ((char *)attendee.value); + g_free ((char *)attendee.delto); + g_free ((char *)attendee.delfrom); } /* set_summary handler for the task page */ @@ -334,13 +388,26 @@ get_widgets (TaskDetailsPage *tdpage) priv->url = GW ("url"); + priv->organizer = GW ("organizer"); + priv->organizer_lbl = GW ("organizer-label"); + priv->delegated_to = GW ("delegated-to"); + priv->delegated_to_lbl = GW ("delegated-to-label"); + priv->delegated_from = GW ("delegated-from"); + priv->delegated_from_lbl = GW ("delegated-from-label"); + #undef GW return (priv->summary && priv->date_time && priv->completed_date && priv->completed_timezone - && priv->url); + && priv->url + && priv->organizer + && priv->organizer_lbl + && priv->delegated_to + && priv->delegated_to_lbl + && priv->delegated_from + && priv->delegated_from_lbl); } /* Callback used when the start or end date widgets change. We check that the @@ -400,6 +467,14 @@ init_widgets (TaskDetailsPage *tdpage) /* URL */ gtk_signal_connect (GTK_OBJECT (priv->url), "changed", GTK_SIGNAL_FUNC (field_changed_cb), tdpage); + + /* Delegation */ + gtk_signal_connect (GTK_OBJECT (priv->organizer), "changed", + GTK_SIGNAL_FUNC (field_changed_cb), tdpage); + + gtk_signal_connect (GTK_OBJECT (priv->delegated_to), "changed", + GTK_SIGNAL_FUNC (field_changed_cb), tdpage); + } @@ -461,6 +536,33 @@ task_details_page_new (void) return tdpage; } +void +task_details_page_show_delegation (TaskDetailsPage *tdpage, gboolean show) +{ + TaskDetailsPagePrivate *priv; + + priv = tdpage->priv; + + if (show) { + gtk_widget_show (priv->organizer); + gtk_widget_show (priv->organizer_lbl); + gtk_widget_show (priv->delegated_to); + gtk_widget_show (priv->delegated_to_lbl); + gtk_widget_show (priv->delegated_from); + gtk_widget_show (priv->delegated_from_lbl); + comp_editor_page_notify_needs_send (COMP_EDITOR_PAGE (tdpage)); + } else { + gtk_widget_hide (priv->organizer); + gtk_widget_hide (priv->organizer_lbl); + gtk_widget_hide (priv->delegated_to); + gtk_widget_hide (priv->delegated_to_lbl); + gtk_widget_hide (priv->delegated_from); + gtk_widget_hide (priv->delegated_from_lbl); + } + +// gtk_widget_queue_draw (priv->main); +} + GtkWidget *task_details_page_create_date_edit (void); GtkWidget * diff --git a/calendar/gui/dialogs/task-details-page.glade b/calendar/gui/dialogs/task-details-page.glade index b2438785b5..77c9679e1f 100644 --- a/calendar/gui/dialogs/task-details-page.glade +++ b/calendar/gui/dialogs/task-details-page.glade @@ -163,7 +163,7 @@ GtkTable table1 4 - 2 + 5 2 False 2 @@ -174,6 +174,130 @@ True + + GtkEntry + url + True + True + True + 0 + + + 1 + 2 + 4 + 5 + 0 + 0 + True + False + False + False + True + False + + + + + GtkEntry + delegated-to + True + True + True + 0 + + + 1 + 2 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + + + + + GtkEntry + organizer + True + True + True + 0 + + + 1 + 2 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + + + + + GtkLabel + delegated-from-label + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + delegated-to-label + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + GtkLabel label12 @@ -187,8 +311,8 @@ 0 1 - 0 - 1 + 3 + 4 0 0 False @@ -213,8 +337,8 @@ 0 1 - 1 - 2 + 4 + 5 0 0 False @@ -227,13 +351,41 @@ - GtkEntry - url - True - True - True - 0 - + GtkLabel + organizer-label + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + delegated-from + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 1 2 @@ -241,7 +393,7 @@ 2 0 0 - True + False False False False @@ -258,8 +410,8 @@ 1 2 - 0 - 1 + 3 + 4 0 0 False diff --git a/calendar/gui/dialogs/task-details-page.h b/calendar/gui/dialogs/task-details-page.h index 555e7d162d..01aae95d93 100644 --- a/calendar/gui/dialogs/task-details-page.h +++ b/calendar/gui/dialogs/task-details-page.h @@ -51,9 +51,11 @@ typedef struct { } TaskDetailsPageClass; -GtkType task_details_page_get_type (void); -TaskDetailsPage *task_details_page_construct (TaskDetailsPage *tdpage); -TaskDetailsPage *task_details_page_new (void); +GtkType task_details_page_get_type (void); +TaskDetailsPage *task_details_page_construct (TaskDetailsPage *tdpage); +TaskDetailsPage *task_details_page_new (void); +void task_details_page_show_delegation (TaskDetailsPage *tdpage, + gboolean show); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 165d871680..6b582315f4 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -1,6 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* Evolution calendar - Event editor dialog +/* Evolution calendar - Task editor dialog * * Copyright (C) 2000 Ximian, Inc. * Copyright (C) 2001 Ximian, Inc. @@ -8,6 +7,7 @@ * Authors: Miguel de Icaza * Federico Mena-Quintero * Seth Alves + * JP Rosevear * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +33,7 @@ #include "task-page.h" #include "task-details-page.h" #include "recurrence-page.h" +#include "cancel-comp.h" #include "task-editor.h" struct _TaskEditorPrivate { @@ -44,17 +45,24 @@ struct _TaskEditorPrivate { static void task_editor_class_init (TaskEditorClass *class); static void task_editor_init (TaskEditor *te); +static void task_editor_edit_comp (CompEditor *editor, CalComponent *comp); static void task_editor_destroy (GtkObject *object); +static void delegate_task_cmd (GtkWidget *widget, gpointer data); +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 BonoboUIVerb verbs [] = { + BONOBO_UI_UNSAFE_VERB ("ActionDelegateTask", delegate_task_cmd), + BONOBO_UI_UNSAFE_VERB ("ActionRefreshTask", refresh_task_cmd), + BONOBO_UI_UNSAFE_VERB ("ActionCancelTask", cancel_task_cmd), BONOBO_UI_UNSAFE_VERB ("ActionForward", forward_cmd), BONOBO_UI_VERB_END }; -static CompEditor *parent_class; +static CompEditorClass *parent_class; @@ -92,14 +100,18 @@ task_editor_get_type (void) /* Class initialization function for the event editor */ static void -task_editor_class_init (TaskEditorClass *class) +task_editor_class_init (TaskEditorClass *klass) { GtkObjectClass *object_class; + CompEditorClass *editor_class; - object_class = (GtkObjectClass *) class; + object_class = (GtkObjectClass *) klass; + editor_class = (CompEditorClass *) klass; parent_class = gtk_type_class (TYPE_COMP_EDITOR); + editor_class->edit_comp = task_editor_edit_comp; + object_class->destroy = task_editor_destroy; } @@ -127,6 +139,27 @@ task_editor_init (TaskEditor *te) verbs); } +static void +task_editor_edit_comp (CompEditor *editor, CalComponent *comp) +{ + TaskEditor *te; + TaskEditorPrivate *priv; + GSList *attendees = NULL; + + te = TASK_EDITOR (editor); + priv = te->priv; + + cal_component_get_attendee_list (comp, &attendees); + if (attendees == NULL) + task_details_page_show_delegation (priv->task_details_page, FALSE); + else + task_details_page_show_delegation (priv->task_details_page, TRUE); + cal_component_free_attendee_list (attendees); + + if (parent_class->edit_comp) + parent_class->edit_comp (editor, comp); +} + /* Destroy handler for the event editor */ static void task_editor_destroy (GtkObject *object) @@ -158,6 +191,40 @@ task_editor_new (void) return TASK_EDITOR (gtk_type_new (TYPE_TASK_EDITOR)); } +static void +delegate_task_cmd (GtkWidget *widget, gpointer data) +{ + TaskEditor *te = TASK_EDITOR (data); + TaskEditorPrivate *priv; + + priv = te->priv; + + task_details_page_show_delegation (priv->task_details_page, TRUE); + comp_editor_show_page (COMP_EDITOR (te), + COMP_EDITOR_PAGE (priv->task_details_page)); +} + +static void +refresh_task_cmd (GtkWidget *widget, gpointer data) +{ + TaskEditor *te = TASK_EDITOR (data); + + comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_REFRESH); +} + +static void +cancel_task_cmd (GtkWidget *widget, gpointer data) +{ + TaskEditor *te = TASK_EDITOR (data); + CalComponent *comp; + + comp = comp_editor_get_current_comp (COMP_EDITOR (te)); + if (cancel_component_dialog (comp)) { + comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_CANCEL); + comp_editor_delete_comp (COMP_EDITOR (te)); + } +} + static void forward_cmd (GtkWidget *widget, gpointer data) { diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 8363f11d2e..24717b0aa7 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -895,8 +895,23 @@ remove_item (EItipControl *itip) } static void -send_freebusy (void) +send_freebusy (EItipControl *itip) { + EItipControlPrivate *priv; + CalComponent *comp; + CalComponentDateTime datetime; + CalClientGetStatus status; + time_t start, end; + + priv = itip->priv; + + cal_component_get_dtstart (priv->comp, &datetime); + start = icaltime_as_timet (*datetime.value); + cal_component_get_dtend (priv->comp, &datetime); + end = icaltime_as_timet (*datetime.value); + status = cal_client_get_free_busy (priv->event_client, start, end, &comp); + if (status == CAL_CLIENT_GET_SUCCESS) + itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp); } static void @@ -983,7 +998,7 @@ ok_clicked_cb (GtkWidget *widget, gpointer data) itip_send_comp (CAL_COMPONENT_METHOD_REPLY, priv->comp); } else if (priv->map == request_fb_map) { - send_freebusy (); + send_freebusy (itip); } else if (priv->map == reply_map) { update_item (itip); diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index b407f38693..b3566e51cf 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -204,8 +204,8 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *comp) description = CORBA_string_dup (tempstr); show_inline = FALSE; - /* I need to create an encapsulating iCalendar component, and stuff our vEvent - into it. */ + /* Need to create an encapsulating iCalendar component, and + stuff our component into it. */ { icalcomponent *icomp, *clone; icalproperty *prop; -- cgit