ocarina/gui/settings.c

43 lines
781 B
C
Raw Normal View History

/*
* 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;
}
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;
}
#ifdef CONFIG_TESTING
GHashTable *test_get_gui_settings()
{
return gui_settings;
}
#endif /* CONFIG_TESTING */