Re: Nautilus patch to prevent annoying flicker during directory loading



Actually, here is a patch that actually works.  :)

(I am not 100% sure about the clause I changed in
queue_pending_files()...)

-- 
Ettore Perazzoli <ettore ximian com>
? src/file-manager/fm-directory-view-orig.c
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 19:22:13 -0000
@@ -1,3 +1,15 @@
+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): Schedule an idle display only if we are not
+	loading, or if all the files have been seen.
+	(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 19:22:17 -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,8 @@ 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 {
+	if (! view->details->loading || nautilus_directory_are_all_files_seen (view->details->model))
 		schedule_idle_display_of_pending_files (view);
-	}
 }
 
 static void
@@ -5555,8 +5489,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]