summaryrefslogtreecommitdiff
path: root/gtk/gtktreestore.c
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2004-06-25 04:33:25 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-06-25 04:33:25 +0000
commit776c9c74808e65e7bf023f0438c6386c8ec52677 (patch)
tree3ca4d90a303915a6a92e8fb317014bc197b92a50 /gtk/gtktreestore.c
parentbb57b98e6d6154ab905f46e673f13abe4355b271 (diff)
downloadgtk+-776c9c74808e65e7bf023f0438c6386c8ec52677.tar.gz
Commit a forgotten fix.
Diffstat (limited to 'gtk/gtktreestore.c')
-rw-r--r--gtk/gtktreestore.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/gtk/gtktreestore.c b/gtk/gtktreestore.c
index 6f7bf8c84a..8d18427394 100644
--- a/gtk/gtktreestore.c
+++ b/gtk/gtktreestore.c
@@ -2014,18 +2014,33 @@ gtk_tree_store_swap (GtkTreeStore *tree_store,
gtk_tree_path_up (path_a);
gtk_tree_path_up (path_b);
- if (gtk_tree_path_compare (path_a, path_b))
+ if (gtk_tree_path_get_depth (path_a) == 0
+ || gtk_tree_path_get_depth (path_b) == 0)
{
- gtk_tree_path_free (path_a);
- gtk_tree_path_free (path_b);
-
- g_warning ("Given childs are not in the same level\n");
- return;
+ if (gtk_tree_path_get_depth (path_a) != gtk_tree_path_get_depth (path_b))
+ {
+ gtk_tree_path_free (path_a);
+ gtk_tree_path_free (path_b);
+
+ g_warning ("Given children are not in the same level\n");
+ return;
+ }
+ parent_node = G_NODE (tree_store->root);
+ }
+ else
+ {
+ if (gtk_tree_path_compare (path_a, path_b))
+ {
+ gtk_tree_path_free (path_a);
+ gtk_tree_path_free (path_b);
+
+ g_warning ("Given children don't have a common parent\n");
+ return;
+ }
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_store), &parent,
+ path_a);
+ parent_node = G_NODE (parent.user_data);
}
-
- gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_store), &parent, path_a);
- parent_node = G_NODE (parent.user_data);
-
gtk_tree_path_free (path_b);
/* old links which we have to keep around */