From df9d541968bc6416e909a085cdbf9fb6ffd48c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Sat, 18 Dec 2021 14:07:32 +0100 Subject: [PATCH] origin: Add interface to get emergency numbers --- src/calls-origin.c | 30 ++++++++++++++++++++++++++++++ src/calls-origin.h | 22 ++++++++++++---------- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/src/calls-origin.c b/src/calls-origin.c index 487a303..c6192a8 100644 --- a/src/calls-origin.c +++ b/src/calls-origin.c @@ -78,6 +78,19 @@ calls_origin_default_init (CallsOriginInterface *iface) NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + /** + * CallsOrigin:emergency-numbers: + * + * The available emergency numbers. + */ + g_object_interface_install_property ( + iface, + g_param_spec_boxed ("emergency-numbers", + "", + "", + G_TYPE_STRV, + G_PARAM_READABLE)); + signals[SIGNAL_CALL_ADDED] = g_signal_newv ("call-added", G_TYPE_FROM_INTERFACE (iface), @@ -131,6 +144,23 @@ DEFINE_ORIGIN_GETTER (id, char *, NULL); */ DEFINE_ORIGIN_GETTER (calls, GList *, NULL); +/** + * calls_origin_get_emergency_numbers: + * @self: a #CallsOrigin + * + * Returns: (transfer full): The supported emergency numbers + */ +GStrv +calls_origin_get_emergency_numbers (CallsOrigin *origin) +{ + GStrv numbers; + + g_return_val_if_fail (CALLS_IS_ORIGIN (origin), NULL); + + g_object_get (origin, "emergency-numbers", &numbers, NULL); + return numbers; +} + /** * calls_origin_foreach_call: * @self: a #CallsOrigin diff --git a/src/calls-origin.h b/src/calls-origin.h index 9031eff..af6e106 100644 --- a/src/calls-origin.h +++ b/src/calls-origin.h @@ -47,15 +47,17 @@ struct _CallsOriginInterface { typedef void (*CallsOriginForeachCallFunc) (gpointer param, CallsCall* call, CallsOrigin* origin); -char *calls_origin_get_name (CallsOrigin *self); -char *calls_origin_get_id (CallsOrigin *self); -GList *calls_origin_get_calls (CallsOrigin *self); -void calls_origin_foreach_call (CallsOrigin *self, - CallsOriginForeachCallFunc callback, - gpointer param); -void calls_origin_dial (CallsOrigin *self, - const char *number); -gboolean calls_origin_supports_protocol (CallsOrigin *self, - const char *protocol); +char * calls_origin_get_name (CallsOrigin *self); +char * calls_origin_get_id (CallsOrigin *self); +GList * calls_origin_get_calls (CallsOrigin *self); +void calls_origin_foreach_call (CallsOrigin *self, + CallsOriginForeachCallFunc callback, + gpointer param); +void calls_origin_dial (CallsOrigin *self, + const char *number); +gboolean calls_origin_supports_protocol (CallsOrigin *self, + const char *protocol); +GStrv calls_origin_get_emergency_numbers (CallsOrigin *self); + G_END_DECLS