aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-08-21 14:01:38 -0500
committerTed Gould <ted@canonical.com>2009-08-21 14:01:38 -0500
commit33e07dab3aafaf7219b3284a95ad4f16755d677d (patch)
treeced58358d917b817a64784e6b75b5f2277c7f1b0 /src
parent79f4b7e53cc1a26d37de1daf98fdcb9a6f803aa8 (diff)
downloadayatana-indicator-messages-33e07dab3aafaf7219b3284a95ad4f16755d677d.tar.gz
ayatana-indicator-messages-33e07dab3aafaf7219b3284a95ad4f16755d677d.tar.bz2
ayatana-indicator-messages-33e07dab3aafaf7219b3284a95ad4f16755d677d.zip
Turning blacklist dir changes into events
Diffstat (limited to 'src')
-rw-r--r--src/messages-service.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/messages-service.c b/src/messages-service.c
index b153eda..4e03c26 100644
--- a/src/messages-service.c
+++ b/src/messages-service.c
@@ -53,7 +53,7 @@ static gboolean build_launcher (gpointer data);
static gboolean build_launchers (gpointer data);
static gboolean blacklist_init (gpointer data);
static gboolean blacklist_add (gpointer data);
-static void blacklist_remove (const gchar * definition_file);
+static gboolean blacklist_remove (gpointer data);
static void blacklist_dir_changed (GFileMonitor * monitor, GFile * file, GFile * other_file, GFileMonitorEvent event_type, gpointer user_data);
static void app_dir_changed (GFileMonitor * monitor, GFile * file, GFile * other_file, GFileMonitorEvent event_type, gpointer user_data);
@@ -258,17 +258,18 @@ blacklist_add (gpointer udata)
}
}
- blacklist_remove(NULL);
return FALSE;
}
/* Remove a black list item based on the definition file
and uneclipse those launchers blocked by it. */
-static void
-blacklist_remove (const gchar * definition_file)
+static gboolean
+blacklist_remove (gpointer data)
{
+ gchar * definition_file = (gchar *)data;
+ g_debug("Removing: %s", definition_file);
- return;
+ return FALSE;
}
/* Check to see if a particular desktop file is
@@ -294,6 +295,23 @@ blacklist_dir_changed (GFileMonitor * monitor, GFile * file, GFile * other_file,
{
g_debug("Blacklist directory changed!");
+ switch (event_type) {
+ case G_FILE_MONITOR_EVENT_DELETED: {
+ gchar * path = g_file_get_path(file);
+ g_debug("\tDelete: %s", path);
+ g_idle_add(blacklist_remove, path);
+ break;
+ }
+ case G_FILE_MONITOR_EVENT_CREATED: {
+ gchar * path = g_file_get_path(file);
+ g_debug("\tCreate: %s", path);
+ g_idle_add(blacklist_add, path);
+ break;
+ }
+ default:
+ break;
+ }
+
return;
}