diff options
author | Ted Gould <ted@gould.cx> | 2010-03-24 20:29:54 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-03-24 20:29:54 -0500 |
commit | 9d667c37212143addd60bb99b6c53c98943a05ae (patch) | |
tree | 09510370ab9aaec57c015736fb9d0633860523cf /src | |
parent | 2597b609c3a84e80be1babbb547bac1ccb25f75f (diff) | |
download | ayatana-indicator-messages-9d667c37212143addd60bb99b6c53c98943a05ae.tar.gz ayatana-indicator-messages-9d667c37212143addd60bb99b6c53c98943a05ae.tar.bz2 ayatana-indicator-messages-9d667c37212143addd60bb99b6c53c98943a05ae.zip |
Changing to be more of a singleton type of thing. Really that makes more sense.
Diffstat (limited to 'src')
-rw-r--r-- | src/seen-db.c | 15 | ||||
-rw-r--r-- | src/seen-db.h | 8 |
2 files changed, 13 insertions, 10 deletions
diff --git a/src/seen-db.c b/src/seen-db.c index dd164f8..cf2293c 100644 --- a/src/seen-db.c +++ b/src/seen-db.c @@ -1,15 +1,20 @@ #include "seen-db.h" -SeenDB * +GHashTable * seendb = NULL; + +void seen_db_init(void) { - GHashTable * hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + if (seendb != NULL) { + return; + } - return hash; + seendb = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + return; } void -seen_db_add (SeenDB * seendb, const gchar * desktop) +seen_db_add (const gchar * desktop) { g_hash_table_insert(seendb, g_strdup(desktop), @@ -19,7 +24,7 @@ seen_db_add (SeenDB * seendb, const gchar * desktop) } gboolean -seen_db_seen (SeenDB * seendb, const gchar * desktop) +seen_db_seen (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 index f73c74e..0914e52 100644 --- a/src/seen-db.h +++ b/src/seen-db.h @@ -4,10 +4,8 @@ #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); +void seen_db_init(void); +void seen_db_add (const gchar * desktop); +gboolean seen_db_seen (const gchar * desktop); #endif /* SEEN_DB_H__ */ |