Commit b32d6453 authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Only use directory monitors to avoid using lots and lots of file monitors.

2005-09-06  Alexander Larsson  <alexl@redhat.com>

	* libnautilus-private/nautilus-directory-async.c:
	(nautilus_directory_monitor_add_internal),
	(nautilus_directory_monitor_remove_internal):
	* libnautilus-private/nautilus-file-private.h:
	* libnautilus-private/nautilus-file.c: (finalize):
	Only use directory monitors to avoid using lots and lots of
	file monitors. This is an optimization in almost all cases, although
	it does a bit more work when viewing a file properties dialog with the
	containing folder window hidden. (#315041)
parent 5f2794ae
2005-09-06 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-directory-async.c:
(nautilus_directory_monitor_add_internal),
(nautilus_directory_monitor_remove_internal):
* libnautilus-private/nautilus-file-private.h:
* libnautilus-private/nautilus-file.c: (finalize):
Only use directory monitors to avoid using lots and lots of
file monitors. This is an optimization in almost all cases, although
it does a bit more work when viewing a file properties dialog with the
containing folder window hidden. (#315041)
2005-09-06 Christian Neumair <chris@gnome-de.org>
* src/file-manager/fm-directory-view.c: (add_extension_menu_items),
......
......@@ -479,35 +479,6 @@ find_monitor (NautilusDirectory *directory,
monitor_key_compare);
}
static int
monitor_file_compare (gconstpointer a,
gconstpointer data)
{
const Monitor *monitor;
NautilusFile *file;
monitor = a;
file = (NautilusFile *) data;
if (monitor->file < file) {
return -1;
}
if (monitor->file > file) {
return +1;
}
return 0;
}
static gboolean
find_any_monitor (NautilusDirectory *directory,
NautilusFile *file)
{
return g_list_find_custom (directory->details->monitor_list,
file,
monitor_file_compare) != NULL;
}
static void
remove_monitor_link (NautilusDirectory *directory,
GList *link)
......@@ -623,7 +594,6 @@ nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
{
Monitor *monitor;
GList *file_list;
char *file_uri;
g_assert (NAUTILUS_IS_DIRECTORY (directory));
......@@ -649,16 +619,12 @@ nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
}
/* Start the "real" monitoring (FAM or whatever). */
if (file == NULL) {
if (directory->details->monitor == NULL) {
directory->details->monitor = nautilus_monitor_directory (directory->details->uri);
}
} else {
if (file->details->monitor == NULL) {
file_uri = nautilus_file_get_uri (file);
file->details->monitor = nautilus_monitor_file (file_uri);
g_free (file_uri);
}
/* We always monitor the whole directory since in practice
* nautilus almost always shows the whole directory anyway, and
* it allows us to avoid one file monitor per file in a directory.
*/
if (directory->details->monitor == NULL) {
directory->details->monitor = nautilus_monitor_directory (directory->details->uri);
}
/* We could just call update_metadata_monitors here, but we can be smarter
......@@ -1129,18 +1095,10 @@ nautilus_directory_monitor_remove_internal (NautilusDirectory *directory,
remove_monitor (directory, file, client);
if (file == NULL) {
if (directory->details->monitor != NULL
&& !find_any_monitor (directory, NULL)) {
nautilus_monitor_cancel (directory->details->monitor);
directory->details->monitor = NULL;
}
} else {
if (file->details->monitor != NULL
&& !find_any_monitor (directory, file)) {
nautilus_monitor_cancel (file->details->monitor);
file->details->monitor = NULL;
}
if (directory->details->monitor != NULL
&& directory->details->monitor_list == NULL) {
nautilus_monitor_cancel (directory->details->monitor);
directory->details->monitor = NULL;
}
update_metadata_monitors (directory);
......
......@@ -65,8 +65,6 @@ struct NautilusFileDetails
GnomeVFSFileInfo *info;
GnomeVFSResult get_info_error;
NautilusMonitor *monitor;
guint directory_count;
guint deep_directory_count;
......
......@@ -471,10 +471,6 @@ finalize (GObject *object)
g_free (uri);
}
if (file->details->monitor != NULL) {
nautilus_monitor_cancel (file->details->monitor);
}
nautilus_async_destroying_file (file);
remove_from_link_hash_table (file);
......
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