From 2403bbcdd196745314786af3b6318de56ef3948e Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 24 Apr 2009 19:40:31 +0200 Subject: Use new ESourceList API (simplifies code) ** Part of fix for bug #569652 --- plugins/caldav/ChangeLog | 7 +++++++ plugins/caldav/caldav-source.c | 32 +------------------------------- 2 files changed, 8 insertions(+), 31 deletions(-) (limited to 'plugins/caldav') diff --git a/plugins/caldav/ChangeLog b/plugins/caldav/ChangeLog index 2fe681cb55..5f28deb6b3 100644 --- a/plugins/caldav/ChangeLog +++ b/plugins/caldav/ChangeLog @@ -1,3 +1,10 @@ +2009-04-24 Milan Crha + + ** Part of fix for bug #569652 + + * caldav-source.c: (ensure_caldav_source_group): + Use new ESourceList API (simplifies code). + 2009-04-24 Milan Crha ** Fix for bug #572348 diff --git a/plugins/caldav/caldav-source.c b/plugins/caldav/caldav-source.c index 00ca5acac5..46e510367f 100644 --- a/plugins/caldav/caldav-source.c +++ b/plugins/caldav/caldav-source.c @@ -55,43 +55,13 @@ static void ensure_caldav_source_group (ECalSourceType source_type) { ESourceList *slist; - GSList *groups, *g; - ESourceGroup *group = NULL; if (!e_cal_get_sources (&slist, source_type, NULL)) { g_warning ("Could not get calendar source list from GConf!"); return; } - groups = e_source_list_peek_groups (slist); - for (g = groups; g; g = g->next) { - group = E_SOURCE_GROUP (g->data); - - if (group && e_source_group_peek_base_uri (group) && strncmp ("caldav://", e_source_group_peek_base_uri (group), 9) == 0) - break; - - group = NULL; - } - - if (group == NULL) { - /* no such group has been found, create it */ - gboolean res; - - group = e_source_group_new (_("CalDAV"), "caldav://"); - res = e_source_list_add_group (slist, group, -1); - - if (res == FALSE) { - g_warning ("Could not add CalDAV source group!"); - } else { - e_source_list_sync (slist, NULL); - } - - g_object_unref (group); - } else { - /* we found the group, change the name based on the actual language */ - e_source_group_set_name (group, _("CalDAV")); - } - + e_source_list_ensure_group (slist, _("CalDAV"), "caldav://", FALSE); g_object_unref (slist); } -- cgit v1.2.3