manager: set default origin

This is a bit of a hack to get the country code property hooked up
and will require a rework when multiple provider support is being added.
As the default origin is not being used anywhere else in the code
it's currently not a problem that we're not tracking if the default
origin is being removed.

Additionally test-manager.c needed some adjustment.
This commit is contained in:
Evangelos Ribeiro Tzaras
2021-04-05 01:40:32 +02:00
parent a559587a19
commit 25d651c834
2 changed files with 13 additions and 2 deletions

View File

@@ -221,9 +221,11 @@ origin_items_changed_cb (CallsManager *self)
{
GListModel *origins;
guint n_items;
gboolean has_default_origin = FALSE;
g_assert (CALLS_IS_MANAGER (self));
has_default_origin = !!self->default_origin;
origins = calls_provider_get_origins (self->provider);
n_items = g_list_model_get_n_items (origins);
@@ -238,6 +240,17 @@ origin_items_changed_cb (CallsManager *self)
origin = g_list_model_get_item (origins, i);
add_origin (self, origin, self->provider);
if (!has_default_origin)
{
/* XXX
This actually doesn't work correctly when we default origin is removed.
This will require a rework when supporting multiple providers anyway
and also isn't really used outside of getting the country code
it's not really a problem.
*/
calls_manager_set_default_origin (self, origin);
has_default_origin = TRUE;
}
}
}