settings: Convert to the singleton pattern

We only have a single source of settings, so we should reflect that by
using a singleton. This also reduces our LoC.

This doesn't impair our ability to run tests because there we run with
GSETTINGS_BACKEND=memory
This commit is contained in:
Evangelos Ribeiro Tzaras
2022-05-09 22:57:41 +02:00
parent d28be2650b
commit 94fa13af4c
11 changed files with 26 additions and 57 deletions

View File

@@ -646,7 +646,6 @@ calls_manager_finalize (GObject *object)
g_clear_object (&self->origins);
g_clear_object (&self->contacts_provider);
g_clear_object (&self->settings);
g_clear_pointer (&self->providers, g_hash_table_unref);
g_clear_pointer (&self->origins_by_protocol, g_hash_table_unref);
@@ -795,9 +794,9 @@ calls_manager_init (CallsManager *self)
/* This hash table only owns the value, not the key */
self->calls = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref);
self->settings = calls_settings_new ();
self->settings = calls_settings_get_default ();
// Load the contacts provider
self->contacts_provider = calls_contacts_provider_new (self->settings);
self->contacts_provider = calls_contacts_provider_new ();
peas = peas_engine_get_default ();