Merge lp:~elementary-pantheon/maya/fix-1270091 into lp:~elementary-apps/maya/trunk

Proposed by Corentin Noël
Status: Merged
Merged at revision: 523
Proposed branch: lp:~elementary-pantheon/maya/fix-1270091
Merge into: lp:~elementary-apps/maya/trunk
Diff against target: 305 lines (+62/-37)
8 files modified
CMakeLists.txt (+2/-2)
src/Model/CalendarModel.vala (+13/-13)
src/Utils.vala (+35/-8)
src/View/Grid/EventButton/EventButton.vala (+2/-2)
src/View/Grid/Grid.vala (+5/-5)
src/View/Sidebar/AgendaView.vala (+2/-3)
src/View/Sidebar/SourceWidget.vala (+2/-2)
src/maya-calendar.pc.cmake (+1/-2)
To merge this branch: bzr merge lp:~elementary-pantheon/maya/fix-1270091
Reviewer Review Type Date Requested Status
David Gomes (community) Needs Fixing
Review via email: mp+203146@code.launchpad.net
To post a comment you must log in.
Revision history for this message
David Gomes (davidgomes) wrote :

Might as well get rid of `using Gee` no in the files where you moved to discriminating the Gee namespace, right? Not really sure though, just an idea.

review: Needs Fixing
508. By David Gomes

