[Xfce4-commits] <ristretto:master> Cleanup file-monitors on file removal
Stephan Arts
noreply at xfce.org
Sat Mar 10 21:30:02 CET 2012
Updating branch refs/heads/master
to 9d581bfe9fd32b1b18ed7e3c0841b25f71eabc20 (commit)
from d57356c0c184f8ab6c1ec4116f5de8f8534425c2 (commit)
commit 9d581bfe9fd32b1b18ed7e3c0841b25f71eabc20
Author: Stephan Arts <stephan at xfce.org>
Date: Sat Mar 10 21:27:59 2012 +0100
Cleanup file-monitors on file removal
src/image_list.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/src/image_list.c b/src/image_list.c
index a56d54e..124ebf8 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -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;
More information about the Xfce4-commits
mailing list