summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure2
-rw-r--r--meson.build8
-rw-r--r--meson_options.txt1
-rw-r--r--src/contacts-contact-list.vala2
-rw-r--r--src/contacts-contact-sheet.vala6
-rw-r--r--src/contacts-contact.vala20
-rw-r--r--src/contacts-store.vala15
-rw-r--r--src/contacts-utils.vala2
-rw-r--r--src/meson.build7
9 files changed, 53 insertions, 10 deletions
diff --git a/configure b/configure
index 48d0ca1..c3b94ac 100755
--- a/configure
+++ b/configure
@@ -15,7 +15,7 @@ shopt -s extglob
# ====================
DIRECTORY_OPTIONS='--@(prefix|bindir|sbindir|libexecdir|datadir|sysconfdir|libdir|mandir|includedir)'
# Keep this in sync with meson_options.txt
-PROJECT_OPTIONS='--@(with-cheese|maps|with-manpage)'
+PROJECT_OPTIONS='--@(with-cheese|maps|telepathy|with-manpage)'
# The configurable option values
declare -A option_values
diff --git a/meson.build b/meson.build
index b9ce3cb..9238512 100644
--- a/meson.build
+++ b/meson.build
@@ -32,7 +32,6 @@ min_glib_version = '2.44.0'
folks = dependency('folks', version: '>=' + min_folks_version)
folks_eds = dependency('folks-eds', version: '>=' + min_folks_version)
-folks_telepathy = dependency('folks-telepathy', version: '>=' + min_folks_version)
gee = dependency('gee-0.8')
gio_unix = dependency('gio-unix-2.0', version: '>=' + min_glib_version)
glib = dependency('glib-2.0', version: '>=' + min_glib_version)
@@ -43,7 +42,6 @@ gtk = dependency('gtk+-3.0', version: '>= 3.22.0')
libebook = dependency('libebook-1.2', version: '>=' + min_eds_version)
libedataserver = dependency('libedataserver-1.2', version: '>=' + min_eds_version)
libedataserverui = dependency('libedataserverui-1.2', version: '>=' + min_eds_version)
-telepathy_glib = dependency('telepathy-glib', version: '>= 0.22.0')
# Libraries
math = meson.get_compiler('c').find_library('m')
@@ -64,6 +62,12 @@ if maps_enabled
geocode_glib = dependency('geocode-glib-1.0', version: '>= 3.15.3')
endif
+telepathy_enabled = get_option('telepathy')
+if telepathy_enabled
+ folks_telepathy = dependency('folks-telepathy', version: '>=' + min_folks_version)
+ telepathy_glib = dependency('telepathy-glib', version: '>= 0.22.0')
+endif
+
manpage_enabled = get_option('with-manpage')
# Configuration
diff --git a/meson_options.txt b/meson_options.txt
index 2aa5cc6..fa67894 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,4 @@
option('with-cheese', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto', description: 'enable cheese webcam support')
option('maps', type: 'boolean', value: true, description: 'Enable built-in support for maps.')
+option('telepathy', type: 'boolean', value: true, description: 'Enable Telepathy call/chat support.')
option('with-manpage', type: 'boolean', value: true, description: 'enable building man pages')
diff --git a/src/contacts-contact-list.vala b/src/contacts-contact-list.vala
index 4e013ef..1d074d2 100644
--- a/src/contacts-contact-list.vala
+++ b/src/contacts-contact-list.vala
@@ -181,8 +181,10 @@ public class Contacts.ContactList : ListBox {
var data = row as ContactDataRow;
var contact = data != null ? data.contact : null;
selection_changed (contact);
+#if HAVE_TELEPATHY
if (contact != null)
contact.fetch_contact_info ();
+#endif
}
private bool filter (ListBoxRow row) {
diff --git a/src/contacts-contact-sheet.vala b/src/contacts-contact-sheet.vala
index 9e21a89..0323c75 100644
--- a/src/contacts-contact-sheet.vala
+++ b/src/contacts-contact-sheet.vala
@@ -153,6 +153,7 @@ public class Contacts.ContactSheet : Grid {
if (phone_details != null) {
var phones = Contact.sort_fields<PhoneFieldDetails>(phone_details.phone_numbers);
foreach (var phone in phones) {
+#if HAVE_TELEPATHY
if (c.store != null && c.store.caller_account != null) {
var button = add_row_with_button (ref i, TypeSet.phone.format_type (phone), phone.value);
button.clicked.connect (() => {
@@ -161,9 +162,13 @@ public class Contacts.ContactSheet : Grid {
} else {
add_row_with_label (ref i, TypeSet.phone.format_type (phone), phone.value);
}
+#else
+ add_row_with_label (ref i, TypeSet.phone.format_type (phone), phone.value);
+#endif
}
}
+#if HAVE_TELEPATHY
var im_details = p as ImDetails;
if (im_details != null) {
foreach (var protocol in im_details.im_addresses.get_keys ()) {
@@ -186,6 +191,7 @@ public class Contacts.ContactSheet : Grid {
}
}
}
+#endif
var url_details = p as UrlDetails;
if (url_details != null) {
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index aafc14c..e7180ee 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -295,6 +295,7 @@ public class Contacts.Contact : GLib.Object {
return lines;
}
+#if HAVE_TELEPATHY
public Tpf.Persona? find_im_persona (string protocol, string im_address) {
var iid = protocol + ":" + im_address;
foreach (var p in individual.personas) {
@@ -305,6 +306,7 @@ public class Contacts.Contact : GLib.Object {
}
return null;
}
+#endif
private struct ImData {
unowned string service;
@@ -506,10 +508,16 @@ public class Contacts.Contact : GLib.Object {
that will typically unlink the rest. */
public bool can_remove_personas () {
foreach (var p in individual.personas) {
+#if HAVE_TELEPATHY
if (p.store.can_remove_personas == MaybeBool.TRUE &&
!(p is Tpf.Persona)) {
return true;
}
+#else
+ if (p.store.can_remove_personas == MaybeBool.TRUE) {
+ return true;
+ }
+#endif
}
return false;
}
@@ -517,10 +525,16 @@ public class Contacts.Contact : GLib.Object {
public async void remove_personas () throws Folks.PersonaStoreError {
var personas = new HashSet<Persona> ();
foreach (var p in individual.personas) {
+#if HAVE_TELEPATHY
if (p.store.can_remove_personas == MaybeBool.TRUE &&
!(p is Tpf.Persona)) {
personas.add (p);
}
+#else
+ if (p.store.can_remove_personas == MaybeBool.TRUE) {
+ personas.add (p);
+ }
+#endif
}
foreach (var persona in personas) {
yield persona.store.remove_persona (persona);
@@ -645,10 +659,12 @@ public class Contacts.Contact : GLib.Object {
if (eds_name != null)
return eds_name;
}
+#if HAVE_TELEPATHY
if (store.type_id == "telepathy") {
var account = (store as Tpf.PersonaStore).account;
return format_im_service (account.service);
}
+#endif
return store.display_name;
}
@@ -738,10 +754,12 @@ public class Contacts.Contact : GLib.Object {
if (eds_name != null)
return eds_name;
}
+#if HAVE_TELEPATHY
if (store.type_id == "telepathy") {
var account = (store as Tpf.PersonaStore).account;
return format_im_service (account.service);
}
+#endif
return store.display_name;
}
@@ -897,6 +915,7 @@ public class Contacts.Contact : GLib.Object {
w.destroy.connect (() => { this.disconnect (id); });
}
+#if HAVE_TELEPATHY
public void fetch_contact_info () {
/* TODO: Ideally Folks should have API for this (#675131) */
foreach (var p in individual.personas) {
@@ -906,6 +925,7 @@ public class Contacts.Contact : GLib.Object {
}
}
}
+#endif
}
public class Contacts.FakePersonaStore : PersonaStore {
diff --git a/src/contacts-store.vala b/src/contacts-store.vala
index c92f61a..c1653e4 100644
--- a/src/contacts-store.vala
+++ b/src/contacts-store.vala
@@ -19,7 +19,6 @@
using Gtk;
using Folks;
using Gee;
-using TelepathyGLib;
public class Contacts.Store : GLib.Object {
public signal void changed (Contact c);
@@ -36,7 +35,9 @@ public class Contacts.Store : GLib.Object {
public Gee.HashMultiMap<string, string> dont_suggest_link;
- public Account? caller_account { get; private set; default = null; }
+#if HAVE_TELEPATHY
+ public TelepathyGLib.Account? caller_account { get; private set; default = null; }
+#endif
public bool is_quiescent {
get { return this.aggregator.is_quiescent; }
@@ -233,7 +234,9 @@ public class Contacts.Store : GLib.Object {
});
aggregator.prepare.begin ();
+#if HAVE_TELEPATHY
check_call_capabilities.begin ();
+#endif
}
private void contact_changed_cb (Contact c) {
@@ -311,9 +314,10 @@ public class Contacts.Store : GLib.Object {
removed (c);
}
+#if HAVE_TELEPATHY
// TODO: listen for changes in Account#URISchemes
private async void check_call_capabilities () {
- var account_manager = AccountManager.dup ();
+ var account_manager = TelepathyGLib.AccountManager.dup ();
try {
yield account_manager.prepare_async (null);
@@ -328,8 +332,8 @@ public class Contacts.Store : GLib.Object {
}
}
- private async void check_account_caps (Account account) {
- GLib.Quark addressing = Account.get_feature_quark_addressing ();
+ private async void check_account_caps (TelepathyGLib.Account account) {
+ GLib.Quark addressing = TelepathyGLib.Account.get_feature_quark_addressing ();
if (!account.is_prepared (addressing)) {
GLib.Quark[] features = { addressing };
try {
@@ -344,4 +348,5 @@ public class Contacts.Store : GLib.Object {
this.caller_account = account;
}
}
+#endif
}
diff --git a/src/contacts-utils.vala b/src/contacts-utils.vala
index bcfec4d..954e1f2 100644
--- a/src/contacts-utils.vala
+++ b/src/contacts-utils.vala
@@ -130,6 +130,7 @@ namespace Contacts.Utils {
}
}
+#if HAVE_TELEPATHY
public void start_chat (Contact contact, string protocol, string id) {
var im_persona = contact.find_im_persona (protocol, id);
var account = (im_persona.store as Tpf.PersonaStore).account;
@@ -162,6 +163,7 @@ namespace Contacts.Utils {
var request = new TelepathyGLib.AccountChannelRequest(account, request_dict, int64.MAX);
request.ensure_channel_async.begin ("org.freedesktop.Telepathy.Client.Empathy.Call", null);
}
+#endif
public T? get_first<T> (Collection<T> collection) {
var i = collection.iterator();
diff --git a/src/meson.build b/src/meson.build
index 8e25a04..2a387c3 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -49,7 +49,6 @@ contacts_c_args = [
contacts_deps = [
folks,
folks_eds,
- folks_telepathy,
gee,
gio_unix,
glib,
@@ -60,7 +59,6 @@ contacts_deps = [
libedataserver,
libedataserverui,
math,
- telepathy_glib,
]
# Add extra stuff given a certain set of options
@@ -76,6 +74,11 @@ if maps_enabled
contacts_vala_sources += 'contacts-address-map.vala'
endif
+if telepathy_enabled
+ contacts_deps += [ folks_telepathy, telepathy_glib ]
+ contacts_vala_args += [ '-D', 'HAVE_TELEPATHY' ]
+endif
+
contacts_sources = [
contacts_c_sources,
contacts_vala_sources,