1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-04 20:07:36 +00:00

origin: Add network country code

This is technically only useful for mobile networks.
This commit is contained in:
Guido Günther 2023-07-19 12:41:50 +02:00
parent 4695f81f5c
commit c4630a2647
2 changed files with 27 additions and 1 deletions

View file

@ -250,3 +250,27 @@ calls_origin_get_country_code (CallsOrigin *self)
return iface->get_country_code (self);
}
/**
* calls_origin_get_network_country_code:
* @self: A #CallsOrigin
*
* Gets the country code of the mobile network we're currently
* connected to.
*
* Returns: (nullable): The country code
*/
const char *
calls_origin_get_network_country_code (CallsOrigin *self)
{
CallsOriginInterface *iface;
g_return_val_if_fail (CALLS_IS_ORIGIN (self), FALSE);
iface = CALLS_ORIGIN_GET_IFACE (self);
/* network country code is optional */
if (iface->get_network_country_code == NULL)
return NULL;
return iface->get_network_country_code (self);
}

View file

@ -44,6 +44,8 @@ struct _CallsOriginInterface {
gboolean (*supports_protocol) (CallsOrigin *self,
const char *protocol);
const char * (*get_country_code) (CallsOrigin *self);
/* TODO: should we have an additional CALLS_MODEM_ORIGIN interface for modems? */
const char * (*get_network_country_code) (CallsOrigin *self);
};
typedef void (*CallsOriginForeachCallFunc) (gpointer param, CallsCall* call, CallsOrigin* origin);
@ -60,6 +62,6 @@ gboolean calls_origin_supports_protocol (CallsOrigin *self,
const char *protocol);
GStrv calls_origin_get_emergency_numbers (CallsOrigin *self);
const char * calls_origin_get_country_code (CallsOrigin *self);
const char * calls_origin_get_network_country_code (CallsOrigin *self);
G_END_DECLS