2009-27-09 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / tests / dummyatk / resources_storage.c
1 #include <atk/atk.h>
2
3 GHashTable* resources = NULL;
4
5 void resource_storage_init()
6 {
7     if(resources == NULL)
8     resources = g_hash_table_new_full(g_str_hash, g_str_equal,
9         (GDestroyNotify)g_free, (GDestroyNotify)g_object_unref);
10 }
11
12 void resource_storage_free()
13 {
14     if(resources == NULL) return;
15     g_hash_table_destroy(resources);
16     resources = NULL;
17 }
18
19 void resource_storage_add(const gchar* name, AtkObject* resource)
20 {
21     if(resources == NULL) return;
22     g_hash_table_insert(resources, g_strdup(name), g_object_ref(resource));
23 }
24
25 AtkObject* resource_storage_get(const gchar* name)
26 {
27     if(resources == NULL) return NULL;
28     return g_hash_table_lookup(resources, name);
29 }
30 void resources_storage_remove(const gchar* name)
31 {
32     if(resources == NULL) return;
33     g_hash_table_remove(resources, name);
34 }