[Nautilus-list] Patch : final fix for flashing background



Hi all,

I had time to hack on Nautilus during my holidays and I've fixed the
last flash problem when starting nautilus with a pixmap background.

This last flash is caused by eel-background.c which always load
background pixmap asynchronously. I've added a optionnal synchronous
mode which is only used when loading background for Desktop. 

This patch is against stable branch. I haven't increased eel release
number but it should also be increased, as well as nautilus dependency
on eel.

Comments on these patches ?
-- 
Frédéric Crozat
MandrakeSoft
? bg-async-eel.patch
Index: eel/eel-background.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-background.c,v
retrieving revision 1.6.4.3
diff -u -r1.6.4.3 eel-background.c
--- eel/eel-background.c	2001/10/02 16:31:04	1.6.4.3
+++ eel/eel-background.c	2001/12/29 13:58:28
@@ -62,7 +62,8 @@
 							  int            width,
 							  int            height);
 static void     eel_background_start_loading_image       (EelBackground *background,
-							  gboolean       emit_appearance_change);
+							  gboolean       emit_appearance_change,
+							  gboolean       load_async);
 static gboolean eel_background_is_image_load_in_progress (EelBackground *background);
 
 EEL_DEFINE_CLASS_BOILERPLATE (EelBackground, eel_background, GTK_TYPE_OBJECT)
@@ -524,7 +525,7 @@
 		if (reload_image) {
 			gdk_pixbuf_unref (background->details->image);
 			background->details->image = NULL;
-			eel_background_start_loading_image (background, TRUE);
+			eel_background_start_loading_image (background, TRUE, TRUE);
 			background->details->image_rect_x = 0;
 			background->details->image_rect_y = 0;
 			background->details->image_rect_width = 0;
@@ -812,14 +813,20 @@
 }
 
 static void
-eel_background_start_loading_image (EelBackground *background, gboolean emit_appearance_change)
+eel_background_start_loading_image (EelBackground *background, gboolean emit_appearance_change,
+				    gboolean load_async)
 {
 	background->details->emit_after_load = emit_appearance_change;
 
 	if (background->details->image_uri != NULL) {
-		background->details->load_image_handle = eel_gdk_pixbuf_load_async (background->details->image_uri,
-											 eel_background_load_image_callback,
-											 background);
+		if (load_async) {
+			background->details->load_image_handle = eel_gdk_pixbuf_load_async (background->details->image_uri,
+											    eel_background_load_image_callback,
+											    background);
+		}
+		else {
+			eel_background_load_image_callback (0, eel_gdk_pixbuf_load (background->details->image_uri), background);
+		}
 	} else {
 		eel_background_load_image_callback (0, NULL, background);
 	}
@@ -829,7 +836,8 @@
 eel_background_set_image_uri_helper (EelBackground *background,
 					const char *image_uri,
 					gboolean emit_setting_change,
-					gboolean emit_appearance_change)
+					gboolean emit_appearance_change,
+				     gboolean load_async)
 {
 	g_return_val_if_fail (EEL_IS_BACKGROUND (background), FALSE);
 
@@ -847,8 +855,8 @@
 	 * current image can be used if an update is needed before the load completes.
 	 */
 	
-	eel_background_start_loading_image (background, emit_appearance_change);
-
+	eel_background_start_loading_image (background, emit_appearance_change, load_async);
+	
 	if (emit_setting_change) {
 		gtk_signal_emit (GTK_OBJECT (background), signals[SETTINGS_CHANGED]);
 	}
@@ -858,8 +866,14 @@
 
 void
 eel_background_set_image_uri (EelBackground *background, const char *image_uri)
+{
+	eel_background_set_image_uri_helper (background, image_uri, TRUE, TRUE, TRUE);
+}
+
+void
+eel_background_set_image_uri_sync (EelBackground *background, const char *image_uri)
 {
-	eel_background_set_image_uri_helper (background, image_uri, TRUE, TRUE);
+	eel_background_set_image_uri_helper (background, image_uri, TRUE, TRUE, FALSE);
 }
 
 static void
@@ -911,7 +925,7 @@
 	 * return value (if false) tells us whether or not we need to
 	 * call set_image_and_color_image_loading_done_callback ourselves.
 	 */
-	if (!eel_background_set_image_uri_helper (background, image_uri, FALSE, FALSE)) {
+	if (!eel_background_set_image_uri_helper (background, image_uri, FALSE, FALSE, TRUE)) {
 		set_image_and_color_image_loading_done_callback (background, TRUE, color_copy);
 	}
 }
Index: eel/eel-background.h
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-background.h,v
retrieving revision 1.5
diff -u -r1.5 eel-background.h
--- eel/eel-background.h	2001/06/06 15:02:41	1.5
+++ eel/eel-background.h	2001/12/29 13:58:30
@@ -76,6 +76,10 @@
 									     const char                  *color_or_gradient);
 void                        eel_background_set_image_uri                    (EelBackground               *background,
 									     const char                  *image_uri);
