[evolution/evolution-3-12] [Alarm Notify] Avoid UI freeze on an alarm dismiss
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/evolution-3-12] [Alarm Notify] Avoid UI freeze on an alarm dismiss
- Date: Fri, 10 Oct 2014 13:25:46 +0000 (UTC)
commit 84aa8f1b0e5abeb27111508e716d3a96bbde7a4a
Author: Milan Crha <mcrha redhat com>
Date: Fri Oct 10 15:20:21 2014 +0200
[Alarm Notify] Avoid UI freeze on an alarm dismiss
There was called a synchronous version of the ECalClient function
in the main thread, which caused the UI freeze when the backend
(or calendar factory) had been busy with something. This was fine
some time ago, when this function was invoked in a dedicated thread,
but that's not a case for some time. Using async version of the function
avoids the UI freeze.
calendar/alarm-notify/alarm-queue.c | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/calendar/alarm-notify/alarm-queue.c b/calendar/alarm-notify/alarm-queue.c
index 4b51f9e..f52a9ef 100644
--- a/calendar/alarm-notify/alarm-queue.c
+++ b/calendar/alarm-notify/alarm-queue.c
@@ -332,6 +332,24 @@ lookup_queued_alarm (CompQueuedAlarms *cqa,
return NULL;
}
+static void
+alarm_queue_discard_alarm_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ ECalClient *client = E_CAL_CLIENT (source);
+ GError *error = NULL;
+
+ g_return_if_fail (client != NULL);
+
+ if (!e_cal_client_discard_alarm_finish (client, result, &error))
+ g_warning ("Failed to discard alarm at '%s': %s",
+ e_source_get_display_name (e_client_get_source (E_CLIENT (client))),
+ error ? error->message : "Unknown error");
+
+ g_clear_error (&error);
+}
+
/* Removes an alarm from the list of alarms of a component. If the alarm was
* the last one listed for the component, it removes the component itself.
*/
@@ -364,9 +382,10 @@ remove_queued_alarm (CompQueuedAlarms *cqa,
id = e_cal_component_get_id (cqa->alarms->comp);
if (id) {
cqa->expecting_update = TRUE;
- e_cal_client_discard_alarm_sync (
+ e_cal_client_discard_alarm (
cqa->parent_client->cal_client, id->uid,
- id->rid, qa->instance->auid, NULL, &error);
+ id->rid, qa->instance->auid, NULL,
+ alarm_queue_discard_alarm_cb, NULL);
cqa->expecting_update = FALSE;
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_NOT_SUPPORTED)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]