[Nautilus-list] [PATCH take 2]: Avoid directory reload when FAM is active.



Hi,

Here is the final attempt to make this patch, 
I tested it with and without fam, on local / non local URI, with
reload / no reload.

All appear to work fine.
Please tell me if I can commit.


Index: src/nautilus-window-manage-views.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-manage-views.c,v
retrieving revision 1.266
diff -u -p -r1.266 nautilus-window-manage-views.c
--- src/nautilus-window-manage-views.c	2001/06/02 19:39:16	1.266
+++ src/nautilus-window-manage-views.c	2001/06/22 10:47:34
@@ -57,6 +57,7 @@
 #include <libnautilus-private/nautilus-metadata.h>
 #include <libnautilus-private/nautilus-mime-actions.h>
 #include <libnautilus-private/nautilus-search-uri.h>
+#include <libnautilus-private/nautilus-monitor.h>
 
 /* FIXME bugzilla.eazel.com 1243: 
  * We should use inheritance instead of these special cases
@@ -1366,8 +1367,9 @@ begin_location_change (NautilusWindow *w
                        NautilusLocationChangeType type,
                        guint distance)
 {
-        NautilusDirectory *directory;
         NautilusFile *file;
+        gboolean use_monitoring;
+        NautilusDirectory *directory;
 
         g_assert (NAUTILUS_IS_WINDOW (window));
         g_assert (location != NULL);
@@ -1384,13 +1386,24 @@ begin_location_change (NautilusWindow *w
         window->details->location_change_distance = distance;
 
         directory = nautilus_directory_get (location);
-
-        /* In all 4 cases, we want fresh information. */
-        nautilus_directory_force_reload (directory);
-        file = nautilus_directory_get_corresponding_file (directory);
-        nautilus_file_invalidate_all_attributes (file);
-        nautilus_file_unref (file);
+        use_monitoring = nautilus_monitor_active ();
 
+        /*
+         * Reload in :
+         * - the reload case.
+         * - if we do not use FAM.
+         * - if we use FAM but the uri is not local.
+         */
+        if ( type == NAUTILUS_LOCATION_CHANGE_RELOAD || ! use_monitoring ||
+             (use_monitoring && ! nautilus_directory_is_local (directory)) ) {
+                       
+                /* In all 4 cases, we want fresh information. */
+                nautilus_directory_force_reload (directory);
+                file = nautilus_directory_get_corresponding_file (directory);
+                nautilus_file_invalidate_all_attributes (file);
+                nautilus_file_unref (file);
+        }
+        
         window->details->determine_view_handle = nautilus_determine_initial_view
                 (location,
                  determined_initial_view_callback,


-- 
Yoann Vandoorselaere | Unix IS user friendly. It's just selective about who its
MandrakeSoft         | friends are.




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