summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chimento <philip@endlessm.com>2015-12-15 22:01:07 -0800
committerCosimo Cecchi <cosimo@endlessm.com>2015-12-29 10:39:14 -0800
commit94b034a52837c129d8a8c0092182b44305c54755 (patch)
treea53eb544846327c21e6eeb9d8b03438f56189020
parent9936f8e7d5e254d6435a33f51a903dbba6dee7a3 (diff)
Move utility functions to new eosutil.c
We have one utility function currently living in eosinit.c. Since we are about to have another one, we should put them in a file for utility functions. [endlessm/eos-sdk#3930]
-rw-r--r--endless/Makefile.am1
-rw-r--r--endless/eosinit.c65
-rw-r--r--endless/eosutil.c68
3 files changed, 69 insertions, 65 deletions
diff --git a/endless/Makefile.am b/endless/Makefile.am
index 4640cde..c49684d 100644
--- a/endless/Makefile.am
+++ b/endless/Makefile.am
@@ -49,6 +49,7 @@ endless_library_sources = \
endless/eospagemanager.c \
endless/eosresource.c endless/eosresource-private.h \
endless/eostopbar.c endless/eostopbar-private.h \
+ endless/eosutil.c \
endless/eoswindow.c \
endless/eosflexygrid.c endless/eosflexygridcell.c endless/eosflexygrid-private.h
diff --git a/endless/eosinit.c b/endless/eosinit.c
index dec5375..19d6d9b 100644
--- a/endless/eosinit.c
+++ b/endless/eosinit.c
@@ -52,68 +52,3 @@ eos_is_inited (void)
{
return _eos_initialized;
}
-
-/**
- * eos_get_system_personality:
- *
- * Retrieves the "personality" of the system.
- *
- * The personality is a unique string that identifies the installation
- * of EndlessOS for a specific country or audience. The availability of
- * certain applications, or their content, is determined by this value.
- *
- * Return value: (transfer none): a string, owned by the Endless SDK,
- * with the name of the personality. You should never free or modify
- * the returned string.
- */
-const gchar *
-eos_get_system_personality (void)
-{
- static gchar *personality;
-
- if (g_once_init_enter (&personality))
- {
- gchar *tmp;
-
- tmp = g_strdup (g_getenv ("ENDLESS_OS_PERSONALITY"));
- if (tmp != NULL && tmp[0] == '\0')
- {
- g_free (tmp);
- tmp = NULL;
- }
-
- if (tmp == NULL)
- {
- GKeyFile *personality_file = g_key_file_new ();
- char *path = g_build_filename (SYSCONFDIR,
- "EndlessOS",
- "personality.conf",
- NULL);
-
- GError *error = NULL;
- 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");
-
- g_once_init_leave (&personality, tmp);
- }
-
- return personality;
-}
diff --git a/endless/eosutil.c b/endless/eosutil.c
new file mode 100644
index 0000000..6ef12bf
--- /dev/null
+++ b/endless/eosutil.c
@@ -0,0 +1,68 @@
+#include <glib.h>
+
+#include "endless.h"
+
+/**
+ * eos_get_system_personality:
+ *
+ * Retrieves the "personality" of the system.
+ *
+ * The personality is a unique string that identifies the installation
+ * of EndlessOS for a specific country or audience. The availability of
+ * certain applications, or their content, is determined by this value.
+ *
+ * Return value: (transfer none): a string, owned by the Endless SDK,
+ * with the name of the personality. You should never free or modify
+ * the returned string.
+ */
+const gchar *
+eos_get_system_personality (void)
+{
+ static gchar *personality;
+
+ if (g_once_init_enter (&personality))
+ {
+ gchar *tmp;
+
+ tmp = g_strdup (g_getenv ("ENDLESS_OS_PERSONALITY"));
+ if (tmp != NULL && tmp[0] == '\0')
+ {
+ g_free (tmp);
+ tmp = NULL;
+ }
+
+ if (tmp == NULL)
+ {
+ GKeyFile *personality_file = g_key_file_new ();
+ char *path = g_build_filename (SYSCONFDIR,
+ "EndlessOS",
+ "personality.conf",
+ NULL);
+
+ GError *error = NULL;
+ 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");
+
+ g_once_init_leave (&personality, tmp);
+ }
+
+ return personality;
+}