Code style fixes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-12-23 18:19:22 +0000
3+++ CMakeLists.txt 2014-02-06 23:18:58 +0000
4@@ -77,7 +77,7 @@
5
6 set (DEPS_PACKAGES
7 gconf-2.0
8- gee-1.0
9+ gee-0.8
10 gio-2.0
11 granite
12 gtk+-3.0
13@@ -93,7 +93,7 @@
14 gthread-2.0
15 glib-2.0
16 gio-2.0
17- gee-1.0
18+ gee-0.8
19 gtk+-3.0>=3.10
20 granite
21 libecal-1.2>=3.8.0
22
23=== modified file 'src/Model/CalendarModel.vala'
24--- src/Model/CalendarModel.vala 2013-12-17 22:19:40 +0000
25+++ src/Model/CalendarModel.vala 2014-02-06 23:18:58 +0000
26@@ -60,18 +60,18 @@
27 compute_ranges ();
28
29 source_client = new Gee.HashMap<E.Source, E.CalClient> (
30- (HashFunc) Util.source_hash_func,
31- (EqualFunc) Util.source_equal_func,
32+ (Gee.HashDataFunc<E.Source>?) Util.source_hash_func,
33+ (Gee.EqualDataFunc<E.CalComponent>?) Util.source_equal_func,
34 null);
35
36 source_events = new Gee.HashMap<E.Source, Gee.Map<string, E.CalComponent>> (
37- (HashFunc) Util.source_hash_func,
38- (EqualFunc) Util.source_equal_func,
39+ (Gee.HashDataFunc<E.Source>?) Util.source_hash_func,
40+ (Gee.EqualDataFunc<E.CalComponent>?) Util.source_equal_func,
41 null);
42
43 source_view = new Gee.HashMap<E.Source, E.CalClientView> (
44- (HashFunc) Util.source_hash_func,
45- (EqualFunc) Util.source_equal_func,
46+ (Gee.HashDataFunc<E.Source>?) Util.source_hash_func,
47+ (Gee.EqualDataFunc<E.CalComponent>?) Util.source_equal_func,
48 null);
49
50 calendar_trash = new Gee.LinkedList<E.Source> ();
51@@ -275,9 +275,9 @@
52 // create empty source-event map
53
54 Gee.Map<string, E.CalComponent> events = new Gee.HashMap<string, E.CalComponent> (
55- (HashFunc) Util.string_hash_func,
56- (EqualFunc) Util.string_equal_func,
57- (EqualFunc) Util.calcomponent_equal_func);
58+ (Gee.HashDataFunc<string>?) Util.string_hash_func,
59+ (Gee.EqualDataFunc<E.CalComponent>?) Util.string_equal_func,
60+ (Gee.EqualDataFunc<E.CalComponent>?) Util.calcomponent_equal_func);
61
62 source_events.set (source, events);
63
64@@ -459,7 +459,7 @@
65 Gee.Map<string, E.CalComponent> events = source_events.get (source);
66
67 Gee.ArrayList<E.CalComponent> added_events = new Gee.ArrayList<E.CalComponent> (
68- (EqualFunc) Util.calcomponent_equal_func);
69+ (Gee.EqualDataFunc<E.CalComponent>?) Util.calcomponent_equal_func);
70
71 foreach (var comp in objects) {
72
73@@ -483,7 +483,7 @@
74 debug (@"Received $(objects.length()) modified event(s) for source '%s'", source.dup_display_name ());
75
76 Gee.Collection<E.CalComponent> updated_events = new Gee.ArrayList<E.CalComponent> (
77- (EqualFunc) Util.calcomponent_equal_func);
78+ (Gee.EqualDataFunc<E.CalComponent>?) Util.calcomponent_equal_func);
79
80 foreach (var comp in objects) {
81
82@@ -504,7 +504,7 @@
83
84 var events = source_events.get (source);
85 Gee.Collection<E.CalComponent> removed_events = new Gee.ArrayList<E.CalComponent> (
86- (EqualFunc) Util.calcomponent_equal_func);
87+ (Gee.EqualDataFunc<E.CalComponent>?) Util.calcomponent_equal_func);
88
89 foreach (unowned E.CalComponentId? cid in cids) {
90
91@@ -537,4 +537,4 @@
92 }
93 }
94
95-}
96+}
97\ No newline at end of file
98
99=== modified file 'src/Utils.vala'
100--- src/Utils.vala 2014-02-06 01:15:30 +0000
101+++ src/Utils.vala 2014-02-06 23:18:58 +0000
102@@ -132,8 +132,8 @@
103 requires (dr1.days == dr2.days) {
104
105 var map = new Gee.TreeMap<DateTime, DateTime>(
106- (CompareFunc) DateTime.compare,
107- (EqualFunc) datetime_equal_func);
108+ (GLib.CompareDataFunc<E.CalComponent>?) DateTime.compare,
109+ (Gee.EqualDataFunc<GLib.DateTime>?) datetime_equal_func);
110
111 var i1 = dr1.iterator();
112 var i2 = dr2.iterator();
113@@ -146,16 +146,33 @@
114 }
115
116 /* Iterator of DateRange objects */
117- public class DateIterator : Object, Gee.Iterator<DateTime> {
118+ public class DateIterator : Object, Gee.Traversable<DateTime>, Gee.Iterator<DateTime> {
119
120 DateTime current;
121 DateRange range;
122
123+ public bool valid { get {return true;} }
124+ public bool read_only { get {return false;} }
125+
126 public DateIterator (DateRange range) {
127 this.range = range;
128 this.current = range.first.add_days (-1);
129 }
130
131+ public bool @foreach (Gee.ForallFunc<DateTime> f) {
132+ var element = range.first;
133+
134+ while (element.compare (range.last) < 0) {
135+ if (f (element) == false) {
136+ return false;
137+ }
138+
139+ element = element.add_days (1);
140+ }
141+
142+ return true;
143+ }
144+
145 public bool next () {
146 if (! has_next ())
147 return false;
148@@ -182,11 +199,21 @@
149 }
150
151 /* Represents date range from 'first' to 'last' inclusive */
152- public class DateRange : Object, Gee.Iterable<DateTime> {
153+ public class DateRange : Object, Gee.Traversable<DateTime>, Gee.Iterable<DateTime> {
154
155 public DateTime first { get; private set; }
156 public DateTime last { get; private set; }
157
158+ public bool @foreach (Gee.ForallFunc<DateTime> f) {
159+ foreach (var date in this) {
160+ if (f (date) == false) {
161+ return false;
162+ }
163+ }
164+
165+ return true;
166+ }
167+
168 public int64 days {
169 get { return last.difference (first) / GLib.TimeSpan.DAY; }
170 }
171@@ -219,7 +246,7 @@
172
173 public Gee.SortedSet<DateTime> to_set() {
174
175- var @set = new Gee.TreeSet<DateTime> ((CompareFunc) DateTime.compare);
176+ var @set = new Gee.TreeSet<DateTime> ((GLib.CompareDataFunc<GLib.DateTime>?) DateTime.compare);
177
178 foreach (var date in this)
179 set.add (date);
180@@ -229,7 +256,7 @@
181
182 public Gee.List<DateTime> to_list() {
183
184- var list = new Gee.ArrayList<DateTime> ((EqualFunc) datetime_equal_func);
185+ var list = new Gee.ArrayList<DateTime> ((Gee.EqualDataFunc<GLib.DateTime>?) datetime_equal_func);
186
187 foreach (var date in this)
188 list.add (date);
189@@ -388,9 +415,9 @@
190 public void save_temp_selected_calendars (){
191 var calmodel = new Model.CalendarModel(Maya.Settings.Weekday.MONDAY);
192 }
193-
194+
195 public string get_hexa_color (Gdk.RGBA color) {
196 return "#%02X%02X%02X".printf ((uint)(color.red*255), (uint)(color.green*255), (uint)(color.blue*255));
197 }
198
199-}
200+}
201\ No newline at end of file
202
203=== modified file 'src/View/Grid/EventButton/EventButton.vala'
204--- src/View/Grid/EventButton/EventButton.vala 2013-08-31 15:14:02 +0000
205+++ src/View/Grid/EventButton/EventButton.vala 2014-02-06 23:18:58 +0000
206@@ -54,7 +54,7 @@
207 /**
208 * Compares the given buttons according to date.
209 */
210- public static CompareFunc<EventButton> compare_buttons = (button1, button2) => {
211+ public static GLib.CompareDataFunc<Maya.View.EventButton>? compare_buttons = (button1, button2) => {
212 var comp1 = button1.comp;
213 var comp2 = button2.comp;
214
215@@ -63,4 +63,4 @@
216
217 }
218
219-}
220+}
221\ No newline at end of file
222
223=== modified file 'src/View/Grid/Grid.vala'
224--- src/View/Grid/Grid.vala 2013-08-29 17:04:35 +0000
225+++ src/View/Grid/Grid.vala 2014-02-06 23:18:58 +0000
226@@ -46,8 +46,8 @@
227 row_spacing = 0;
228
229 data = new Gee.HashMap<DateTime, GridDay> (
230- (HashFunc) DateTime.hash,
231- (EqualFunc) Util.datetime_equal_func,
232+ (Gee.HashDataFunc<GLib.DateTime>?) DateTime.hash,
233+ (Gee.EqualDataFunc<GLib.DateTime>?) Util.datetime_equal_func,
234 null);
235 }
236
237@@ -82,8 +82,8 @@
238 var new_dates = new_range.to_list();
239
240 var data_new = new Gee.HashMap<DateTime, GridDay> (
241- (HashFunc) DateTime.hash,
242- (EqualFunc) Util.datetime_equal_func,
243+ (Gee.HashDataFunc<GLib.DateTime>?) DateTime.hash,
244+ (Gee.EqualDataFunc<GLib.DateTime>?) Util.datetime_equal_func,
245 null);
246
247 // Assert that a valid number of weeks should be displayed
248@@ -228,4 +228,4 @@
249 }
250 }
251
252-}
253+}
254\ No newline at end of file
255
256=== modified file 'src/View/Sidebar/AgendaView.vala'
257--- src/View/Sidebar/AgendaView.vala 2013-08-31 15:14:02 +0000
258+++ src/View/Sidebar/AgendaView.vala 2014-02-06 23:18:58 +0000
259@@ -53,8 +53,8 @@
260 row_spacing = 0;
261
262 source_widgets = new Gee.HashMap<E.Source, SourceWidget> (
263- (HashFunc) Util.source_hash_func,
264- (EqualFunc) Util.source_equal_func,
265+ (Gee.HashDataFunc<E.Source>?) Util.source_hash_func,
266+ (Gee.EqualDataFunc<E.Source>?) Util.source_equal_func,
267 null);
268
269 try {
270@@ -246,4 +246,3 @@
271 }
272
273 }
274-
275
276=== modified file 'src/View/Sidebar/SourceWidget.vala'
277--- src/View/Sidebar/SourceWidget.vala 2013-08-26 22:10:40 +0000
278+++ src/View/Sidebar/SourceWidget.vala 2014-02-06 23:18:58 +0000
279@@ -176,7 +176,7 @@
280 /**
281 * Compares the given buttons according to date.
282 */
283- static CompareFunc<E.CalComponent> compare_comps = (comp1, comp2) => {
284+ static GLib.CompareDataFunc<E.CalComponent>? compare_comps = (comp1, comp2) => {
285 return Util.compare_events (comp1, comp2);
286 };
287
288@@ -320,4 +320,4 @@
289
290 }
291
292-}
293+}
294\ No newline at end of file
295
296=== modified file 'src/maya-calendar.pc.cmake'
297--- src/maya-calendar.pc.cmake 2013-08-30 00:14:47 +0000
298+++ src/maya-calendar.pc.cmake 2014-02-06 23:18:58 +0000
299@@ -8,5 +8,4 @@
300 Version: 0.2
301 Libs: -lmaya-calendar
302 Cflags: -I@DOLLAR@{includedir}/maya-calendar
303-Requires: glib-2.0 gio-2.0 gee-1.0 libpeas-1.0 gtk+-3.0 granite libecalendar-1.2 libedataserver-1.2 libical
304-
305+Requires: glib-2.0 gio-2.0 gee-0.8 libpeas-1.0 gtk+-3.0 granite libecalendar-1.2 libedataserver-1.2 libical

Subscribers

People subscribed via source and target branches