Commit 9d581bfe authored by Stephan Arts's avatar Stephan Arts

Cleanup file-monitors on file removal

parent d57356c0
......@@ -708,6 +708,14 @@ cb_file_monitor_changed (
{
case G_FILE_MONITOR_EVENT_DELETED:
rstto_image_list_remove_file ( image_list, r_file );
if (image_list->priv->dir_monitor == NULL)
{
image_list->priv->image_monitors = g_list_remove (
image_list->priv->image_monitors,
monitor);
g_object_unref (monitor);
monitor = NULL;
}
break;
case G_FILE_MONITOR_EVENT_CREATED:
rstto_image_list_add_file (image_list, r_file, NULL);
......@@ -720,6 +728,27 @@ cb_file_monitor_changed (
r_file = rstto_file_new (other_file);
rstto_image_list_add_file (image_list, r_file, NULL);
if (image_list->priv->dir_monitor == NULL)
{
image_list->priv->image_monitors = g_list_remove (
image_list->priv->image_monitors,
monitor);
g_object_unref (monitor);
monitor = g_file_monitor_file (
other_file,
G_FILE_MONITOR_NONE,
NULL,
NULL);
g_signal_connect (
G_OBJECT(monitor),
"changed",
G_CALLBACK (cb_file_monitor_changed),
image_list);
image_list->priv->image_monitors = g_list_prepend (
image_list->priv->image_monitors,
monitor);
}
break;
default:
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment