summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNiels De Graef <nielsdegraef@gmail.com>2022-09-07 09:02:10 +0200
committerNiels De Graef <nielsdegraef@gmail.com>2022-09-08 07:16:50 +0200
commit3ae5790f0d884220e236725607a1f28f118e3ac7 (patch)
tree59c535d7c0fd7b1d0ff059aa1a1fc649703f80fb /src
parent245d8a48c51b640b292719e600610b54272cad41 (diff)
downloadgnome-contacts-3ae5790f0d884220e236725607a1f28f118e3ac7.tar.gz
contact: Don't use Gtk.INVALID_LIST_POSITION
Try to avoid using GTK in the core logic. Since we know it's not really realistic we'll get an overflow for the properties on a specific contact, we can just solve this case by using a signed integer and returning -1.
Diffstat (limited to 'src')
-rw-r--r--src/core/contacts-contact.vala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/contacts-contact.vala b/src/core/contacts-contact.vala
index 071f6f4..866ec18 100644
--- a/src/core/contacts-contact.vala
+++ b/src/core/contacts-contact.vala
@@ -109,18 +109,18 @@ public class Contacts.Contact : GLib.Object, GLib.ListModel {
public unowned Chunk? create_chunk (string property_name, Persona? persona) {
var pos = create_chunk_internal (property_name, persona);
- if (pos == Gtk.INVALID_LIST_POSITION)
+ if (pos == -1)
return null;
items_changed (pos, 0, 1);
return this.chunks[pos];
}
// Helper to create a chunk and return its position, without items_changed()
- private uint create_chunk_internal (string property_name, Persona? persona) {
+ private int create_chunk_internal (string property_name, Persona? persona) {
var chunk_gtype = chunk_gtype_for_property (property_name);
if (chunk_gtype == GLib.Type.NONE) {
debug ("unsupported property '%s', ignoring", property_name);
- return Gtk.INVALID_LIST_POSITION;
+ return -1;
}
var chunk = (Chunk) Object.new (chunk_gtype,