=== modified file 'src/totem-sidebar.c'
--- src/totem-sidebar.c	2006-09-24 22:31:54 +0000
+++ src/totem-sidebar.c	2006-10-30 19:42:29 +0000
@@ -126,7 +126,6 @@
 			G_CALLBACK (toggle_sidebar_from_sidebar), totem);
 
 	gtk_widget_show_all (totem->sidebar);
-	gtk_widget_realize (totem->sidebar);
 
 	if (!visible)
 		gtk_widget_hide (totem->sidebar);

=== modified file 'src/totem.c'
--- src/totem.c	2006-10-27 21:59:17 +0000
+++ src/totem.c	2006-10-30 19:42:38 +0000
@@ -166,10 +166,8 @@
 			"show_sidebar", totem_sidebar_is_visible (totem));
 	g_key_file_set_boolean (keyfile, "State",
 			"maximised", totem->maximised);
-	if (totem->maximised == FALSE) {
-		g_key_file_set_integer (keyfile, "State",
-				"sidebar_w", totem->sidebar_w);
-	}
+	g_key_file_set_integer (keyfile, "State",
+			"sidebar_w", totem->sidebar_w);
 
 	page_id = totem_sidebar_get_current_page (totem);
 	g_key_file_set_string (keyfile, "State",
@@ -2757,19 +2755,36 @@
 }
 
 static void
+main_pane_size_allocated (GtkWidget *main_pane, GtkAllocation *allocation, Totem *totem)
+{
+	gulong handler_id;
+
+	if (!totem->maximised || GTK_WIDGET_MAPPED (totem->win)) {
+		handler_id = g_signal_handler_find (main_pane, 
+				G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+				0, 0, NULL,
+				main_pane_size_allocated, totem);
+		g_signal_handler_disconnect (main_pane, handler_id);
+
+		gtk_paned_set_position (GTK_PANED (main_pane), allocation->width - totem->sidebar_w);
+	}
+}
+
+static void
 totem_setup_window (Totem *totem)
 {
 	GKeyFile *keyfile;
-	int w, h, sidebar_w;
+	int w, h;
 	gboolean show_sidebar;
 	char *filename, *page_id;
 	GError *err = NULL;
+	GtkWidget *main_pane;
 
 	filename = g_build_filename (g_get_home_dir (), ".gnome2", "totem", NULL);
 	keyfile = g_key_file_new ();
 	if (g_key_file_load_from_file (keyfile, filename,
 			G_KEY_FILE_NONE, NULL) == FALSE) {
-		sidebar_w = w = h = 0;
+		totem->sidebar_w = w = h = 0;
 		show_sidebar = TRUE;
 		page_id = NULL;
 		g_free (filename);
@@ -2813,11 +2828,11 @@
 			err = NULL;
 		}
 
-		sidebar_w = g_key_file_get_integer (keyfile, "State",
+		totem->sidebar_w = g_key_file_get_integer (keyfile, "State",
 				"sidebar_w", &err);
 		if (err != NULL) {
 			g_error_free (err);
-			sidebar_w = 0;
+			totem->sidebar_w = 0;
 		}
 		g_key_file_free (keyfile);
 	}
@@ -2830,17 +2845,11 @@
 	} else if (totem->maximised != FALSE) {
 		gtk_window_maximize (GTK_WINDOW (totem->win));
 	}
-
-	if (sidebar_w > 0 && totem->maximised == FALSE) {
-		GtkWidget *item;
-
-		totem->sidebar_w = sidebar_w;
-		totem_sidebar_setup (totem, show_sidebar, page_id);
-		item = glade_xml_get_widget (totem->xml, "tmw_main_pane");
-		gtk_paned_set_position (GTK_PANED (item), w - sidebar_w);
-	} else {
-		totem_sidebar_setup (totem, show_sidebar, page_id);
-	}
+	
+	main_pane = glade_xml_get_widget (totem->xml, "tmw_main_pane");
+	g_signal_connect (G_OBJECT (main_pane), "size-allocate", G_CALLBACK (main_pane_size_allocated), totem);
+
+	totem_sidebar_setup (totem, show_sidebar, page_id);
 }
 
 static void
@@ -3060,7 +3069,7 @@
 video_widget_create (Totem *totem) 
 {
 	GError *err = NULL;
-	GtkWidget *container, *container2;
+	GtkWidget *container;
 
 	totem->scr = totem_scrsaver_new ();
 
@@ -3157,9 +3166,6 @@
 
 	gtk_widget_show (GTK_WIDGET (totem->bvw));
 
-	container2 = glade_xml_get_widget (totem->xml, "tmw_main_pane");
-	gtk_paned_set_position (GTK_PANED (container2), totem->window_w - totem->sidebar_w);
-
 	bacon_video_widget_set_volume (totem->bvw,
 			gconf_client_get_int (totem->gc,
 				GCONF_PREFIX"/volume", NULL));

