Index: src/wbc-gtk.c
===================================================================
--- src/wbc-gtk.c	(revision 16456)
+++ src/wbc-gtk.c	(working copy)
@@ -77,6 +77,10 @@
 #include <hildon-widgets/hildon-program.h>
 #endif
 
+#ifdef GNM_WITH_GNOME
+#include <gconf/gconf-client.h>
+#endif
+
 #define	SHEET_CONTROL_KEY	"SheetControl"
 
 enum {
@@ -3049,7 +3053,7 @@
 static void
 set_toolbar_style_for_position (GtkToolbar *tb, GtkPositionType pos)
 {
-	GtkHandleBox *hdlbox = GTK_HANDLE_BOX (GTK_WIDGET (tb)->parent);
+	GtkWidget *box = GTK_WIDGET (tb)->parent;
 
 	static const GtkPositionType hdlpos[] = {
 		GTK_POS_TOP, GTK_POS_TOP,
@@ -3061,26 +3065,28 @@
 	};
 
 	gtk_toolbar_set_orientation (tb, orientations[pos]);
-	gtk_handle_box_set_handle_position (hdlbox, hdlpos[pos]);
+	if (GTK_IS_HANDLE_BOX(box)) {
+		gtk_handle_box_set_handle_position (GTK_HANDLE_BOX(box), hdlpos[pos]);
+	}
 }
 
 static void
 set_toolbar_position (GtkToolbar *tb, GtkPositionType pos, WBCGtk *gtk)
 {
-	GtkWidget *hdlbox = GTK_WIDGET (tb)->parent;
-	GtkContainer *zone = GTK_CONTAINER (GTK_WIDGET (hdlbox)->parent);
+	GtkWidget *box = GTK_WIDGET (tb)->parent;
+	GtkContainer *zone = GTK_CONTAINER (GTK_WIDGET (box)->parent);
 	GtkContainer *new_zone = GTK_CONTAINER (gtk->toolbar_zones[pos]);
-	char const *name = g_object_get_data (G_OBJECT (hdlbox), "name");
+	char const *name = g_object_get_data (G_OBJECT (box), "name");
 
 	if (zone == new_zone)
 		return;
 
-	g_object_ref (hdlbox);
+	g_object_ref (box);
 	if (zone)
-		gtk_container_remove (zone, hdlbox);
+		gtk_container_remove (zone, box);
 	set_toolbar_style_for_position (tb, pos);
-	gtk_container_add (new_zone, hdlbox);
-	g_object_unref (hdlbox);
+	gtk_container_add (new_zone, box);
+	g_object_unref (box);
 
 	if (zone)
 		gnm_gconf_set_toolbar_position (name, pos);
@@ -3205,7 +3211,7 @@
 }
 
 static void
-cb_handlebox_visible (GtkWidget *box, G_GNUC_UNUSED GParamSpec *pspec,
+cb_box_visible (GtkWidget *box, G_GNUC_UNUSED GParamSpec *pspec,
 		      WBCGtk *wbcg)
 {
 	GtkToggleAction *toggle_action = g_object_get_data (
@@ -3236,8 +3242,23 @@
 		g_hash_table_insert (wbcg->visibility_widgets,
 			g_strdup (toggle_name), g_object_ref (w));
 #else
-		GtkWidget *box = gtk_handle_box_new ();
+		GtkWidget *box;
 		GtkPositionType pos = gnm_gconf_get_toolbar_position (name);
+		gboolean toolbars_can_detach = TRUE;
+#ifdef GNM_WITH_GNOME
+		/* annoyingly the backend agnostic config interface makes this impossible
+		 * so we do it ourselves */
+		GConfClient *gclient = gconf_client_get_default ();
+		GConfValue *gvalue = gconf_client_get(gclient, "/desktop/gnome/interface/toolbar_detachable", NULL);
+		if (gvalue)
+			toolbars_can_detach = gconf_value_get_bool (gvalue);
+		gconf_value_free(gvalue);
+		g_object_unref(gclient);
+#endif
+		if (toolbars_can_detach)
+			box = gtk_handle_box_new ();
+		else
+			box = gtk_hbox_new (FALSE, 2);
 		g_signal_connect (G_OBJECT (w),
 				  "button_press_event",
 				  G_CALLBACK (cb_toolbar_button_press),
@@ -3253,11 +3274,17 @@
 			gtk_widget_hide (box);
 		set_toolbar_position (GTK_TOOLBAR (w), pos, gtk);
 
-		g_object_connect (box,
-			"signal::notify::visible", G_CALLBACK (cb_handlebox_visible), wbcg,
-			"signal::child_attached", G_CALLBACK (cb_handlebox_dock_status), GINT_TO_POINTER (TRUE),
-			"signal::child_detached", G_CALLBACK (cb_handlebox_dock_status), GINT_TO_POINTER (FALSE),
-			NULL);
+		if (GTK_IS_HANDLE_BOX(box)) {
+			g_object_connect (box,
+				"signal::notify::visible", G_CALLBACK (cb_box_visible), wbcg,
+				"signal::child_attached", G_CALLBACK (cb_handlebox_dock_status), GINT_TO_POINTER (TRUE),
+				"signal::child_detached", G_CALLBACK (cb_handlebox_dock_status), GINT_TO_POINTER (FALSE),
+				NULL);
+		} else {
+			g_object_connect (box,
+				"signal::notify::visible", G_CALLBACK (cb_box_visible), wbcg,
+				NULL);
+		}
 		g_object_set_data_full (G_OBJECT (box), "name",
 					g_strdup (name),
 					(GDestroyNotify)g_free);
