1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-07-02 15:09:31 +00:00

CallsCall: Add method to optain matching contact

This commit is contained in:
Julian Sparber 2021-01-28 17:05:00 +01:00 committed by Evangelos Ribeiro Tzaras
parent 6d3b75262d
commit 501d29145f
2 changed files with 34 additions and 11 deletions

View file

@ -24,6 +24,7 @@
#include "calls-call.h" #include "calls-call.h"
#include "calls-message-source.h" #include "calls-message-source.h"
#include "calls-manager.h"
#include "enum-types.h" #include "enum-types.h"
#include "util.h" #include "util.h"
@ -325,3 +326,22 @@ calls_call_tone_stop (CallsCall *self,
iface->tone_stop (self, key); iface->tone_stop (self, key);
} }
/**
* calls_call_get_contact:
* @self: a #CallsCall
*
* This a convenience function to optain the #CallsBestMatch matching the
* phone number of the #CallsCall.
*
* Returns: (transfer full): A #CallsBestMatch
*/
CallsBestMatch *
calls_call_get_contact (CallsCall *self)
{
CallsContactsProvider *contacts_provider =
calls_manager_get_contacts_provider (calls_manager_get_default ());
return calls_contacts_provider_lookup_phone_number (contacts_provider,
calls_call_get_number (self));
}

View file

@ -25,6 +25,8 @@
#ifndef CALLS_CALL_H__ #ifndef CALLS_CALL_H__
#define CALLS_CALL_H__ #define CALLS_CALL_H__
#include "calls-best-match.h"
#include <glib-object.h> #include <glib-object.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -62,17 +64,18 @@ struct _CallsCallInterface
}; };
const gchar * calls_call_get_number (CallsCall *self); const gchar * calls_call_get_number (CallsCall *self);
const gchar * calls_call_get_name (CallsCall *self); const gchar * calls_call_get_name (CallsCall *self);
CallsCallState calls_call_get_state (CallsCall *self); CallsCallState calls_call_get_state (CallsCall *self);
gboolean calls_call_get_inbound (CallsCall *self); gboolean calls_call_get_inbound (CallsCall *self);
void calls_call_answer (CallsCall *self); void calls_call_answer (CallsCall *self);
void calls_call_hang_up (CallsCall *self); void calls_call_hang_up (CallsCall *self);
void calls_call_tone_start (CallsCall *self, void calls_call_tone_start (CallsCall *self,
gchar key); gchar key);
gboolean calls_call_tone_stoppable (CallsCall *self); gboolean calls_call_tone_stoppable (CallsCall *self);
void calls_call_tone_stop (CallsCall *self, void calls_call_tone_stop (CallsCall *self,
gchar key); gchar key);
CallsBestMatch * calls_call_get_contact (CallsCall *self);
G_END_DECLS G_END_DECLS