[california/wip/732671-double: 7/10] Unwind most of prior commit
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [california/wip/732671-double: 7/10] Unwind most of prior commit
- Date: Wed, 10 Sep 2014 21:49:03 +0000 (UTC)
commit 223a4e06d3716aad8c8ee2b95671792b7401346e
Author: Jim Nelson <jim yorba org>
Date: Wed Sep 10 12:59:06 2014 -0700
Unwind most of prior commit
src/collection/collection.vala | 14 --------------
src/view/common/common-events-cell.vala | 9 ++++-----
2 files changed, 4 insertions(+), 19 deletions(-)
---
diff --git a/src/collection/collection.vala b/src/collection/collection.vala
index 9090ff2..f352f6b 100644
--- a/src/collection/collection.vala
+++ b/src/collection/collection.vala
@@ -48,19 +48,5 @@ public inline int size(Gee.Collection? c) {
return !is_empty(c) ? c.size : 0;
}
-public int remove_matching<G>(Gee.Iterable<G> iterable, Gee.Predicate<G> pred) {
- int count = 0;
-
- Gee.Iterator<G> iter = iterable.iterator();
- while (iter.next()) {
- if (pred(iter.get())) {
- iter.remove();
- count++;
- }
- }
-
- return count;
-}
-
}
diff --git a/src/view/common/common-events-cell.vala b/src/view/common/common-events-cell.vala
index 92cab64..8f57872 100644
--- a/src/view/common/common-events-cell.vala
+++ b/src/view/common/common-events-cell.vala
@@ -241,10 +241,9 @@ internal abstract class EventsCell : Gtk.EventBox, InstanceContainer {
}
private bool internal_remove_event(Component.Event event) {
- int count = Collection.remove_matching<Component.Event>(sorted_events, (item) => item == event);
- if (count != 1) {
- debug("Unable to remove event %Xh from cell for %s: not present in sorted_events (%d removed)",
- (uint) event, date.to_string(), count);
+ if (!sorted_events.remove(event)) {
+ debug("Unable to remove event %Xh from cell for %s: not present in sorted_events",
+ (uint) event, date.to_string());
return false;
}
@@ -398,7 +397,7 @@ internal abstract class EventsCell : Gtk.EventBox, InstanceContainer {
date.to_string());
remove_event(event);
- } else if (Collection.remove_matching<Component.Event>(sorted_events, (item) => item == event) > 0) {
+ } else if (sorted_events.remove(event)) {
debug("Re-sorting event %Xh in cell for %s: date/time changed", (uint) event,
date.to_string());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]