[folks] Make Folks.PersonaStore.detail_key() static.
- From: Travis Reitter <treitter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Make Folks.PersonaStore.detail_key() static.
- Date: Sat, 2 Apr 2011 20:49:47 +0000 (UTC)
commit 5dd9f0cca03880739e9a3b37fe816070c0b5e5cf
Author: Travis Reitter <travis reitter collabora co uk>
Date: Sat Apr 2 12:51:27 2011 -0700
Make Folks.PersonaStore.detail_key() static.
backends/key-file/kf-persona-store.vala | 4 +-
backends/tracker/lib/trf-persona-store.vala | 35 +++++++++++++++----------
folks/persona-store.vala | 4 +-
tests/tracker/add-persona.vala | 37 ++++++++++++++++-----------
tests/tracker/remove-persona.vala | 5 ++-
5 files changed, 50 insertions(+), 35 deletions(-)
---
diff --git a/backends/key-file/kf-persona-store.vala b/backends/key-file/kf-persona-store.vala
index 94c3769..d4c69dc 100644
--- a/backends/key-file/kf-persona-store.vala
+++ b/backends/key-file/kf-persona-store.vala
@@ -296,8 +296,8 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
public override async Folks.Persona? add_persona_from_details (
HashTable<string, Value?> details) throws Folks.PersonaStoreError
{
- unowned Value val =
- details.lookup (this.detail_key (PersonaDetail.IM_ADDRESSES));
+ unowned Value val = details.lookup (Folks.PersonaStore.detail_key (
+ PersonaDetail.IM_ADDRESSES));
unowned HashTable<string, LinkedHashSet<string>> im_addresses =
(HashTable<string, LinkedHashSet<string>>) val.get_boxed ();
diff --git a/backends/tracker/lib/trf-persona-store.vala b/backends/tracker/lib/trf-persona-store.vala
index 930954c..874030b 100644
--- a/backends/tracker/lib/trf-persona-store.vala
+++ b/backends/tracker/lib/trf-persona-store.vala
@@ -393,19 +393,21 @@ public class Trf.PersonaStore : Folks.PersonaStore
foreach (var k in details.get_keys ())
{
Value? v = details.lookup (k);
- if (k == this.detail_key (PersonaDetail.ALIAS))
+ if (k == Folks.PersonaStore.detail_key (PersonaDetail.ALIAS))
{
builder.subject ("_:p");
builder.predicate (Trf.OntologyDefs.NCO_NICKNAME);
builder.object_string (v.get_string ());
}
- else if (k == this.detail_key (PersonaDetail.FULL_NAME))
+ else if (k == Folks.PersonaStore.detail_key (
+ PersonaDetail.FULL_NAME))
{
builder.subject ("_:p");
builder.predicate (Trf.OntologyDefs.NCO_FULLNAME);
builder.object_string (v.get_string ());
}
- else if (k == this.detail_key (PersonaDetail.STRUCTURED_NAME))
+ else if (k == Folks.PersonaStore.detail_key (
+ PersonaDetail.STRUCTURED_NAME))
{
StructuredName sname = (StructuredName) v.get_object ();
builder.subject ("_:p");
@@ -420,7 +422,8 @@ public class Trf.PersonaStore : Folks.PersonaStore
builder.predicate (Trf.OntologyDefs.NCO_PREFIX);
builder.object_string (sname.prefixes);
}
- else if (k == this.detail_key (PersonaDetail.FAVOURITE))
+ else if (k == Folks.PersonaStore.detail_key (
+ PersonaDetail.FAVOURITE))
{
if (v.get_boolean ())
{
@@ -429,7 +432,7 @@ public class Trf.PersonaStore : Folks.PersonaStore
builder.object (Trf.OntologyDefs.NAO_FAVORITE);
}
}
- else if (k == this.detail_key (PersonaDetail.AVATAR))
+ else if (k == Folks.PersonaStore.detail_key (PersonaDetail.AVATAR))
{
var avatar = (File) v.get_object ();
builder.subject ("_:photo");
@@ -441,7 +444,7 @@ public class Trf.PersonaStore : Folks.PersonaStore
builder.predicate (Trf.OntologyDefs.NCO_PHOTO);
builder.object ("_:photo");
}
- else if (k == this.detail_key (PersonaDetail.BIRTHDAY))
+ else if (k == Folks.PersonaStore.detail_key (PersonaDetail.BIRTHDAY))
{
var birthday = (DateTime) v.get_boxed ();
builder.subject ("_:p");
@@ -450,7 +453,7 @@ public class Trf.PersonaStore : Folks.PersonaStore
birthday.to_timeval (out tv);
builder.object_string (tv.to_iso8601 ());
}
- else if (k == this.detail_key (PersonaDetail.GENDER))
+ else if (k == Folks.PersonaStore.detail_key (PersonaDetail.GENDER))
{
var gender = (Gender) v.get_enum ();
if (gender != Gender.UNSPECIFIED)
@@ -463,7 +466,8 @@ public class Trf.PersonaStore : Folks.PersonaStore
builder.object (Trf.OntologyDefs.NCO_FEMALE);
}
}
- else if (k == this.detail_key (PersonaDetail.EMAIL_ADDRESSES))
+ else if (k == Folks.PersonaStore.detail_key (
+ PersonaDetail.EMAIL_ADDRESSES))
{
unowned GLib.List<FieldDetails> email_addresses =
(GLib.List<FieldDetails>) v.get_pointer ();
@@ -491,7 +495,8 @@ public class Trf.PersonaStore : Folks.PersonaStore
email_cnt++;
}
}
- else if (k == this.detail_key (PersonaDetail.IM_ADDRESSES))
+ else if (k == Folks.PersonaStore.detail_key (
+ PersonaDetail.IM_ADDRESSES))
{
var im_addresses =
(HashTable<string, LinkedHashSet<string>>) v.get_boxed ();
@@ -528,7 +533,7 @@ public class Trf.PersonaStore : Folks.PersonaStore
}
}
}
- else if (k == this.detail_key (PersonaDetail.NOTES))
+ else if (k == Folks.PersonaStore.detail_key (PersonaDetail.NOTES))
{
var notes = (Gee.HashSet<Note>) v.get_object ();
foreach (var n in notes)
@@ -538,7 +543,8 @@ public class Trf.PersonaStore : Folks.PersonaStore
builder.object_string (n.content);
}
}
- else if (k == this.detail_key (PersonaDetail.PHONE_NUMBERS))
+ else if (k == Folks.PersonaStore.detail_key (
+ PersonaDetail.PHONE_NUMBERS))
{
unowned GLib.List<FieldDetails> phone_numbers =
(GLib.List<FieldDetails>) v.get_pointer ();
@@ -567,7 +573,7 @@ public class Trf.PersonaStore : Folks.PersonaStore
phone_cnt++;
}
}
- else if (k == this.detail_key (PersonaDetail.ROLES))
+ else if (k == Folks.PersonaStore.detail_key (PersonaDetail.ROLES))
{
var roles = (Gee.HashSet<Role>) v.get_object ();
@@ -591,7 +597,8 @@ public class Trf.PersonaStore : Folks.PersonaStore
roles_cnt++;
}
}
- else if (k == this.detail_key (PersonaDetail.POSTAL_ADDRESSES))
+ else if (k == Folks.PersonaStore.detail_key (
+ PersonaDetail.POSTAL_ADDRESSES))
{
unowned GLib.List<PostalAddress> postal_addresses =
(GLib.List<PostalAddress>) v.get_pointer ();
@@ -632,7 +639,7 @@ public class Trf.PersonaStore : Folks.PersonaStore
postal_cnt++;
}
}
- else if (k == this.detail_key (PersonaDetail.URLS))
+ else if (k == Folks.PersonaStore.detail_key (PersonaDetail.URLS))
{
unowned GLib.List<FieldDetails> urls =
(GLib.List<FieldDetails>) v.get_pointer ();
diff --git a/folks/persona-store.vala b/folks/persona-store.vala
index fe16279..38e68f9 100644
--- a/folks/persona-store.vala
+++ b/folks/persona-store.vala
@@ -173,9 +173,9 @@ public abstract class Folks.PersonaStore : Object
*
* @since UNRELEASED
*/
- public unowned string detail_key (Folks.PersonaDetail detail)
+ public static unowned string detail_key (Folks.PersonaDetail detail)
{
- return this._PERSONA_DETAIL[detail];
+ return PersonaStore._PERSONA_DETAIL[detail];
}
/**
diff --git a/tests/tracker/add-persona.vala b/tests/tracker/add-persona.vala
index 1606f37..f0145d1 100644
--- a/tests/tracker/add-persona.vala
+++ b/tests/tracker/add-persona.vala
@@ -180,29 +180,31 @@ public class AddPersonaTests : Folks.TestCase
Value? v1 = Value (typeof (string));
v1.set_string (this._persona_fullname);
- details.insert (this._pstore.detail_key (PersonaDetail.FULL_NAME),
- (owned)v1);
+ details.insert (Folks.PersonaStore.detail_key (PersonaDetail.FULL_NAME),
+ (owned) v1);
Value? v2 = Value (typeof (string));
v2.set_string (this._persona_alias);
- details.insert (this._pstore.detail_key (PersonaDetail.ALIAS), (owned)v2);
+ details.insert (Folks.PersonaStore.detail_key (PersonaDetail.ALIAS),
+ (owned) v2);
Value? v3 = Value (typeof (bool));
v3.set_boolean (true);
- details.insert (this._pstore.detail_key (PersonaDetail.FAVOURITE),
+ details.insert (Folks.PersonaStore.detail_key (PersonaDetail.FAVOURITE),
(owned) v3);
Value? v4 = Value (typeof (StructuredName));
StructuredName sname = new StructuredName (this._family_name,
this._given_name, null, null, null);
v4.set_object (sname);
- details.insert (this._pstore.detail_key (PersonaDetail.STRUCTURED_NAME),
+ details.insert (
+ Folks.PersonaStore.detail_key (PersonaDetail.STRUCTURED_NAME),
(owned) v4);
Value? v5 = Value (typeof (File));
File avatar = File.new_for_uri (this._file_uri);
v5.set_object (avatar);
- details.insert (this._pstore.detail_key (PersonaDetail.AVATAR),
+ details.insert (Folks.PersonaStore.detail_key (PersonaDetail.AVATAR),
(owned) v5);
Value? v6 = Value (typeof (DateTime));
@@ -210,12 +212,12 @@ public class AddPersonaTests : Folks.TestCase
t.from_iso8601 (this._birthday);
DateTime dobj = new DateTime.from_timeval_utc (t);
v6.set_boxed (dobj);
- details.insert (this._pstore.detail_key (PersonaDetail.BIRTHDAY),
+ details.insert (Folks.PersonaStore.detail_key (PersonaDetail.BIRTHDAY),
(owned) v6);
Value? v7 = Value (typeof (Folks.Gender));
v7.set_enum (Folks.Gender.MALE);
- details.insert (this._pstore.detail_key (PersonaDetail.GENDER),
+ details.insert (Folks.PersonaStore.detail_key (PersonaDetail.GENDER),
(owned) v7);
Value? v8 = Value (typeof (GLib.List<FieldDetails>));
@@ -226,7 +228,8 @@ public class AddPersonaTests : Folks.TestCase
var email_2 = new FieldDetails (this._email_2);
emails.prepend ((owned) email_2);
v8.set_pointer (emails);
- details.insert (this._pstore.detail_key (PersonaDetail.EMAIL_ADDRESSES),
+ details.insert (
+ Folks.PersonaStore.detail_key (PersonaDetail.EMAIL_ADDRESSES),
(owned) v8);
Value? v9 = Value (typeof (HashTable<string, LinkedHashSet<string>>));
@@ -239,14 +242,15 @@ public class AddPersonaTests : Folks.TestCase
proto2.add (this._im_addr_2);
im_addrs.insert ("yahoo", proto2);
v9.set_boxed (im_addrs);
- details.insert (this._pstore.detail_key (PersonaDetail.IM_ADDRESSES), v9);
+ details.insert (
+ Folks.PersonaStore.detail_key (PersonaDetail.IM_ADDRESSES), v9);
Value? v10 = Value (typeof (Gee.HashSet<Note>));
Gee.HashSet<Note> notes = new Gee.HashSet<Note> ();
Note n1 = new Note (this._note_1);
notes.add (n1);
v10.set_object (notes);
- details.insert (this._pstore.detail_key (PersonaDetail.NOTES),
+ details.insert (Folks.PersonaStore.detail_key (PersonaDetail.NOTES),
(owned) v10);
Value? v11 = Value (typeof (GLib.List<FieldDetails>));
@@ -257,7 +261,8 @@ public class AddPersonaTests : Folks.TestCase
var phone_2 = new FieldDetails (this._phone_2);
phones.prepend ((owned) phone_2);
v11.set_pointer (phones);
- details.insert (this._pstore.detail_key (PersonaDetail.PHONE_NUMBERS),
+ details.insert (
+ Folks.PersonaStore.detail_key (PersonaDetail.PHONE_NUMBERS),
(owned) v11);
Value? v12 = Value (typeof (Gee.HashSet<Role>));
@@ -265,7 +270,7 @@ public class AddPersonaTests : Folks.TestCase
Role r1 = new Role (this._title_1, this._organisation_1);
roles.add (r1);
v12.set_object (roles);
- details.insert (this._pstore.detail_key (PersonaDetail.ROLES),
+ details.insert (Folks.PersonaStore.detail_key (PersonaDetail.ROLES),
(owned) v12);
Value? v13 = Value (typeof (GLib.List<PostalAddress>));
@@ -278,7 +283,8 @@ public class AddPersonaTests : Folks.TestCase
this._postal_code, this._country, null, types, null);
postal_addresses.prepend ((owned) postal_a);
v13.set_pointer (postal_addresses);
- details.insert (this._pstore.detail_key (PersonaDetail.POSTAL_ADDRESSES),
+ details.insert (
+ Folks.PersonaStore.detail_key (PersonaDetail.POSTAL_ADDRESSES),
(owned) v13);
Value? v14 = Value (typeof (GLib.List<FieldDetails>));
@@ -289,7 +295,8 @@ public class AddPersonaTests : Folks.TestCase
var url_2 = new FieldDetails (this._url_2);
urls.prepend ((owned) url_2);
v14.set_pointer (urls);
- details.insert (this._pstore.detail_key (PersonaDetail.URLS), (owned)v14);
+ details.insert (Folks.PersonaStore.detail_key (PersonaDetail.URLS),
+ (owned) v14);
try
{
diff --git a/tests/tracker/remove-persona.vala b/tests/tracker/remove-persona.vala
index e83d0fd..0c8f612 100644
--- a/tests/tracker/remove-persona.vala
+++ b/tests/tracker/remove-persona.vala
@@ -128,7 +128,7 @@ public class RemovePersonaTests : Folks.TestCase
(str_hash, str_equal);
Value? v1 = Value (typeof (string));
v1.set_string (this._persona_fullname);
- details.insert (this._pstore.detail_key (PersonaDetail.FULL_NAME),
+ details.insert (Folks.PersonaStore.detail_key (PersonaDetail.FULL_NAME),
(owned) v1);
Value? v2 = Value (typeof (GLib.List<FieldDetails>));
@@ -139,7 +139,8 @@ public class RemovePersonaTests : Folks.TestCase
var email_2 = new FieldDetails ("test-2 example org");
emails.prepend ((owned) email_2);
v2.set_pointer (emails);
- details.insert (this._pstore.detail_key (PersonaDetail.EMAIL_ADDRESSES),
+ details.insert (
+ Folks.PersonaStore.detail_key (PersonaDetail.EMAIL_ADDRESSES),
(owned) v2);
try
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]