diff options
author | Chenthill Palanisamy <pchenthill@novell.com> | 2004-12-02 22:05:50 +0800 |
---|---|---|
committer | Chenthill Palanisamy <pchen@src.gnome.org> | 2004-12-02 22:05:50 +0800 |
commit | 300ec3f74d9f2ea59503ad267c927723ea59fd3e (patch) | |
tree | 5b6c2f78eb177f049be8a3e9fd91163e5eb6e7da /calendar/gui | |
parent | 2f70359db9a97a8e3f13d0ee9970d93a139f839e (diff) | |
download | gsoc2013-evolution-300ec3f74d9f2ea59503ad267c927723ea59fd3e.tar.gz gsoc2013-evolution-300ec3f74d9f2ea59503ad267c927723ea59fd3e.tar.zst gsoc2013-evolution-300ec3f74d9f2ea59503ad267c927723ea59fd3e.zip |
Add a boolean variable to denote assigned task and construct the meeting
2004-12-02 Chenthill Palanisamy <pchenthill@novell.com>
* gui/dialogs/task-editor.[ch] (task_editor_new), (task_editor_construct),
(show_assignment):
Add a boolean variable to denote assigned task and construct the
meeting page only for the assigned task. Set it as a group item
in component editor.
(_TaskEditorPrivate): added the boolean variable (is_assigned).
(task_editor_init): initialized the variable.
* gui/dialogs/comp-editor.[ch]: Added functions to set and get whether comp
is a group item or individual item.
* gui/comp-editor.c (make_title_from_string), (make_title_from_comp):
Set the Title for the appointment editor window as "Meeting" or "Assigned
Task" if its a group calendar/task item.
(_CompEditorPrivate): added a boolean variable (is_group_item).
(comp_editor_init): initialized the same.
* gui/dialogs/event-editor.c (event_editor_construct), (show_meeting): Set whether
the component is a group item or not in comp editor.
* gui/e-calendar-table.c (e_calendar_table_open_task), (e_calendar_table_open_selected),
(open_task_by_row): Check whether the component being opened is an assigned task by
checking for attendees and call open_task with proper value for boolean variable assign.
* gui/comp-editor-factory.c (edit_existing):
* gui/e-calendar-table.c (open_task):
* gui/e-tasks.c (e_tasks_new_task):
* gui/gnome-cal.c (gnome_calendar_new_task):
* gui/tasks-component.c (create_new_todo):
Called the function task_editor_new with a added argument.
svn path=/trunk/; revision=28044
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/comp-editor-factory.c | 4 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 61 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.h | 3 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 31 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.h | 4 | ||||
-rw-r--r-- | calendar/gui/e-calendar-table.c | 14 | ||||
-rw-r--r-- | calendar/gui/e-tasks.c | 2 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 2 | ||||
-rw-r--r-- | calendar/gui/tasks-component.c | 2 |
10 files changed, 90 insertions, 35 deletions
diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c index ea809b35e5..56a75d557d 100644 --- a/calendar/gui/comp-editor-factory.c +++ b/calendar/gui/comp-editor-factory.c @@ -273,7 +273,7 @@ edit_existing (OpenClient *oc, const char *uid) break; case E_CAL_COMPONENT_TODO: - editor = COMP_EDITOR (task_editor_new (oc->client)); + editor = COMP_EDITOR (task_editor_new (oc->client, e_cal_component_has_attendees (comp))); break; default: @@ -323,7 +323,7 @@ edit_new (OpenClient *oc, const GNOME_Evolution_Calendar_CompEditorFactory_CompE comp = cal_comp_event_new_with_current_time (oc->client, TRUE); break; case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO: - editor = COMP_EDITOR (task_editor_new (oc->client)); + editor = COMP_EDITOR (task_editor_new (oc->client, FALSE)); comp = get_default_task (oc->client); break; default: diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 17e723d6f2..7a4040db78 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -76,6 +76,7 @@ struct _CompEditorPrivate { gboolean existing_org; gboolean user_org; + gboolean is_group_item; gboolean warned; }; @@ -358,16 +359,16 @@ response_cb (GtkWidget *widget, int response, gpointer data) if (e_cal_component_is_instance (priv->comp)) if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor))) return; - + if (save_comp_with_send (editor)) { - + e_cal_component_get_summary (priv->comp, &text); if (!text.value) { if (!send_component_prompt_subject ((GtkWindow *) editor, priv->client, priv->comp)) return; } - close_dialog (editor); + close_dialog (editor); } break; @@ -421,6 +422,7 @@ comp_editor_init (CompEditor *editor) priv->existing_org = FALSE; priv->user_org = FALSE; priv->warned = FALSE; + priv->is_group_item = FALSE; gtk_window_set_type_hint (GTK_WINDOW (editor), GDK_WINDOW_TYPE_HINT_NORMAL); } @@ -578,6 +580,31 @@ comp_editor_get_user_org (CompEditor *editor) return priv->user_org; } +void +comp_editor_set_group_item (CompEditor *editor, gboolean group_item) +{ + CompEditorPrivate *priv; + + g_return_if_fail (editor != NULL); + g_return_if_fail (IS_COMP_EDITOR (editor)); + + priv = editor->priv; + + priv->is_group_item = group_item; +} + +gboolean +comp_editor_get_is_group_item (CompEditor *editor) +{ + CompEditorPrivate *priv; + + g_return_val_if_fail (editor != NULL, FALSE); + g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); + + priv = editor->priv; + + return priv->is_group_item; +} /** * comp_editor_set_changed: @@ -861,7 +888,7 @@ comp_editor_get_e_cal (CompEditor *editor) /* Creates an appropriate title for the event editor dialog */ static char * -make_title_from_comp (ECalComponent *comp) +make_title_from_comp (ECalComponent *comp, gboolean is_group_item) { char *title; const char *type_string; @@ -874,10 +901,16 @@ make_title_from_comp (ECalComponent *comp) type = e_cal_component_get_vtype (comp); switch (type) { case E_CAL_COMPONENT_EVENT: - type_string = _("Appointment - %s"); + if (is_group_item) + type_string = _("Meeting - %s"); + else + type_string = _("Appointment - %s"); break; case E_CAL_COMPONENT_TODO: - type_string = _("Task - %s"); + if (is_group_item) + type_string = _("Assigned Task - %s"); + else + type_string = _("Task - %s"); break; case E_CAL_COMPONENT_JOURNAL: type_string = _("Journal entry - %s"); @@ -899,7 +932,7 @@ make_title_from_comp (ECalComponent *comp) /* Creates an appropriate title for the event editor dialog */ static char * -make_title_from_string (ECalComponent *comp, const char *str) +make_title_from_string (ECalComponent *comp, const char *str, gboolean is_group_item) { char *title; const char *type_string; @@ -911,10 +944,16 @@ make_title_from_string (ECalComponent *comp, const char *str) type = e_cal_component_get_vtype (comp); switch (type) { case E_CAL_COMPONENT_EVENT: - type_string = _("Appointment - %s"); + if (is_group_item) + type_string = _("Meeting - %s"); + else + type_string = _("Appointment - %s"); break; case E_CAL_COMPONENT_TODO: - type_string = _("Task - %s"); + if (is_group_item) + type_string = _("Assigned Task - %s"); + else + type_string = _("Task - %s"); break; case E_CAL_COMPONENT_JOURNAL: type_string = _("Journal entry - %s"); @@ -962,7 +1001,7 @@ set_title_from_comp (CompEditor *editor) char *title; priv = editor->priv; - title = make_title_from_comp (priv->comp); + title = make_title_from_comp (priv->comp, priv->is_group_item); gtk_window_set_title (GTK_WINDOW (editor), title); g_free (title); } @@ -974,7 +1013,7 @@ set_title_from_string (CompEditor *editor, const char *str) char *title; priv = editor->priv; - title = make_title_from_string (priv->comp, str); + title = make_title_from_string (priv->comp, str, priv->is_group_item); gtk_window_set_title (GTK_WINDOW (editor), title); g_free (title); } diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 14846ec615..39966c70a7 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -68,6 +68,9 @@ gboolean comp_editor_get_existing_org (CompEditor *editor); void comp_editor_set_user_org (CompEditor *editor, gboolean user_org); gboolean comp_editor_get_user_org (CompEditor *editor); +void comp_editor_set_group_item (CompEditor *editor, + gboolean is_group_item); +gboolean comp_editor_get_group_item (CompEditor *editor); void comp_editor_append_page (CompEditor *editor, CompEditorPage *page, const char *label); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 0609158fa4..d804744e36 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -147,6 +147,7 @@ event_editor_construct (EventEditor *ee, ECal *client) _("Recurrence")); if (priv->is_meeting) { + comp_editor_set_group_item (COMP_EDITOR (ee), TRUE); priv->sched_page = schedule_page_new (priv->model); g_object_ref (priv->sched_page); gtk_object_sink (GTK_OBJECT (priv->sched_page)); @@ -359,6 +360,7 @@ show_meeting (EventEditor *ee) priv = ee->priv; + if (!priv->meeting_shown) { comp_editor_append_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->sched_page), diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 96d0dbe40e..ffcb48c7c7 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -45,6 +45,7 @@ struct _TaskEditorPrivate { EMeetingStore *model; gboolean assignment_shown; + gboolean is_assigned; gboolean updating; }; @@ -115,16 +116,18 @@ task_editor_init (TaskEditor *te) priv->model = E_MEETING_STORE (e_meeting_store_new ()); priv->assignment_shown = TRUE; priv->updating = FALSE; + priv->is_assigned = FALSE; } TaskEditor * -task_editor_construct (TaskEditor *te, ECal *client) +task_editor_construct (TaskEditor *te, ECal *client, gboolean is_assigned) { TaskEditorPrivate *priv; priv = te->priv; + priv->is_assigned = is_assigned; priv->task_page = task_page_new (); g_object_ref (priv->task_page); gtk_object_sink (GTK_OBJECT (priv->task_page)); @@ -140,13 +143,15 @@ task_editor_construct (TaskEditor *te, ECal *client) comp_editor_append_page (COMP_EDITOR (te), COMP_EDITOR_PAGE (priv->task_details_page), _("Status")); - - priv->meet_page = meeting_page_new (priv->model, client); - g_object_ref (priv->meet_page); - gtk_object_sink (GTK_OBJECT (priv->meet_page)); - comp_editor_append_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->meet_page), - _("Assignment")); + if (priv->is_assigned) { + comp_editor_set_group_item (COMP_EDITOR (te), TRUE); + priv->meet_page = meeting_page_new (priv->model, client); + g_object_ref (priv->meet_page); + gtk_object_sink (GTK_OBJECT (priv->meet_page)); + comp_editor_append_page (COMP_EDITOR (te), + COMP_EDITOR_PAGE (priv->meet_page), + _("Assignment")); + } comp_editor_set_e_cal (COMP_EDITOR (te), client); @@ -245,7 +250,9 @@ task_editor_edit_comp (CompEditor *editor, ECalComponent *comp) if (ia != NULL) e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_NONE); } - + + + comp_editor_set_group_item (COMP_EDITOR (te), TRUE); priv->assignment_shown = TRUE; } e_cal_component_free_attendee_list (attendees); @@ -324,12 +331,12 @@ task_editor_finalize (GObject *object) * editor could not be created. **/ TaskEditor * -task_editor_new (ECal *client) +task_editor_new (ECal *client, gboolean is_assigned) { TaskEditor *te; te = g_object_new (TYPE_TASK_EDITOR, NULL); - return task_editor_construct (te, client); + return task_editor_construct (te, client, is_assigned); } static void @@ -349,8 +356,6 @@ show_assignment (TaskEditor *te) comp_editor_set_changed (COMP_EDITOR (te), TRUE); } - comp_editor_show_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->meet_page)); } void diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h index e0e6ac75be..d1b8b327d5 100644 --- a/calendar/gui/dialogs/task-editor.h +++ b/calendar/gui/dialogs/task-editor.h @@ -53,8 +53,8 @@ struct _TaskEditorClass { GtkType task_editor_get_type (void); TaskEditor *task_editor_construct (TaskEditor *te, - ECal *client); -TaskEditor *task_editor_new (ECal *client); + ECal *client, gboolean is_assigned); +TaskEditor *task_editor_new (ECal *client, gboolean is_assigned); void task_editor_show_assignment(TaskEditor *te); diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 1a8020aa02..64193687fa 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -584,10 +584,12 @@ void e_calendar_table_open_selected (ECalendarTable *cal_table) { ECalModelComponent *comp_data; + icalproperty *prop; comp_data = get_selected_comp (cal_table); + prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY); if (comp_data != NULL) - open_task (cal_table, comp_data, FALSE); + open_task (cal_table, comp_data, prop ? TRUE : FALSE); } /** @@ -940,7 +942,7 @@ open_task (ECalendarTable *cal_table, ECalModelComponent *comp_data, gboolean as if (tedit == NULL) { ECalComponent *comp; - tedit = COMP_EDITOR (task_editor_new (comp_data->client)); + tedit = COMP_EDITOR (task_editor_new (comp_data->client, assign)); comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp)); @@ -959,9 +961,11 @@ static void open_task_by_row (ECalendarTable *cal_table, int row) { ECalModelComponent *comp_data; + icalproperty *prop; comp_data = e_cal_model_get_component_at (cal_table->model, row); - open_task (cal_table, comp_data, FALSE); + prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY); + open_task (cal_table, comp_data, prop ? TRUE : FALSE); } static void @@ -981,10 +985,12 @@ e_calendar_table_on_open_task (EPopup *ep, EPopupItem *pitem, void *data) { ECalendarTable *cal_table = data; ECalModelComponent *comp_data; + icalproperty *prop; comp_data = get_selected_comp (cal_table); + prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY); if (comp_data) - open_task (cal_table, comp_data, FALSE); + open_task (cal_table, comp_data, prop ? TRUE : FALSE); } static void diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index e6c82a4355..355d04c2b8 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -901,7 +901,7 @@ e_tasks_new_task (ETasks *tasks) category = cal_search_bar_get_category (CAL_SEARCH_BAR (priv->search_bar)); e_cal_component_set_categories (comp, category); - tedit = task_editor_new (ecal); + tedit = task_editor_new (ecal, FALSE); comp_editor_edit_comp (COMP_EDITOR (tedit), comp); g_object_unref (comp); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index cd0280c55b..81fc9061d3 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -2833,7 +2833,7 @@ gnome_calendar_new_task (GnomeCalendar *gcal) if (!ecal) return; - tedit = task_editor_new (ecal); + tedit = task_editor_new (ecal, FALSE); icalcomp = e_cal_model_create_component_with_defaults (model); comp = e_cal_component_new (); diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index 8060c5f77d..feaf6b16ce 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -791,7 +791,7 @@ create_new_todo (TasksComponent *task_component, gboolean is_assigned, TasksComp if (!ecal) return FALSE; - editor = task_editor_new (ecal); + editor = task_editor_new (ecal, is_assigned); comp = cal_comp_task_new_with_defaults (ecal); comp_editor_edit_comp (COMP_EDITOR (editor), comp); |