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
1=== added file 'debian/patches/0001-Removed-WORKAROUND-used-by-old-EDS-API.patch'
2--- debian/patches/0001-Removed-WORKAROUND-used-by-old-EDS-API.patch 1970-01-01 00:00:00 +0000
3+++ debian/patches/0001-Removed-WORKAROUND-used-by-old-EDS-API.patch 2014-04-15 17:00:47 +0000
4@@ -0,0 +1,59 @@
5+From b252db30416e15949aa4736c30991bf69d060506 Mon Sep 17 00:00:00 2001
6+From: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
7+Date: Tue, 15 Apr 2014 13:51:32 -0300
8+Subject: [PATCH 1/3] Removed WORKAROUND used by old EDS API.
9+
10+Does not remove children events before add the main event when using E_CLIENT API.
11+---
12+ src/backends/evolution/EvolutionCalendarSource.cpp | 17 ++++++-----------
13+ 1 file changed, 6 insertions(+), 11 deletions(-)
14+
15+diff --git a/src/backends/evolution/EvolutionCalendarSource.cpp b/src/backends/evolution/EvolutionCalendarSource.cpp
16+index 7cddbca..cac00c3 100644
17+--- a/src/backends/evolution/EvolutionCalendarSource.cpp
18++++ b/src/backends/evolution/EvolutionCalendarSource.cpp
19+@@ -619,11 +619,12 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
20+ // adding the parent, then updating it with the
21+ // saved children.
22+ //
23+- // TODO: still necessary with e_cal_client API?
24++#ifndef USE_EDS_CLIENT
25+ ICalComps_t children;
26+ if (id.m_rid.empty()) {
27+ children = removeEvents(id.m_uid, true);
28+ }
29++#endif
30+
31+ // creating new objects works for normal events and detached occurrences alike
32+ if (
33+@@ -648,23 +649,17 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
34+ throwError("storing new item", gerror);
35+ }
36+
37++#ifndef USE_EDS_CLIENT
38+ // Recreate any children removed earlier: when we get here,
39+ // the parent exists and we must update it.
40+ BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
41+- if (
42+-#ifdef USE_EDS_CLIENT
43+- !e_cal_client_modify_object_sync(m_calendar, *icalcomp,
44+- CALOBJ_MOD_THIS, NULL,
45+- gerror)
46+-#else
47+- !e_cal_modify_object(m_calendar, *icalcomp,
48++ if (!e_cal_modify_object(m_calendar, *icalcomp,
49+ CALOBJ_MOD_THIS,
50+- gerror)
51+-#endif
52+- ) {
53++ gerror)) {
54+ throwError(string("recreating item ") + newluid, gerror);
55+ }
56+ }
57++#endif
58+ }
59+ }
60+ }
61+--
62+1.9.1
63+
64
65=== added file 'debian/patches/0002-Avoid-register-unecessary-timezones.patch'
66--- debian/patches/0002-Avoid-register-unecessary-timezones.patch 1970-01-01 00:00:00 +0000
67+++ debian/patches/0002-Avoid-register-unecessary-timezones.patch 2014-04-15 17:00:47 +0000
68@@ -0,0 +1,66 @@
69+From c7d7466d44de7129fb5c1c67d4ec9274ae11fb1f Mon Sep 17 00:00:00 2001
70+From: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
71+Date: Tue, 15 Apr 2014 13:53:58 -0300
72+Subject: [PATCH 2/3] Avoid register unecessary timezones.
73+
74+---
75+ src/backends/evolution/EvolutionCalendarSource.cpp | 13 ++++++++++++-
76+ src/backends/evolution/EvolutionCalendarSource.h | 1 +
77+ 2 files changed, 13 insertions(+), 1 deletion(-)
78+
79+diff --git a/src/backends/evolution/EvolutionCalendarSource.cpp b/src/backends/evolution/EvolutionCalendarSource.cpp
80+index cac00c3..b7200e1 100644
81+--- a/src/backends/evolution/EvolutionCalendarSource.cpp
82++++ b/src/backends/evolution/EvolutionCalendarSource.cpp
83+@@ -430,6 +430,7 @@ void EvolutionCalendarSource::listAllItems(RevisionMap_t &revisions)
84+
85+ void EvolutionCalendarSource::close()
86+ {
87++ m_knownTimezones.clear();
88+ m_calendar.reset();
89+ }
90+
91+@@ -543,10 +544,18 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
92+
93+ GErrorCXX gerror;
94+ const char *tzid = icaltimezone_get_tzid(zone);
95++
96++ //we are receiving two similar timezones names we will remove the prefix to make easy to compare
97++ string timeZoneName(tzid);
98++ std::size_t found = timeZoneName.find("/freeassociation.sourceforge.net/Tzfile/");
99++ if (found != std::string::npos) {
100++ timeZoneName.replace(timeZoneName.begin(), timeZoneName.begin() + 40, ""); // 40 == strlen("/freeassociation.sourceforge.net/Tzfile/")
101++ }
102++
103+ if (!tzid || !tzid[0]) {
104+ // cannot add a VTIMEZONE without TZID
105+ SE_LOG_DEBUG(getDisplayName(), "skipping VTIMEZONE without TZID");
106+- } else {
107++ } else if (find(m_knownTimezones.begin(), m_knownTimezones.end(), timeZoneName) == m_knownTimezones.end()) {
108+ gboolean success =
109+ #ifdef USE_EDS_CLIENT
110+ e_cal_client_add_timezone_sync(m_calendar, zone, NULL, gerror)
111+@@ -557,6 +566,8 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
112+ if (!success) {
113+ throwError(string("error adding VTIMEZONE ") + tzid,
114+ gerror);
115++ } else {
116++ m_knownTimezones.push_back(timeZoneName);
117+ }
118+ }
119+ }
120+diff --git a/src/backends/evolution/EvolutionCalendarSource.h b/src/backends/evolution/EvolutionCalendarSource.h
121+index 6fcfdf5..e197eb9 100644
122+--- a/src/backends/evolution/EvolutionCalendarSource.h
123++++ b/src/backends/evolution/EvolutionCalendarSource.h
124+@@ -164,6 +164,7 @@ class EvolutionCalendarSource : public EvolutionSyncSource,
125+ #endif
126+ string m_typeName; /**< "calendar", "task list", "memo list" */
127+ EvolutionCalendarSourceType m_type; /**< use events, tasks or memos? */
128++ list<string> m_knownTimezones; /** list with all timezones already registered on EDS */
129+
130+ // Convenience function for source type casting
131+ #ifdef USE_EDS_CLIENT
132+--
133+1.9.1
134+
135
136=== added file 'debian/patches/0003-Modify-all-children-using-the-same-function-call.patch'
137--- debian/patches/0003-Modify-all-children-using-the-same-function-call.patch 1970-01-01 00:00:00 +0000
138+++ debian/patches/0003-Modify-all-children-using-the-same-function-call.patch 2014-04-15 17:00:47 +0000
139@@ -0,0 +1,53 @@
140+From 5dda5ff313150d15edd900094624f504d70baef8 Mon Sep 17 00:00:00 2001
141+From: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
142+Date: Tue, 15 Apr 2014 13:56:08 -0300
143+Subject: [PATCH 3/3] Modify all children using the same function call.
144+
145+Avoid call individual functions for each child event.
146+---
147+ src/backends/evolution/EvolutionCalendarSource.cpp | 23 +++++++++++++---------
148+ 1 file changed, 14 insertions(+), 9 deletions(-)
149+
150+diff --git a/src/backends/evolution/EvolutionCalendarSource.cpp b/src/backends/evolution/EvolutionCalendarSource.cpp
151+index b7200e1..1e909e1 100644
152+--- a/src/backends/evolution/EvolutionCalendarSource.cpp
153++++ b/src/backends/evolution/EvolutionCalendarSource.cpp
154+@@ -748,21 +748,26 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
155+
156+ // Recreate any children removed earlier: when we get here,
157+ // the parent exists and we must update it.
158+- BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
159+- if (
160+ #ifdef USE_EDS_CLIENT
161+- !e_cal_client_modify_object_sync(m_calendar, *icalcomp,
162+- CALOBJ_MOD_THIS, NULL,
163+- gerror)
164++ GSList *objs = 0;
165++ BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
166++ objs = g_slist_append(objs, *icalcomp);
167++ }
168++ if (!e_cal_client_modify_objects_sync(m_calendar, objs,
169++ CALOBJ_MOD_THIS, NULL,
170++ gerror)) {
171++ throwError(string("recreating item ") + luid, gerror);
172++ }
173++ g_slist_free(objs);
174+ #else
175+- !e_cal_modify_object(m_calendar, *icalcomp,
176++ BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
177++ if (!e_cal_modify_object(m_calendar, *icalcomp,
178+ CALOBJ_MOD_THIS,
179+- gerror)
180+-#endif
181+- ) {
182++ gerror)) {
183+ throwError(string("recreating item ") + luid, gerror);
184+ }
185+ }
186++#endif
187+ } else {
188+ // no children, updating is simple
189+ if (
190+--
191+1.9.1
192+
193
194=== modified file 'debian/patches/series'
195--- debian/patches/series 2014-04-04 18:24:20 +0000
196+++ debian/patches/series 2014-04-15 17:00:47 +0000
197@@ -2,3 +2,6 @@
198 0001-Include-missing-stdint.h.patch
199 0001-autotools-Add-QtCore-include-path-to-KDEPIM_CFLAGS.patch
200 fix-photo-merging.patch
201+0001-Removed-WORKAROUND-used-by-old-EDS-API.patch
202+0002-Avoid-register-unecessary-timezones.patch
203+0003-Modify-all-children-using-the-same-function-call.patch

Subscribers

People subscribed via source and target branches