diff options
-rw-r--r-- | plugins/mail-to-task/ChangeLog | 7 | ||||
-rw-r--r-- | plugins/mail-to-task/mail-to-task.c | 23 |
2 files changed, 28 insertions, 2 deletions
diff --git a/plugins/mail-to-task/ChangeLog b/plugins/mail-to-task/ChangeLog index 8d09d629b4..2b108b08dd 100644 --- a/plugins/mail-to-task/ChangeLog +++ b/plugins/mail-to-task/ChangeLog @@ -1,3 +1,10 @@ +2007-11-23 Milan Crha <mcrha@redhat.com> + + ** Fix for bug #353807 + + * mail-to-task.c: (do_mail_to_task): Notice user if any error occur + during opening calendar, calendar is readonly or when add fails. + 2007-11-05 Milan Crha <mcrha@redhat.com> ** Fix for bug #334675 diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c index 2d1968073d..73ddc3d815 100644 --- a/plugins/mail-to-task/mail-to-task.c +++ b/plugins/mail-to-task/mail-to-task.c @@ -30,6 +30,7 @@ #include "mail/em-utils.h" #include "mail/em-folder-view.h" #include "mail/em-format-html.h" +#include "e-util/e-dialog-utils.h" #include <gtkhtml/gtkhtml.h> #include <calendar/common/authentication.h> @@ -261,9 +262,18 @@ do_mail_to_task (AsyncData *data) ECal *client = data->client; struct _CamelFolder *folder = data->folder; GPtrArray *uids = data->uids; + GError *err = NULL; + gboolean readonly = FALSE; /* open the task client */ - if (e_cal_open (client, FALSE, NULL)) { + if (!e_cal_open (client, FALSE, &err)) { + e_notice (NULL, GTK_MESSAGE_ERROR, _("Cannot open calendar. %s"), err ? err->message : ""); + } else if (!e_cal_is_read_only (client, &readonly, &err) || readonly) { + if (err) + e_notice (NULL, GTK_MESSAGE_ERROR, err->message); + else + e_notice (NULL, GTK_MESSAGE_ERROR, _("Selected source is read only, thus cannot create task there. Select other source, please.")); + } else { int i; for (i = 0; i < (uids ? uids->len : 0); i++) { @@ -313,7 +323,13 @@ do_mail_to_task (AsyncData *data) icalcomponent_add_property (icalcomp, icalprop); /* save the task to the selected source */ - e_cal_create_object (client, icalcomp, NULL, NULL); + if (!e_cal_create_object (client, icalcomp, NULL, &err)) { + g_warning ("Could not create object: %s", err ? err->message : "Unknown error"); + + if (err) + g_error_free (err); + err = NULL; + } g_object_unref (comp); } @@ -326,6 +342,9 @@ do_mail_to_task (AsyncData *data) g_free (data); data = NULL; + if (err) + g_error_free (err); + return TRUE; } |