aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/gui/e-cal-model-tasks.c113
-rw-r--r--calendar/gui/e-cal-model-tasks.h10
-rw-r--r--calendar/gui/e-task-table.c33
-rw-r--r--data/org.gnome.evolution.calendar.gschema.xml.in14
-rw-r--r--modules/calendar/e-cal-config-model.c10
-rw-r--r--modules/calendar/e-cal-shell-settings.c10
-rw-r--r--modules/calendar/e-calendar-preferences.c22
-rw-r--r--modules/calendar/e-calendar-preferences.ui18
8 files changed, 215 insertions, 15 deletions
diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c
index 8602ce58cf..fdbcd379b4 100644
--- a/calendar/gui/e-cal-model-tasks.c
+++ b/calendar/gui/e-cal-model-tasks.c
@@ -38,7 +38,9 @@
#include "misc.h"
struct _ECalModelTasksPrivate {
+ gboolean highlight_due_today;
gchar *color_due_today;
+ gboolean highlight_overdue;
gchar *color_overdue;
};
@@ -61,7 +63,9 @@ G_DEFINE_TYPE (ECalModelTasks, e_cal_model_tasks, E_TYPE_CAL_MODEL)
enum {
PROP_0,
+ PROP_HIGHLIGHT_DUE_TODAY,
PROP_COLOR_DUE_TODAY,
+ PROP_HIGHLIGHT_OVERDUE,
PROP_COLOR_OVERDUE
};
@@ -72,12 +76,24 @@ cal_model_tasks_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_HIGHLIGHT_DUE_TODAY:
+ e_cal_model_tasks_set_highlight_due_today (
+ E_CAL_MODEL_TASKS (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_COLOR_DUE_TODAY:
e_cal_model_tasks_set_color_due_today (
E_CAL_MODEL_TASKS (object),
g_value_get_string (value));
return;
+ case PROP_HIGHLIGHT_OVERDUE:
+ e_cal_model_tasks_set_highlight_overdue (
+ E_CAL_MODEL_TASKS (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_COLOR_OVERDUE:
e_cal_model_tasks_set_color_overdue (
E_CAL_MODEL_TASKS (object),
@@ -95,6 +111,13 @@ cal_model_tasks_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_HIGHLIGHT_DUE_TODAY:
+ g_value_set_boolean (
+ value,
+ e_cal_model_tasks_get_highlight_due_today (
+ E_CAL_MODEL_TASKS (object)));
+ return;
+
case PROP_COLOR_DUE_TODAY:
g_value_set_string (
value,
@@ -102,6 +125,13 @@ cal_model_tasks_get_property (GObject *object,
E_CAL_MODEL_TASKS (object)));
return;
+ case PROP_HIGHLIGHT_OVERDUE:
+ g_value_set_boolean (
+ value,
+ e_cal_model_tasks_get_highlight_overdue (
+ E_CAL_MODEL_TASKS (object)));
+ return;
+
case PROP_COLOR_OVERDUE:
g_value_set_string (
value,
@@ -158,6 +188,16 @@ e_cal_model_tasks_class_init (ECalModelTasksClass *class)
g_object_class_install_property (
object_class,
+ PROP_HIGHLIGHT_DUE_TODAY,
+ g_param_spec_boolean (
+ "highlight-due-today",
+ "Highlight Due Today",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
PROP_COLOR_DUE_TODAY,
g_param_spec_string (
"color-due-today",
@@ -168,6 +208,16 @@ e_cal_model_tasks_class_init (ECalModelTasksClass *class)
g_object_class_install_property (
object_class,
+ PROP_HIGHLIGHT_OVERDUE,
+ g_param_spec_boolean (
+ "highlight-overdue",
+ "Highlight Overdue",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
PROP_COLOR_OVERDUE,
g_param_spec_string (
"color-overdue",
@@ -183,6 +233,9 @@ e_cal_model_tasks_init (ECalModelTasks *model)
model->priv = G_TYPE_INSTANCE_GET_PRIVATE (
model, E_TYPE_CAL_MODEL_TASKS, ECalModelTasksPrivate);
+ model->priv->highlight_due_today = TRUE;
+ model->priv->highlight_overdue = TRUE;
+
e_cal_model_set_component_kind (
E_CAL_MODEL (model), ICAL_VTODO_COMPONENT);
}
@@ -1104,19 +1157,25 @@ static const gchar *
ecmt_get_color_for_component (ECalModel *model,
ECalModelComponent *comp_data)
{
+ ECalModelTasks *tasks;
+
g_return_val_if_fail (E_IS_CAL_MODEL_TASKS (model), NULL);
g_return_val_if_fail (comp_data != NULL, NULL);
+ tasks = E_CAL_MODEL_TASKS (model);
+
/* XXX ECalModel's get_color_for_component() method should really
* get a GdkColor instead of a color specification string. */
- switch (get_due_status ((ECalModelTasks *) model, comp_data)) {
+ switch (get_due_status (tasks, comp_data)) {
case E_CAL_MODEL_TASKS_DUE_TODAY:
- return e_cal_model_tasks_get_color_due_today (
- E_CAL_MODEL_TASKS (model));
+ if (!e_cal_model_tasks_get_highlight_due_today (tasks))
+ break;
+ return e_cal_model_tasks_get_color_due_today (tasks);
case E_CAL_MODEL_TASKS_DUE_OVERDUE:
- return e_cal_model_tasks_get_color_overdue (
- E_CAL_MODEL_TASKS (model));
+ if (!e_cal_model_tasks_get_highlight_overdue (tasks))
+ break;
+ return e_cal_model_tasks_get_color_overdue (tasks);
case E_CAL_MODEL_TASKS_DUE_NEVER:
case E_CAL_MODEL_TASKS_DUE_FUTURE:
case E_CAL_MODEL_TASKS_DUE_COMPLETE:
@@ -1167,6 +1226,28 @@ e_cal_model_tasks_new (void)
return g_object_new (E_TYPE_CAL_MODEL_TASKS, NULL);
}
+gboolean
+e_cal_model_tasks_get_highlight_due_today (ECalModelTasks *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL_TASKS (model), FALSE);
+
+ return model->priv->highlight_due_today;
+}
+
+void
+e_cal_model_tasks_set_highlight_due_today (ECalModelTasks *model,
+ gboolean highlight)
+{
+ g_return_if_fail (E_IS_CAL_MODEL_TASKS (model));
+
+ if ((highlight ? 1 : 0) == (model->priv->highlight_due_today ? 1 : 0))
+ return;
+
+ model->priv->highlight_due_today = highlight;
+
+ g_object_notify (G_OBJECT (model), "highlight-due-today");
+}
+
const gchar *
e_cal_model_tasks_get_color_due_today (ECalModelTasks *model)
{
@@ -1188,6 +1269,28 @@ e_cal_model_tasks_set_color_due_today (ECalModelTasks *model,
g_object_notify (G_OBJECT (model), "color-due-today");
}
+gboolean
+e_cal_model_tasks_get_highlight_overdue (ECalModelTasks *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL_TASKS (model), FALSE);
+
+ return model->priv->highlight_overdue;
+}
+
+void
+e_cal_model_tasks_set_highlight_overdue (ECalModelTasks *model,
+ gboolean highlight)
+{
+ g_return_if_fail (E_IS_CAL_MODEL_TASKS (model));
+
+ if ((highlight ? 1 : 0) == (model->priv->highlight_overdue ? 1 : 0))
+ return;
+
+ model->priv->highlight_overdue = highlight;
+
+ g_object_notify (G_OBJECT (model), "highlight-overdue");
+}
+
const gchar *
e_cal_model_tasks_get_color_overdue (ECalModelTasks *model)
{
diff --git a/calendar/gui/e-cal-model-tasks.h b/calendar/gui/e-cal-model-tasks.h
index f35f8dd28c..54d31cbaaa 100644
--- a/calendar/gui/e-cal-model-tasks.h
+++ b/calendar/gui/e-cal-model-tasks.h
@@ -80,11 +80,21 @@ struct _ECalModelTasksClass {
GType e_cal_model_tasks_get_type (void);
ECalModel * e_cal_model_tasks_new (void);
+gboolean e_cal_model_tasks_get_highlight_due_today
+ (ECalModelTasks *model);
+void e_cal_model_tasks_set_highlight_due_today
+ (ECalModelTasks *model,
+ gboolean highlight);
const gchar * e_cal_model_tasks_get_color_due_today
(ECalModelTasks *model);
void e_cal_model_tasks_set_color_due_today
(ECalModelTasks *model,
const gchar *color_due_today);
+gboolean e_cal_model_tasks_get_highlight_overdue
+ (ECalModelTasks *model);
+void e_cal_model_tasks_set_highlight_overdue
+ (ECalModelTasks *model,
+ gboolean highlight);
const gchar * e_cal_model_tasks_get_color_overdue
(ECalModelTasks *model);
void e_cal_model_tasks_set_color_overdue
diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c
index e052e82357..4efe8d0669 100644
--- a/calendar/gui/e-task-table.c
+++ b/calendar/gui/e-task-table.c
@@ -288,6 +288,16 @@ delete_selected_components (ETaskTable *task_table)
}
static void
+task_table_queue_draw_cb (ECalModelTasks *tasks_model,
+ GParamSpec *param,
+ GtkWidget *task_table)
+{
+ g_return_if_fail (task_table != NULL);
+
+ gtk_widget_queue_draw (task_table);
+}
+
+static void
task_table_set_model (ETaskTable *task_table,
ECalModel *model)
{
@@ -304,6 +314,28 @@ task_table_set_model (ETaskTable *task_table,
model, "cal-view-complete",
G_CALLBACK (task_table_model_cal_view_complete_cb),
task_table);
+
+ /* redraw on drawing options change */
+ g_signal_connect (
+ model, "notify::highlight-due-today",
+ G_CALLBACK (task_table_queue_draw_cb),
+ task_table);
+
+ g_signal_connect (
+ model, "notify::color-due-today",
+ G_CALLBACK (task_table_queue_draw_cb),
+ task_table);
+
+ g_signal_connect (
+ model, "notify::highlight-overdue",
+ G_CALLBACK (task_table_queue_draw_cb),
+ task_table);
+
+ g_signal_connect (
+ model, "notify::color-overdue",
+ G_CALLBACK (task_table_queue_draw_cb),
+ task_table);
+
}
static void
@@ -397,6 +429,7 @@ task_table_dispose (GObject *object)
}
if (priv->model != NULL) {
+ g_signal_handlers_disconnect_by_func (priv->model, task_table_queue_draw_cb, object);
g_object_unref (priv->model);
priv->model = NULL;
}
diff --git a/data/org.gnome.evolution.calendar.gschema.xml.in b/data/org.gnome.evolution.calendar.gschema.xml.in
index 3fd0607a07..90d3192016 100644
--- a/data/org.gnome.evolution.calendar.gschema.xml.in
+++ b/data/org.gnome.evolution.calendar.gschema.xml.in
@@ -250,10 +250,15 @@
<_summary>Vertical position for the tag pane</_summary>
<_description>Vertical position for the tag pane</_description>
</key>
+ <key name="task-due-today-highlight" type="b">
+ <default>true</default>
+ <_summary>Highlight tasks due today</_summary>
+ <_description>Whether highlight tasks due today with a special color (task-due-today-color)</_description>
+ </key>
<key name="task-due-today-color" type="s">
<default>'#1e90ff'</default>
<_summary>Tasks due today color</_summary>
- <_description>Background color of tasks that are due today, in "#rrggbb" format</_description>
+ <_description>Background color of tasks that are due today, in "#rrggbb" format. Used together with task-due-today-highlight</_description>
</key>
<key name="task-hpane-position" type="i">
<default>200</default>
@@ -270,10 +275,15 @@
<_summary>Task preview pane position (vertical)</_summary>
<_description>Position of the task preview pane when oriented vertically</_description>
</key>
+ <key name="task-overdue-highlight" type="b">
+ <default>true</default>
+ <_summary>Highlight overdue tasks</_summary>
+ <_description>Whether highlight overdue tasks with a special color (task-overdue-color)</_description>
+ </key>
<key name="task-overdue-color" type="s">
<default>'#ff0000'</default>
<_summary>Overdue tasks color</_summary>
- <_description>Background color of tasks that are overdue, in "#rrggbb" format</_description>
+ <_description>Background color of tasks that are overdue, in "#rrggbb" format. Used together with task-overdue-highlight.</_description>
</key>
<key name="time-divisions" type="i">
<default>30</default>
diff --git a/modules/calendar/e-cal-config-model.c b/modules/calendar/e-cal-config-model.c
index 9898942bf9..f7a0e162af 100644
--- a/modules/calendar/e-cal-config-model.c
+++ b/modules/calendar/e-cal-config-model.c
@@ -111,11 +111,21 @@ cal_config_model_constructed (GObject *object)
if (E_IS_CAL_MODEL_TASKS (extensible)) {
g_object_bind_property (
+ shell_settings, "cal-tasks-highlight-due-today",
+ extensible, "highlight-due-today",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
shell_settings, "cal-tasks-color-due-today",
extensible, "color-due-today",
G_BINDING_SYNC_CREATE);
g_object_bind_property (
+ shell_settings, "cal-tasks-highlight-overdue",
+ extensible, "highlight-overdue",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
shell_settings, "cal-tasks-color-overdue",
extensible, "color-overdue",
G_BINDING_SYNC_CREATE);
diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c
index 88b961e64f..9810d816e6 100644
--- a/modules/calendar/e-cal-shell-settings.c
+++ b/modules/calendar/e-cal-shell-settings.c
@@ -633,11 +633,21 @@ e_cal_shell_backend_init_settings (EShell *shell)
"show-week-numbers");
e_shell_settings_install_property_for_key (
+ "cal-tasks-highlight-due-today",
+ CALENDAR_SCHEMA,
+ "task-due-today-highlight");
+
+ e_shell_settings_install_property_for_key (
"cal-tasks-color-due-today",
CALENDAR_SCHEMA,
"task-due-today-color");
e_shell_settings_install_property_for_key (
+ "cal-tasks-highlight-overdue",
+ CALENDAR_SCHEMA,
+ "task-overdue-highlight");
+
+ e_shell_settings_install_property_for_key (
"cal-tasks-color-overdue",
CALENDAR_SCHEMA,
"task-overdue-color");
diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c
index 5578f39a2c..55a91acd70 100644
--- a/modules/calendar/e-calendar-preferences.c
+++ b/modules/calendar/e-calendar-preferences.c
@@ -797,6 +797,13 @@ calendar_preferences_construct (ECalendarPreferences *prefs,
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
+ widget = e_builder_get_widget (prefs->builder, "tasks_due_today_highlight");
+ g_object_bind_property (
+ shell_settings, "cal-tasks-highlight-due-today",
+ widget, "active",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+
widget = e_builder_get_widget (prefs->builder, "tasks_due_today_color");
g_object_bind_property_full (
shell_settings, "cal-tasks-color-due-today",
@@ -806,6 +813,17 @@ calendar_preferences_construct (ECalendarPreferences *prefs,
e_binding_transform_string_to_color,
e_binding_transform_color_to_string,
NULL, (GDestroyNotify) NULL);
+ g_object_bind_property (
+ shell_settings, "cal-tasks-highlight-due-today",
+ widget, "sensitive",
+ G_BINDING_SYNC_CREATE);
+
+ widget = e_builder_get_widget (prefs->builder, "tasks_overdue_highlight");
+ g_object_bind_property (
+ shell_settings, "cal-tasks-highlight-overdue",
+ widget, "active",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
widget = e_builder_get_widget (prefs->builder, "tasks_overdue_color");
g_object_bind_property_full (
@@ -816,6 +834,10 @@ calendar_preferences_construct (ECalendarPreferences *prefs,
e_binding_transform_string_to_color,
e_binding_transform_color_to_string,
(GDestroyNotify) NULL, NULL);
+ g_object_bind_property (
+ shell_settings, "cal-tasks-highlight-overdue",
+ widget, "sensitive",
+ G_BINDING_SYNC_CREATE);
widget = e_builder_get_widget (prefs->builder, "tasks_hide_completed");
g_object_bind_property (
diff --git a/modules/calendar/e-calendar-preferences.ui b/modules/calendar/e-calendar-preferences.ui
index 44ffc19100..5cbc82fbf4 100644
--- a/modules/calendar/e-calendar-preferences.ui
+++ b/modules/calendar/e-calendar-preferences.ui
@@ -1032,12 +1032,13 @@
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
- <object class="GtkLabel" id="label21">
+ <object class="GtkCheckButton" id="tasks_due_today_highlight">
+ <property name="label" translatable="yes">Highlight t_asks due today</property>
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">T_asks due today:</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">tasks_due_today_color</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1071,12 +1072,13 @@
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
- <object class="GtkLabel" id="label22">
+ <object class="GtkCheckButton" id="tasks_overdue_highlight">
+ <property name="label" translatable="yes">Highlight _overdue tasks</property>
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Overdue tasks:</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">tasks_overdue_color</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>