[Xfce4-commits] <ristretto:ristretto-0.3> Cleanup file-monitors on file removal

Stephan Arts noreply at xfce.org
Sat Mar 10 21:46:04 CET 2012


Updating branch refs/heads/ristretto-0.3
         to eb6a5e421fcc9fdf8703e4ebd0eb0764e09df77d (commit)
       from 08509337e10bd43d1d826e7de0163a9fae8b3615 (commit)

commit eb6a5e421fcc9fdf8703e4ebd0eb0764e09df77d
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 31fcb85..9d52341 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -541,6 +541,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);
@@ -553,6 +561,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