diff options
-rw-r--r-- | calendar/ChangeLog | 18 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 10 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-details-page.c | 476 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-details-page.glade | 497 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-details-page.h | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 68 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.c | 274 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.glade | 172 |
8 files changed, 578 insertions, 939 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 1267014928..4337750958 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,21 @@ +2001-08-09 JP Rosevear <jpr@ximian.com> + + * gui/dialogs/task-page.*: Remove progress frame + + * gui/dialogs/task-details-page.*: Put in progress frame, remove + basics frame + + * gui/dialogs/task-editor.c (set_menu_sens): util function to set + menu sensitivity based on state + (task_editor_init): add meeting page + (task_editor_edit_comp): show page if necessary + (task_editor_destroy): unref meeting page + (assign_task_cmd): bring up meeting page + (refresh_task_cmd): save before sending + (forward_cmd): ditto + + * gui/dialogs/comp-editor.c (save_cmd): implement new save command + 2001-08-09 Federico Mena Quintero <federico@ximian.com> * gui/e-itip-control.c (destroy): Chain to the destroy handler in diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index ba0ed77ec6..447d5b4fa0 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -91,6 +91,7 @@ static void page_dates_changed_cb (GtkWidget *widget, CompEditorPageDates *dates static void obj_updated_cb (CalClient *client, const char *uid, gpointer data); static void obj_removed_cb (CalClient *client, const char *uid, gpointer data); +static void save_cmd (GtkWidget *widget, gpointer data); static void save_close_cmd (GtkWidget *widget, gpointer data); static void save_as_cmd (GtkWidget *widget, gpointer data); static void delete_cmd (GtkWidget *widget, gpointer data); @@ -113,6 +114,7 @@ static EPixmap pixmaps [] = }; static BonoboUIVerb verbs [] = { + BONOBO_UI_UNSAFE_VERB ("FileSave", save_cmd), BONOBO_UI_UNSAFE_VERB ("FileSaveAndClose", save_close_cmd), BONOBO_UI_UNSAFE_VERB ("FileSaveAs", save_as_cmd), BONOBO_UI_UNSAFE_VERB ("FileDelete", delete_cmd), @@ -805,6 +807,14 @@ close_dialog (CompEditor *editor) /* Menu Commands */ static void +save_cmd (GtkWidget *widget, gpointer data) +{ + CompEditor *editor = COMP_EDITOR (data); + + save_comp_with_send (editor); +} + +static void save_close_cmd (GtkWidget *widget, gpointer data) { CompEditor *editor = COMP_EDITOR (data); diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 6212e8f76f..3955abc182 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -1,4 +1,4 @@ -/* Evolution calendar - Main page of the task editor dialog +/* Evolution calendar - task details page * * Copyright (C) 2001 Ximian, Inc. * @@ -47,23 +47,41 @@ struct _TaskDetailsPagePrivate { /* Widgets from the Glade file */ GtkWidget *main; - GtkWidget *summary; - GtkWidget *date_time; - + GtkWidget *status; + GtkWidget *priority; + GtkWidget *percent_complete; + GtkWidget *completed_date; GtkWidget *url; - GtkWidget *organizer; - GtkWidget *organizer_lbl; - GtkWidget *delegated_to; - GtkWidget *delegated_to_lbl; - GtkWidget *delegated_from; - GtkWidget *delegated_from_lbl; - gboolean updating; }; +/* Note that these two arrays must match. */ +static const int status_map[] = { + ICAL_STATUS_NEEDSACTION, + ICAL_STATUS_INPROCESS, + ICAL_STATUS_COMPLETED, + ICAL_STATUS_CANCELLED, + -1 +}; + +typedef enum { + PRIORITY_HIGH, + PRIORITY_NORMAL, + PRIORITY_LOW, + PRIORITY_UNDEFINED, +} TaskEditorPriority; + +static const int priority_map[] = { + PRIORITY_HIGH, + PRIORITY_NORMAL, + PRIORITY_LOW, + PRIORITY_UNDEFINED, + -1 +}; + static void task_details_page_class_init (TaskDetailsPageClass *class); @@ -74,8 +92,6 @@ static GtkWidget *task_details_page_get_widget (CompEditorPage *page); static void task_details_page_focus_main_widget (CompEditorPage *page); static void task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp); static void task_details_page_fill_component (CompEditorPage *page, CalComponent *comp); -static void task_details_page_set_summary (CompEditorPage *page, const char *summary); -static void task_details_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); static CompEditorPageClass *parent_class = NULL; @@ -130,8 +146,6 @@ task_details_page_class_init (TaskDetailsPageClass *class) editor_page_class->focus_main_widget = task_details_page_focus_main_widget; editor_page_class->fill_widgets = task_details_page_fill_widgets; editor_page_class->fill_component = task_details_page_fill_component; - editor_page_class->set_summary = task_details_page_set_summary; - editor_page_class->set_dates = task_details_page_set_dates; object_class->destroy = task_details_page_destroy; } @@ -148,8 +162,11 @@ task_details_page_init (TaskDetailsPage *tdpage) priv->xml = NULL; priv->main = NULL; - priv->summary = NULL; - priv->date_time = NULL; + + priv->status = NULL; + priv->priority = NULL; + priv->percent_complete = NULL; + priv->completed_date = NULL; priv->url = NULL; @@ -206,7 +223,52 @@ task_details_page_focus_main_widget (CompEditorPage *page) tdpage = TASK_DETAILS_PAGE (page); priv = tdpage->priv; - gtk_widget_grab_focus (priv->organizer); + gtk_widget_grab_focus (priv->status); +} + + +static TaskEditorPriority +priority_value_to_index (int priority_value) +{ + TaskEditorPriority retval; + + if (priority_value == 0) + retval = PRIORITY_UNDEFINED; + else if (priority_value <= 4) + retval = PRIORITY_HIGH; + else if (priority_value == 5) + retval = PRIORITY_NORMAL; + else + retval = PRIORITY_LOW; + + return retval; +} + +static int +priority_index_to_value (TaskEditorPriority priority) +{ + int retval; + + switch (priority) { + case PRIORITY_UNDEFINED: + retval = 0; + break; + case PRIORITY_HIGH: + retval = 3; + break; + case PRIORITY_NORMAL: + retval = 5; + break; + case PRIORITY_LOW: + retval = 7; + break; + default: + retval = -1; + g_assert_not_reached (); + break; + } + + return retval; } /* Fills the widgets with default values */ @@ -217,12 +279,6 @@ clear_widgets (TaskDetailsPage *tdpage) priv = tdpage->priv; - /* Summary */ - gtk_label_set_text (GTK_LABEL (priv->summary), ""); - - /* Start date */ - gtk_label_set_text (GTK_LABEL (priv->date_time), ""); - /* Date completed */ e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), -1); @@ -236,12 +292,11 @@ task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp) { TaskDetailsPage *tdpage; TaskDetailsPagePrivate *priv; - GSList *list; - CalComponentText text; - CalComponentOrganizer organizer; + int *priority_value, *percent; + TaskEditorPriority priority; + icalproperty_status status; const char *url; - CompEditorPageDates dates; - + tdpage = TASK_DETAILS_PAGE (page); priv = tdpage->priv; @@ -250,37 +305,45 @@ task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp) /* Clean the screen */ clear_widgets (tdpage); - /* Summary */ - cal_component_get_summary (comp, &text); - task_details_page_set_summary (page, text.value); + /* Percent Complete. */ + cal_component_get_percent (comp, &percent); + if (percent) { + e_dialog_spin_set (priv->percent_complete, *percent); + cal_component_free_percent (percent); + } else { + /* FIXME: Could check if task is completed and set 100%. */ + e_dialog_spin_set (priv->percent_complete, 0); + } + + /* Status. */ + cal_component_get_status (comp, &status); + if (status == ICAL_STATUS_NONE) { + /* Try to use the percent value. */ + if (percent) { + if (*percent == 0) + status = ICAL_STATUS_NEEDSACTION; + else if (*percent == 100) + status = ICAL_STATUS_COMPLETED; + else + status = ICAL_STATUS_INPROCESS; + } else + status = ICAL_STATUS_NEEDSACTION; + } + e_dialog_option_menu_set (priv->status, status, status_map); + + /* Priority. */ + cal_component_get_priority (comp, &priority_value); + if (priority_value) { + priority = priority_value_to_index (*priority_value); + cal_component_free_priority (priority_value); + } else { + priority = PRIORITY_UNDEFINED; + } + e_dialog_option_menu_set (priv->priority, priority, priority_map); - /* Dates */ - comp_editor_dates (&dates, comp); - task_details_page_set_dates (page, &dates); - /* URL */ 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) { - gchar *s = e_utf8_to_gtk_string (priv->delegated_from, attendee->delfrom); - gtk_label_set_text (GTK_LABEL (priv->delegated_from), s); - g_free (s); - } - } - cal_component_free_attendee_list (list); priv->updating = FALSE; } @@ -292,15 +355,28 @@ task_details_page_fill_component (CompEditorPage *page, CalComponent *comp) TaskDetailsPage *tdpage; TaskDetailsPagePrivate *priv; struct icaltimetype icaltime; - GSList list; - CalComponentOrganizer organizer; - CalComponentAttendee attendee; + icalproperty_status status; + TaskEditorPriority priority; + int priority_value, percent; char *url; gboolean date_set; tdpage = TASK_DETAILS_PAGE (page); priv = tdpage->priv; + /* Percent Complete. */ + percent = e_dialog_spin_get_int (priv->percent_complete); + cal_component_set_percent (comp, &percent); + + /* Status. */ + status = e_dialog_option_menu_get (priv->status, status_map); + cal_component_set_status (comp, status); + + /* Priority. */ + priority = e_dialog_option_menu_get (priv->priority, priority_map); + priority_value = priority_index_to_value (priority); + cal_component_set_priority (comp, &priority_value); + icaltime = icaltime_null_time (); /* COMPLETED must be in UTC. */ @@ -335,90 +411,6 @@ 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 */ -static void -task_details_page_set_summary (CompEditorPage *page, const char *summary) -{ - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; - gchar *s; - - tdpage = TASK_DETAILS_PAGE (page); - priv = tdpage->priv; - - s = e_utf8_to_gtk_string (priv->summary, summary); - gtk_label_set_text (GTK_LABEL (priv->summary), s); - g_free (s); -} - -static void -task_details_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) -{ - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; - - tdpage = TASK_DETAILS_PAGE (page); - priv = tdpage->priv; - - if (priv->updating) - return; - - priv->updating = TRUE; - - comp_editor_date_label (dates, priv->date_time); - - if (dates->complete) { - if (icaltime_is_null_time (*dates->complete)) { - e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), -1); - } else { - struct icaltimetype *tt = dates->complete; - - /* Convert it from UTC to local time to display. - FIXME: We should really use one timezone for the - entire time the dialog is shown. Otherwise if the - user changes the timezone, the COMPLETED date may - get changed as well. */ - char *location = calendar_config_get_timezone (); - icaltimezone *zone = icaltimezone_get_builtin_timezone (location); - icaltimezone_convert_time (tt, - icaltimezone_get_utc_timezone (), - zone); - - e_date_edit_set_date (E_DATE_EDIT (priv->completed_date), - tt->year, tt->month, tt->day); - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->completed_date), - tt->hour, tt->minute); - } - } - - priv->updating = FALSE; } @@ -440,44 +432,58 @@ get_widgets (TaskDetailsPage *tdpage) gtk_widget_ref (priv->main); gtk_widget_unparent (priv->main); - priv->summary = GW ("summary"); - priv->date_time = GW ("date-time"); + priv->status = GW ("status"); + priv->priority = GW ("priority"); + priv->percent_complete = GW ("percent-complete"); priv->completed_date = GW ("completed-date"); 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 + return (priv->status + && priv->priority + && priv->percent_complete && priv->completed_date - && priv->url - && priv->organizer - && priv->organizer_lbl - && priv->delegated_to - && priv->delegated_to_lbl - && priv->delegated_from - && priv->delegated_from_lbl); + && priv->url); +} + + +static void +complete_date_changed (TaskDetailsPage *tdpage, time_t ctime, gboolean complete) +{ + TaskDetailsPagePrivate *priv; + CompEditorPageDates dates = {NULL, NULL, NULL, NULL}; + icaltimezone *zone; + struct icaltimetype completed_tt = icaltime_null_time(); + + priv = tdpage->priv; + + /* Get the current time in UTC. */ + zone = icaltimezone_get_utc_timezone (); + completed_tt = icaltime_from_timet_with_zone (ctime, FALSE, zone); + completed_tt.is_utc = TRUE; + + dates.start = NULL; + dates.end = NULL; + dates.due = NULL; + if (complete) + dates.complete = &completed_tt; + + /* Notify upstream */ + comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (tdpage), + &dates); } -/* Callback used when the start or end date widgets change. We check that the - * start date < end date and we set the "all day task" button as appropriate. - */ static void date_changed_cb (EDateEdit *dedit, gpointer data) { TaskDetailsPage *tdpage; TaskDetailsPagePrivate *priv; - CompEditorPageDates dates; - struct icaltimetype completed_tt = icaltime_null_time(); + CompEditorPageDates dates = {NULL, NULL, NULL, NULL}; + struct icaltimetype completed_tt; + icalproperty_status status; gboolean date_set; tdpage = TASK_DETAILS_PAGE (data); @@ -493,18 +499,97 @@ date_changed_cb (EDateEdit *dedit, gpointer data) e_date_edit_get_time_of_day (E_DATE_EDIT (priv->completed_date), &completed_tt.hour, &completed_tt.minute); - if (!date_set) + if (!date_set) { completed_tt = icaltime_null_time (); - dates.start = NULL; - dates.end = NULL; - dates.due = NULL; - dates.complete = &completed_tt; + status = e_dialog_option_menu_get (priv->status, status_map); + if (status == ICAL_STATUS_COMPLETED) { + e_dialog_option_menu_set (priv->status, ICAL_STATUS_NEEDSACTION, status_map); + e_dialog_spin_set (priv->percent_complete, 0); + } + } else { + e_dialog_option_menu_set (priv->status, ICAL_STATUS_COMPLETED, status_map); + e_dialog_spin_set (priv->percent_complete, 100); + } /* Notify upstream */ comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (tdpage), &dates); } +static void +status_changed (GtkMenu *menu, TaskDetailsPage *tdpage) +{ + TaskDetailsPagePrivate *priv; + icalproperty_status status; + time_t ctime = -1; + + priv = tdpage->priv; + + if (priv->updating) + return; + + priv->updating = TRUE; + + status = e_dialog_option_menu_get (priv->status, status_map); + if (status == ICAL_STATUS_NEEDSACTION) { + e_dialog_spin_set (priv->percent_complete, 0); + e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), ctime); + complete_date_changed (tdpage, 0, FALSE); + } else if (status == ICAL_STATUS_INPROCESS) { + e_dialog_spin_set (priv->percent_complete, 50); + e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), ctime); + complete_date_changed (tdpage, 0, FALSE); + } else if (status == ICAL_STATUS_COMPLETED) { + e_dialog_spin_set (priv->percent_complete, 100); + ctime = time (NULL); + e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), ctime); + complete_date_changed (tdpage, ctime, TRUE); + } + + priv->updating = FALSE; + + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tdpage)); +} + +static void +percent_complete_changed (GtkAdjustment *adj, TaskDetailsPage *tdpage) +{ + TaskDetailsPagePrivate *priv; + gint percent; + icalproperty_status status; + gboolean complete; + time_t ctime = -1; + + priv = tdpage->priv; + + if (priv->updating) + return; + + priv->updating = TRUE; + + percent = e_dialog_spin_get_int (priv->percent_complete); + if (percent == 100) { + complete = TRUE; + ctime = time (NULL); + status = ICAL_STATUS_COMPLETED; + } else { + complete = FALSE; + + if (percent == 0) + status = ICAL_STATUS_NEEDSACTION; + else + status = ICAL_STATUS_INPROCESS; + } + + e_dialog_option_menu_set (priv->status, status, status_map); + e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), ctime); + complete_date_changed (tdpage, ctime, complete); + + priv->updating = FALSE; + + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tdpage)); +} + /* This is called when any field is changed; it notifies upstream. */ static void field_changed_cb (GtkWidget *widget, gpointer data) @@ -533,6 +618,22 @@ init_widgets (TaskDetailsPage *tdpage) (EDateEditGetTimeCallback) comp_editor_get_current_time, tdpage, NULL); + /* Connect signals. The Status, Percent Complete & Date Completed + properties are closely related so whenever one changes we may need + to update the other 2. */ + gtk_signal_connect (GTK_OBJECT (GTK_OPTION_MENU (priv->status)->menu), + "deactivate", + GTK_SIGNAL_FUNC (status_changed), tdpage); + + gtk_signal_connect (GTK_OBJECT (GTK_SPIN_BUTTON (priv->percent_complete)->adjustment), + "value_changed", + GTK_SIGNAL_FUNC (percent_complete_changed), tdpage); + + /* Priority */ + gtk_signal_connect (GTK_OBJECT (GTK_OPTION_MENU (priv->priority)->menu), + "deactivate", + GTK_SIGNAL_FUNC (field_changed_cb), tdpage); + /* Completed Date */ gtk_signal_connect (GTK_OBJECT (priv->completed_date), "changed", GTK_SIGNAL_FUNC (date_changed_cb), tdpage); @@ -540,14 +641,6 @@ 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); - } @@ -609,31 +702,6 @@ 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); - } -} - 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 c92bd52b8f..54ba5d35b5 100644 --- a/calendar/gui/dialogs/task-details-page.glade +++ b/calendar/gui/dialogs/task-details-page.glade @@ -33,8 +33,8 @@ <widget> <class>GtkFrame</class> - <name>frame1</name> - <label>Basics</label> + <name>frame2</name> + <label>Progress</label> <label_xalign>0</label_xalign> <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> <child> @@ -44,287 +44,217 @@ </child> <widget> - <class>GtkTable</class> - <name>table1</name> - <border_width>4</border_width> - <rows>2</rows> - <columns>2</columns> + <class>GtkVBox</class> + <name>vbox1</name> <homogeneous>False</homogeneous> - <row_spacing>2</row_spacing> - <column_spacing>2</column_spacing> + <spacing>0</spacing> <widget> - <class>GtkLabel</class> - <name>label15</name> - <label>Summary:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> + <class>GtkHBox</class> + <name>hbox1</name> + <border_width>4</border_width> + <homogeneous>False</homogeneous> + <spacing>4</spacing> <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkLabel</class> + <name>label17</name> + <label>_Status:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>False</yfill> - </child> - </widget> + <default_focus_target>status</default_focus_target> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> - <widget> - <class>GtkLabel</class> - <name>label16</name> - <label>Date/Time:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> + <widget> + <class>GtkOptionMenu</class> + <name>status</name> + <can_focus>True</can_focus> + <items>Not Started +In Progress +Completed +Cancelled +</items> + <initial_choice>0</initial_choice> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label18</name> + <label>_Priority:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>False</yfill> - </child> - </widget> + <default_focus_target>priority</default_focus_target> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> - <widget> - <class>GtkLabel</class> - <name>date-time</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>4</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> + <widget> + <class>GtkOptionMenu</class> + <name>priority</name> + <can_focus>True</can_focus> + <items>High +Normal +Low +Undefined +</items> + <initial_choice>0</initial_choice> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label19</name> + <label>% Complete</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkSpinButton</class> + <name>percent-complete</name> + <can_focus>True</can_focus> + <climb_rate>1</climb_rate> + <digits>0</digits> + <numeric>False</numeric> + <update_policy>GTK_UPDATE_ALWAYS</update_policy> + <snap>False</snap> + <wrap>False</wrap> + <value>1</value> + <lower>0</lower> + <upper>100</upper> + <step>1</step> + <page>10</page> + <page_size>10</page_size> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + </widget> </widget> <widget> - <class>GtkLabel</class> - <name>summary</name> - <label></label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>4</xpad> - <ypad>0</ypad> + <class>GtkTable</class> + <name>table1</name> + <border_width>4</border_width> + <rows>1</rows> + <columns>2</columns> + <homogeneous>False</homogeneous> + <row_spacing>2</row_spacing> + <column_spacing>4</column_spacing> <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkLabel</class> + <name>label12</name> + <label>Date Completed:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>Custom</class> + <name>completed-date</name> + <creation_function>task_details_page_create_date_edit</creation_function> + <int1>0</int1> + <int2>0</int2> + <last_modification_time>Fri, 01 Jun 2001 18:58:51 GMT</last_modification_time> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> </widget> </widget> </widget> <widget> <class>GtkTable</class> - <name>table1</name> + <name>table2</name> <border_width>4</border_width> - <rows>5</rows> + <rows>1</rows> <columns>2</columns> <homogeneous>False</homogeneous> <row_spacing>2</row_spacing> <column_spacing>4</column_spacing> <child> <padding>0</padding> - <expand>True</expand> + <expand>False</expand> <fill>True</fill> </child> <widget> - <class>GtkEntry</class> - <name>url</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>delegated-to</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>organizer</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>delegated-from-label</name> - <label>Delegated From:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>delegated-to-label</name> - <label>Delegated To:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label12</name> - <label>Date Completed:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> <class>GtkLabel</class> <name>label14</name> <label>URL:</label> @@ -337,32 +267,6 @@ <child> <left_attach>0</left_attach> <right_attach>1</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>organizer-label</name> - <label>Organizer:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> <top_attach>0</top_attach> <bottom_attach>1</bottom_attach> <xpad>0</xpad> @@ -377,23 +281,21 @@ </widget> <widget> - <class>GtkLabel</class> - <name>delegated-from</name> - <label>No one</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> + <class>GtkEntry</class> + <name>url</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> <child> <left_attach>1</left_attach> <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> - <xexpand>False</xexpand> + <xexpand>True</xexpand> <yexpand>False</yexpand> <xshrink>False</xshrink> <yshrink>False</yshrink> @@ -401,29 +303,6 @@ <yfill>False</yfill> </child> </widget> - - <widget> - <class>Custom</class> - <name>completed-date</name> - <creation_function>task_details_page_create_date_edit</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Fri, 01 Jun 2001 18:58:51 GMT</last_modification_time> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> </widget> </widget> </widget> diff --git a/calendar/gui/dialogs/task-details-page.h b/calendar/gui/dialogs/task-details-page.h index 01aae95d93..1821f00cec 100644 --- a/calendar/gui/dialogs/task-details-page.h +++ b/calendar/gui/dialogs/task-details-page.h @@ -54,8 +54,6 @@ typedef struct { 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 6e5a6f689e..22b89e5ce5 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -32,13 +32,16 @@ #include "task-page.h" #include "task-details-page.h" -#include "recurrence-page.h" +#include "meeting-page.h" #include "cancel-comp.h" #include "task-editor.h" struct _TaskEditorPrivate { TaskPage *task_page; TaskDetailsPage *task_details_page; + MeetingPage *meet_page; + + gboolean meeting_shown; }; @@ -48,13 +51,13 @@ 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 assign_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 ("ActionAssignTask", assign_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), @@ -115,6 +118,24 @@ task_editor_class_init (TaskEditorClass *klass) object_class->destroy = task_editor_destroy; } +static void +set_menu_sens (TaskEditor *te) +{ + TaskEditorPrivate *priv; + + priv = te->priv; + + comp_editor_set_ui_prop (COMP_EDITOR (te), + "/commands/ActionAssignTask", + "sensitive", priv->meeting_shown ? "0" : "1"); + comp_editor_set_ui_prop (COMP_EDITOR (te), + "/commands/ActionRefreshTask", + "sensitive", priv->meeting_shown ? "1" : "0"); + comp_editor_set_ui_prop (COMP_EDITOR (te), + "/commands/ActionCancelTask", + "sensitive", priv->meeting_shown ? "1" : "0"); +} + /* Object initialization function for the event editor */ static void task_editor_init (TaskEditor *te) @@ -127,16 +148,24 @@ task_editor_init (TaskEditor *te) priv->task_page = task_page_new (); comp_editor_append_page (COMP_EDITOR (te), COMP_EDITOR_PAGE (priv->task_page), - _("Task")); + _("Basic")); priv->task_details_page = task_details_page_new (); comp_editor_append_page (COMP_EDITOR (te), COMP_EDITOR_PAGE (priv->task_details_page), _("Details")); + priv->meet_page = meeting_page_new (); + comp_editor_append_page (COMP_EDITOR (te), + COMP_EDITOR_PAGE (priv->meet_page), + _("Assignment")); + comp_editor_merge_ui (COMP_EDITOR (te), EVOLUTION_DATADIR "/gnome/ui/evolution-task-editor.xml", verbs); + + priv->meeting_shown = TRUE; + set_menu_sens (te); } static void @@ -148,12 +177,13 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp) 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); + if (attendees == NULL) { + comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page)); + priv->meeting_shown = FALSE; + set_menu_sens (te); + } cal_component_free_attendee_list (attendees); if (parent_class->edit_comp) @@ -175,6 +205,7 @@ task_editor_destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT (priv->task_page)); gtk_object_unref (GTK_OBJECT (priv->task_details_page)); + gtk_object_unref (GTK_OBJECT (priv->meet_page)); if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -195,23 +226,31 @@ task_editor_new (void) } static void -delegate_task_cmd (GtkWidget *widget, gpointer data) +assign_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); + if (!priv->meeting_shown) { + comp_editor_append_page (COMP_EDITOR (te), + COMP_EDITOR_PAGE (priv->meet_page), + _("Assignment")); + priv->meeting_shown = TRUE; + set_menu_sens (te); + } + comp_editor_show_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->task_details_page)); + COMP_EDITOR_PAGE (priv->meet_page)); } static void refresh_task_cmd (GtkWidget *widget, gpointer data) { TaskEditor *te = TASK_EDITOR (data); - + + comp_editor_save_comp (COMP_EDITOR (te)); comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_REFRESH); } @@ -233,5 +272,8 @@ forward_cmd (GtkWidget *widget, gpointer data) { TaskEditor *te = TASK_EDITOR (data); + comp_editor_save_comp (COMP_EDITOR (te)); comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_PUBLISH); } + + diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 4410fbddf3..edf037ef98 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -58,11 +58,6 @@ struct _TaskPagePrivate { GtkWidget *due_timezone; GtkWidget *start_timezone; - GtkWidget *percent_complete; - - GtkWidget *status; - GtkWidget *priority; - GtkWidget *description; GtkWidget *classification_public; @@ -78,30 +73,6 @@ struct _TaskPagePrivate { gboolean updating; }; -/* Note that these two arrays must match. */ -static const int status_map[] = { - ICAL_STATUS_NEEDSACTION, - ICAL_STATUS_INPROCESS, - ICAL_STATUS_COMPLETED, - ICAL_STATUS_CANCELLED, - -1 -}; - -typedef enum { - PRIORITY_HIGH, - PRIORITY_NORMAL, - PRIORITY_LOW, - PRIORITY_UNDEFINED, -} TaskEditorPriority; - -static const int priority_map[] = { - PRIORITY_HIGH, - PRIORITY_NORMAL, - PRIORITY_LOW, - PRIORITY_UNDEFINED, - -1 -}; - static const int classification_map[] = { CAL_COMPONENT_CLASS_PUBLIC, CAL_COMPONENT_CLASS_PRIVATE, @@ -197,8 +168,6 @@ task_page_init (TaskPage *tpage) priv->start_date = NULL; priv->due_timezone = NULL; priv->start_timezone = NULL; - priv->percent_complete = NULL; - priv->status = NULL; priv->description = NULL; priv->classification_public = NULL; priv->classification_private = NULL; @@ -284,59 +253,10 @@ clear_widgets (TaskPage *tpage) e_dialog_radio_set (priv->classification_public, CAL_COMPONENT_CLASS_PRIVATE, classification_map); - /* Status, priority, complete percent */ - e_dialog_spin_set (priv->percent_complete, 0.0); - e_dialog_option_menu_set (priv->status, ICAL_STATUS_NEEDSACTION, status_map); - e_dialog_option_menu_set (priv->priority, PRIORITY_UNDEFINED, priority_map); - /* Categories */ e_dialog_editable_set (priv->categories, NULL); } -static TaskEditorPriority -priority_value_to_index (int priority_value) -{ - TaskEditorPriority retval; - - if (priority_value == 0) - retval = PRIORITY_UNDEFINED; - else if (priority_value <= 4) - retval = PRIORITY_HIGH; - else if (priority_value == 5) - retval = PRIORITY_NORMAL; - else - retval = PRIORITY_LOW; - - return retval; -} - -static int -priority_index_to_value (TaskEditorPriority priority) -{ - int retval; - - switch (priority) { - case PRIORITY_UNDEFINED: - retval = 0; - break; - case PRIORITY_HIGH: - retval = 3; - break; - case PRIORITY_NORMAL: - retval = 5; - break; - case PRIORITY_LOW: - retval = 7; - break; - default: - retval = -1; - g_assert_not_reached (); - break; - } - - return retval; -} - /* Decode the radio button group for classifications */ static CalComponentClassification classification_get (GtkWidget *widget) @@ -355,9 +275,6 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp) CalComponentClassification cl; CalClientGetStatus get_tz_status; GSList *l; - int *priority_value, *percent; - icalproperty_status status; - TaskEditorPriority priority; const char *categories; icaltimezone *zone; @@ -440,44 +357,6 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp) cal_component_free_datetime (&d); - - /* Percent Complete. */ - cal_component_get_percent (comp, &percent); - if (percent) { - e_dialog_spin_set (priv->percent_complete, *percent); - cal_component_free_percent (percent); - } else { - /* FIXME: Could check if task is completed and set 100%. */ - e_dialog_spin_set (priv->percent_complete, 0); - } - - /* Status. */ - cal_component_get_status (comp, &status); - if (status == ICAL_STATUS_NONE) { - /* Try to user the percent value. */ - if (percent) { - if (*percent == 0) - status = ICAL_STATUS_NEEDSACTION; - else if (*percent == 100) - status = ICAL_STATUS_COMPLETED; - else - status = ICAL_STATUS_INPROCESS; - } else - status = ICAL_STATUS_NEEDSACTION; - } - e_dialog_option_menu_set (priv->status, status, status_map); - - /* Priority. */ - cal_component_get_priority (comp, &priority_value); - if (priority_value) { - priority = priority_value_to_index (*priority_value); - cal_component_free_priority (priority_value); - } else { - priority = PRIORITY_UNDEFINED; - } - e_dialog_option_menu_set (priv->priority, priority, priority_map); - - /* Classification. */ cal_component_get_classification (comp, &cl); @@ -515,11 +394,7 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp) TaskPagePrivate *priv; CalComponentDateTime date; struct icaltimetype icaltime; - icalproperty_status status; - TaskEditorPriority priority; - int priority_value, percent; - char *cat; - char *str; + char *cat, *str; gboolean date_set; icaltimezone *zone; @@ -606,19 +481,6 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp) cal_component_set_dtstart (comp, NULL); } - /* Percent Complete. */ - percent = e_dialog_spin_get_int (priv->percent_complete); - cal_component_set_percent (comp, &percent); - - /* Status. */ - status = e_dialog_option_menu_get (priv->status, status_map); - cal_component_set_status (comp, status); - - /* Priority. */ - priority = e_dialog_option_menu_get (priv->priority, priority_map); - priority_value = priority_index_to_value (priority); - cal_component_set_priority (comp, &priority_value); - /* Classification. */ cal_component_set_classification (comp, classification_get (priv->classification_public)); @@ -658,26 +520,6 @@ task_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) return; priv->updating = TRUE; - - if (dates->complete) { - if (icaltime_is_null_time (*dates->complete)) { - /* If the 'Completed Date' is set to 'None', - we set the status to 'Not Started' and the - percent-complete to 0. The task may - actually be partially-complete, but we - leave it to the user to set those - fields. */ - e_dialog_option_menu_set (priv->status, - ICAL_STATUS_NEEDSACTION, - status_map); - e_dialog_spin_set (priv->percent_complete, 0); - } else { - e_dialog_option_menu_set (priv->status, - ICAL_STATUS_COMPLETED, - status_map); - e_dialog_spin_set (priv->percent_complete, 100); - } - } priv->updating = FALSE; } @@ -708,11 +550,6 @@ get_widgets (TaskPage *tpage) priv->due_timezone = GW ("due-timezone"); priv->start_timezone = GW ("start-timezone"); - priv->percent_complete = GW ("percent-complete"); - - priv->status = GW ("status"); - priv->priority = GW ("priority"); - priv->description = GW ("description"); priv->classification_public = GW ("classification-public"); @@ -732,9 +569,6 @@ get_widgets (TaskPage *tpage) && priv->start_date && priv->due_timezone && priv->start_timezone - && priv->percent_complete - && priv->status - && priv->priority && priv->classification_public && priv->classification_private && priv->classification_confidential @@ -845,98 +679,6 @@ field_changed_cb (GtkWidget *widget, gpointer data) comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tpage)); } -static void -complete_date_changed (TaskPage *tpage, gboolean complete) -{ - TaskPagePrivate *priv; - CompEditorPageDates dates; - icaltimezone *zone; - struct icaltimetype completed_tt = icaltime_null_time(); - - priv = tpage->priv; - - /* Get the current time in UTC. */ - zone = icaltimezone_get_utc_timezone (); - completed_tt = icaltime_from_timet_with_zone (time (NULL), FALSE, zone); - completed_tt.is_utc = TRUE; - - dates.start = NULL; - dates.end = NULL; - dates.due = NULL; - dates.complete = &completed_tt; - - /* Notify upstream */ - comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (tpage), - &dates); -} - -static void -status_changed (GtkMenu *menu, TaskPage *tpage) -{ - TaskPagePrivate *priv; - icalproperty_status status; - - priv = tpage->priv; - - if (priv->updating) - return; - - priv->updating = TRUE; - - status = e_dialog_option_menu_get (priv->status, status_map); - if (status == ICAL_STATUS_NEEDSACTION) { - e_dialog_spin_set (priv->percent_complete, 0); - complete_date_changed (tpage, FALSE); - } else if (status == ICAL_STATUS_INPROCESS) { - e_dialog_spin_set (priv->percent_complete, 50); - complete_date_changed (tpage, FALSE); - } else if (status == ICAL_STATUS_COMPLETED) { - e_dialog_spin_set (priv->percent_complete, 100); - complete_date_changed (tpage, TRUE); - } - - priv->updating = FALSE; - - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tpage)); -} - -static void -percent_complete_changed (GtkAdjustment *adj, TaskPage *tpage) -{ - TaskPagePrivate *priv; - gint percent; - icalproperty_status status; - gboolean complete; - - priv = tpage->priv; - - if (priv->updating) - return; - - priv->updating = TRUE; - - percent = e_dialog_spin_get_int (priv->percent_complete); - if (percent == 100) { - complete = TRUE; - status = ICAL_STATUS_COMPLETED; - } else { - complete = FALSE; - - if (percent == 0) - status = ICAL_STATUS_NEEDSACTION; - else - status = ICAL_STATUS_INPROCESS; - } - - e_dialog_option_menu_set (priv->status, status, status_map); - complete_date_changed (tpage, complete); - - priv->updating = FALSE; - - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tpage)); -} - - /* Hooks the widget signals */ static void init_widgets (TaskPage *tpage) @@ -969,17 +711,6 @@ init_widgets (TaskPage *tpage) gtk_signal_connect (GTK_OBJECT (priv->start_timezone), "changed", GTK_SIGNAL_FUNC (field_changed_cb), tpage); - /* Connect signals. The Status, Percent Complete & Date Completed - properties are closely related so whenever one changes we may need - to update the other 2. */ - gtk_signal_connect (GTK_OBJECT (GTK_OPTION_MENU (priv->status)->menu), - "deactivate", - GTK_SIGNAL_FUNC (status_changed), tpage); - - gtk_signal_connect (GTK_OBJECT (GTK_SPIN_BUTTON (priv->percent_complete)->adjustment), - "value_changed", - GTK_SIGNAL_FUNC (percent_complete_changed), tpage); - /* Classification */ gtk_signal_connect (GTK_OBJECT (priv->description), "changed", GTK_SIGNAL_FUNC (field_changed_cb), tpage); @@ -995,9 +726,6 @@ init_widgets (TaskPage *tpage) /* Connect the default signal handler to use to make sure the "changed" field gets set whenever a field is changed. */ - gtk_signal_connect (GTK_OBJECT (GTK_OPTION_MENU (priv->priority)->menu), - "deactivate", - GTK_SIGNAL_FUNC (field_changed_cb), tpage); gtk_signal_connect (GTK_OBJECT (priv->description), "changed", GTK_SIGNAL_FUNC (field_changed_cb), tpage); gtk_signal_connect (GTK_OBJECT (priv->contacts), "changed", diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade index 0c54bb80a9..7c4a53c098 100644 --- a/calendar/gui/dialogs/task-page.glade +++ b/calendar/gui/dialogs/task-page.glade @@ -278,12 +278,10 @@ </widget> <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + <class>GtkVBox</class> + <name>vbox1</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> <child> <padding>0</padding> <expand>True</expand> @@ -291,144 +289,42 @@ </child> <widget> - <class>GtkText</class> - <name>description</name> - <height>80</height> - <can_focus>True</can_focus> - <editable>True</editable> - <text></text> + <class>GtkLabel</class> + <name>label18</name> + <label>Description:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame23</name> - <label>Progress</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> <widget> - <class>GtkHBox</class> - <name>hbox3</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkLabel</class> - <name>label7</name> - <label>_Status:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>status</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>status</name> - <can_focus>True</can_focus> - <items>Not Started -In Progress -Completed -Cancelled -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label8</name> - <label>_Priority:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>priority</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>priority</name> - <can_focus>True</can_focus> - <items>High -Normal -Low -Undefined -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label9</name> - <label>% Comp_lete:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>percent-complete</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> + <class>GtkScrolledWindow</class> + <name>scrolledwindow1</name> + <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> + <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> + <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> + <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> <widget> - <class>GtkSpinButton</class> - <name>percent-complete</name> - <width>60</width> + <class>GtkText</class> + <name>description</name> + <height>80</height> <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>False</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>0</value> - <lower>0</lower> - <upper>100</upper> - <step>10</step> - <page>10</page> - <page_size>10</page_size> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> + <editable>True</editable> + <text></text> </widget> </widget> </widget> |