Index: totem-sidebar.c
===================================================================
RCS file: /cvs/gnome/totem/src/totem-sidebar.c,v
retrieving revision 1.4
diff -u -r1.4 totem-sidebar.c
--- totem-sidebar.c	9 Aug 2005 16:25:43 -0000	1.4
+++ totem-sidebar.c	17 Dec 2005 18:33:16 -0000
@@ -41,7 +41,7 @@
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), !state);
 }
 
-static void
+static gboolean
 cb_resize (Totem * totem)
 {
 	gint w = totem->win->allocation.width,
@@ -50,15 +50,25 @@
 	if (totem->sidebar_shown) {
 		w += totem->sidebar->allocation.width;
 	} else {
-		w -= totem->sidebar->allocation.height;
+		w -= totem->sidebar->allocation.width;
 	}
 
 	gtk_window_resize (GTK_WINDOW (totem->win), w, h);
+
+	return FALSE;
+}
+
+static void
+cb_got_size (GtkWidget *widget, GtkAllocation *alloc, Totem *totem)
+{
+	g_signal_handlers_disconnect_by_func (widget, cb_got_size, totem);
+	cb_resize (totem);
 }
 
 static void
 on_sidebar_button_toggled (GtkToggleButton *button, Totem *totem)
 {
+	static gboolean was_ever_visible = FALSE;
 	GtkWidget *item;
 	gboolean state;
 
@@ -79,7 +89,14 @@
 				NULL);
 	totem->sidebar_shown = state;
 
-	cb_resize (totem);
+	if (!state || was_ever_visible)
+		cb_resize (totem);
+	else
+		g_signal_connect_after (totem->sidebar, "size-allocate",
+					G_CALLBACK (cb_got_size), totem);
+
+	if (state)
+		was_ever_visible = TRUE;
 }
 
 static void
