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);
}