mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-12-13 16:07:36 +00:00
manager: Implement lookup_origin_by_id()
This function is used in the activate callback for the per protocol dial actions to choose the correct origin to place a call from. If an origin cannot be found it will return NULL which will lead to the fallback "app.dial" action being invoked.
This commit is contained in:
parent
30c4e90499
commit
d24d1c8c59
1 changed files with 17 additions and 0 deletions
|
@ -157,6 +157,23 @@ static CallsOrigin *
|
|||
lookup_origin_by_id (CallsManager *self,
|
||||
const char *origin_id)
|
||||
{
|
||||
uint n_origins;
|
||||
|
||||
g_assert (CALLS_IS_MANAGER (self));
|
||||
|
||||
if (!origin_id || !*origin_id)
|
||||
goto out;
|
||||
|
||||
n_origins = g_list_model_get_n_items (G_LIST_MODEL (self->origins));
|
||||
for (uint i = 0; i < n_origins; i++) {
|
||||
g_autoptr (CallsOrigin) origin =
|
||||
g_list_model_get_item (G_LIST_MODEL (self->origins), i);
|
||||
g_autofree char *id = calls_origin_get_id (origin);
|
||||
|
||||
if (g_strcmp0 (id, origin_id) == 0)
|
||||
return origin;
|
||||
}
|
||||
out:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue