mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-09-29 15:25:24 +00:00
origin: Allow to fetch country code
This is an optional method as not all origins might support this (e.g. SIP).
This commit is contained in:
parent
d598acd96b
commit
6cdae3fd40
3 changed files with 27 additions and 3 deletions
|
@ -23,7 +23,7 @@ test_dummy_origin_object (OriginFixture *fixture,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_dummy_origin_get_name (OriginFixture *fixture,
|
test_dummy_origin_getters (OriginFixture *fixture,
|
||||||
gconstpointer user_data)
|
gconstpointer user_data)
|
||||||
{
|
{
|
||||||
CallsOrigin *origin;
|
CallsOrigin *origin;
|
||||||
|
@ -34,6 +34,7 @@ test_dummy_origin_get_name (OriginFixture *fixture,
|
||||||
name = calls_origin_get_name (origin);
|
name = calls_origin_get_name (origin);
|
||||||
g_assert_nonnull (name);
|
g_assert_nonnull (name);
|
||||||
g_assert_cmpstr (name, ==, TEST_ORIGIN_NAME);
|
g_assert_cmpstr (name, ==, TEST_ORIGIN_NAME);
|
||||||
|
g_assert_null (calls_origin_get_country_code (origin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,7 +85,7 @@ main (gint argc,
|
||||||
#define add_test(name) add_calls_test(Origin, origin, name)
|
#define add_test(name) add_calls_test(Origin, origin, name)
|
||||||
|
|
||||||
add_test(object);
|
add_test(object);
|
||||||
add_test(get_name);
|
add_test(getters);
|
||||||
add_test(calls);
|
add_test(calls);
|
||||||
|
|
||||||
#undef add_test
|
#undef add_test
|
||||||
|
|
|
@ -229,3 +229,24 @@ calls_origin_supports_protocol (CallsOrigin *self,
|
||||||
|
|
||||||
return iface->supports_protocol (self, protocol);
|
return iface->supports_protocol (self, protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* calls_origin_get_country_code:
|
||||||
|
* @self: A #CallsOrigin
|
||||||
|
*
|
||||||
|
* Returns: (nullable): The iso country code
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
calls_origin_get_country_code (CallsOrigin *self)
|
||||||
|
{
|
||||||
|
CallsOriginInterface *iface;
|
||||||
|
|
||||||
|
g_return_val_if_fail (CALLS_IS_ORIGIN (self), FALSE);
|
||||||
|
|
||||||
|
iface = CALLS_ORIGIN_GET_IFACE (self);
|
||||||
|
/* country code is optional */
|
||||||
|
if (iface->get_country_code == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return iface->get_country_code (self);
|
||||||
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ struct _CallsOriginInterface {
|
||||||
const char *number);
|
const char *number);
|
||||||
gboolean (*supports_protocol) (CallsOrigin *self,
|
gboolean (*supports_protocol) (CallsOrigin *self,
|
||||||
const char *protocol);
|
const char *protocol);
|
||||||
|
const char * (*get_country_code) (CallsOrigin *self);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (*CallsOriginForeachCallFunc) (gpointer param, CallsCall* call, CallsOrigin* origin);
|
typedef void (*CallsOriginForeachCallFunc) (gpointer param, CallsCall* call, CallsOrigin* origin);
|
||||||
|
@ -58,6 +59,7 @@ void calls_origin_dial (CallsOrigin *self,
|
||||||
gboolean calls_origin_supports_protocol (CallsOrigin *self,
|
gboolean calls_origin_supports_protocol (CallsOrigin *self,
|
||||||
const char *protocol);
|
const char *protocol);
|
||||||
GStrv calls_origin_get_emergency_numbers (CallsOrigin *self);
|
GStrv calls_origin_get_emergency_numbers (CallsOrigin *self);
|
||||||
|
const char * calls_origin_get_country_code (CallsOrigin *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue