[evolution] I#156 - Make Location editable for Tasks
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#156 - Make Location editable for Tasks
- Date: Mon, 1 Oct 2018 16:28:57 +0000 (UTC)
commit 74a15bc03c2fc02aa8f2c9e0065860b09480fbc9
Author: Milan Crha <mcrha redhat com>
Date: Mon Oct 1 18:29:07 2018 +0200
I#156 - Make Location editable for Tasks
Closes https://gitlab.gnome.org/GNOME/evolution/issues/156
src/calendar/gui/e-cal-model-tasks.c | 50 +++++++++++++++++++++++++++++++++++
src/calendar/gui/e-cal-model-tasks.h | 1 +
src/calendar/gui/e-calendar-view.c | 2 +-
src/calendar/gui/e-comp-editor-task.c | 25 ++++++++++--------
src/calendar/gui/e-task-table.c | 15 +++++++++++
src/calendar/gui/e-task-table.etspec | 1 +
6 files changed, 82 insertions(+), 12 deletions(-)
---
diff --git a/src/calendar/gui/e-cal-model-tasks.c b/src/calendar/gui/e-cal-model-tasks.c
index 7df5ebf47f..71bb3ae069 100644
--- a/src/calendar/gui/e-cal-model-tasks.c
+++ b/src/calendar/gui/e-cal-model-tasks.c
@@ -290,6 +290,18 @@ get_url (ECalModelComponent *comp_data)
return (gpointer) "";
}
+static gpointer
+get_location (ECalModelComponent *comp_data)
+{
+ icalproperty *prop;
+
+ prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_LOCATION_PROPERTY);
+ if (prop)
+ return (gpointer) icalproperty_get_location (prop);
+
+ return (gpointer) "";
+}
+
static gboolean
is_complete (ECalModelComponent *comp_data)
{
@@ -640,6 +652,29 @@ set_url (ECalModelComponent *comp_data,
}
}
+static void
+set_location (ECalModelComponent *comp_data,
+ gconstpointer value)
+{
+ icalproperty *prop;
+
+ prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_LOCATION_PROPERTY);
+
+ if (string_is_empty (value)) {
+ if (prop) {
+ icalcomponent_remove_property (comp_data->icalcomp, prop);
+ icalproperty_free (prop);
+ }
+ } else {
+ if (prop)
+ icalproperty_set_location (prop, (const gchar *) value);
+ else {
+ prop = icalproperty_new_location ((const gchar *) value);
+ icalcomponent_add_property (comp_data->icalcomp, prop);
+ }
+ }
+}
+
static void
cal_model_tasks_set_property (GObject *object,
guint property_id,
@@ -778,6 +813,7 @@ cal_model_tasks_store_values_from_model (ECalModel *model,
e_cal_model_util_set_value (values, source_model, E_CAL_MODEL_TASKS_FIELD_GEO, row);
e_cal_model_util_set_value (values, source_model, E_CAL_MODEL_TASKS_FIELD_PRIORITY, row);
e_cal_model_util_set_value (values, source_model, E_CAL_MODEL_TASKS_FIELD_URL, row);
+ e_cal_model_util_set_value (values, source_model, E_CAL_MODEL_TASKS_FIELD_LOCATION, row);
}
static void
@@ -807,6 +843,7 @@ cal_model_tasks_fill_component_from_values (ECalModel *model,
set_geo (comp_data, e_cal_model_util_get_value (values, E_CAL_MODEL_TASKS_FIELD_GEO));
set_priority (comp_data, e_cal_model_util_get_value (values, E_CAL_MODEL_TASKS_FIELD_PRIORITY));
set_url (comp_data, e_cal_model_util_get_value (values, E_CAL_MODEL_TASKS_FIELD_URL));
+ set_location (comp_data, e_cal_model_util_get_value (values, E_CAL_MODEL_TASKS_FIELD_LOCATION));
}
static gint
@@ -856,6 +893,8 @@ cal_model_tasks_value_at (ETableModel *etm,
return get_status (comp_data);
case E_CAL_MODEL_TASKS_FIELD_URL :
return get_url (comp_data);
+ case E_CAL_MODEL_TASKS_FIELD_LOCATION:
+ return get_location (comp_data);
}
return (gpointer) "";
@@ -909,6 +948,9 @@ cal_model_tasks_set_value_at (ETableModel *etm,
case E_CAL_MODEL_TASKS_FIELD_URL :
set_url (comp_data, value);
break;
+ case E_CAL_MODEL_TASKS_FIELD_LOCATION:
+ set_location (comp_data, value);
+ break;
}
e_cal_model_modify_component (E_CAL_MODEL (model), comp_data, E_CAL_OBJ_MOD_ALL);
@@ -941,6 +983,7 @@ cal_model_tasks_is_cell_editable (ETableModel *etm,
case E_CAL_MODEL_TASKS_FIELD_PRIORITY :
case E_CAL_MODEL_TASKS_FIELD_STATUS :
case E_CAL_MODEL_TASKS_FIELD_URL :
+ case E_CAL_MODEL_TASKS_FIELD_LOCATION:
return TRUE;
}
@@ -970,6 +1013,9 @@ cal_model_tasks_duplicate_value (ETableModel *etm,
case E_CAL_MODEL_TASKS_FIELD_PERCENT :
case E_CAL_MODEL_TASKS_FIELD_OVERDUE :
return (gpointer) value;
+
+ case E_CAL_MODEL_TASKS_FIELD_LOCATION:
+ return g_strdup (value);
}
return NULL;
@@ -997,6 +1043,7 @@ cal_model_tasks_free_value (ETableModel *etm,
case E_CAL_MODEL_TASKS_FIELD_PRIORITY :
case E_CAL_MODEL_TASKS_FIELD_STATUS :
case E_CAL_MODEL_TASKS_FIELD_URL :
+ case E_CAL_MODEL_TASKS_FIELD_LOCATION:
break;
case E_CAL_MODEL_TASKS_FIELD_PERCENT :
case E_CAL_MODEL_TASKS_FIELD_COMPLETE :
@@ -1022,6 +1069,7 @@ cal_model_tasks_initialize_value (ETableModel *etm,
case E_CAL_MODEL_TASKS_FIELD_PRIORITY :
case E_CAL_MODEL_TASKS_FIELD_STATUS :
case E_CAL_MODEL_TASKS_FIELD_URL :
+ case E_CAL_MODEL_TASKS_FIELD_LOCATION:
return (gpointer) "";
case E_CAL_MODEL_TASKS_FIELD_COMPLETED :
case E_CAL_MODEL_TASKS_FIELD_DUE :
@@ -1053,6 +1101,7 @@ cal_model_tasks_value_is_empty (ETableModel *etm,
case E_CAL_MODEL_TASKS_FIELD_PRIORITY :
case E_CAL_MODEL_TASKS_FIELD_STATUS :
case E_CAL_MODEL_TASKS_FIELD_URL :
+ case E_CAL_MODEL_TASKS_FIELD_LOCATION:
return string_is_empty (value);
case E_CAL_MODEL_TASKS_FIELD_COMPLETED :
case E_CAL_MODEL_TASKS_FIELD_DUE :
@@ -1085,6 +1134,7 @@ cal_model_tasks_value_to_string (ETableModel *etm,
case E_CAL_MODEL_TASKS_FIELD_PRIORITY :
case E_CAL_MODEL_TASKS_FIELD_STATUS :
case E_CAL_MODEL_TASKS_FIELD_URL :
+ case E_CAL_MODEL_TASKS_FIELD_LOCATION:
return g_strdup (value);
case E_CAL_MODEL_TASKS_FIELD_COMPLETED :
case E_CAL_MODEL_TASKS_FIELD_DUE :
diff --git a/src/calendar/gui/e-cal-model-tasks.h b/src/calendar/gui/e-cal-model-tasks.h
index 0fa19ff935..bf9aa54b63 100644
--- a/src/calendar/gui/e-cal-model-tasks.h
+++ b/src/calendar/gui/e-cal-model-tasks.h
@@ -65,6 +65,7 @@ typedef enum {
E_CAL_MODEL_TASKS_FIELD_STATUS,
E_CAL_MODEL_TASKS_FIELD_URL,
E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, /* it's another virtual readonly column */
+ E_CAL_MODEL_TASKS_FIELD_LOCATION,
E_CAL_MODEL_TASKS_FIELD_LAST
} ECalModelTasksField;
diff --git a/src/calendar/gui/e-calendar-view.c b/src/calendar/gui/e-calendar-view.c
index 2f0c3f1f23..5ba5e4a8f6 100644
--- a/src/calendar/gui/e-calendar-view.c
+++ b/src/calendar/gui/e-calendar-view.c
@@ -1870,7 +1870,7 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
e_cal_component_get_location (newcomp, &str);
if (str) {
- /* To Translators: It will display "Location: PlaceOfTheMeeting" */
+ /* Translators: It will display "Location: PlaceOfTheMeeting" */
tmp = g_markup_printf_escaped (_("Location: %s"), str);
label = gtk_label_new (NULL);
gtk_widget_set_halign (label, GTK_ALIGN_START);
diff --git a/src/calendar/gui/e-comp-editor-task.c b/src/calendar/gui/e-comp-editor-task.c
index 23577a7f76..54f7451c4e 100644
--- a/src/calendar/gui/e-comp-editor-task.c
+++ b/src/calendar/gui/e-comp-editor-task.c
@@ -759,63 +759,66 @@ e_comp_editor_task_constructed (GObject *object)
e_comp_editor_page_add_property_part (page, part, 0, 2, 4, 1);
summary = part;
+ part = e_comp_editor_property_part_location_new (focus_tracker);
+ e_comp_editor_page_add_property_part (page, part, 0, 3, 4, 1);
+
part = e_comp_editor_property_part_dtstart_new (C_("ECompEditor", "Sta_rt date:"), TRUE, TRUE);
- e_comp_editor_page_add_property_part (page, part, 0, 3, 2, 1);
+ e_comp_editor_page_add_property_part (page, part, 0, 4, 2, 1);
task_editor->priv->dtstart = part;
edit_widget = e_comp_editor_property_part_get_edit_widget (part);
g_signal_connect (edit_widget, "changed", G_CALLBACK (ece_task_dtstart_changed_cb), task_editor);
part = e_comp_editor_property_part_status_new ();
- e_comp_editor_page_add_property_part (page, part, 2, 3, 2, 1);
+ e_comp_editor_page_add_property_part (page, part, 2, 4, 2, 1);
task_editor->priv->status = part;
edit_widget = e_comp_editor_property_part_get_edit_widget (part);
g_signal_connect (edit_widget, "changed", G_CALLBACK (ece_task_status_changed_cb), task_editor);
part = e_comp_editor_property_part_due_new (TRUE, TRUE);
- e_comp_editor_page_add_property_part (page, part, 0, 4, 2, 1);
+ e_comp_editor_page_add_property_part (page, part, 0, 5, 2, 1);
task_editor->priv->due_date = part;
edit_widget = e_comp_editor_property_part_get_edit_widget (part);
g_signal_connect (edit_widget, "changed", G_CALLBACK (ece_task_due_date_changed_cb), task_editor);
part = e_comp_editor_property_part_priority_new ();
- e_comp_editor_page_add_property_part (page, part, 2, 4, 2, 1);
+ e_comp_editor_page_add_property_part (page, part, 2, 5, 2, 1);
part = e_comp_editor_property_part_completed_new (TRUE, TRUE);
- e_comp_editor_page_add_property_part (page, part, 0, 5, 2, 1);
+ e_comp_editor_page_add_property_part (page, part, 0, 6, 2, 1);
task_editor->priv->completed_date = part;
edit_widget = e_comp_editor_property_part_get_edit_widget (part);
g_signal_connect (edit_widget, "changed", G_CALLBACK (ece_task_completed_date_changed_cb),
task_editor);
part = e_comp_editor_property_part_percentcomplete_new ();
- e_comp_editor_page_add_property_part (page, part, 2, 5, 2, 1);
+ e_comp_editor_page_add_property_part (page, part, 2, 6, 2, 1);
task_editor->priv->percentcomplete = part;
edit_widget = e_comp_editor_property_part_get_edit_widget (part);
g_signal_connect (edit_widget, "value-changed", G_CALLBACK
(ece_task_percentcomplete_value_changed_cb), task_editor);
part = e_comp_editor_property_part_url_new (focus_tracker);
- e_comp_editor_page_add_property_part (page, part, 0, 6, 2, 1);
+ e_comp_editor_page_add_property_part (page, part, 0, 7, 2, 1);
edit_widget = e_comp_editor_property_part_get_edit_widget (part);
gtk_widget_set_hexpand (edit_widget, TRUE);
part = e_comp_editor_property_part_classification_new ();
- e_comp_editor_page_add_property_part (page, part, 2, 6, 2, 1);
+ e_comp_editor_page_add_property_part (page, part, 2, 7, 2, 1);
part = e_comp_editor_property_part_timezone_new ();
- e_comp_editor_page_add_property_part (page, part, 0, 7, 4, 1);
+ e_comp_editor_page_add_property_part (page, part, 0, 8, 4, 1);
task_editor->priv->timezone = part;
part = e_comp_editor_property_part_categories_new (focus_tracker);
- e_comp_editor_page_add_property_part (page, part, 0, 8, 4, 1);
+ e_comp_editor_page_add_property_part (page, part, 0, 9, 4, 1);
task_editor->priv->categories = part;
part = e_comp_editor_property_part_description_new (focus_tracker);
- e_comp_editor_page_add_property_part (page, part, 0, 9, 4, 1);
+ e_comp_editor_page_add_property_part (page, part, 0, 10, 4, 1);
task_editor->priv->description = part;
e_comp_editor_add_page (comp_editor, C_("ECompEditorPage", "General"), page);
diff --git a/src/calendar/gui/e-task-table.c b/src/calendar/gui/e-task-table.c
index c442f95a4b..61e825739c 100644
--- a/src/calendar/gui/e-task-table.c
+++ b/src/calendar/gui/e-task-table.c
@@ -832,6 +832,21 @@ task_table_query_tooltip (GtkWidget *widget,
gtk_widget_override_color (l, GTK_STATE_FLAG_NORMAL, &norm_text);
}
+ e_cal_component_get_location (new_comp, &str);
+
+ if (str) {
+ /* Translators: It will display "Location: PlaceOfTheMeeting" */
+ tmp = g_markup_printf_escaped (_("Location: %s"), str);
+ l = gtk_label_new (NULL);
+ gtk_widget_set_halign (l, GTK_ALIGN_START);
+ gtk_misc_set_alignment ((GtkMisc *) l, 0.0, 0.0);
+ gtk_label_set_markup ((GtkLabel *) l, tmp);
+ gtk_label_set_line_wrap ((GtkLabel *) l, TRUE);
+ gtk_label_set_max_width_chars ((GtkLabel *) l, 80);
+ gtk_box_pack_start (GTK_BOX (w), l, FALSE, FALSE, 0);
+ g_free (tmp);
+ }
+
e_cal_component_get_dtstart (new_comp, &dtstart);
e_cal_component_get_due (new_comp, &dtdue);
diff --git a/src/calendar/gui/e-task-table.etspec b/src/calendar/gui/e-task-table.etspec
index 4cc31faa68..ce06a7ec17 100644
--- a/src/calendar/gui/e-task-table.etspec
+++ b/src/calendar/gui/e-task-table.etspec
@@ -9,6 +9,7 @@
<ETableColumn model_col= "20" _title="Priority" expansion="1.0" minimum_width="10" resizable="true"
cell="priority" compare="priority-compare" priority="-3"/>
<ETableColumn model_col="21" _title="Status" expansion="1.0" minimum_width="10" resizable="true"
cell="calstatus" compare="status-compare" priority="-1"/>
<ETableColumn model_col="0" _title="Categories" cell="calstring" compare="stringcase" expansion="1.0"
minimum_width="10" resizable="true" priority="-2"/>
+ <ETableColumn model_col="24" _title="Location" expansion="3.0" minimum_width="10" resizable="true"
cell="calstring" compare="collate" priority="10"/>
<ETableColumn model_col="10" _title="Created" expansion="2.0" minimum_width="10" resizable="true"
cell="dateedit" compare="date-compare" priority="-2"/>
<ETableColumn model_col="11" _title="Last modified" expansion="2.0" minimum_width="10" resizable="true"
cell="dateedit" compare="date-compare" priority="-2"/>
<ETableColumn model_col="12" _title="Source" expansion="1.0" minimum_width="10" resizable="true"
cell="string" compare="collate" priority="-2"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]