mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-06 03:25:31 +00:00
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:
parent
a559587a19
commit
25d651c834
2 changed files with 13 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ test_calls_manager_dummy_provider ()
|
|||
g_assert_nonnull (calls_manager_get_origins (manager));
|
||||
g_assert_true (g_list_model_get_n_items (origins) > 0);
|
||||
g_assert_null (calls_manager_get_calls (manager));
|
||||
g_assert_null (calls_manager_get_default_origin (manager));
|
||||
|
||||
test_call = NULL;
|
||||
if (g_list_model_get_n_items (origins) > 0) {
|
||||
|
@ -69,7 +68,6 @@ test_calls_manager_dummy_provider ()
|
|||
origin = g_list_model_get_item (origins, 0);
|
||||
g_assert (CALLS_IS_ORIGIN (origin));
|
||||
|
||||
calls_manager_set_default_origin (manager, origin);
|
||||
g_assert (calls_manager_get_default_origin (manager) == origin);
|
||||
|
||||
calls_origin_dial (origin, "+393422342");
|
||||
|
|
Loading…
Reference in a new issue