aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-08-20 14:59:45 -0500
committerTed Gould <ted@canonical.com>2009-08-20 14:59:45 -0500
commit528c37375ce30f80c2ca0376d62fd41a3629b66e (patch)
tree28b2655ad99c0a21925fac9d2ad2346156c676b0
parentee713f22dd253cf6e757f3ffb4ec839dad91bf31 (diff)
downloadayatana-indicator-messages-528c37375ce30f80c2ca0376d62fd41a3629b66e.tar.gz
ayatana-indicator-messages-528c37375ce30f80c2ca0376d62fd41a3629b66e.tar.bz2
ayatana-indicator-messages-528c37375ce30f80c2ca0376d62fd41a3629b66e.zip
Fleshing out the add function. Just a little.
-rw-r--r--src/messages-service.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/messages-service.c b/src/messages-service.c
index 1ff97ca..e4290f4 100644
--- a/src/messages-service.c
+++ b/src/messages-service.c
@@ -167,6 +167,8 @@ static GHashTable * blacklist = NULL;
static void
blacklist_init (gpointer data)
{
+ blacklist = g_hash_table_new_full(g_str_hash, g_str_equal,
+ g_free, g_free);
return;
}
@@ -174,8 +176,46 @@ blacklist_init (gpointer data)
/* Add a definition file into the black list and eclipse
and launchers that have the same file. */
static void
-blacklist_add (const gchar * definition_file)
+blacklist_add (gchar * definition_file)
{
+ /* Dump the file */
+ gchar * desktop;
+ g_file_get_contents(definition_file, &desktop, NULL, NULL);
+ if (desktop == NULL) {
+ g_warning("Couldn't get data out of: %s", definition_file);
+ return;
+ }
+
+ /* Clean up the data */
+ gchar * trimdesktop = pango_trim_string(desktop);
+ g_free(desktop);
+
+ /* Check for conflicts */
+ gpointer data = g_hash_table_lookup(blacklist, trimdesktop);
+ if (data != NULL) {
+ gchar * oldfile = (gchar *)data;
+ if (!g_strcmp0(oldfile, definition_file)) {
+ g_warning("Already added file '%s'", oldfile);
+ } else {
+ g_warning("Already have desktop file '%s' in blacklist file '%s' not adding from '%s'", trimdesktop, oldfile, definition_file);
+ }
+
+ g_free(trimdesktop);
+ return;
+ }
+
+ /* Actually blacklist this thing */
+ g_hash_table_insert(blacklist, trimdesktop, definition_file);
+ g_debug("Adding Blacklist item '%s' for desktop '%s'", definition_file, trimdesktop);
+
+ /* Go through and eclipse folks */
+ GList * launcher;
+ for (launcher = launcherList; launcher != NULL; launcher = launcher->next) {
+ launcherList_t * item = (launcherList_t *)launcher->data;
+ if (!g_strcmp0(trimdesktop, launcher_menu_item_get_desktop(item->menuitem))) {
+ launcher_menu_item_set_eclipsed(item->menuitem, TRUE);
+ }
+ }
return;
}