diff options
author | Ted Gould <ted@canonical.com> | 2009-08-21 15:12:51 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-08-21 15:12:51 -0500 |
commit | 51992ee519580718b3904adaabc76004dba6f323 (patch) | |
tree | 87d1138ee0ae25b328664b99ae6f00e91b362794 /src/messages-service.c | |
parent | 10a149cf899e14f6ef5dd4be97d21f450fd8bd0f (diff) | |
download | ayatana-indicator-messages-51992ee519580718b3904adaabc76004dba6f323.tar.gz ayatana-indicator-messages-51992ee519580718b3904adaabc76004dba6f323.tar.bz2 ayatana-indicator-messages-51992ee519580718b3904adaabc76004dba6f323.zip |
I'd have to say that hash_table_find didn't do what I expected, and is pretty useless.
Diffstat (limited to 'src/messages-service.c')
-rw-r--r-- | src/messages-service.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/messages-service.c b/src/messages-service.c index 9c015e2..7d48769 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -261,14 +261,6 @@ blacklist_add (gpointer udata) return FALSE; } -/* Looks through the list of definition files and - tries to match the one passed in. */ -static gboolean -blacklist_find_def (gpointer key, gpointer value, gpointer data) -{ - return !g_strcmp0((gchar *)value, (gchar *)data); -} - /* Remove a black list item based on the definition file and uneclipse those launchers blocked by it. */ static gboolean @@ -277,8 +269,19 @@ blacklist_remove (gpointer data) gchar * definition_file = (gchar *)data; g_debug("Removing: %s", definition_file); - gpointer key = g_hash_table_find(blacklist, blacklist_find_def, data); - if (key == NULL) { + GHashTableIter iter; + gpointer key, value; + gboolean found = FALSE; + + g_hash_table_iter_init(&iter, blacklist); + while (g_hash_table_iter_next(&iter, &key, &value)) { + if (!g_strcmp0((gchar *)value, definition_file)) { + found = TRUE; + break; + } + } + + if (!found) { g_debug("\tNot found!"); return FALSE; } @@ -300,7 +303,9 @@ blacklist_remove (gpointer data) } } - g_hash_table_remove(blacklist, key); + if (!g_hash_table_remove(blacklist, key)) { + g_warning("Unable to remove '%s' with value '%s'", definition_file, (gchar *)key); + } return FALSE; } |