[seahorse/feature/seahorse-pgp-key-api: 7/8] util: Remove own implementation of ListStore.find()
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse/feature/seahorse-pgp-key-api: 7/8] util: Remove own implementation of ListStore.find()
- Date: Sun, 15 Aug 2021 12:13:31 +0000 (UTC)
commit 787e757d5e1eadf63a6b5fc00739ac6c4d6a61b9
Author: Niels De Graef <nielsdegraef gmail com>
Date: Sun Aug 15 14:07:56 2021 +0200
util: Remove own implementation of ListStore.find()
We recently bumped our GLib version to a high enough number that we can
just use the API instead of implementing it ourself.
common/util.vala | 21 ---------------------
ssh/source.vala | 4 ++--
2 files changed, 2 insertions(+), 23 deletions(-)
---
diff --git a/common/util.vala b/common/util.vala
index 44f29bba..533d3ffe 100644
--- a/common/util.vala
+++ b/common/util.vala
@@ -54,25 +54,4 @@ namespace Seahorse.Util {
var created_date = new DateTime.from_unix_utc((int64) time);
return created_date.format("%x");
}
-
- // TODO: one we rely on GLib >= 2.54, we can use g_list_store_find
- public bool list_store_find(GLib.ListStore store, GLib.Object item, out uint position) {
- return list_store_find_with_equal_func (store, item, GLib.direct_equal, out position);
- }
-
- // TODO: one we rely on GLib >= 2.54, we can use g_list_store_find_with_equal_func
- public bool list_store_find_with_equal_func(GLib.ListStore store,
- GLib.Object item,
- GLib.EqualFunc func,
- out uint position) {
- for (uint i = 0; i < store.get_n_items(); i++) {
- if (func(store.get_item(i), item)) {
- if (&position != null)
- position = i;
- return true;
- }
- }
-
- return false;
- }
}
diff --git a/ssh/source.vala b/ssh/source.vala
index 41092534..bf366419 100644
--- a/ssh/source.vala
+++ b/ssh/source.vala
@@ -185,12 +185,12 @@ public class Seahorse.Ssh.Source : GLib.Object, Gcr.Collection, Seahorse.Place {
}
public bool contains(GLib.Object object) {
- return Util.list_store_find(this.keys, object, null);
+ return this.keys.find(object, null);
}
public void remove_object(GLib.Object object) {
uint pos;
- if (Util.list_store_find(this.keys, object, out pos)) {
+ if (this.keys.find(object, out pos)) {
this.keys.remove(pos);
removed(object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]