Merge lp:~renatofilho/ubuntu/trusty/syncevolution/fix-1306112 into lp:ubuntu/trusty/syncevolution

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Merge reported by: Martin Pitt
Merged at revision: not available
Proposed branch: lp:~renatofilho/ubuntu/trusty/syncevolution/fix-1306112
Merge into: lp:ubuntu/trusty/syncevolution
Diff against target: 203 lines (+181/-0)
4 files modified
debian/patches/0001-Removed-WORKAROUND-used-by-old-EDS-API.patch (+59/-0)
debian/patches/0002-Avoid-register-unecessary-timezones.patch (+66/-0)
debian/patches/0003-Modify-all-children-using-the-same-function-call.patch (+53/-0)
debian/patches/series (+3/-0)
To merge this branch: bzr merge lp:~renatofilho/ubuntu/trusty/syncevolution/fix-1306112
Reviewer Review Type Date Requested Status
Martin Pitt Approve
Review via email: mp+215881@code.launchpad.net

Commit message

Added patch to optimize EDS calendar sync.

To post a comment you must log in.
24. By Renato Araujo Oliveira Filho

Added patches to optimized calendar sync.

Revision history for this message
Martin Pitt (pitti) wrote :

syncevolution was already uploaded: https://launchpad.net/ubuntu/+source/syncevolution/1.4-1ubuntu4 Closing MP.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'debian/patches/0001-Removed-WORKAROUND-used-by-old-EDS-API.patch'
--- debian/patches/0001-Removed-WORKAROUND-used-by-old-EDS-API.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/0001-Removed-WORKAROUND-used-by-old-EDS-API.patch 2014-04-15 17:00:47 +0000
@@ -0,0 +1,59 @@
1From b252db30416e15949aa4736c30991bf69d060506 Mon Sep 17 00:00:00 2001
2From: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
3Date: Tue, 15 Apr 2014 13:51:32 -0300
4Subject: [PATCH 1/3] Removed WORKAROUND used by old EDS API.
5
6Does not remove children events before add the main event when using E_CLIENT API.
7---
8 src/backends/evolution/EvolutionCalendarSource.cpp | 17 ++++++-----------
9 1 file changed, 6 insertions(+), 11 deletions(-)
10
11diff --git a/src/backends/evolution/EvolutionCalendarSource.cpp b/src/backends/evolution/EvolutionCalendarSource.cpp
12index 7cddbca..cac00c3 100644
13--- a/src/backends/evolution/EvolutionCalendarSource.cpp
14+++ b/src/backends/evolution/EvolutionCalendarSource.cpp
15@@ -619,11 +619,12 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
16 // adding the parent, then updating it with the
17 // saved children.
18 //
19- // TODO: still necessary with e_cal_client API?
20+#ifndef USE_EDS_CLIENT
21 ICalComps_t children;
22 if (id.m_rid.empty()) {
23 children = removeEvents(id.m_uid, true);
24 }
25+#endif
26
27 // creating new objects works for normal events and detached occurrences alike
28 if (
29@@ -648,23 +649,17 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
30 throwError("storing new item", gerror);
31 }
32
33+#ifndef USE_EDS_CLIENT
34 // Recreate any children removed earlier: when we get here,
35 // the parent exists and we must update it.
36 BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
37- if (
38-#ifdef USE_EDS_CLIENT
39- !e_cal_client_modify_object_sync(m_calendar, *icalcomp,
40- CALOBJ_MOD_THIS, NULL,
41- gerror)
42-#else
43- !e_cal_modify_object(m_calendar, *icalcomp,
44+ if (!e_cal_modify_object(m_calendar, *icalcomp,
45 CALOBJ_MOD_THIS,
46- gerror)
47-#endif
48- ) {
49+ gerror)) {
50 throwError(string("recreating item ") + newluid, gerror);
51 }
52 }
53+#endif
54 }
55 }
56 }
57--
581.9.1
59
060
=== added file 'debian/patches/0002-Avoid-register-unecessary-timezones.patch'
--- debian/patches/0002-Avoid-register-unecessary-timezones.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/0002-Avoid-register-unecessary-timezones.patch 2014-04-15 17:00:47 +0000
@@ -0,0 +1,66 @@
1From c7d7466d44de7129fb5c1c67d4ec9274ae11fb1f Mon Sep 17 00:00:00 2001
2From: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
3Date: Tue, 15 Apr 2014 13:53:58 -0300
4Subject: [PATCH 2/3] Avoid register unecessary timezones.
5
6---
7 src/backends/evolution/EvolutionCalendarSource.cpp | 13 ++++++++++++-
8 src/backends/evolution/EvolutionCalendarSource.h | 1 +
9 2 files changed, 13 insertions(+), 1 deletion(-)
10
11diff --git a/src/backends/evolution/EvolutionCalendarSource.cpp b/src/backends/evolution/EvolutionCalendarSource.cpp
12index cac00c3..b7200e1 100644
13--- a/src/backends/evolution/EvolutionCalendarSource.cpp
14+++ b/src/backends/evolution/EvolutionCalendarSource.cpp
15@@ -430,6 +430,7 @@ void EvolutionCalendarSource::listAllItems(RevisionMap_t &revisions)
16
17 void EvolutionCalendarSource::close()
18 {
19+ m_knownTimezones.clear();
20 m_calendar.reset();
21 }
22
23@@ -543,10 +544,18 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
24
25 GErrorCXX gerror;
26 const char *tzid = icaltimezone_get_tzid(zone);
27+
28+ //we are receiving two similar timezones names we will remove the prefix to make easy to compare
29+ string timeZoneName(tzid);
30+ std::size_t found = timeZoneName.find("/freeassociation.sourceforge.net/Tzfile/");
31+ if (found != std::string::npos) {
32+ timeZoneName.replace(timeZoneName.begin(), timeZoneName.begin() + 40, ""); // 40 == strlen("/freeassociation.sourceforge.net/Tzfile/")
33+ }
34+
35 if (!tzid || !tzid[0]) {
36 // cannot add a VTIMEZONE without TZID
37 SE_LOG_DEBUG(getDisplayName(), "skipping VTIMEZONE without TZID");
38- } else {
39+ } else if (find(m_knownTimezones.begin(), m_knownTimezones.end(), timeZoneName) == m_knownTimezones.end()) {
40 gboolean success =
41 #ifdef USE_EDS_CLIENT
42 e_cal_client_add_timezone_sync(m_calendar, zone, NULL, gerror)
43@@ -557,6 +566,8 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
44 if (!success) {
45 throwError(string("error adding VTIMEZONE ") + tzid,
46 gerror);
47+ } else {
48+ m_knownTimezones.push_back(timeZoneName);
49 }
50 }
51 }
52diff --git a/src/backends/evolution/EvolutionCalendarSource.h b/src/backends/evolution/EvolutionCalendarSource.h
53index 6fcfdf5..e197eb9 100644
54--- a/src/backends/evolution/EvolutionCalendarSource.h
55+++ b/src/backends/evolution/EvolutionCalendarSource.h
56@@ -164,6 +164,7 @@ class EvolutionCalendarSource : public EvolutionSyncSource,
57 #endif
58 string m_typeName; /**< "calendar", "task list", "memo list" */
59 EvolutionCalendarSourceType m_type; /**< use events, tasks or memos? */
60+ list<string> m_knownTimezones; /** list with all timezones already registered on EDS */
61
62 // Convenience function for source type casting
63 #ifdef USE_EDS_CLIENT
64--
651.9.1
66
067
=== added file 'debian/patches/0003-Modify-all-children-using-the-same-function-call.patch'
--- debian/patches/0003-Modify-all-children-using-the-same-function-call.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/0003-Modify-all-children-using-the-same-function-call.patch 2014-04-15 17:00:47 +0000
@@ -0,0 +1,53 @@
1From 5dda5ff313150d15edd900094624f504d70baef8 Mon Sep 17 00:00:00 2001
2From: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
3Date: Tue, 15 Apr 2014 13:56:08 -0300
4Subject: [PATCH 3/3] Modify all children using the same function call.
5
6Avoid call individual functions for each child event.
7---
8 src/backends/evolution/EvolutionCalendarSource.cpp | 23 +++++++++++++---------
9 1 file changed, 14 insertions(+), 9 deletions(-)
10
11diff --git a/src/backends/evolution/EvolutionCalendarSource.cpp b/src/backends/evolution/EvolutionCalendarSource.cpp
12index b7200e1..1e909e1 100644
13--- a/src/backends/evolution/EvolutionCalendarSource.cpp
14+++ b/src/backends/evolution/EvolutionCalendarSource.cpp
15@@ -748,21 +748,26 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
16
17 // Recreate any children removed earlier: when we get here,
18 // the parent exists and we must update it.
19- BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
20- if (
21 #ifdef USE_EDS_CLIENT
22- !e_cal_client_modify_object_sync(m_calendar, *icalcomp,
23- CALOBJ_MOD_THIS, NULL,
24- gerror)
25+ GSList *objs = 0;
26+ BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
27+ objs = g_slist_append(objs, *icalcomp);
28+ }
29+ if (!e_cal_client_modify_objects_sync(m_calendar, objs,
30+ CALOBJ_MOD_THIS, NULL,
31+ gerror)) {
32+ throwError(string("recreating item ") + luid, gerror);
33+ }
34+ g_slist_free(objs);
35 #else
36- !e_cal_modify_object(m_calendar, *icalcomp,
37+ BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
38+ if (!e_cal_modify_object(m_calendar, *icalcomp,
39 CALOBJ_MOD_THIS,
40- gerror)
41-#endif
42- ) {
43+ gerror)) {
44 throwError(string("recreating item ") + luid, gerror);
45 }
46 }
47+#endif
48 } else {
49 // no children, updating is simple
50 if (
51--
521.9.1
53
054
=== modified file 'debian/patches/series'
--- debian/patches/series 2014-04-04 18:24:20 +0000
+++ debian/patches/series 2014-04-15 17:00:47 +0000
@@ -2,3 +2,6 @@
20001-Include-missing-stdint.h.patch20001-Include-missing-stdint.h.patch
30001-autotools-Add-QtCore-include-path-to-KDEPIM_CFLAGS.patch30001-autotools-Add-QtCore-include-path-to-KDEPIM_CFLAGS.patch
4fix-photo-merging.patch4fix-photo-merging.patch
50001-Removed-WORKAROUND-used-by-old-EDS-API.patch
60002-Avoid-register-unecessary-timezones.patch
70003-Modify-all-children-using-the-same-function-call.patch

Subscribers

People subscribed via source and target branches