summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNiels De Graef <nielsdegraef@gmail.com>2022-10-23 16:38:00 +0200
committerNiels De Graef <nielsdegraef@gmail.com>2022-10-23 16:39:47 +0200
commit5c011486d6beac60981dafe5741f8acae197ce5d (patch)
tree1eb475600ccec9ec6275ddddd2bfcd78a6edaebf /src
parent9a6fe8a72fc6e60da8ab96209cb9700b1fd2f8af (diff)
downloadgnome-contacts-5c011486d6beac60981dafe5741f8acae197ce5d.tar.gz
Make goa an optional dependency
GNOME Online Accounts has some pretty big changes on its roadmap and doesn't make any promises on API stability. The only use of the API at this point is to fetch the icon for a GOA-backed address book, so it isn't really problematic if users disable support for it
Diffstat (limited to 'src')
-rw-r--r--src/contacts-accounts-list.vala5
-rw-r--r--src/contacts-esd-setup.vala4
-rw-r--r--src/meson.build5
3 files changed, 11 insertions, 3 deletions
diff --git a/src/contacts-accounts-list.vala b/src/contacts-accounts-list.vala
index 0990f30..b7de4f7 100644
--- a/src/contacts-accounts-list.vala
+++ b/src/contacts-accounts-list.vala
@@ -107,10 +107,11 @@ public class Contacts.AccountsList : Adw.PreferencesGroup {
var goa_source_ext = parent_source.get_extension (E.SOURCE_EXTENSION_GOA) as E.SourceGoa;
source_account_id = goa_source_ext.account_id;
}
- Gtk.Image provider_image;
+
+ Gtk.Image? provider_image = null;
if (this.persona_store.id != "system-address-book" && source_account_id != "")
provider_image = Contacts.get_icon_for_goa_account (source_account_id);
- else
+ if (provider_image == null)
provider_image = new Gtk.Image.from_icon_name (Config.APP_ID);
provider_image.icon_size = Gtk.IconSize.LARGE;
add_prefix (provider_image);
diff --git a/src/contacts-esd-setup.vala b/src/contacts-esd-setup.vala
index 29a4530..f1a1a90 100644
--- a/src/contacts-esd-setup.vala
+++ b/src/contacts-esd-setup.vala
@@ -173,6 +173,7 @@ public unowned string? lookup_esource_name_by_uid_for_contact (string uid) {
}
public Gtk.Image? get_icon_for_goa_account (string goa_id) {
+#if HAVE_GOA
Goa.Client client;
try {
client = new Goa.Client.sync (null);
@@ -192,5 +193,8 @@ public Gtk.Image? get_icon_for_goa_account (string goa_id) {
}
return new Gtk.Image.from_gicon (provider_icon);
+#else
+ return null;
+#endif
}
}
diff --git a/src/meson.build b/src/meson.build
index e17fe6c..87a9fd0 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -52,7 +52,6 @@ contacts_deps = [
gee,
gio_unix,
glib,
- goa,
gtk4_dep,
libadwaita_dep,
libebook,
@@ -62,6 +61,10 @@ contacts_deps = [
math,
]
+if get_option('goa')
+ contacts_deps += [ goa_dep ]
+endif
+
libcontacts = static_library('contacts',
libcontacts_sources,
include_directories: config_h_dir,