1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2025-01-06 11:35:32 +00:00

sip: Make save_to_disk() public and use it when updating accounts

Account credentials will not get updated at all otherwise.
This commit is contained in:
Evangelos Ribeiro Tzaras 2021-08-27 10:10:23 +02:00
parent f47139f7d2
commit 0bfa55473e
3 changed files with 23 additions and 16 deletions

View file

@ -400,6 +400,7 @@ on_apply_clicked (CallsSipAccountWidget *self)
TRUE);
update_header (self);
calls_sip_provider_save_accounts_to_disk (self->provider);
g_signal_emit_by_name (self->provider, "widget-edit-done");
}

View file

@ -303,20 +303,6 @@ origin_to_keyfile (CallsSipOrigin *origin,
}
static void
save_to_disk (CallsSipProvider *self)
{
g_autoptr (GKeyFile) key_file = g_key_file_new ();
g_autoptr (GError) error = NULL;
g_assert (CALLS_IS_SIP_PROVIDER (self));
calls_sip_provider_save_accounts (self, key_file);
if (!g_key_file_save_to_file (key_file, self->filename, &error))
g_warning ("Error saving keyfile to file %s: %s", self->filename, error->message);
}
static const char *
calls_sip_provider_get_name (CallsProvider *provider)
{
@ -718,7 +704,7 @@ calls_sip_provider_add_origin_full (CallsSipProvider *self,
g_list_store_append (self->origins, origin);
if (store_credentials && !self->use_memory_backend)
save_to_disk (self);
calls_sip_provider_save_accounts_to_disk (self);
return origin;
}
@ -739,7 +725,7 @@ calls_sip_provider_remove_origin (CallsSipProvider *self,
if (!self->use_memory_backend) {
origin_pw_delete_secret (origin);
save_to_disk (self);
calls_sip_provider_save_accounts_to_disk (self);
}
g_object_unref (origin);
return TRUE;
@ -793,6 +779,25 @@ calls_sip_provider_save_accounts (CallsSipProvider *self,
}
gboolean
calls_sip_provider_save_accounts_to_disk (CallsSipProvider *self)
{
g_autoptr (GKeyFile) key_file = g_key_file_new ();
g_autoptr (GError) error = NULL;
gboolean saved = FALSE;
g_assert (CALLS_IS_SIP_PROVIDER (self));
calls_sip_provider_save_accounts (self, key_file);
if (!(saved = g_key_file_save_to_file (key_file, self->filename, &error)))
g_warning ("Error saving keyfile to file %s: %s", self->filename, error->message);
return saved;
}
G_MODULE_EXPORT void
peas_register_types (PeasObjectModule *module)
{

View file

@ -62,6 +62,7 @@ void calls_sip_provider_load_accounts (CallsSipProvider *s
GKeyFile *key_file);
void calls_sip_provider_save_accounts (CallsSipProvider *self,
GKeyFile *key_file);
gboolean calls_sip_provider_save_accounts_to_disk (CallsSipProvider *self);
void peas_register_types (PeasObjectModule *module);
G_END_DECLS