[Xfce4-commits] <thunar:master> Don't add duplicates of devices (bug #9440).

Nick Schermer noreply at xfce.org
Thu Nov 1 19:58:05 CET 2012


Updating branch refs/heads/master
         to 70a4301660b81ecd7dc13845bfa14b625fe2e311 (commit)
       from 6e4f1c2dd65eeb88776673aabb8c73f86eaad358 (commit)

commit 70a4301660b81ecd7dc13845bfa14b625fe2e311
Author: Lionel Le Folgoc <lionel at lefolgoc.net>
Date:   Thu Nov 1 19:56:16 2012 +0100

    Don't add duplicates of devices (bug #9440).
    
    On some setups the volume-added singal is emitted after the
    devices have been added, resulting in devices appear twice
    in the sidepane.

 thunar/thunar-device-monitor.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/thunar/thunar-device-monitor.c b/thunar/thunar-device-monitor.c
index b6c64ba..a246b95 100644
--- a/thunar/thunar-device-monitor.c
+++ b/thunar/thunar-device-monitor.c
@@ -476,6 +476,14 @@ thunar_device_monitor_volume_added (GVolumeMonitor      *volume_monitor,
   _thunar_return_if_fail (monitor->volume_monitor == volume_monitor);
   _thunar_return_if_fail (G_IS_VOLUME (volume));
 
+  /* check that the volume is not in the internal list already */
+  if (g_list_find (monitor->hidden_volumes, volume) != NULL)
+    return;
+
+  /* nor in the list of visible volumes */
+  if (g_hash_table_lookup (monitor->devices, volume) != NULL)
+    return;
+
   /* add to internal list */
   monitor->hidden_volumes = g_list_prepend (monitor->hidden_volumes, g_object_ref (volume));
 
@@ -621,6 +629,10 @@ thunar_device_monitor_mount_added (GVolumeMonitor      *volume_monitor,
   _thunar_return_if_fail (monitor->volume_monitor == volume_monitor);
   _thunar_return_if_fail (G_IS_MOUNT (mount));
 
+  /* check if the mount is not already known */
+  if (g_hash_table_lookup (monitor->devices, mount) != NULL)
+    return;
+
   /* never handle shadowed mounts */
   if (g_mount_is_shadowed (mount))
     return;


More information about the Xfce4-commits mailing list