Index: lib/ephy-node.c
===================================================================
RCS file: /cvs/gnome/epiphany/lib/ephy-node.c,v
retrieving revision 1.5
diff -u -3 -p -u -r1.5 ephy-node.c
--- lib/ephy-node.c	14 Apr 2003 19:59:09 -0000	1.5
+++ lib/ephy-node.c	24 Apr 2003 23:47:38 -0000
@@ -93,6 +93,7 @@ enum
 	CHILD_ADDED,
 	CHILD_CHANGED,
 	CHILD_REMOVED,
+	CHILDREN_REORDERED,
 	LAST_SIGNAL
 };
 
@@ -202,6 +203,16 @@ ephy_node_class_init (EphyNodeClass *kla
 			      G_TYPE_NONE,
 			      1,
 			      EPHY_TYPE_NODE);
+	ephy_node_signals[CHILDREN_REORDERED] =
+		g_signal_new ("children_reordered",
+			      G_OBJECT_CLASS_TYPE (object_class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (EphyNodeClass, children_reordered),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__POINTER,
+			      G_TYPE_NONE,
+			      1,
+			      G_TYPE_POINTER);
 }
 
 static gboolean
@@ -1223,6 +1234,48 @@ ephy_node_has_child (EphyNode *node,
 	g_static_rw_lock_reader_unlock (child->priv->lock);
 
 	return ret;
+}
+
+void
+ephy_node_reorder_children (EphyNode *node,
+ 			    int *new_order)
+{
+	GPtrArray *newkids;
+	int i;
+
+	g_return_if_fail (EPHY_IS_NODE (node));
+	g_return_if_fail (new_order != NULL);
+
+	lock_gdk ();
+
+	g_static_rw_lock_writer_lock (node->priv->lock);
+
+	newkids = g_ptr_array_new ();
+	g_ptr_array_set_size (newkids, node->priv->children->len);
+
+	for (i = 0; i < node->priv->children->len; i++) {
+		EphyNode *child;
+		EphyNodeParent *node_info;
+
+		child = g_ptr_array_index (node->priv->children, i);
+
+		g_ptr_array_index (newkids, new_order[i]) = child;
+
+		node_info = g_hash_table_lookup (child->priv->parents,
+					         GINT_TO_POINTER (node->priv->id));
+		node_info->index = new_order[i];
+	}
+
+	g_ptr_array_free (node->priv->children, FALSE);
+	node->priv->children = newkids;
+
+	write_lock_to_read_lock (node);
+
+	g_signal_emit (G_OBJECT (node), ephy_node_signals[CHILDREN_REORDERED], 0, new_order);
+
+	g_static_rw_lock_reader_unlock (node->priv->lock);
+
+	unlock_gdk ();
 }
 
 GPtrArray *
Index: lib/ephy-node.h
===================================================================
RCS file: /cvs/gnome/epiphany/lib/ephy-node.h,v
retrieving revision 1.3
diff -u -3 -p -u -r1.3 ephy-node.h
--- lib/ephy-node.h	13 Apr 2003 10:12:32 -0000	1.3
+++ lib/ephy-node.h	24 Apr 2003 23:47:39 -0000
@@ -53,8 +53,7 @@ typedef struct
 
 	void (*child_added)     (EphyNode *node, EphyNode *child);
 	void (*child_changed)   (EphyNode *node, EphyNode *child);
-	void (*child_reordered) (EphyNode *node, EphyNode *child,
-			         int old_index, int new_index);
+	void (*children_reordered) (EphyNode *node, int *new_order);
 	void (*child_removed)   (EphyNode *node, EphyNode *child);
 } EphyNodeClass;
 
@@ -121,6 +120,9 @@ void        ephy_node_remove_child      
 					     EphyNode *child);
 gboolean    ephy_node_has_child             (EphyNode *node,
 					     EphyNode *child);
+
+void	    ephy_node_reorder_children	    (EphyNode *node,
+					     int *new_order);
 
 /* Note that ephy_node_get_children freezes the node; you'll have to thaw it when done.
  * This is to prevent the data getting changed from another thread. */
Index: lib/widgets/ephy-tree-model-node.c
===================================================================
RCS file: /cvs/gnome/epiphany/lib/widgets/ephy-tree-model-node.c,v
retrieving revision 1.3
diff -u -3 -p -u -r1.3 ephy-tree-model-node.c
--- lib/widgets/ephy-tree-model-node.c	19 Apr 2003 15:08:17 -0000	1.3
+++ lib/widgets/ephy-tree-model-node.c	24 Apr 2003 23:47:40 -0000
@@ -74,6 +74,9 @@ static void root_child_added_cb (EphyNod
 static void root_child_changed_cb (EphyNode *node,
 				   EphyNode *child,
 		                   EphyTreeModelNode *model);
+static void root_children_reordered_cb (EphyNode *node,
+				     int *new_order,
+				     EphyTreeModelNode *model);
 static inline void ephy_tree_model_node_update_node (EphyTreeModelNode *model,
 				                     EphyNode *node,
 					             int idx);
@@ -264,6 +267,11 @@ ephy_tree_model_node_set_property (GObje
 				         G_OBJECT (model),
 					 0);
 		g_signal_connect_object (G_OBJECT (model->priv->root),
+					 "children_reordered",
+					 G_CALLBACK (root_children_reordered_cb),
+					 G_OBJECT (model),
+					 0);
+		g_signal_connect_object (G_OBJECT (model->priv->root),
 				         "destroyed",
 				         G_CALLBACK (root_destroyed_cb),
 				         G_OBJECT (model),
@@ -712,6 +720,14 @@ root_child_changed_cb (EphyNode *node,
 		       EphyTreeModelNode *model)
 {
 	ephy_tree_model_node_update_node (model, child, -1);
+}
+
+static void
+root_children_reordered_cb (EphyNode *node,
+			    int *new_order,
+			    EphyTreeModelNode *model)
+{
+	gtk_tree_model_rows_reordered (GTK_TREE_MODEL (model), NULL, NULL, new_order);
 }
 
 static void
