2015-12-21 10:09:05 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2015 (c) Anna Schumaker.
|
|
|
|
*/
|
|
|
|
#include <gui/settings.h>
|
|
|
|
|
|
|
|
static GHashTable *gui_settings = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
void gui_settings_init()
|
|
|
|
{
|
|
|
|
gui_settings = g_hash_table_new_full(g_str_hash, g_str_equal,
|
|
|
|
g_free, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void gui_settings_deinit()
|
|
|
|
{
|
|
|
|
g_hash_table_destroy(gui_settings);
|
|
|
|
gui_settings = NULL;
|
|
|
|
}
|
|
|
|
|
2015-12-21 10:35:32 -05:00
|
|
|
void gui_settings_set(const gchar *key, unsigned int value)
|
|
|
|
{
|
|
|
|
if (gui_settings)
|
|
|
|
g_hash_table_replace(gui_settings, g_strdup(key),
|
|
|
|
GUINT_TO_POINTER(value));
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int gui_settings_get(const gchar *key)
|
|
|
|
{
|
|
|
|
unsigned int ret = 0;
|
|
|
|
if (gui_settings)
|
|
|
|
ret = GPOINTER_TO_UINT(g_hash_table_lookup(gui_settings, key));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-21 10:09:05 -05:00
|
|
|
#ifdef CONFIG_TESTING
|
|
|
|
GHashTable *test_get_gui_settings()
|
|
|
|
{
|
|
|
|
return gui_settings;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_TESTING */
|