commit 11d102b0292d3b09923593ebcd43504a20e0838f
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Mon Dec 8 11:16:36 2008 -0500

    Don't connect to session manager until we are ready.
    
    gnome-session takes our connection as "I'm ready, go ahead and start
    the next phase (Nautilus)".  To avoid Nautilus icons jumping around
    when we set struts, we should set the struts before connecting to
    session.

diff --git a/gnome-panel/main.c b/gnome-panel/main.c
index 4792b4d..6059dba 100644
--- a/gnome-panel/main.c
+++ b/gnome-panel/main.c
@@ -61,6 +61,7 @@ main (int argc, char **argv)
 	program = gnome_program_init ("gnome-panel", VERSION,
 				      LIBGNOMEUI_MODULE,
 				      argc, argv,
+				      GNOME_CLIENT_PARAM_SM_CONNECT, FALSE,
 				      GNOME_PARAM_GOPTION_CONTEXT, context,
 				      GNOME_PROGRAM_STANDARD_PROPERTIES,
 				      NULL);
@@ -76,10 +77,10 @@ main (int argc, char **argv)
 	gnome_authentication_manager_init ();
 
 	panel_action_protocol_init ();
+
 	panel_multiscreen_init ();
-	panel_init_stock_icons_and_items ();
 
-	panel_session_init ();
+	panel_init_stock_icons_and_items ();
 
 	gconf_client_add_dir (panel_gconf_get_client (),
 			      "/desktop/gnome/interface",
@@ -97,6 +98,12 @@ main (int argc, char **argv)
 
 	xstuff_init ();
 
+	/* flush to make sure our struts are seen by everyone
+	 * starting immediate after (ie. metacity) */
+	gdk_flush ();
+
+	panel_session_init ();
+
 	gtk_main ();
 
 	panel_lockdown_finalize ();
diff --git a/gnome-panel/panel-session.c b/gnome-panel/panel-session.c
index 337ee5c..7e831ce 100644
--- a/gnome-panel/panel-session.c
+++ b/gnome-panel/panel-session.c
@@ -64,13 +64,15 @@ panel_session_init (void)
 {
 	GnomeClient *client;
 
+	client = gnome_master_client ();
+
+	gnome_client_connect (client);
+
 	/* We don't want the WM to try and save/restore our
 	 * window position
 	 */
 	gdk_set_sm_client_id (NULL);
 
-	client = gnome_master_client ();
-
         if (!getenv ("GNOME_PANEL_DEBUG"))
                 gnome_client_set_restart_style (client, GNOME_RESTART_IMMEDIATELY);
 
