[gnome-online-accounts/wip/rishi/templates: 8/10] daemon: Use a instance variable for the main user configuration file
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/wip/rishi/templates: 8/10] daemon: Use a instance variable for the main user configuration file
- Date: Fri, 26 Aug 2016 19:06:48 +0000 (UTC)
commit 54d70f7150b8590499329f2f3e1d0275f03e2b67
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Aug 26 20:55:08 2016 +0200
daemon: Use a instance variable for the main user configuration file
We are already using it in multiple places. We will use it even more
when we add support for templates.
src/daemon/goadaemon.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
index a01fc63..0c73a79 100644
--- a/src/daemon/goadaemon.c
+++ b/src/daemon/goadaemon.c
@@ -40,6 +40,7 @@ struct _GoaDaemon
GFileMonitor *system_conf_dir_monitor;
GFileMonitor *home_conf_file_monitor;
GFileMonitor *home_conf_dir_monitor;
+ gchar *home_conf_file_path;
GNetworkMonitor *network_monitor;
@@ -166,6 +167,7 @@ goa_daemon_finalize (GObject *object)
g_object_unref (self->home_conf_file_monitor);
}
+ g_free (self->home_conf_file_path);
g_object_unref (self->manager);
g_object_unref (self->object_manager);
g_object_unref (self->connection);
@@ -315,11 +317,10 @@ goa_daemon_init (GoaDaemon *self)
g_free (path);
/* set up file monitoring */
- path = g_strdup_printf ("%s/goa-1.0/accounts.conf", g_get_user_config_dir ());
- self->home_conf_file_monitor = create_monitor (path, FALSE);
+ self->home_conf_file_path = g_strdup_printf ("%s/goa-1.0/accounts.conf", g_get_user_config_dir ());
+ self->home_conf_file_monitor = create_monitor (self->home_conf_file_path, FALSE);
if (self->home_conf_file_monitor != NULL)
g_signal_connect (self->home_conf_file_monitor, "changed", G_CALLBACK (on_file_monitor_changed), self);
- g_free (path);
/* prime the list of accounts */
goa_daemon_reload_configuration (self);
@@ -823,7 +824,6 @@ static void
goa_daemon_reload_configuration (GoaDaemon *self)
{
GHashTable *group_name_to_key_file_data;
- gchar *path;
group_name_to_key_file_data = g_hash_table_new_full (g_str_hash,
g_str_equal,
@@ -831,9 +831,7 @@ goa_daemon_reload_configuration (GoaDaemon *self)
(GDestroyNotify) key_file_data_free);
/* Read the main user config file at $HOME/.config/goa-1.0/accounts.conf */
- path = g_strdup_printf ("%s/goa-1.0/accounts.conf", g_get_user_config_dir ());
- add_config_file (self, path, group_name_to_key_file_data);
- g_free (path);
+ add_config_file (self, self->home_conf_file_path, group_name_to_key_file_data);
/* now process the group_name_to_key_file_data hash table */
process_config_entries (self, group_name_to_key_file_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]