diff options
author | Niels De Graef <nielsdegraef@gmail.com> | 2022-09-07 11:22:44 +0200 |
---|---|---|
committer | Niels De Graef <nielsdegraef@gmail.com> | 2022-09-08 07:16:50 +0200 |
commit | f44c598969203edca388516a5cb4a3c096dcb958 (patch) | |
tree | 793607c68f4a5cc0c8d62bbe231e56abe989b76a /src | |
parent | 71eb9d032e7d1d55d62b6836b22368e3d99dbe03 (diff) | |
download | gnome-contacts-f44c598969203edca388516a5cb4a3c096dcb958.tar.gz |
Create a "core" static library
The mainly useful thing about this is that we now have a way of testing
our core logic which got added as we created the `Contacts.Chunk`
concept.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/contacts-bin-chunk.vala | 2 | ||||
-rw-r--r-- | src/core/contacts-type-set.vala | 5 | ||||
-rw-r--r-- | src/core/meson.build | 52 | ||||
-rw-r--r-- | src/meson.build | 22 |
4 files changed, 58 insertions, 23 deletions
diff --git a/src/core/contacts-bin-chunk.vala b/src/core/contacts-bin-chunk.vala index 24b2f04..3ce05e5 100644 --- a/src/core/contacts-bin-chunk.vala +++ b/src/core/contacts-bin-chunk.vala @@ -204,7 +204,7 @@ public abstract class Contacts.BinChunkChild : GLib.Object { */ public bool has_pref_marker () { var evolution_pref = this.parameters["x-evolution-ui-slot"]; - if (evolution_pref != null && Utils.get_first (evolution_pref) == "1") + if (evolution_pref != null && ("1" in evolution_pref)) return true; foreach (var param in this.parameters["type"]) { diff --git a/src/core/contacts-type-set.vala b/src/core/contacts-type-set.vala index 94877db..2b6d01c 100644 --- a/src/core/contacts-type-set.vala +++ b/src/core/contacts-type-set.vala @@ -135,8 +135,9 @@ public class Contacts.TypeSet : Object, GLib.ListModel { */ public TypeDescriptor lookup_by_parameters (Gee.MultiMap<string, string> parameters, out uint position = null) { - if (parameters.contains (TypeDescriptor.X_GOOGLE_LABEL)) { - var label = Utils.get_first<string> (parameters[TypeDescriptor.X_GOOGLE_LABEL]); + var google_label = parameters[TypeDescriptor.X_GOOGLE_LABEL]; + if (!google_label.is_empty) { + var label = google_label.to_array ()[0]; var descriptor = lookup_by_custom_label (label, out position); // Still didn't find it => create it if (descriptor == null) diff --git a/src/core/meson.build b/src/core/meson.build new file mode 100644 index 0000000..f3af30b --- /dev/null +++ b/src/core/meson.build @@ -0,0 +1,52 @@ +# Core library +libcontactscore_sources = files( + 'contacts-addresses-chunk.vala', + 'contacts-alias-chunk.vala', + 'contacts-avatar-chunk.vala', + 'contacts-bin-chunk.vala', + 'contacts-birthday-chunk.vala', + 'contacts-chunk.vala', + 'contacts-contact.vala', + 'contacts-email-addresses-chunk.vala', + 'contacts-full-name-chunk.vala', + 'contacts-im-addresses-chunk.vala', + 'contacts-nickname-chunk.vala', + 'contacts-notes-chunk.vala', + 'contacts-phones-chunk.vala', + 'contacts-roles-chunk.vala', + 'contacts-structured-name-chunk.vala', + 'contacts-type-descriptor.vala', + 'contacts-type-set.vala', + 'contacts-urls-chunk.vala', + 'contacts-vcard-type-mapping.vala', +) + +libcontactscore_vala_args = [ + '--target-glib=@0@'.format(min_glib_version), + '--pkg', 'config', +] + +libcontactscore_c_args = [ + '-include', 'config.h', +] + +libcontactscore_deps = [ + folks, + folks_eds, + gee, + glib, +] + +libcontactscore = static_library('contactscore', + libcontactscore_sources, + include_directories: config_h_dir, + vala_args: libcontactscore_vala_args, + c_args: libcontactscore_c_args, + dependencies: libcontactscore_deps, +) + +libcontactscore_dep = declare_dependency( + link_with: libcontactscore, + include_directories: include_directories('.'), + dependencies: libcontactscore_deps, +) diff --git a/src/meson.build b/src/meson.build index 346aae7..e17fe6c 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,3 +1,4 @@ +subdir('core') subdir('io') # GSettings @@ -8,26 +9,6 @@ install_data('org.gnome.Contacts.gschema.xml', # Common library libcontacts_sources = files( - 'core/contacts-addresses-chunk.vala', - 'core/contacts-alias-chunk.vala', - 'core/contacts-avatar-chunk.vala', - 'core/contacts-bin-chunk.vala', - 'core/contacts-birthday-chunk.vala', - 'core/contacts-chunk.vala', - 'core/contacts-contact.vala', - 'core/contacts-email-addresses-chunk.vala', - 'core/contacts-full-name-chunk.vala', - 'core/contacts-im-addresses-chunk.vala', - 'core/contacts-nickname-chunk.vala', - 'core/contacts-notes-chunk.vala', - 'core/contacts-phones-chunk.vala', - 'core/contacts-roles-chunk.vala', - 'core/contacts-structured-name-chunk.vala', - 'core/contacts-type-descriptor.vala', - 'core/contacts-type-set.vala', - 'core/contacts-urls-chunk.vala', - 'core/contacts-vcard-type-mapping.vala', - 'contacts-chunk-filter.vala', 'contacts-chunk-empty-filter.vala', 'contacts-chunk-property-filter.vala', @@ -65,6 +46,7 @@ contacts_c_args = [ ] contacts_deps = [ + libcontactscore_dep, folks, folks_eds, gee, |