+
+void                        eel_background_set_image_uri_sync               (EelBackground               *background, 
+									     const char                  *image_uri);
+
 void                        eel_background_reset                            (EelBackground               *background);
 void                        eel_background_set_image_placement              (EelBackground               *background,
 									     EelBackgroundImagePlacement  placement);
Index: po/ChangeLog
===================================================================
RCS file: /cvs/gnome/eel/po/ChangeLog,v
retrieving revision 1.36.2.22
diff -u -r1.36.2.22 ChangeLog
--- po/ChangeLog	2001/12/14 08:09:23	1.36.2.22
+++ po/ChangeLog	2001/12/29 13:58:32
@@ -1,3 +1,15 @@
+2001-12-28  gettextize  <bug-gnu-utils gnu org>
+
+	* Makefile.in.in: Upgrade to gettext-0.10.39.
+
+2001-12-28  gettextize  <bug-gnu-utils gnu org>
+
+	* Makefile.in.in: Upgrade to gettext-0.10.39.
+
+2001-12-28  gettextize  <bug-gnu-utils gnu org>
+
+	* Makefile.in.in: Upgrade to gettext-0.10.39.
+
 2001-12-14  Akira TAGOH  <tagoh gnome gr jp>
 
 	* ja.po: Updated Japanese translation.
? bg-async.patch
Index: libnautilus-private/nautilus-directory-background.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-directory-background.c,v
retrieving revision 1.61
diff -u -r1.61 nautilus-directory-background.c
--- libnautilus-private/nautilus-directory-background.c	2001/09/15 19:17:44	1.61
+++ libnautilus-private/nautilus-directory-background.c	2001/12/29 13:55:14
@@ -79,6 +79,7 @@
 	gtk_object_set_data (GTK_OBJECT (background), "icon_container", (gpointer) icon_container);
 
 	nautilus_file_update_desktop_pixmaps (background);
+
 }
 
 static const char *default_theme_source = "directory";
@@ -596,6 +597,7 @@
  * same conventions we do
  * (copied from gnome-source/control-panels/capplets/background-properties/render-background.c)
  */
+
 static void 
 set_root_pixmap (GdkPixmap *pixmap)
 {
@@ -844,7 +846,12 @@
                                           file);
 
 	eel_background_set_color (background, color);     
-	eel_background_set_image_uri (background, image);
+        if (background_is_desktop(background)) {
+                eel_background_set_image_uri_sync (background, image);
+        }
+        else {
+                eel_background_set_image_uri (background, image);
+        }
         eel_background_set_image_placement (background, placement);
 	
 	/* Unblock the handler. */
Index: po/ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/po/ChangeLog,v
retrieving revision 1.658.2.22
diff -u -r1.658.2.22 ChangeLog
--- po/ChangeLog	2001/12/20 07:51:38	1.658.2.22
+++ po/ChangeLog	2001/12/29 13:55:24
@@ -1,3 +1,7 @@
+2001-12-28  gettextize  <bug-gnu-utils gnu org>
+
+	* Makefile.in.in: Upgrade to gettext-0.10.39.
+
 2001-12-20  Akira TAGOH  <tagoh gnome gr jp>
 
 	* ja.po: Updated Japanese translation.
Index: src/nautilus-desktop-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-desktop-window.c,v
retrieving revision 1.40
diff -u -r1.40 nautilus-desktop-window.c
--- src/nautilus-desktop-window.c	2001/09/15 19:18:01	1.40
+++ src/nautilus-desktop-window.c	2001/12/29 13:55:26
@@ -343,10 +343,6 @@
 static void
 map (GtkWidget *widget)
 {
-	NautilusDesktopWindow *window;
-
-	window = NAUTILUS_DESKTOP_WINDOW (widget);
-	
 	set_window_background (widget, FALSE, FALSE, None, 0);
 	
 	/* Chain up to realize our children */


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