summaryrefslogtreecommitdiff
path: root/endless/eosinit.c
diff options
context:
space:
mode:
authorJohn Hiesey <john@endlessm.com>2013-10-23 14:27:12 -0700
committerJohn Hiesey <john@endlessm.com>2013-10-24 09:54:18 -0700
commitf23425c58a95b586cb48c303c1e072e661d19785 (patch)
treeb8b58ef4eee939dccb808bbb235c43cf4acfbc7b /endless/eosinit.c
parentfb50c457ab4f2594208c74931e42ad4310368dcf (diff)
Read personality from keyfile instead of text file
[endlessm/eos-shell#1269]
Diffstat (limited to 'endless/eosinit.c')
-rw-r--r--endless/eosinit.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/endless/eosinit.c b/endless/eosinit.c
index 1d0a7a1..dec5375 100644
--- a/endless/eosinit.c
+++ b/endless/eosinit.c
@@ -76,7 +76,7 @@ eos_get_system_personality (void)
gchar *tmp;
tmp = g_strdup (g_getenv ("ENDLESS_OS_PERSONALITY"));
- if (tmp == '\0')
+ if (tmp != NULL && tmp[0] == '\0')
{
g_free (tmp);
tmp = NULL;
@@ -84,23 +84,33 @@ eos_get_system_personality (void)
if (tmp == NULL)
{
+ GKeyFile *personality_file = g_key_file_new ();
char *path = g_build_filename (SYSCONFDIR,
"EndlessOS",
- "personality.txt",
+ "personality.conf",
NULL);
GError *error = NULL;
- g_file_get_contents (path, &tmp, NULL, &error);
+ g_key_file_load_from_file (personality_file, path,
+ G_KEY_FILE_NONE, &error);
+
+ if (error == NULL)
+ tmp = g_key_file_get_string (personality_file, "Personality",
+ "PersonalityName", &error);
+
if (error != NULL)
{
g_critical ("No personality defined: %s", error->message);
g_error_free (error);
tmp = NULL;
}
+
+ g_key_file_free (personality_file);
+ g_free (path);
}
if (tmp == NULL)
- tmp = g_strdup ("Default");
+ tmp = g_strdup ("default");
g_once_init_leave (&personality, tmp);
}