aboutsummaryrefslogtreecommitdiff
path: root/src/seen-db.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-03-24 21:27:59 -0500
committerTed Gould <ted@gould.cx>2010-03-24 21:27:59 -0500
commit6e638f602e5765f16b9b7a5f58a5c09f1ffec2ef (patch)
treecf32811d14fdfbeebf167c2e6c734a443bc533af /src/seen-db.c
parent347750ba909a005d9529c6054f33dbe15fe8fa6c (diff)
downloadayatana-indicator-messages-6e638f602e5765f16b9b7a5f58a5c09f1ffec2ef.tar.gz
ayatana-indicator-messages-6e638f602e5765f16b9b7a5f58a5c09f1ffec2ef.tar.bz2
ayatana-indicator-messages-6e638f602e5765f16b9b7a5f58a5c09f1ffec2ef.zip
More comments
Diffstat (limited to 'src/seen-db.c')
-rw-r--r--src/seen-db.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/seen-db.c b/src/seen-db.c
index 09e67df..4c900be 100644
--- a/src/seen-db.c
+++ b/src/seen-db.c
@@ -49,17 +49,20 @@ seen_db_init(void)
if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
GKeyFile * keyfile = g_key_file_new();
+ /* Load from file */
if (!g_key_file_load_from_file(keyfile, filename, G_KEY_FILE_NONE, NULL)) {
g_key_file_free(keyfile);
keyfile = NULL;
}
+ /* Check for keys */
if (keyfile != NULL && !g_key_file_has_key(keyfile, GROUP_NAME, KEY_NAME, NULL)) {
g_warning("Seen DB '%s' does not have key '%s' in group '%s'", filename, KEY_NAME, GROUP_NAME);
g_key_file_free(keyfile);
keyfile = NULL;
}
+ /* Grab them and put in DB */
if (keyfile != NULL) {
gchar ** desktops = g_key_file_get_string_list(keyfile, GROUP_NAME, KEY_NAME, NULL, NULL);
gint i = 0;
@@ -73,6 +76,7 @@ seen_db_init(void)
g_strfreev(desktops);
}
+ /* Clean up our file */
if (keyfile != NULL) {
g_key_file_free(keyfile);
}
@@ -95,6 +99,8 @@ write_seen_db (gpointer user_data)
void
seen_db_add (const gchar * desktop)
{
+ /* If this is a new one, let's set up the timer. If
+ there's already one clear it. */
if (!seen_db_seen(desktop)) {
if (write_process != 0) {
g_source_remove(write_process);