1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-11-17 15:55:58 +00:00

application: Don't add a provider if one is already present

If we initially invoked `gnome-calls -p sip` and later invoke
`gnome-calls sip:user@host` we don't expect to have the default MM provider
added.
This commit is contained in:
Evangelos Ribeiro Tzaras 2021-04-16 19:12:27 +02:00
parent 3f3b108cea
commit 98d66743a1
3 changed files with 19 additions and 3 deletions

View file

@ -104,9 +104,10 @@ handle_local_options (GApplication *application,
"set-provider-name", "set-provider-name",
g_variant_new_string (arg)); g_variant_new_string (arg));
} else { } else {
g_action_group_activate_action (G_ACTION_GROUP (application), if (!calls_manager_has_any_provider (calls_manager_get_default ()))
"set-provider-name", g_action_group_activate_action (G_ACTION_GROUP (application),
g_variant_new_string (DEFAULT_PROVIDER_PLUGIN)); "set-provider-name",
g_variant_new_string (DEFAULT_PROVIDER_PLUGIN));
} }
ok = g_variant_dict_contains (options, "daemon"); ok = g_variant_dict_contains (options, "daemon");

View file

@ -853,3 +853,17 @@ calls_manager_get_suitable_origins (CallsManager *self,
return NULL; return NULL;
} }
/**
* calls_manager_has_any_provider:
* @self: The #CallsManager
*
* Returns: %TRUE if any provider is loaded, %FALSE otherwise
*/
gboolean
calls_manager_has_any_provider (CallsManager *self)
{
g_return_val_if_fail (CALLS_IS_MANAGER (self), FALSE);
return !!g_hash_table_size (self->providers);
}

View file

@ -66,5 +66,6 @@ GListModel *calls_manager_get_suitable_origins (CallsManager
const gchar *calls_manager_get_contact_name (CallsCall *call); const gchar *calls_manager_get_contact_name (CallsCall *call);
gboolean calls_manager_has_active_call (CallsManager *self); gboolean calls_manager_has_active_call (CallsManager *self);
void calls_manager_hang_up_all_calls (CallsManager *self); void calls_manager_hang_up_all_calls (CallsManager *self);
gboolean calls_manager_has_any_provider (CallsManager *self);
G_END_DECLS G_END_DECLS