Nautilus patch to prevent annoying flicker during directory loading



Hello!

This patch addresses one of my pet peeves with Nautilus, i.e. the fact
that async directory loading causes continuous relayout and flickering.
These changes make directory windows display their contents only after
they are fully done loading.

I know the existing behavior is designed to allow the user to open files
and directories before the directory is fully loaded (esp. if the
directory is remote), but in practice it doesn't really work, because
the positions of the files change continuosly on the screen at load
time; so the icon you want to click might move before you even have a
chance to put the pointer on it.

(A possible alternative fix could be to make it always load the files
from gnome-vfs in the same order they are going to appear on the screen,
to at least avoid the relayout problem, but I am not even sure that's
possible.)

This patch is against gnome-2-4 branch on CVS.  It might be nice to make
it change the mouse pointer to the hourglass shape during loading as
well...  I can do that later if there is agreement on this patch.

(Please Cc: me, I am not on the list.)

-- Ettore
-- 
Ettore Perazzoli <ettore ximian com>

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5937
diff -u -p -r1.5937 ChangeLog
--- ChangeLog	19 Sep 2003 09:10:05 -0000	1.5937
+++ ChangeLog	21 Sep 2003 18:21:42 -0000
@@ -1,3 +1,14 @@
+2003-09-20  Ettore Perazzoli  <ettore ximian com>
+
+	* src/file-manager/fm-directory-view.c
+	(schedule_timeout_display_of_pending_files): Removed.
+	(unschedule_timeout_display_of_pending_files): Removed.
+	(display_pending_timeout_callback): Removed.
+	(unschedule_display_of_pending_files): Don't call
+	unschedule_timeout_display_of_pending_files() since it's gone.
+	(queue_pending_files): Always schedule an idle display.
+	(finish_loading): Don't schedule a timeout display.
+
 2003-09-19  Alexander Larsson  <alexl redhat com>
 
 	* src/file-manager/fm-properties-window.c (permission_change_callback):
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.580
diff -u -p -r1.580 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	2 Aug 2003 18:51:39 -0000	1.580
+++ src/file-manager/fm-directory-view.c	21 Sep 2003 18:21:46 -0000
@@ -331,9 +331,6 @@ static void     schedule_update_menus_ca
 static void     remove_update_menus_timeout_callback           (FMDirectoryView      *view);
 static void     schedule_idle_display_of_pending_files         (FMDirectoryView      *view);
 static void     unschedule_idle_display_of_pending_files       (FMDirectoryView      *view);
-static void     schedule_timeout_display_of_pending_files      (FMDirectoryView      *view,
-								gboolean              first);
-static void     unschedule_timeout_display_of_pending_files    (FMDirectoryView      *view);
 static void     unschedule_display_of_pending_files            (FMDirectoryView      *view);
 static void     disconnect_model_handlers                      (FMDirectoryView      *view);
 static void     filtering_changed_callback                     (gpointer              callback_data);
@@ -2330,30 +2327,6 @@ display_pending_idle_callback (gpointer 
 	return ret;
 }
 
-static gboolean
-display_pending_timeout_callback (gpointer data)
-{
-	FMDirectoryView *view;
-
-	view = FM_DIRECTORY_VIEW (data);
-
-	g_object_ref (G_OBJECT (view));
-
-	view->details->display_pending_timeout_id = 0;
-
-	/* If we have more files to do, use an idle, not another timeout. */
-	if (display_pending_files (view)) {
-		schedule_idle_display_of_pending_files (view);
-	}
-
-	g_signal_emit (view,
-		       signals[FLUSH_ADDED_FILES], 0);
-
-	g_object_unref (G_OBJECT (view));
-
-	return FALSE;
-}
-
 static void
 schedule_idle_display_of_pending_files (FMDirectoryView *view)
 {
@@ -2371,30 +2344,6 @@ schedule_idle_display_of_pending_files (
 }
 
 static void
-schedule_timeout_display_of_pending_files (FMDirectoryView *view, gboolean first)
-{
-	/* No need to schedule a timeout if there's already one pending. */
-	if (view->details->display_pending_timeout_id != 0) {
-		return;
-	}
-
-	/* An idle takes precedence over a timeout. */
-	if (view->details->display_pending_idle_id != 0) {
-		return;
-	}
-
-	if (first) {
-		view->details->display_pending_timeout_id =
-			g_timeout_add (DISPLAY_TIMEOUT_FIRST_MSECS,
-				       display_pending_timeout_callback, view);
-	} else {
-		view->details->display_pending_timeout_id =
-			g_timeout_add (DISPLAY_TIMEOUT_INTERVAL_MSECS,
-				       display_pending_timeout_callback, view);
-	}
-}
-
-static void
 unschedule_idle_display_of_pending_files (FMDirectoryView *view)
 {
 	/* Get rid of idle if it's active. */
@@ -2405,20 +2354,9 @@ unschedule_idle_display_of_pending_files
 }
 
 static void
-unschedule_timeout_display_of_pending_files (FMDirectoryView *view)
-{
-	/* Get rid of timeout if it's active. */
-	if (view->details->display_pending_timeout_id != 0) {
-		g_source_remove (view->details->display_pending_timeout_id);
-		view->details->display_pending_timeout_id = 0;
-	}
-}
-
-static void
 unschedule_display_of_pending_files (FMDirectoryView *view)
 {
 	unschedule_idle_display_of_pending_files (view);
-	unschedule_timeout_display_of_pending_files (view);
 }
 
 static void
@@ -2433,12 +2371,7 @@ queue_pending_files (FMDirectoryView *vi
 	*pending_list = g_list_concat (*pending_list,
 				       nautilus_file_list_copy (files));
 
-	if (view->details->loading) {
-		schedule_idle_display_of_pending_files (view);
-		schedule_timeout_display_of_pending_files (view, FALSE);
-	} else {
-		schedule_idle_display_of_pending_files (view);
-	}
+	schedule_idle_display_of_pending_files (view);
 }
 
 static void
@@ -5555,8 +5488,6 @@ finish_loading (FMDirectoryView *view)
 
 	if (nautilus_directory_are_all_files_seen (view->details->model)) {
 		schedule_idle_display_of_pending_files (view);		
-	} else {
-		schedule_timeout_display_of_pending_files (view, TRUE);
 	}
 	
 	view->details->loading = TRUE;


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