manager: support multiple providers
This includes the following changes: - Introduce a `providers` hash table to keep track of multiple CallProvider's and remove the `provider` member - Remove `calls_manager_get_provider()` and `calls_manager_set_provider()` in favour of `calls_manager_add_provider()`, `calls_manager_remove_provider()` and `calls_manager_has_provider()` - Introduce a `origins` GListStore to keep track of available origins. `origins` is updated in `items_changed_cb()` when the origins of any CallsProvider are updated. - Adapt to changes with respect to `calls_manager_get_origins()`. - Introduce `origins_by_protocol` hash table to keep track of available origins per protocol. - Adjust tests - We temporarily break country code lookup which was handled previously with the "default-origin" mechanism. We will add it back to the CallsSettings class which will provide a better application-wide mechanism.
This commit is contained in:
@@ -135,17 +135,14 @@ set_provider_name_action (GSimpleAction *action,
|
||||
name = g_variant_get_string (parameter, NULL);
|
||||
g_return_if_fail (name != NULL);
|
||||
|
||||
/* FIXME: allow to set a new provider, we need to make sure that the
|
||||
provider is unloaded correctly from the CallsManager */
|
||||
if (calls_manager_get_provider (calls_manager_get_default ()) != NULL) {
|
||||
g_warning ("Cannot set provider name to `%s'"
|
||||
" because provider is already created",
|
||||
if (calls_manager_has_provider (calls_manager_get_default (), name)) {
|
||||
g_warning ("Cannot add provider `%s' because it is already loaded",
|
||||
name);
|
||||
return;
|
||||
}
|
||||
|
||||
g_debug ("Start loading provider `%s'", name);
|
||||
calls_manager_set_provider (calls_manager_get_default (), name);
|
||||
calls_manager_add_provider (calls_manager_get_default (), name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user