aboutsummaryrefslogtreecommitdiff
path: root/src/seen-db.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-03-24 21:22:49 -0500
committerTed Gould <ted@gould.cx>2010-03-24 21:22:49 -0500
commitaf3e958c5a95d419aacdbf6d332935f02a06c57f (patch)
tree06339db7908c625600ddb1ea40691b9de1a2690a /src/seen-db.c
parent288cb93d92574b947ab5addafcbf58fc7d907670 (diff)
downloadayatana-indicator-messages-af3e958c5a95d419aacdbf6d332935f02a06c57f.tar.gz
ayatana-indicator-messages-af3e958c5a95d419aacdbf6d332935f02a06c57f.tar.bz2
ayatana-indicator-messages-af3e958c5a95d419aacdbf6d332935f02a06c57f.zip
Have a background process for writing out the seen DB
Diffstat (limited to 'src/seen-db.c')
-rw-r--r--src/seen-db.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/seen-db.c b/src/seen-db.c
index 7849781..6429c13 100644
--- a/src/seen-db.c
+++ b/src/seen-db.c
@@ -5,6 +5,7 @@
GHashTable * seendb = NULL;
gchar * filename = NULL;
+guint write_process = 0;
void
seen_db_init(void)
@@ -57,9 +58,25 @@ seen_db_init(void)
return;
}
+static gboolean
+write_seen_db (gpointer user_data)
+{
+ write_process = 0;
+ return FALSE;
+}
+
void
seen_db_add (const gchar * desktop)
{
+ if (!seen_db_seen(desktop)) {
+ if (write_process != 0) {
+ g_source_remove(write_process);
+ write_process = 0;
+ }
+
+ write_process = g_timeout_add_seconds(300, write_seen_db, NULL);
+ }
+
g_hash_table_insert(seendb,
g_strdup(desktop),
GINT_TO_POINTER(TRUE));