[evolution] Bug 752665 - Be able to suppress reminders for completed tasks



commit 806931eb54ec6ab3a933f4b9f2ca85c937d984e7
Author: Milan Crha <mcrha redhat com>
Date:   Thu Aug 6 12:24:19 2015 +0200

    Bug 752665 - Be able to suppress reminders for completed tasks

 calendar/alarm-notify/alarm-queue.c              |   11 +++++++++++
 calendar/alarm-notify/config-data.c              |    8 ++++++++
 calendar/alarm-notify/config-data.h              |    2 ++
 data/org.gnome.evolution.calendar.gschema.xml.in |    5 +++++
 modules/calendar/e-calendar-preferences.c        |    6 ++++++
 modules/calendar/e-calendar-preferences.ui       |   21 ++++++++++++++++++---
 6 files changed, 50 insertions(+), 3 deletions(-)
---
diff --git a/calendar/alarm-notify/alarm-queue.c b/calendar/alarm-notify/alarm-queue.c
index 26a3421..5f5a418 100644
--- a/calendar/alarm-notify/alarm-queue.c
+++ b/calendar/alarm-notify/alarm-queue.c
@@ -482,6 +482,17 @@ alarm_trigger_cb (gpointer alarm_id,
                cqa->parent_client->cal_client, trigger);
        debug (("Setting Last notification time to %s", e_ctime (&trigger)));
 
+       if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_TODO) {
+               icalproperty_status status = ICAL_STATUS_NONE;
+
+               e_cal_component_get_status (comp, &status);
+
+               if (status == ICAL_STATUS_COMPLETED &&
+                   !config_data_get_task_reminder_for_completed ()) {
+                       return;
+               }
+       }
+
        qa = lookup_queued_alarm (cqa, alarm_id);
        if (!qa)
                return;
diff --git a/calendar/alarm-notify/config-data.c b/calendar/alarm-notify/config-data.c
index aa6d1a9..4c0fa72 100644
--- a/calendar/alarm-notify/config-data.c
+++ b/calendar/alarm-notify/config-data.c
@@ -108,6 +108,14 @@ config_data_get_notify_with_tray (void)
        return g_settings_get_boolean (calendar_settings, "notify-with-tray");
 }
 
+gboolean
+config_data_get_task_reminder_for_completed (void)
+{
+       ensure_inited ();
+
+       return g_settings_get_boolean (calendar_settings, "task-reminder-for-completed");
+}
+
 gint
 config_data_get_default_snooze_minutes (void)
 {
diff --git a/calendar/alarm-notify/config-data.h b/calendar/alarm-notify/config-data.h
index 2ea9de7..5cf21bc 100644
--- a/calendar/alarm-notify/config-data.h
+++ b/calendar/alarm-notify/config-data.h
@@ -34,6 +34,8 @@ icaltimezone *        config_data_get_timezone        (void);
 gboolean       config_data_get_24_hour_format  (void);
 gboolean       config_data_get_notify_with_tray
                                                (void);
+gboolean       config_data_get_task_reminder_for_completed
+                                               (void);
 gint           config_data_get_default_snooze_minutes
                                                (void);
 void           config_data_set_last_notification_time
diff --git a/data/org.gnome.evolution.calendar.gschema.xml.in 
b/data/org.gnome.evolution.calendar.gschema.xml.in
index 3a02454..20965b4 100644
--- a/data/org.gnome.evolution.calendar.gschema.xml.in
+++ b/data/org.gnome.evolution.calendar.gschema.xml.in
@@ -369,6 +369,11 @@
       <_summary>Task preview pane position (vertical)</_summary>
       <_description>Position of the task preview pane when oriented vertically</_description>
     </key>
+    <key name="task-reminder-for-completed" type="b">
+      <default>false</default>
+      <_summary>Show reminders for completed tasks</_summary>
+      <_description>Whether to show reminders for completed tasks. When set to false, reminders for 
completed tasks are suppressed.</_description>
+    </key>
     <key name="task-overdue-highlight" type="b">
       <default>true</default>
       <_summary>Highlight overdue tasks</_summary>
diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c
index 0d52166..888b4ba 100644
--- a/modules/calendar/e-calendar-preferences.c
+++ b/modules/calendar/e-calendar-preferences.c
@@ -1031,6 +1031,12 @@ calendar_preferences_construct (ECalendarPreferences *prefs,
                widget, "active",
                G_SETTINGS_BIND_DEFAULT);
 
+       widget = e_builder_get_widget (prefs->builder, "task_reminder_for_completed");
+       g_settings_bind (
+               settings, "task-reminder-for-completed",
+               widget, "active",
+               G_SETTINGS_BIND_DEFAULT);
+
        widget = e_builder_get_widget (prefs->builder, "default-snooze-minutes-spin");
        g_settings_bind (
                settings, "default-snooze-minutes",
diff --git a/modules/calendar/e-calendar-preferences.ui b/modules/calendar/e-calendar-preferences.ui
index 2fbd008..f03ad75 100644
--- a/modules/calendar/e-calendar-preferences.ui
+++ b/modules/calendar/e-calendar-preferences.ui
@@ -1217,6 +1217,21 @@
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkCheckButton" id="task_reminder_for_completed">
+                    <property name="label" translatable="yes">Display reminders for completed 
_tasks</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="fill">False</property>
+                    <property name="expand">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
                   <object class="GtkHBox" id="hbox6">
                     <property name="visible">True</property>
                     <property name="spacing">4</property>
@@ -1280,7 +1295,7 @@
                   <packing>
                     <property name="fill">False</property>
                     <property name="expand">False</property>
-                    <property name="position">1</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
                 <child>
@@ -1347,7 +1362,7 @@
                   <packing>
                     <property name="fill">False</property>
                     <property name="expand">False</property>
-                    <property name="position">2</property>
+                    <property name="position">4</property>
                   </packing>
                 </child>
                 <child>
@@ -1384,7 +1399,7 @@
                   <packing>
                     <property name="fill">False</property>
                     <property name="expand">False</property>
-                    <property name="position">3</property>
+                    <property name="position">5</property>
                   </packing>
                 </child>
               </object>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]