summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Sullivan <sullivan@src.gnome.org>2001-01-24 01:49:33 +0000
committerJohn Sullivan <sullivan@src.gnome.org>2001-01-24 01:49:33 +0000
commitaeb4b32c17e7c06c6a39c45f7db47cbcaea6debb (patch)
tree7ada17abead4688fbcad709e7f005dc3313974c7
parentc562c9ca9ff682836ee99d29bb32d1e0b9b15bb4 (diff)
downloadnautilus-aeb4b32c17e7c06c6a39c45f7db47cbcaea6debb.tar.gz
Fixed bug 2153 (deep count calculation in properties window
could be faster) Fixed bug 5687 (Sidebar flickers and CPU thrashes during deep count calculation in properties window) Changed the deep count calculation to send a specialized signal when the in-progress count updates, instead of using "file_changed", since many parts of the UI react to file_changed by doing (in this case unnecessary) work. My stopwatch measurement on a large directory showed that the time to calculate 20000 contained files went from 147 seconds to 8 seconds, and the CPU usage pegged around 15% (formerly 100%). * libnautilus-extensions/nautilus-directory-async.c: (deep_count_callback): Call nautilus_file_changed only when count is finished; call nautilus_file_updated_deep_count_in_progress after every new higher value is computed. * libnautilus-extensions/nautilus-file-private.h: Added prototype for nautilus_file_updated_deep_count_in_progress. * libnautilus-extensions/nautilus-file.h: * libnautilus-extensions/nautilus-file.c: (nautilus_file_initialize_class): define "updated_deep_count_in_progres" signal. (nautilus_file_updated_deep_count_in_progress): send this new signal for this file (which must be a directory) and any links pointing to it. * src/file-manager/fm-properties-window.c: (attach_directory_contents_value_field): Make text field in properties window react to new signal instead of "changed".
-rw-r--r--ChangeLog38
-rw-r--r--libnautilus-extensions/nautilus-directory-async.c3
-rw-r--r--libnautilus-extensions/nautilus-file-private.h1
-rw-r--r--libnautilus-extensions/nautilus-file.c32
-rw-r--r--libnautilus-extensions/nautilus-file.h3
-rw-r--r--libnautilus-private/nautilus-directory-async.c3
-rw-r--r--libnautilus-private/nautilus-file-private.h1
-rw-r--r--libnautilus-private/nautilus-file.c32
-rw-r--r--libnautilus-private/nautilus-file.h3
-rw-r--r--src/file-manager/fm-properties-window.c2
10 files changed, 115 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 10799f3c0..4d8b3bf9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,43 @@
2001-01-23 John Sullivan <sullivan@eazel.com>
+ reviewed by: Pavel Cisler <pavel@eazel.com>
+
+ Fixed bug 2153 (deep count calculation in properties window
+ could be faster)
+
+ Fixed bug 5687 (Sidebar flickers and CPU thrashes during
+ deep count calculation in properties window)
+
+ Changed the deep count calculation to send a specialized
+ signal when the in-progress count updates, instead of using
+ "file_changed", since many parts of the UI react to file_changed
+ by doing (in this case unnecessary) work. My stopwatch measurement
+ on a large directory showed that the time to calculate 20000
+ contained files went from 147 seconds to 8 seconds, and the CPU
+ usage pegged around 15% (formerly 100%).
+
+ * libnautilus-extensions/nautilus-directory-async.c:
+ (deep_count_callback): Call nautilus_file_changed only when
+ count is finished; call nautilus_file_updated_deep_count_in_progress
+ after every new higher value is computed.
+
+ * libnautilus-extensions/nautilus-file-private.h:
+ Added prototype for nautilus_file_updated_deep_count_in_progress.
+
+ * libnautilus-extensions/nautilus-file.h:
+ * libnautilus-extensions/nautilus-file.c:
+ (nautilus_file_initialize_class): define "updated_deep_count_in_progres"
+ signal.
+ (nautilus_file_updated_deep_count_in_progress): send this new signal
+ for this file (which must be a directory) and any links pointing to
+ it.
+
+ * src/file-manager/fm-properties-window.c:
+ (attach_directory_contents_value_field): Make text field in properties
+ window react to new signal instead of "changed".
+
+2001-01-23 John Sullivan <sullivan@eazel.com>
+
Fixed bug 5959 (File name in "no applications available"
dialog should be in quotes)
diff --git a/libnautilus-extensions/nautilus-directory-async.c b/libnautilus-extensions/nautilus-directory-async.c
index c8173b544..a50f3fffd 100644
--- a/libnautilus-extensions/nautilus-directory-async.c
+++ b/libnautilus-extensions/nautilus-directory-async.c
@@ -2540,9 +2540,10 @@ deep_count_callback (GnomeVFSAsyncHandle *handle,
}
}
- nautilus_file_changed (file);
+ nautilus_file_updated_deep_count_in_progress (file);
if (done) {
+ nautilus_file_changed (file);
async_job_end (directory, "deep count");
nautilus_directory_async_state_changed (directory);
}
diff --git a/libnautilus-extensions/nautilus-file-private.h b/libnautilus-extensions/nautilus-file-private.h
index ed981017f..31778fb57 100644
--- a/libnautilus-extensions/nautilus-file-private.h
+++ b/libnautilus-extensions/nautilus-file-private.h
@@ -114,6 +114,7 @@ void nautilus_file_set_directory (NautilusFile
gboolean nautilus_file_get_date (NautilusFile *file,
NautilusDateType date_type,
time_t *date);
+void nautilus_file_updated_deep_count_in_progress (NautilusFile *file);
/* Compare file's state with a fresh file info struct, return FALSE if
* no change, update file and return TRUE if the file info contains
diff --git a/libnautilus-extensions/nautilus-file.c b/libnautilus-extensions/nautilus-file.c
index 474b1ffe7..ef275d0b9 100644
--- a/libnautilus-extensions/nautilus-file.c
+++ b/libnautilus-extensions/nautilus-file.c
@@ -81,6 +81,7 @@ typedef GList * (* ModifyListFunction) (GList *list, NautilusFile *file);
enum {
CHANGED,
+ UPDATED_DEEP_COUNT_IN_PROGRESS,
LAST_SIGNAL
};
@@ -116,6 +117,14 @@ nautilus_file_initialize_class (NautilusFileClass *klass)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+ signals[UPDATED_DEEP_COUNT_IN_PROGRESS] =
+ gtk_signal_new ("updated_deep_count_in_progress",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (NautilusFileClass, updated_deep_count_in_progress),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
@@ -4172,6 +4181,29 @@ nautilus_file_changed (NautilusFile *file)
}
}
+/**
+ * nautilus_file_updated_deep_count_in_progress
+ *
+ * Notify clients that a newer deep count is available for
+ * the directory in question.
+ */
+void
+nautilus_file_updated_deep_count_in_progress (NautilusFile *file) {
+ GList *link_files, *node;
+
+ g_assert (NAUTILUS_IS_FILE (file));
+ g_assert (nautilus_file_is_directory (file));
+
+ /* Send out a signal. */
+ gtk_signal_emit (GTK_OBJECT (file), signals[UPDATED_DEEP_COUNT_IN_PROGRESS], file);
+
+ /* Tell link files pointing to this object about the change. */
+ link_files = get_link_files (file);
+ for (node = link_files; node != NULL; node = node->next) {
+ nautilus_file_updated_deep_count_in_progress (NAUTILUS_FILE (node->data));
+ }
+ nautilus_file_list_free (link_files);
+}
/**
* nautilus_file_emit_changed
diff --git a/libnautilus-extensions/nautilus-file.h b/libnautilus-extensions/nautilus-file.h
index 707f27951..2f29a9056 100644
--- a/libnautilus-extensions/nautilus-file.h
+++ b/libnautilus-extensions/nautilus-file.h
@@ -304,6 +304,9 @@ typedef struct {
/* Called when the file notices any change. */
void (* changed) (NautilusFile *file);
+ /* Called periodically while directory deep count is being computed. */
+ void (* updated_deep_count_in_progress) (NautilusFile *file);
+
/* Virtual functions (mainly used for trash directory). */
void (* monitor_add) (NautilusFile *file,
gconstpointer client,
diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c
index c8173b544..a50f3fffd 100644
--- a/libnautilus-private/nautilus-directory-async.c
+++ b/libnautilus-private/nautilus-directory-async.c
@@ -2540,9 +2540,10 @@ deep_count_callback (GnomeVFSAsyncHandle *handle,
}
}
- nautilus_file_changed (file);
+ nautilus_file_updated_deep_count_in_progress (file);
if (done) {
+ nautilus_file_changed (file);
async_job_end (directory, "deep count");
nautilus_directory_async_state_changed (directory);
}
diff --git a/libnautilus-private/nautilus-file-private.h b/libnautilus-private/nautilus-file-private.h
index ed981017f..31778fb57 100644
--- a/libnautilus-private/nautilus-file-private.h
+++ b/libnautilus-private/nautilus-file-private.h
@@ -114,6 +114,7 @@ void nautilus_file_set_directory (NautilusFile
gboolean nautilus_file_get_date (NautilusFile *file,
NautilusDateType date_type,
time_t *date);
+void nautilus_file_updated_deep_count_in_progress (NautilusFile *file);
/* Compare file's state with a fresh file info struct, return FALSE if
* no change, update file and return TRUE if the file info contains
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 474b1ffe7..ef275d0b9 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -81,6 +81,7 @@ typedef GList * (* ModifyListFunction) (GList *list, NautilusFile *file);
enum {
CHANGED,
+ UPDATED_DEEP_COUNT_IN_PROGRESS,
LAST_SIGNAL
};
@@ -116,6 +117,14 @@ nautilus_file_initialize_class (NautilusFileClass *klass)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+ signals[UPDATED_DEEP_COUNT_IN_PROGRESS] =
+ gtk_signal_new ("updated_deep_count_in_progress",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (NautilusFileClass, updated_deep_count_in_progress),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
@@ -4172,6 +4181,29 @@ nautilus_file_changed (NautilusFile *file)
}
}
+/**
+ * nautilus_file_updated_deep_count_in_progress
+ *
+ * Notify clients that a newer deep count is available for
+ * the directory in question.
+ */
+void
+nautilus_file_updated_deep_count_in_progress (NautilusFile *file) {
+ GList *link_files, *node;
+
+ g_assert (NAUTILUS_IS_FILE (file));
+ g_assert (nautilus_file_is_directory (file));
+
+ /* Send out a signal. */
+ gtk_signal_emit (GTK_OBJECT (file), signals[UPDATED_DEEP_COUNT_IN_PROGRESS], file);
+
+ /* Tell link files pointing to this object about the change. */
+ link_files = get_link_files (file);
+ for (node = link_files; node != NULL; node = node->next) {
+ nautilus_file_updated_deep_count_in_progress (NAUTILUS_FILE (node->data));
+ }
+ nautilus_file_list_free (link_files);
+}
/**
* nautilus_file_emit_changed
diff --git a/libnautilus-private/nautilus-file.h b/libnautilus-private/nautilus-file.h
index 707f27951..2f29a9056 100644
--- a/libnautilus-private/nautilus-file.h
+++ b/libnautilus-private/nautilus-file.h
@@ -304,6 +304,9 @@ typedef struct {
/* Called when the file notices any change. */
void (* changed) (NautilusFile *file);
+ /* Called periodically while directory deep count is being computed. */
+ void (* updated_deep_count_in_progress) (NautilusFile *file);
+
/* Virtual functions (mainly used for trash directory). */
void (* monitor_add) (NautilusFile *file,
gconstpointer client,
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index b6a063099..5285cc15f 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -1016,7 +1016,7 @@ attach_directory_contents_value_field (GtkTable *table,
/* Connect to signal to update value when file changes. */
gtk_signal_connect_object_while_alive (GTK_OBJECT (file),
- "changed",
+ "updated_deep_count_in_progress",
directory_contents_value_field_update,
GTK_OBJECT (value_field));
}