[calls/gnome-41] number-query: Take country code into account
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls/gnome-41] number-query: Take country code into account
- Date: Thu, 28 Oct 2021 12:34:12 +0000 (UTC)
commit ef84973a22cdd6ba00eb77a570a03984ed4e5b07
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date: Wed Sep 22 18:54:05 2021 +0200
number-query: Take country code into account
Fixes #312
(cherry picked from commit bd045be4e4a1578fd226e417aeab82a9a743813e)
src/calls-best-match.c | 2 +-
src/calls-phone-number-query.vala | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/calls-best-match.c b/src/calls-best-match.c
index 63a69060..86255ed1 100644
--- a/src/calls-best-match.c
+++ b/src/calls-best-match.c
@@ -343,7 +343,7 @@ calls_best_match_set_phone_number (CallsBestMatch *self,
if (!number) {
g_warning ("Failed to convert %s to a phone number: %s", phone_number, error->message);
} else {
- query = calls_phone_number_query_new (number);
+ query = calls_phone_number_query_new (number, self->country_code);
self->view = folks_search_view_new (folks_individual_aggregator_dup (), FOLKS_QUERY (query));
g_signal_connect_swapped (self->view,
diff --git a/src/calls-phone-number-query.vala b/src/calls-phone-number-query.vala
index e8f0e771..aa708660 100644
--- a/src/calls-phone-number-query.vala
+++ b/src/calls-phone-number-query.vala
@@ -26,8 +26,9 @@
public class Calls.PhoneNumberQuery : Folks.Query
{
private E.PhoneNumber _number;
+ private string _country_code;
- public PhoneNumberQuery (E.PhoneNumber number)
+ public PhoneNumberQuery (E.PhoneNumber number, string? country_code)
{
string[] match_fields =
{ Folks.PersonaStore.detail_key (Folks.PersonaDetail.PHONE_NUMBERS) };
@@ -35,6 +36,7 @@ public class Calls.PhoneNumberQuery : Folks.Query
Object (match_fields: match_fields);
this._number = number;
+ this._country_code = country_code;
}
public override uint is_match (Folks.Individual individual)
@@ -56,7 +58,7 @@ public class Calls.PhoneNumberQuery : Folks.Query
try
{
indiv_parsed =
- E.PhoneNumber.from_string (indiv_number, null);
+ E.PhoneNumber.from_string (indiv_number, this._country_code);
}
catch (GLib.Error e)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]