util: Add API to query call icon names
This can later be used in the call history or in the call details instead of always constructing the name repeatedly in private functions.
This commit is contained in:
25
src/util.c
25
src/util.c
@@ -273,3 +273,28 @@ dtmf_tone_key_is_valid (gchar key)
|
|||||||
|| key == '#';
|
|| key == '#';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const char * const type_icon_name[] = {
|
||||||
|
"call-arrow-outgoing-symbolic",
|
||||||
|
"call-arrow-outgoing-missed-symbolic",
|
||||||
|
"call-arrow-incoming-symbolic",
|
||||||
|
"call-arrow-incoming-missed-symbolic",
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get_call_icon_type_name:
|
||||||
|
* @inbound: Whether the call was inbound
|
||||||
|
* @missed: Whether the call was missed
|
||||||
|
*
|
||||||
|
* Returns: (transfer null): The icon symbolic name to use in the history, etc
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
get_call_icon_symbolic_name (gboolean inbound,
|
||||||
|
gboolean missed)
|
||||||
|
{
|
||||||
|
guint index = 0;
|
||||||
|
|
||||||
|
index = ((inbound) << 1) + missed;
|
||||||
|
|
||||||
|
return type_icon_name[index];
|
||||||
|
}
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ const char* get_protocol_from_address (const char *target);
|
|||||||
const char* get_protocol_from_address_with_fallback (const char *target);
|
const char* get_protocol_from_address_with_fallback (const char *target);
|
||||||
|
|
||||||
gboolean dtmf_tone_key_is_valid (char key);
|
gboolean dtmf_tone_key_is_valid (char key);
|
||||||
|
const char *get_call_icon_symbolic_name (gboolean inbound,
|
||||||
|
gboolean missed);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user