1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-09-27 06:05:30 +00:00

CallManager: drop calls_manager_get_contact_name ()

This function is replaced with calls_call_get_contact ()
This commit is contained in:
Julian Sparber 2021-01-28 17:09:43 +01:00 committed by Evangelos Ribeiro Tzaras
parent 60e2b39367
commit 889d5a0981
2 changed files with 6 additions and 36 deletions

View file

@ -656,37 +656,3 @@ calls_manager_set_default_origin (CallsManager *self,
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_DEFAULT_ORIGIN]);
}
/**
* calls_manager_get_contact_name:
* @call: a #CallsCall
*
* Looks up the contact name for @call. If the lookup
* succeeds, the contact name will be returned. NULL if
* no match has been found in the contact list.
* If no number is associated with the @call, then
* a translatable string will be returned.
*
* Returns: (transfer none): The caller's name, a string representing
* an unknown caller or %NULL
*/
const gchar *
calls_manager_get_contact_name (CallsCall *call)
{
const gchar *number;
g_autoptr (CallsBestMatch) match = NULL;
CallsContactsProvider *contacts_provider;
number = calls_call_get_number (call);
if (!number || g_strcmp0 (number, "") == 0)
return _("Anonymous caller");
contacts_provider = calls_manager_get_contacts_provider (calls_manager_get_default ());
match = calls_contacts_provider_lookup_phone_number (contacts_provider,
number);
if (!match)
return NULL;
return calls_best_match_get_name (match);
}

View file

@ -44,6 +44,7 @@ notify (CallsNotifier *self, CallsCall *call)
{
GApplication *app = g_application_get_default ();
g_autoptr(GNotification) notification;
g_autoptr (CallsBestMatch) contact = NULL;
g_autofree gchar *msg = NULL;
g_autofree gchar *ref = NULL;
g_autofree gchar *label_callback = NULL;
@ -51,8 +52,11 @@ notify (CallsNotifier *self, CallsCall *call)
notification = g_notification_new (_("Missed call"));
name = calls_manager_get_contact_name (call);
if (name)
contact = calls_call_get_contact (call);
// TODO: We need to update the notification when the contact name changes
name = calls_best_match_get_name (contact);
if (calls_best_match_has_individual (contact))
msg = g_strdup_printf (_("Missed call from <b>%s</b>"), name);
else
msg = g_strdup_printf (_("Missed call from %s"), calls_call_get_number (call));