gvfs r2338 - in trunk: . monitor/proxy



Author: alexl
Date: Tue Mar 17 16:07:59 2009
New Revision: 2338
URL: http://svn.gnome.org/viewvc/gvfs?rev=2338&view=rev

Log:
2009-03-17  Alexander Larsson  <alexl redhat com>

        Bug 575552 â icons for audio cds duplicated on the desktop after remounts

        * monitor/proxy/gproxyvolumemonitor.c:
	Dispose volumes when removed

        * monitor/proxy/gproxyvolume.c:
	When disposed, disconnect from union volume monitor so that we don't get
	a mount_added for a later mount and create a shadow mount for that.



Modified:
   trunk/ChangeLog
   trunk/monitor/proxy/gproxyvolume.c
   trunk/monitor/proxy/gproxyvolumemonitor.c

Modified: trunk/monitor/proxy/gproxyvolume.c
==============================================================================
--- trunk/monitor/proxy/gproxyvolume.c	(original)
+++ trunk/monitor/proxy/gproxyvolume.c	Tue Mar 17 16:07:59 2009
@@ -122,38 +122,58 @@
   if (volume->identifiers != NULL)
     g_hash_table_unref (volume->identifiers);
 
+  if (volume->volume_monitor != NULL)
+    {
+      g_object_unref (volume->volume_monitor);
+    }
+
+  g_hash_table_unref (volume->hash_mount_op_id_to_data);
+
+  if (G_OBJECT_CLASS (g_proxy_volume_parent_class)->finalize)
+    (*G_OBJECT_CLASS (g_proxy_volume_parent_class)->finalize) (object);
+}
+
+static void
+g_proxy_volume_dispose (GObject *object)
+{
+  GProxyVolume *volume;
+
+  volume = G_PROXY_VOLUME (object);
+
   if (volume->shadow_mount != NULL)
     {
       signal_emit_in_idle (volume->shadow_mount, "unmounted", NULL);
       signal_emit_in_idle (volume->volume_monitor, "mount-removed", volume->shadow_mount);
       g_proxy_shadow_mount_remove (volume->shadow_mount);
       g_object_unref (volume->shadow_mount);
+      
+      volume->shadow_mount = NULL;
     }
-
+  
   if (volume->union_monitor != NULL)
     {
-      g_signal_handlers_disconnect_by_func (volume->union_monitor, union_monitor_mount_added, volume);
-      g_signal_handlers_disconnect_by_func (volume->union_monitor, union_monitor_mount_removed, volume);
-      g_signal_handlers_disconnect_by_func (volume->union_monitor, union_monitor_mount_changed, volume);
+      g_signal_handlers_disconnect_by_func (volume->union_monitor,
+                                            union_monitor_mount_added, volume);
+      g_signal_handlers_disconnect_by_func (volume->union_monitor,
+                                            union_monitor_mount_removed, volume);
+      g_signal_handlers_disconnect_by_func (volume->union_monitor,
+                                            union_monitor_mount_changed, volume);
       g_object_unref (volume->union_monitor);
-    }
 
-  if (volume->volume_monitor != NULL)
-    {
-      g_object_unref (volume->volume_monitor);
+      volume->union_monitor = NULL;
     }
-
-  g_hash_table_unref (volume->hash_mount_op_id_to_data);
-
-  if (G_OBJECT_CLASS (g_proxy_volume_parent_class)->finalize)
-    (*G_OBJECT_CLASS (g_proxy_volume_parent_class)->finalize) (object);
+  
+  if (G_OBJECT_CLASS (g_proxy_volume_parent_class)->dispose)
+    (*G_OBJECT_CLASS (g_proxy_volume_parent_class)->dispose) (object);
 }
 
+
 static void
 g_proxy_volume_class_init (GProxyVolumeClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
+  gobject_class->dispose = g_proxy_volume_dispose;
   gobject_class->finalize = g_proxy_volume_finalize;
 }
 

Modified: trunk/monitor/proxy/gproxyvolumemonitor.c
==============================================================================
--- trunk/monitor/proxy/gproxyvolumemonitor.c	(original)
+++ trunk/monitor/proxy/gproxyvolumemonitor.c	Tue Mar 17 16:07:59 2009
@@ -72,6 +72,8 @@
 
 static void signal_emit_in_idle (gpointer object, const char *signal_name, gpointer other_object);
 
+static void dispose_in_idle (gpointer object);
+
 static gboolean is_supported (GProxyVolumeMonitorClass *klass);
 
 /* The is_supported API is kinda lame and doesn't pass in the class,
@@ -517,6 +519,21 @@
   g_idle_add ((GSourceFunc) signal_emit_in_idle_do, data);
 }
 
+static gboolean
+dispose_in_idle_do (GObject *object)
+{
+  g_object_run_dispose (object);
+  g_object_unref (object);
+
+  return FALSE;
+}
+
+static void
+dispose_in_idle (gpointer object)
+{
+  g_idle_add ((GSourceFunc) dispose_in_idle_do, g_object_ref (object));
+}
+
 
 
 static DBusHandlerResult
@@ -734,6 +751,7 @@
               g_hash_table_remove (monitor->volumes, id);
               signal_emit_in_idle (volume, "removed", NULL);
               signal_emit_in_idle (monitor, "volume-removed", volume);
+              dispose_in_idle (volume);
               g_object_unref (volume);
             }
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]