Commit d6df1e84 authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Federico Mena Quintero

Fixes bug #171073:

2005-09-08  Federico Mena Quintero  <federico@ximian.com>

	Fixes bug #171073:

	* libnautilus-private/nautilus-trash-directory.c
	(nautilus_trash_directory_instance_init): In addition to
	connecting to "volume_pre_unmount" on the volume monitor, also
	connect to "volume_unmounted".  This will let the trash clean up
	its merged directory even if the unmount is not initiated from
	Nautilus.

	* libnautilus-private/nautilus-merged-directory.c
	(merged_remove_real_directory): When a real directory is removed
	from the merged directory, emit notifications to that effect.
	This lets the trash window remove the icons that used to
	correspond to a volume that got unmounted.
	(real_directory_notify_files_removed): New utility function.
parent 293fe087
2005-09-08 Federico Mena Quintero <federico@ximian.com>
Fixes bug #171073:
* libnautilus-private/nautilus-trash-directory.c
(nautilus_trash_directory_instance_init): In addition to
connecting to "volume_pre_unmount" on the volume monitor, also
connect to "volume_unmounted". This will let the trash clean up
its merged directory even if the unmount is not initiated from
Nautilus.
* libnautilus-private/nautilus-merged-directory.c
(merged_remove_real_directory): When a real directory is removed
from the merged directory, emit notifications to that effect.
This lets the trash window remove the icons that used to
correspond to a volume that got unmounted.
(real_directory_notify_files_removed): New utility function.
2005-09-06 Christian Neumair <chris@gnome-de.org>
* src/file-manager/fm-list-view.c: (fm_list_view_init): Ensure that
......
......@@ -27,6 +27,7 @@
#include "nautilus-merged-directory.h"
#include "nautilus-directory-private.h"
#include "nautilus-directory-notify.h"
#include "nautilus-file.h"
#include <eel/eel-glib-extensions.h>
#include <gtk/gtksignal.h>
......@@ -539,6 +540,31 @@ monitor_remove_directory (gpointer key,
(NAUTILUS_DIRECTORY (callback_data), value);
}
static void
real_directory_notify_files_removed (NautilusDirectory *real_directory)
{
GList *files, *l;
files = nautilus_directory_get_file_list (real_directory);
for (l = files; l; l = l->next) {
NautilusFile *file;
char *uri;
file = NAUTILUS_FILE (l->data);
uri = nautilus_file_get_uri (file);
nautilus_file_unref (file);
l->data = uri;
}
if (files) {
nautilus_directory_notify_files_removed (files);
}
eel_g_list_free_deep (files);
}
static void
merged_remove_real_directory (NautilusMergedDirectory *merged,
NautilusDirectory *real_directory)
......@@ -547,6 +573,9 @@ merged_remove_real_directory (NautilusMergedDirectory *merged,
g_return_if_fail (NAUTILUS_IS_DIRECTORY (real_directory));
g_return_if_fail (g_list_find (merged->details->directories, real_directory) != NULL);
/* Since the real directory will be going away, act as if files were removed */
real_directory_notify_files_removed (real_directory);
/* Remove this directory from callbacks and monitors. */
eel_g_hash_table_safe_for_each (merged->details->callbacks,
merged_callback_remove_directory_cover,
......
......@@ -264,6 +264,14 @@ volume_mounted_callback (GnomeVFSVolumeMonitor *monitor,
add_volume (trash, volume);
}
static void
volume_unmounted_callback (GnomeVFSVolumeMonitor *monitor,
GnomeVFSVolume *volume,
NautilusTrashDirectory *trash)
{
remove_volume (trash, volume);
}
static void
nautilus_trash_directory_instance_init (NautilusTrashDirectory *trash)
{
......@@ -278,6 +286,8 @@ nautilus_trash_directory_instance_init (NautilusTrashDirectory *trash)
G_CALLBACK (volume_mounted_callback), trash, 0);
g_signal_connect_object (volume_monitor, "volume_pre_unmount",
G_CALLBACK (volume_unmount_started_callback), trash, 0);
g_signal_connect_object (volume_monitor, "volume_unmounted",
G_CALLBACK (volume_unmounted_callback), trash, 0);
}
/* Finish initializing a new NautilusTrashDirectory. We have to do the
......
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