[dates] Return an error when no events were imported
- From: Ross Burton <rburton src gnome org>
- To: svn-commits-list gnome org
- Subject: [dates] Return an error when no events were imported
- Date: Tue, 14 Jul 2009 08:02:37 +0000 (UTC)
commit 8bb002b21bad86daedee5f322f9107b817b13ed0
Author: Long Bu <long bu intel com>
Date: Tue Jul 14 09:02:02 2009 +0100
Return an error when no events were imported
Signed-off-by: Ross Burton <ross linux intel com>
src/dates_callbacks.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/dates_callbacks.c b/src/dates_callbacks.c
index 6ae462b..76e2354 100644
--- a/src/dates_callbacks.c
+++ b/src/dates_callbacks.c
@@ -1762,6 +1762,7 @@ dates_import_calendar_data_from_file (ECal *cal, gchar *filename, GError **error
GIOChannel *channel = NULL;
gchar *line;
gsize length;
+ gint num_comp_imported = 0;
channel = g_io_channel_new_file (filename, "r", &tmp_error);
@@ -1813,7 +1814,9 @@ dates_import_calendar_data_from_file (ECal *cal, gchar *filename, GError **error
g_free (uid);
return FALSE;
}
-
+
+ num_comp_imported ++;
+
icalcompiter_next (&iter);
g_free (uid);
}
@@ -1837,8 +1840,17 @@ dates_import_calendar_data_from_file (ECal *cal, gchar *filename, GError **error
if (channel)
g_io_channel_unref (channel);
-
- return TRUE;
+
+ if (num_comp_imported > 0)
+ {
+ return TRUE;
+ }
+ else
+ {
+ *error = g_error_new_literal
+ (g_quark_from_string ("Dates"), 1, _("No calendar events found."));
+ return FALSE;
+ }
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]