diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/seen-db.c | 25 | ||||
-rw-r--r-- | src/seen-db.h | 13 |
3 files changed, 40 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index c96ef2d..7c9842a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,6 +32,8 @@ indicator_messages_service_SOURCES = \ app-menu-item.h \ launcher-menu-item.c \ launcher-menu-item.h \ + seen-db.c \ + seen-db.h \ dirs.h \ dbus-data.h indicator_messages_service_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed -Werror diff --git a/src/seen-db.c b/src/seen-db.c new file mode 100644 index 0000000..dd164f8 --- /dev/null +++ b/src/seen-db.c @@ -0,0 +1,25 @@ +#include "seen-db.h" + +SeenDB * +seen_db_init(void) +{ + GHashTable * hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + + return hash; +} + +void +seen_db_add (SeenDB * seendb, const gchar * desktop) +{ + g_hash_table_insert(seendb, + g_strdup(desktop), + GINT_TO_POINTER(TRUE)); + + return; +} + +gboolean +seen_db_seen (SeenDB * seendb, const gchar * desktop) +{ + return GPOINTER_TO_INT(g_hash_table_lookup(seendb, desktop)); +} diff --git a/src/seen-db.h b/src/seen-db.h new file mode 100644 index 0000000..f73c74e --- /dev/null +++ b/src/seen-db.h @@ -0,0 +1,13 @@ + +#ifndef SEEN_DB_H__ +#define SEEN_DB_H__ 1 + +#include <glib.h> + +typedef GHashTable SeenDB; + +SeenDB * seen_db_init(void); +void seen_db_add (SeenDB * seendb, const gchar * desktop); +gboolean seen_db_seen (SeenDB * seendb, const gchar * desktop); + +#endif /* SEEN_DB_H__ */ |